;+NAME/ONE LINE DESCRIPTION OF ROUTINE: ; BIN2LL computes the latitude/longitude values for an array of bin numbers. ; pro ll2bin, nrows,lon,lat,bins if (n_params() eq 0) then begin print, 'bin2ll, nrows,bins,latitude,longitude' print, ' ' print, 'where nrows is the number of records in the BinIndex Vdata' print, ' bins is the input array of bin numbers' print, ' latitude is the output array of latitude values' print, ' longitude is the output array of longitude values' return endif n = n_elements(lon) i=indgen(nrows) latbin=float((i + 0.5) * (180.0d0 / nrows) - 90.0) numbin=long(cos(latbin *!dpi/180.0) * (2.0*nrows) +0.5) basebin=lindgen(nrows) & basebin[0]=1 for i=1,nrows-1 do basebin[i]=basebin[i-1] + numbin[i-1] totbins = basebin[nrows-1] + numbin[nrows-1] - 1 basebin = [basebin, totbins+1] bins = lonarr(n) for i=0L,n-1 do begin irow = where(latbin ge lat(i)) & irow = irow(0) if (irow eq -1) then irow = nrows-1 icol = (lon(i)+180.)/(360./numbin(irow)) bins(i) = long(basebin(irow) - 0.5 + icol) endfor return end