From 017b22efa369a67d1ab13ecb4442fd4c7f230989 Mon Sep 17 00:00:00 2001 From: justin-richling <56696811+justin-richling@users.noreply.github.com> Date: Tue, 18 Feb 2025 14:00:51 -0700 Subject: [PATCH] Update polar_map.py --- scripts/plotting/polar_map.py | 25 ++++++++++++++----------- 1 file changed, 14 insertions(+), 11 deletions(-) diff --git a/scripts/plotting/polar_map.py b/scripts/plotting/polar_map.py index dbcfcff70..fa91d4d06 100644 --- a/scripts/plotting/polar_map.py +++ b/scripts/plotting/polar_map.py @@ -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: @@ -181,10 +183,11 @@ 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") @@ -192,8 +195,8 @@ def polar_map(adfobj): #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 @@ -423,4 +426,4 @@ def polar_map(adfobj): #END OF `polar_map` function ############## -# END OF FILE \ No newline at end of file +# END OF FILE