;+ ; NAME: ; locgrid_rect ; PURPOSE: (one line) ; Return location arrays for a rectangular projection map ; DESCRIPTION: ; Return location arrays for a rectangular projection map ; CATEGORY: ; Volatile Transport ; CALLING SEQUENCE: ; locgrid_rect, n_lat, n_lon, n_loc, lat, lon, angarea_delta ; INPUTS: ; n_lon - number of longitude bands ; n_lat - number of latitude bands ; OUTPUTS: ; n_loc - number of locations ; lat - latitude center of each location (radians) ; lon - longitude center of each location (radians) ; angarea_delta - angular area of each location (ster) ; ; n_vert - number of vertices ; lon_vert - lonitude of vertex ; lat_vert - latitude of vertex ; vert[6,n_loc] - indices of vertices ; PROCEDURE ; The exact area of a latitude band is the area from ; north pole to the bottom of the band minus the area ; from the north pole to the top of the band. ; MODIFICATION HISTORY: ; Written 2011 Aug 3, by Leslie Young, SwRI ; 2013-06-05 LAY. Fixed name passed to indexmap ; 2015 Apr 11, move to grahics IDL library ;- pro locgrid_rect, n_lon, n_lat, n_loc, lon, lat, angarea_delta, $ n_vert, lon_vert, lat_vert, vert deg = !dpi/180.d ; set up the map indices, to help with plotting n_lon_str = strtrim(string(n_lon),2) n_lat_str = strtrim(string(n_lat),2) name_loc = 'rect_'+n_lon_str+'_'+n_lat_str name_map = 'map_'+n_lon_str+'_'+n_lat_str name_loc2map = name_loc + '->' + name_map index_map = indxmap(name_loc2map=name_loc2map) n_loc = n_lat * n_lon lon_delta = 2*!dpi/n_lon lon_1d = ( dindgen(n_lon) + 0.5d ) * lon_delta lat_delta = !dpi/n_lat lat_1d = ( dindgen(n_lat) + 0.5d ) * lat_delta - !dpi/2.d angarea_delta_1d = 2.*!pi*( sin(lat_1d + lat_delta/2) - sin(lat_1d - lat_delta/2)) / n_lon lat = reform(lat_1d ## replicate(1.,n_lon), n_loc) angarea_delta = reform(angarea_delta_1d ## replicate(1.,n_lon), n_loc) lon = reform(replicate(1.,n_lat) ## lon_1d, n_loc) n_vert = (n_lat + 1) * (n_lon + 1) lon_vert_1d = ( dindgen(n_lon+1) ) * lon_delta lat_vert_1d = ( dindgen(n_lat+1) ) * lat_delta - !dpi/2.d lat_vert = reform(lat_vert_1d ## replicate(1.,n_lon+1), n_vert) lon_vert = reform(replicate(1.,n_lat+1) ## lon_vert_1d, n_vert) vert = replicate(-1,4,n_vert) iloc = 0 for ilat = 0, n_lat-1 do begin for ilon = 0, n_lon-1 do begin indx0 = (n_lon + 1) * ilat + ilon vert[*,iloc] = [0,1,n_lon+2,n_lon+1] + indx0 iloc = iloc + 1 endfor endfor end