Skip to content

Commit

Permalink
Merge pull request #1132 from PCMDI/zhan391
Browse files Browse the repository at this point in the history
Bug fix for the mean_climate and varibility_mode drivers
  • Loading branch information
lee1043 authored Sep 21, 2024
2 parents fd17646 + 0e69789 commit 2aa8d00
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 5 deletions.
4 changes: 3 additions & 1 deletion pcmdi_metrics/mean_climate/mean_climate_driver.py
Original file line number Diff line number Diff line change
Expand Up @@ -167,7 +167,9 @@
result_dict["Variable"] = dict()
result_dict["Variable"]["id"] = varname
if level is not None:
result_dict["Variable"]["level"] = level * 100 # hPa to Pa
result_dict["Variable"][
"level"
] = level # SZhang: should not "* 100" here # hPa to Pa

result_dict["References"] = dict()

Expand Down
8 changes: 4 additions & 4 deletions pcmdi_metrics/variability_mode/lib/lib_variability_mode.py
Original file line number Diff line number Diff line change
Expand Up @@ -142,8 +142,8 @@ def subset_time(
eyear = int(eyear)

# First trimming
time1 = f"{syear}-01-01 00:00:00"
time2 = f"{eyear}-12-{eday} 23:59:59"
time1 = f"{syear:04d}-01-01 00:00:00"
time2 = f"{eyear:04d}-12-{eday:02d} 23:59:59"
ds = select_subset(ds, time=(time1, time2))

# Check available time window and adjust again if needed
Expand All @@ -170,8 +170,8 @@ def subset_time(

# Second trimming
if adjust_time_length:
time1 = f"{data_syear}-01-01 00:00:00"
time2 = f"{data_eyear}-12-{eday} 23:59:59"
time1 = f"{data_syear:04d}-01-01 00:00:00"
time2 = f"{data_eyear:04d}-12-{eday:02d} 23:59:59"
ds = select_subset(ds, time=(time1, time2))

return ds
Expand Down

0 comments on commit 2aa8d00

Please sign in to comment.