Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
21 commits
Select commit Hold shift + click to select a range
e297e38
generate_gdds: Different time slices needed for h1 vs h2.
samsrabin Feb 10, 2026
ce79750
find_inst_hist_files(): Remove unused this_year option.
samsrabin Nov 14, 2025
424a567
generate_gdds: Don't allow "incorrectly daily" h1 files.
samsrabin Nov 14, 2025
78c6cb6
generate_gdds: Improve logging.
samsrabin Nov 15, 2025
0a38056
crop_calendars: Resolve some FutureWarnings.
samsrabin Nov 15, 2025
b51af72
generate_gdds: Check that all years' files have correct timesteps bef…
samsrabin Nov 15, 2025
b33c42e
generate_gdds bugfix: Use correct h2 years.
samsrabin Nov 15, 2025
01d7c85
test_unit_generate_gdds: Fix expected names of h2 files in a test.
samsrabin Feb 10, 2026
96674d3
TestGenInstDailyYear: Check saves at exactly midnight.
samsrabin Feb 10, 2026
8905786
test_find_inst_hist_files_multiple_months_same_year: Use h2, not h1
samsrabin Feb 10, 2026
dd28452
Delete f09_g17 version of RXCROPMATURITY_ test.
samsrabin Feb 10, 2026
0978fc8
Add f09_t232 version of RXCROPMATURITY_ test to rxcropmaturity suite.
samsrabin Feb 10, 2026
00fbe54
Remove RXCROPMATURITY_ tests from expected failures.
samsrabin Feb 10, 2026
31af968
Split unit tests for generate_gdds vs generate_gdds functions.
samsrabin Feb 10, 2026
d1a23de
Resolve Python FutureWarnings from RXCROPMATURITY tests.
samsrabin Feb 11, 2026
9e471c3
RXCROPMATURITY tests: Always use ctsm_pylib.
samsrabin Feb 11, 2026
fff3a90
crop_calendars Python: Don't gate error() with if logger:.
samsrabin Feb 12, 2026
b3565ad
get_files_in_time_slice() Remove 'if logger' condition.
samsrabin Feb 12, 2026
9d2e455
Rename a test for clarity.
samsrabin Feb 12, 2026
df16fa3
generate_gdds: Be stricter about "tape" vs. "file".
samsrabin Feb 12, 2026
b021196
generate_gdds: Get freq from H_FREQ_DICT.
samsrabin Feb 12, 2026
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
11 changes: 2 additions & 9 deletions cime_config/SystemTests/rxcropmaturity.py
Original file line number Diff line number Diff line change
Expand Up @@ -492,15 +492,8 @@ def _run_interpolate_gdds(self):
)

def _get_conda_env(self):
conda_setup_commands = stu.cmds_to_setup_conda(self._get_caseroot())

# If npl conda environment is available, use that (It has dask, which
# enables chunking, which makes reading daily 1-degree netCDF files
# much more efficient.
if "npl " in os.popen(conda_setup_commands + "conda env list").read():
self._this_conda_env = "npl"
else:
self._this_conda_env = "ctsm_pylib"
stu.cmds_to_setup_conda(self._get_caseroot())
self._this_conda_env = "ctsm_pylib"

def _append_to_user_nl_clm(self, additions):
caseroot = self._get_caseroot()
Expand Down
21 changes: 0 additions & 21 deletions cime_config/testdefs/ExpectedTestFails.xml
Original file line number Diff line number Diff line change
Expand Up @@ -36,27 +36,6 @@
</phase>
</test>

<test name="RXCROPMATURITY_Lm61.f10_f10_mg37.IHistClm60BgcCrop.derecho_intel.clm-cropMonthOutput">
<phase name="RUN">
<status>FAIL</status>
<issue>#3740</issue>
</phase>
</test>

<test name="RXCROPMATURITY_Lm61.f09_t232.IHistClm60BgcCrop.derecho_intel.clm-cropMonthOutput">
<phase name="RUN">
<status>FAIL</status>
<issue>#3740</issue>
</phase>
</test>

<test name="RXCROPMATURITY_Lm61.f09_g17.IHistClm60BgcCrop.derecho_intel.clm-cropMonthOutput">
<phase name="RUN">
<status>FAIL</status>
<issue>#3740</issue>
</phase>
</test>

<test name="SMS_Ld5.f09_g17.IHistClm50Sp.derecho_intel.clm-nofire">
<phase name="SHAREDLIB_BUILD">
<status>FAIL</status>
Expand Down
12 changes: 2 additions & 10 deletions cime_config/testdefs/testlist_clm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4510,22 +4510,14 @@
</options>
</test>

<test name="RXCROPMATURITY_Lm61" grid="f09_g17" compset="IHistClm60BgcCrop" testmods="clm/cropMonthOutput">
<machines>
<machine name="derecho" compiler="intel" category="ctsm_sci"/>
</machines>
<options>
<option name="wallclock">12:00:00</option>
<option name="comment">This test is designed to test the ability to prescribe crop sowing dates and maturity requirements. It first performs a GDD-generating run, then calls Python code to generate the maturity requirement file. This is then used in a sowing+maturity forced run, which finally is tested to ensure correct behavior.</option>
</options>
</test>
<test name="RXCROPMATURITY_Lm61" grid="f09_t232" compset="IHistClm60BgcCropCrujra" testmods="clm/cropMonthOutput">
<machines>
<machine name="derecho" compiler="intel" category="ctsm_sci"/>
<machine name="derecho" compiler="intel" category="rxcropmaturity"/>
</machines>
<options>
<option name="wallclock">12:00:00</option>
<option name="comment">Repeat RXCROP test with t232 and Crujra while the defaults have not changed</option>
<option name="comment">This test is designed to test the ability to prescribe crop sowing dates and maturity requirements. It first performs a GDD-generating run, then calls Python code to generate the maturity requirement file. This is then used in a sowing+maturity forced run, which finally is tested to ensure correct behavior.</option>
</options>
</test>

Expand Down
12 changes: 6 additions & 6 deletions python/ctsm/crop_calendars/check_constant_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -147,8 +147,8 @@ def ensure_all_patches_checked(this_ds, this_da, ra_sp, incl_patches):
incl_patches = np.sort(incl_patches)
if not np.array_equal(incl_patches, np.unique(incl_patches)):
raise RuntimeError("Patch(es) checked but also all-NaN??")
if not np.array_equal(incl_patches, np.arange(this_ds.dims["patch"])):
for patch in np.arange(this_ds.dims["patch"]):
if not np.array_equal(incl_patches, np.arange(this_ds.sizes["patch"])):
for patch in np.arange(this_ds.sizes["patch"]):
if patch not in incl_patches:
raise RuntimeError(
f"Not all patches checked! E.g., {patch}: {this_da.isel(patch=patch).values}"
Expand Down Expand Up @@ -178,7 +178,7 @@ def check_one_constant_var_loop_through_timesteps(
In check_one_constant_var(), loop through timesteps
"""
found_in_rx = None
for timestep in np.arange(time_1 + 1, this_ds.dims[time_coord]):
for timestep in np.arange(time_1 + 1, this_ds.sizes[time_coord]):
t_yr = this_ds[time_coord].values[timestep]
t_vals = np.squeeze(this_da.isel({time_coord: timestep, "patch": these_patches}).values)
ok_p = t1_vals == t_vals
Expand Down Expand Up @@ -267,7 +267,7 @@ def check_one_constant_var(
bad_patches,
) = check_one_constant_var_setup(this_ds, case, var)

for time_1 in np.arange(this_ds.dims[time_coord] - 1):
for time_1 in np.arange(this_ds.sizes[time_coord] - 1):
condn = ~np.isnan(ra_sp[time_1, ...])
if time_1 > 0:
condn = np.bitwise_and(condn, np.all(np.isnan(ra_sp[:time_1, ...]), axis=0))
Expand Down Expand Up @@ -324,12 +324,12 @@ def check_one_constant_var(
if not any_bad:
if any_bad_before_checking_rx:
print(
f"✅ CLM output {var} do not vary through {this_ds.dims[time_coord]} growing "
f"✅ CLM output {var} do not vary through {this_ds.sizes[time_coord]} growing "
+ "seasons of output (except for patch(es) with missing rx)."
)
else:
print(
f"✅ CLM output {var} do not vary through {this_ds.dims[time_coord]} growing "
f"✅ CLM output {var} do not vary through {this_ds.sizes[time_coord]} growing "
+ "seasons of output."
)

Expand Down
12 changes: 6 additions & 6 deletions python/ctsm/crop_calendars/convert_axis_time2gs.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,13 +48,13 @@ def convert_axis_time2gs_setup(this_ds, verbose):
Various setup steps for convert_axis_time2gs_setup()
"""
# How many non-NaN patch-seasons do we expect to have once we're done organizing things?
n_patch = this_ds.dims["patch"]
n_patch = this_ds.sizes["patch"]
# Because some patches will be planted in the last year but not complete, we have to ignore any
# finalyear-planted seasons that do complete.
n_gs = this_ds.dims["time"] - 1
n_gs = this_ds.sizes["time"] - 1
expected_valid = n_patch * n_gs

mxharvests = this_ds.dims["mxharvests"]
mxharvests = this_ds.sizes["mxharvests"]

if verbose:
print(
Expand Down Expand Up @@ -377,7 +377,7 @@ def ignore_harvests_planted_in_final_year(
)
is_valid = ~np.isnan(hdates_pg2)
is_fake = np.isneginf(hdates_pg2)
is_fake = np.reshape(is_fake[is_valid], (this_ds.dims["patch"], n_gs))
is_fake = np.reshape(is_fake[is_valid], (this_ds.sizes["patch"], n_gs))
discrepancy = np.sum(is_valid) - expected_valid
unique_n_seasons = np.unique(np.sum(is_valid, axis=1))
if verbose:
Expand Down Expand Up @@ -435,8 +435,8 @@ def create_dataset(

# Remove the nans and reshape to patches*growingseasons
da_pyh = da_yhp.transpose("patch", "time", "mxharvests")
ar_pg = np.reshape(da_pyh.values, (this_ds.dims["patch"], -1))
ar_valid_pg = np.reshape(ar_pg[is_valid], (this_ds.dims["patch"], n_gs))
ar_pg = np.reshape(da_pyh.values, (this_ds.sizes["patch"], -1))
ar_valid_pg = np.reshape(ar_pg[is_valid], (this_ds.sizes["patch"], n_gs))
# Change -infs to nans
ar_valid_pg[is_fake] = np.nan
# Save as DataArray to new Dataset, stripping _PERHARV from variable name
Expand Down
4 changes: 2 additions & 2 deletions python/ctsm/crop_calendars/cropcal_module.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ def check_and_trim_years(year_1, year_n, ds_in):

# Make sure you have the expected number of timesteps (including extra year)
n_years_expected = year_n - year_1 + 2
if ds_in.dims["time"] != n_years_expected:
if ds_in.sizes["time"] != n_years_expected:
raise RuntimeError(
f"Expected {n_years_expected} timesteps in output but got {ds_in.dims['time']}"
)
Expand Down Expand Up @@ -208,7 +208,7 @@ def import_max_gs_length(paramfile):
Import maximum growing season length
"""
# Get parameter file
paramfile_ds = xr.open_dataset(paramfile)
paramfile_ds = xr.open_dataset(paramfile, decode_timedelta=True)

# Import max growing season length (stored in netCDF as nanoseconds!)
paramfile_mxmats = paramfile_ds["mxmat"].values / np.timedelta64(1, "D")
Expand Down
Loading
Loading