Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

[Refactor]: CDAT Migration Phase 3: testing and documentation update #846

Merged
merged 24 commits into from
Sep 27, 2024
Merged
Show file tree
Hide file tree
Changes from 23 commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
910cc68
Add regression testing notebook and scripts
tomvothecoder Sep 5, 2024
4cd635a
Add debugging script and cfg
tomvothecoder Sep 9, 2024
77d7605
Update regression testing notebook
tomvothecoder Sep 10, 2024
8d1257f
Update dir structure for testing material
tomvothecoder Sep 10, 2024
ab974b4
Add `run_type` arg to `run_set()` in run script
tomvothecoder Sep 10, 2024
1ccb8bd
Rename run script
tomvothecoder Sep 10, 2024
40b4944
Change `model_vs_model` to `model_vs_obs`
tomvothecoder Sep 10, 2024
9735b66
Add log files and update notebooks
tomvothecoder Sep 13, 2024
5be32a4
Rename directories and update notebook names
tomvothecoder Sep 23, 2024
c3bfa55
Update scripts and notebooks
tomvothecoder Sep 24, 2024
cfd268d
Replace `get_ref_climo_dataset()` with `get_climo_dataset()`
tomvothecoder Sep 24, 2024
49ad950
Refactor `lat_lon_driver.py`
tomvothecoder Sep 24, 2024
36290d0
Update model_vs_model regression testing notebook
tomvothecoder Sep 25, 2024
5b5ba04
Fix logic for 3D variable runs in lat_lon
tomvothecoder Sep 26, 2024
2cb644a
Remove unused files
tomvothecoder Sep 26, 2024
dd03561
Add final regression testing notebooks
tomvothecoder Sep 27, 2024
947b3d5
Update notebooks
tomvothecoder Sep 27, 2024
0d7249e
Rename run all script and fix `complete_run.py` script
tomvothecoder Sep 27, 2024
85c820e
Apply suggestions from code review
tomvothecoder Sep 27, 2024
66f68bb
Update run scripts to capture performance benchmarks
tomvothecoder Sep 27, 2024
7af196d
Update CDP references
tomvothecoder Sep 27, 2024
b3ae28e
Remove deprecated cdp .rst file
tomvothecoder Sep 27, 2024
629fb3e
Remove remaining cdp references
tomvothecoder Sep 27, 2024
9484020
Apply suggestions from code review
tomvothecoder Sep 27, 2024
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
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU1.3_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN"]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]


[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU1.3_9.4_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", ]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]


[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU9.4_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN"]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
import xarray as xr
import xcdat as xc

filepath = "/global/cfs/cdirs/e3sm/e3sm_diags/obs_for_e3sm_diags/climatology/ISCCPCOSP/ISCCPCOSP_ANN_climo.nc"

# %%
ds_xc = xc.open_dataset(filepath)
# ValueError: Non-integer years and months are ambiguous and not currently supported.

ds_xr = xr.open_dataset(filepath)
# ValueError: Failed to decode variable 'time': unable to decode time units 'months since 1983-06' # with 'the default calendar'. Try opening your dataset with decode_times=False or installing
# cftime if it is not installed.

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
# %%
from datetime import datetime
from dateutil import parser
from dateutil import relativedelta as rd

import numpy as np
import xarray as xr
import xcdat as xc


# %%
# Reproduce error: ValueError: Non-integer years and months are ambiguous and not currently supported.
# -------------------------------------------------------------------------------------------

filepath = "/global/cfs/cdirs/e3sm/e3sm_diags/obs_for_e3sm_diags/climatology/ISCCPCOSP/ISCCPCOSP_ANN_climo.nc"
ds = xc.open_dataset(filepath, decode_times=True)


# %%
# Debug -- issue is that the time value is a float representing middle of the month (150.5).
# relativedelta expects a time value at the beginning of the month (e.g,. 150).
# -----

flat_offsets = np.array([150.5])
ref_date = "1983-06"
units_type = "months"

ref_datetime: datetime = parser.parse(ref_date, default=datetime(2000, 1, 1))


# ValueError: Non-integer years and months are ambiguous and not currently supported.
times = np.array(
[
ref_datetime + rd.relativedelta(**{units_type: offset})
for offset in flat_offsets
],
dtype="object",
)

# %%
# Fix error -- replace 150.5 (middle month float) with 150 (integer month)
# -----------------------------------------------------------------------------
ds = xc.open_dataset(filepath, decode_times=False)
ds.time.values[:] = 150
ds.to_netcdf(filepath)

# %%
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@

[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU1.3_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN"]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]


[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU1.3_9.4_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN", ]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]


[#]
sets = ["lat_lon"]
case_id = "Cloud ISCCP"
variables = ["CLDTOT_TAU9.4_ISCCP"]
ref_name = "ISCCPCOSP"
reference_name = "ISCCP"
# seasons = ["ANN", "01", "02", "03", "04", "05", "06", "07", "08", "09", "10", "11", "12", "DJF", "MAM", "JJA", "SON"]
seasons = ["ANN"]
test_colormap = "Blues"
reference_colormap = "Blues"
diff_colormap = "RdBu"
contour_levels = [5, 15, 25, 35, 45, 55, 65, 75, 85, 95]
diff_levels = [-30, -25, -20, -15, -10, -5, 5, 10, 15, 20, 25, 30]
Loading