Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

PMP mean climate regional application #931

Merged
merged 26 commits into from
Nov 10, 2023
Merged
Changes from 1 commit
Commits
Show all changes
26 commits
Select commit Hold shift + click to select a range
01348bc
initial commit
lee1043 May 23, 2023
0b7fae6
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 May 23, 2023
03f6fa1
update
lee1043 May 23, 2023
8127cc2
update
lee1043 May 24, 2023
1842b81
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 May 24, 2023
91e6a9a
update
lee1043 May 29, 2023
50b5a08
pre-commit check
lee1043 May 29, 2023
5e93c45
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 1, 2023
752eb5c
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 1, 2023
fc11c80
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 13, 2023
6964789
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 21, 2023
45d45d5
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 22, 2023
a381d13
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Jun 29, 2023
bb8e324
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Aug 25, 2023
ee17fe8
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Aug 26, 2023
e6f2ca6
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Aug 30, 2023
1d7c1d7
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Sep 18, 2023
c10894d
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Sep 25, 2023
e643cb5
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Nov 7, 2023
e6345a1
style fix for pre-commit test
lee1043 Nov 7, 2023
1476824
Merge branch 'main' into mean_clim_loca2_analysis
lee1043 Nov 9, 2023
4e91e19
make time_dim_sync as option and try it if not successful
lee1043 Nov 9, 2023
eb919aa
pre-commit fix
lee1043 Nov 9, 2023
f619758
When open ref dataset, try with decode_times True first, and if that …
lee1043 Nov 10, 2023
c254d53
pre-commit fix
lee1043 Nov 10, 2023
847a1a2
update json file name because now case_id is included as a part of js…
lee1043 Nov 10, 2023
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
Next Next commit
make time_dim_sync as option and try it if not successful
  • Loading branch information
lee1043 committed Nov 9, 2023
commit 4e91e19c459d922e2e80d61fc8ace08f837bdd1d
24 changes: 11 additions & 13 deletions pcmdi_metrics/mean_climate/lib/compute_metrics.py
Original file line number Diff line number Diff line change
@@ -3,7 +3,7 @@
import pcmdi_metrics


def compute_metrics(Var, dm, do, debug=False):
def compute_metrics(Var, dm, do, debug=False, time_dim_sync=False):
# Var is sometimes sent with level associated
var = Var.split("_")[0]
# Did we send data? Or do we just want the info?
@@ -35,23 +35,21 @@ def compute_metrics(Var, dm, do, debug=False):

# unify time and time bounds between observation and model
if debug:
print("before time and time bounds unifying")
print("dm.time: ", dm["time"])
print("do.time: ", do["time"])

"""
# Below is temporary...
dm['time'] = do['time']
dm[dm.time.encoding['bounds']] = do[do.time.attrs['bounds']]
"""
if time_dim_sync:
# Below is temporary...
dm['time'] = do['time']
dm[dm.time.encoding['bounds']] = do[do.time.attrs['bounds']]

if debug:
print("after time and time bounds unifying")
print("dm.time: ", dm["time"])
print("do.time: ", do["time"])
if debug:
print("time and time bounds synced")
print("dm.time: ", dm["time"])
print("do.time: ", do["time"])

dm.to_netcdf("dm.nc")
do.to_netcdf("do.nc")
dm.to_netcdf("dm.nc")
do.to_netcdf("do.nc")

metrics_dictionary = OrderedDict()

24 changes: 15 additions & 9 deletions pcmdi_metrics/mean_climate/mean_climate_driver.py
Original file line number Diff line number Diff line change
@@ -425,16 +425,22 @@
)

# compute metrics

print("compute metrics start")
result_dict["RESULTS"][model][ref][run][
region
] = compute_metrics(
varname,
ds_test_dict[region],
ds_ref_dict[region],
debug=debug,
)
try:
result_dict["RESULTS"][model][ref][run][region] = compute_metrics(
varname,
ds_test_dict[region],
ds_ref_dict[region],
debug=debug,
)
except Exception:
result_dict["RESULTS"][model][ref][run][region] = compute_metrics(
varname,
ds_test_dict[region],
ds_ref_dict[region],
debug=debug,
time_dim_sync=True
)

# write individual JSON
# --- single simulation, obs (need to accumulate later) / single variable