Skip to content

Commit

Permalink
Update polar_map.py
Browse files Browse the repository at this point in the history
  • Loading branch information
justin-richling authored Feb 18, 2025
1 parent 803a373 commit 017b22e
Showing 1 changed file with 14 additions and 11 deletions.
25 changes: 14 additions & 11 deletions scripts/plotting/polar_map.py
Original file line number Diff line number Diff line change
Expand Up @@ -159,11 +159,13 @@ def polar_map(adfobj):
else:
oclim_fils = sorted(dclimo_loc.glob(f"{data_src}_{var}_baseline.nc"))

oclim_ds = pf.load_dataset(oclim_fils)
if oclim_ds is None:
print("\t WARNING: Did not find any regridded reference climo files. Will try to skip.")
print(f"\t INFO: Data Location, dclimo_loc is {dclimo_loc}")
print(f"\t The glob is: {data_src}_{var}_*.nc")
#oclim_ds = pf.load_dataset(oclim_fils)
# Gather reference variable data
odata = adfobj.data.load_reference_regrid_da(data_name, var, syear_baseline, eyear_baseline)
if odata is None:
print("WARNING: Did not find any oclim_fils. Will try to skip.")
print(f"INFO: Data Location, dclimo_loc is {dclimo_loc}")
print(f"INFO: The glob is: {data_src}_{var}_*.nc")
continue

#Loop over model cases:
Expand All @@ -181,19 +183,20 @@ def polar_map(adfobj):
plot_loc.mkdir(parents=True)

# load re-gridded model files:
mclim_fils = sorted(mclimo_rg_loc.glob(f"{data_src}_{case_name}_{var}_*.nc"))
#mclim_fils = sorted(mclimo_rg_loc.glob(f"{data_src}_{case_name}_{var}_*.nc"))

mclim_ds = pf.load_dataset(mclim_fils)
if mclim_ds is None:
#mclim_ds = pf.load_dataset(mclim_fils)
mdata = adfobj.data.load_regrid_da(case_name, var, eyear_cases[case_idx], eyear_cases[case_idx])
if mdata is None:
print("\t WARNING: Did not find any regridded test climo files. Will try to skip.")
print(f"\t INFO: Data Location, mclimo_rg_loc, is {mclimo_rg_loc}")
print(f"\t The glob is: {data_src}_{case_name}_{var}_*.nc")
continue
#End if

#Extract variable of interest
odata = oclim_ds[data_var].squeeze() # squeeze in case of degenerate dimensions
mdata = mclim_ds[var].squeeze()
#odata = oclim_ds[data_var].squeeze() # squeeze in case of degenerate dimensions
#mdata = mclim_ds[var].squeeze()

# APPLY UNITS TRANSFORMATION IF SPECIFIED:
# NOTE: looks like our climo files don't have all their metadata
Expand Down Expand Up @@ -423,4 +426,4 @@ def polar_map(adfobj):
#END OF `polar_map` function

##############
# END OF FILE
# END OF FILE

0 comments on commit 017b22e

Please sign in to comment.