PRO GRIDINDEX_TO_LATLON, INDEX, RES, LAT, LON ; For an equal angle earth grid spanning the range -180 to +180 in longitude ; and -90 to +90 in latitude, compute the latitude and longitude of the ; lower left corner of the 1D grid cell given the zero-based 1D grid cell index ; and grid resolution (in degrees). ; ; The origin of the grid is at -180W, -90S. ; ; For a grid with 10 degree resolution, there are 648 grid cells covering the ; Earth (18 rows and 36 columns). Grid cell index 0 is at lower left of the ; global grid, and grid cell index 647 is at the upper right. ;- Get number of columns in the grid numcol = floor(360.0 / res) ;- Compute row and column in the grid (zero-based) row = index / numcol col = index mod numcol ;- Compute lat and lon lat = float(row * res) - 90.0 lon = float(col * res) - 180.0 END