;Given a bounding box, return the x and y coordinates, and ;the latitude and longitude, of each pixel in the box ;Input ; bbox - Array of 4 ints, sides of bounding box [left,bottom,right,top] ; tile_size - Don't set this. ; /no_colatitude - If not set, program will calcluate the colatitude (180-latitude) ; for pixels to the left of the center of the map. You ; probably want to set this. ; _extra - Passed along to project_lambert. Use it for things like ; center_lon ;Output ; x,y Each is a 2D array of long integers, giving the ; x and y coordinate of the center pixel of each tile. ; lat,lon Each is a 2D array of doubles, with the latitude ; in degrees, and the longitude in degrees ranging from ; -180 to 180. ; pro bbox_lat_lon,bbox,tile_size,x=x,y=y,lat=lat,lon=lon,no_colatitude=no_colatitude,south=south,_extra=extra if n_elements(tile_Size) eq 0 then tile_size=1 x_size=bbox[2]-bbox[0]+1 y_size=bbox[3]-bbox[1]+1 x=rebin(indgen(x_size),x_size,y_size) y=rebin(transpose(indgen(y_size)),x_size,y_size) x=x*tile_Size+bbox[0] y=y*tile_size+bbox[1] project_lambert,x=x,y=y,lat=lat,lon=lon,/inverse,south=south,_extra=extra if ~keyword_set(no_colatitude) then begin xpole=map_size_lambert(_extra=extra)/2 w=where(x le xpole,nw) if keyword_set(south) then begin if nw gt 0 then lat[w]=-180+lat[w] end else begin if nw gt 0 then lat[w]=180-lat[w] end end end