@@ -78,7 +78,7 @@ def regional_climatology(adfobj):
7878 regional_climo_var_list = ['TSA' ,'PREC' ,'ELAI' ,
7979 'FSDS' ,'FLDS' ,'SNOWDP' ,'ASA' ,
8080 'FSH' ,'QRUNOFF_TO_COUPLER' ,'ET' ,'FCTR' ,
81- 'GPP' ,'TWS' ,'FCEV ' ,'FAREA_BURNED' ,
81+ 'GPP' ,'TWS' ,'SOILWATER_10CM ' ,'FAREA_BURNED' ,
8282 ]
8383
8484 # Extract variables:
@@ -332,6 +332,10 @@ def regional_climatology(adfobj):
332332 map_ax .set_extent ([- 180 , 179 , - 89 , 3 ],crs = ccrs .PlateCarree ())
333333 elif region_list [iReg ]== 'Polar' :
334334 map_ax .set_extent ([- 180 , 179 , 45 , 90 ],crs = ccrs .PlateCarree ())
335+ elif region_list [iReg ]== 'CONUS' :
336+ map_ax .set_extent ([- 140 , - 55 , 10 , 70 ],crs = ccrs .PlateCarree ())
337+ elif region_list [iReg ]== 'S America' :
338+ map_ax .set_extent ([- 100 , - 20 , - 45 , 20 ],crs = ccrs .PlateCarree ())
335339 else :
336340 if ((box_south >= 30 ) & (box_east <= - 5 ) ):
337341 map_ax .set_extent ([- 180 , 0 , 30 , 90 ],crs = ccrs .PlateCarree ())
@@ -358,17 +362,18 @@ def regional_climatology(adfobj):
358362 print ('Missing file for ' , field )
359363 continue
360364 else :
361- axs [plt_counter ].plot (np .arange (12 )+ 1 , case_var_wgtd ,
362- label = case_nickname , linewidth = 2 )
363365 axs [plt_counter ].plot (np .arange (12 )+ 1 , base_var_wgtd ,
364366 label = base_nickname , linewidth = 2 )
367+ axs [plt_counter ].plot (np .arange (12 )+ 1 , case_var_wgtd ,
368+ label = case_nickname , linewidth = 2 )
365369 if plot_obs [field ] == True :
366370 axs [plt_counter ].plot (np .arange (12 )+ 1 , obs_var_wgtd ,
367371 label = obs_name [field ], color = 'black' , linewidth = 2 )
372+ axs [plt_counter ].legend ()
373+
368374 axs [plt_counter ].set_title (field )
369375 axs [plt_counter ].set_ylabel (base_data [field ].units )
370376 axs [plt_counter ].set_xticks (np .arange (1 , 13 , 2 ))
371- axs [plt_counter ].legend ()
372377
373378
374379 plt_counter = plt_counter + 1
@@ -437,6 +442,12 @@ def getRegion_xarray(varDS, varName,
437442
438443 if varName not in varDS :
439444 varName = obs_var_name
445+
446+ if varDS .lon .values .min () < 0 :
447+ # Convert lon to [0,360] if necessary
448+ longitude = varDS ['lon' ]
449+ varDS = varDS .assign_coords (lon = (longitude + 180 ) % 360 )
450+ print (f"Converted lon to [0,360] for variable { varName } " )
440451
441452 # TODO is there a less brittle way to do this?
442453 if (area is not None ) and (landfrac is not None ):
@@ -455,7 +466,7 @@ def getRegion_xarray(varDS, varName,
455466 weight = weight * varDS ['datamask' ]
456467 else :
457468 raise ValueError ("No valid weight, area, or landmask found in {varName} dataset." )
458-
469+
459470 # check we have a data array for the variable
460471 if isinstance (varDS , xr .Dataset ):
461472 varDS = varDS [varName ]
@@ -478,7 +489,6 @@ def getRegion_xarray(varDS, varName,
478489 lon = (west_of_0 | east_of_0 ))
479490
480491 wgt_subset = weight_subset / weight_subset .sum ()
481- weight_subset = weight .sel
482492 return domain_subset ,wgt_subset
483493
484494def get_region_boundaries (regions , region_name ):
0 commit comments