From 8e5c0bac6fc0b8e708b2b2fe7e49252b348cfa5f Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Mon, 8 Apr 2024 11:31:31 -0500 Subject: [PATCH 1/6] Enabled 1 month Sigdiff benchmarking --- gcpy/benchmark_funcs.py | 3 --- 1 file changed, 3 deletions(-) diff --git a/gcpy/benchmark_funcs.py b/gcpy/benchmark_funcs.py index 18f7ffd..e18e039 100644 --- a/gcpy/benchmark_funcs.py +++ b/gcpy/benchmark_funcs.py @@ -1514,9 +1514,6 @@ def createplots(filecat): result.keys())[0]]['500'] for result in results} dict_zm = {list(result.keys())[0]: result[list( result.keys())[0]]['zm'] for result in results} - - print("stop here") - quit() # ============================================================== # Write the list of species having significant differences, From ff78c99c9bfc6681d9c57f627cee8a21acdb9836 Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Mon, 8 Apr 2024 13:03:08 -0500 Subject: [PATCH 2/6] Supported 2D slices regridding formatting Enabled compare plots for 2D variables between two different cube-sphere resolutions. --- gcpy/regrid.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/gcpy/regrid.py b/gcpy/regrid.py index 3e9e4fc..e84df88 100644 --- a/gcpy/regrid.py +++ b/gcpy/regrid.py @@ -758,6 +758,12 @@ def ravel_checkpoint_lat(ds_out): }) return ds_out + # Filter non-existent coordinates/dimensions + def rename_existing(ds, rename_dict): + existing_keys = set(ds.coords) | set(ds.dims) + filtered_rename_dict = {key: value for key, value in rename_dict.items() if key in existing_keys} + return ds.rename(filtered_rename_dict) + dim_formats = { 'checkpoint': { 'unravel': [unravel_checkpoint_lat], @@ -790,13 +796,13 @@ def ravel_checkpoint_lat(ds_out): ds = unravel_callback(ds) # Rename dimensions - ds = ds.rename(dim_formats[format].get('rename', {})) + ds = rename_existing(ds, dim_formats[format].get('rename', {})) return ds # %%%% Renaming from the common format %%%% # Reverse rename - ds = ds.rename( + ds = rename_existing(ds, {v: k for k, v in dim_formats[format].get('rename', {}).items()}) # Ravel dimensions From 6f1a92151c44b138db5fa17952913a0b64b5b5fb Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Tue, 9 Apr 2024 12:51:56 -0500 Subject: [PATCH 3/6] Corrected reformatting for regridding Cube-sphere dimensions' sequence was reverse. Enabling versatile reshaping handling. --- gcpy/regrid.py | 14 +++----------- 1 file changed, 3 insertions(+), 11 deletions(-) diff --git a/gcpy/regrid.py b/gcpy/regrid.py index e84df88..def2a28 100644 --- a/gcpy/regrid.py +++ b/gcpy/regrid.py @@ -785,7 +785,8 @@ def rename_existing(ds, rename_dict): 'Ydim': 'Y', 'time': 'T', }, - 'transpose': ('time', 'lev', 'nf', 'Xdim', 'Ydim') + # match format of GCHP output + 'transpose': ('time', 'lev', 'nf', 'Ydim', 'Xdim') } } @@ -810,16 +811,7 @@ def rename_existing(ds, rename_dict): ds = ravel_callback(ds) # Transpose - if len(ds.dims) == 5 or (len(ds.dims) == 4 and 'lev' in list( - ds.dims) and 'time' in list(ds.dims)): - # full dim dataset - ds = ds.transpose(*dim_formats[format].get('transpose', [])) - elif len(ds.dims) == 4: - # single time - ds = ds.transpose(*dim_formats[format].get('transpose', [])[1:]) - elif len(ds.dims) == 3: - # single level / time - ds = ds.transpose(*dim_formats[format].get('transpose', [])[2:]) + ds = ds.transpose(*[x for x in dim_formats[format].get('transpose', []) if x in list(ds.dims)]) return ds From 3d09c4e5c5333376a5820bd58737f3e577a90384 Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Tue, 9 Apr 2024 12:54:42 -0500 Subject: [PATCH 4/6] Corrected automatic regridding decision process Correct automatic regridding decision process to match documentation. --- gcpy/regrid.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcpy/regrid.py b/gcpy/regrid.py index def2a28..3f79804 100644 --- a/gcpy/regrid.py +++ b/gcpy/regrid.py @@ -426,7 +426,7 @@ def create_regridders( "Warning: zonal mean comparison must be lat-lon. Defaulting to 1x1.25") cmpres = '1x1.25' cmpgridtype = "ll" - elif sg_ref_params != [] or sg_dev_params != []: + elif sg_ref_params != [1, 170, -90] or sg_dev_params != [1, 170, -90]: # pick ref grid when a stretched-grid and non-stretched-grid # are passed cmpres = refres From 96b89faec49621a287752f0bf0a905da355cc65d Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Thu, 11 Apr 2024 11:49:28 -0500 Subject: [PATCH 5/6] Go back to resolve merge conflicts with dev branch --- gcpy/benchmark_funcs.py | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/gcpy/benchmark_funcs.py b/gcpy/benchmark_funcs.py index e18e039..d8bb5f7 100644 --- a/gcpy/benchmark_funcs.py +++ b/gcpy/benchmark_funcs.py @@ -1514,7 +1514,10 @@ def createplots(filecat): result.keys())[0]]['500'] for result in results} dict_zm = {list(result.keys())[0]: result[list( result.keys())[0]]['zm'] for result in results} - + + print("stop here") + quit() + # ============================================================== # Write the list of species having significant differences, # which we need to fill out the benchmark approval forms. From 9ac023dcecf968e34cd9fcf67174f6ce38d4f863 Mon Sep 17 00:00:00 2001 From: Yuanjian Zhang Date: Thu, 11 Apr 2024 11:51:53 -0500 Subject: [PATCH 6/6] Resolve merge conflicts with dev branch --- gcpy/benchmark_funcs.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/gcpy/benchmark_funcs.py b/gcpy/benchmark_funcs.py index d8bb5f7..18f7ffd 100644 --- a/gcpy/benchmark_funcs.py +++ b/gcpy/benchmark_funcs.py @@ -1517,7 +1517,7 @@ def createplots(filecat): print("stop here") quit() - + # ============================================================== # Write the list of species having significant differences, # which we need to fill out the benchmark approval forms.