;********************************************************* ; Need to calculate the center lat and lon of the ; bounding box. This can be tricky. ;********************************************************* pro center_lat_lon,lat_min,lon_min,lat_max,lon_max,$ clat,clon ; In case the lon max and min cross the -180/180 line, ; create a lon max and min that is continuously ; increasing. Mainly used for twp plots. ; To convert to continous increasing: where lon < 0, +360 ; To convert back to standard lon : where lon > 180, -360 if lon_min lt 0 then lon_min_cont=lon_min+360 else lon_min_cont=lon_min if lon_max lt 0 then lon_max_cont=lon_max+360 else lon_max_cont=lon_max ; Calculate the center lon and then adjust for the ; conversion to continuously increasing lon clon=(lon_min_cont+lon_max_cont)/2.0 if clon gt 180 then clon=clon-360 ; Calculate the center lat clat=(lat_min+lat_max)/2.0 return end