-
Notifications
You must be signed in to change notification settings - Fork 32
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[Refactor]: CDAT Migration Phase 3: testing and documentation update (#…
…846)
- Loading branch information
1 parent
3a14c8c
commit 8fc5d49
Showing
39 changed files
with
25,845 additions
and
1,366 deletions.
There are no files selected for viewing
43 changes: 43 additions & 0 deletions
43
auxiliary_tools/cdat_regression_testing/843-migration-phase3/ex-scripts/debug.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
12 changes: 12 additions & 0 deletions
12
auxiliary_tools/cdat_regression_testing/843-migration-phase3/ex-scripts/debug_isccp_climo.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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. |
11,822 changes: 11,822 additions & 0 deletions
11,822
..._regression_testing/843-migration-phase3/ex-scripts/examples_regression_test_netcdf.ipynb
Large diffs are not rendered by default.
Oops, something went wrong.
47 changes: 47 additions & 0 deletions
47
...regression_testing/843-migration-phase3/ex-scripts/fix_isccpcosp_ann_climo_nc_calendar.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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) | ||
|
||
# %% |
44 changes: 44 additions & 0 deletions
44
auxiliary_tools/cdat_regression_testing/843-migration-phase3/ex-scripts/run.cfg
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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] |
Oops, something went wrong.