Skip to content

Commit

Permalink
When open ref dataset, try with decode_times True first, and if that …
Browse files Browse the repository at this point in the history
…is not successful, open with decode_times False
  • Loading branch information
lee1043 committed Nov 10, 2023
1 parent eb919aa commit f619758
Showing 1 changed file with 22 additions and 10 deletions.
32 changes: 22 additions & 10 deletions pcmdi_metrics/mean_climate/mean_climate_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -250,16 +250,28 @@
print("ref_data_full_path:", ref_data_full_path)

# load data and regrid
ds_ref = load_and_regrid(
data_path=ref_data_full_path,
varname=varname,
level=level,
t_grid=t_grid,
# decode_times=False,
decode_times=True,
regrid_tool=regrid_tool,
debug=debug,
)
try:
ds_ref = load_and_regrid(
data_path=ref_data_full_path,
varname=varname,
level=level,
t_grid=t_grid,
decode_times=True,
regrid_tool=regrid_tool,
debug=debug,
)
except Exception:
ds_ref = load_and_regrid(
data_path=ref_data_full_path,
varname=varname,
level=level,
t_grid=t_grid,
decode_times=False,
regrid_tool=regrid_tool,
debug=debug,
)

print("ref_data load_and_regrid done")

ds_ref_dict = OrderedDict()

Expand Down

0 comments on commit f619758

Please sign in to comment.