-
Notifications
You must be signed in to change notification settings - Fork 11
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
modify condition to get t_bounds variable #122
Conversation
Could you add a test for this new feature? |
def test_use_preprocess_no_time_bound(data_path):
"""Test that if the time_bound variable does not exist, no error is raised"""
domcfg = open_domain_cfg(
datadir=data_path / "mesh_mask_1_file",
)
ds_raw = xr.open_dataset(data_path / "nemo/GYRE_1y_00010101_00011230_grid_T.nc")
ds_raw.encoding["source"] = "GYRE_1y_00010101_00011230_grid_T.nc"
ds_raw = ds_raw.drop_vars(ds_raw["time_counter"].attrs.get("bounds"))
ds = nemo_preprocess(ds_raw, domcfg)
assert "x_c" in ds
assert "t" in ds
assert ds["t"].attrs.get("bounds") is None |
(untested function) |
Co-authored-by: Romain Caneill <romain.caneill@ens-lyon.org>
…te exist but ot variable
The precommit error comes from the number of spaces around the new function |
xnemogcm/test/test_nemo.py
Outdated
@@ -146,7 +146,19 @@ def test_use_preprocess(data_path): | |||
ds = nemo_preprocess(ds_raw, domcfg) | |||
assert "x_c" in ds | |||
assert "t" in ds | |||
|
|||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
ds = nemo_preprocess(ds_raw, domcfg) | ||
assert "x_c" in ds | ||
assert "t" in ds | ||
assert ds["t"].attrs.get("bounds") is None | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Some CDFTOOLs do not conserve the t_bounds variable but conserves the attribute, and thus xnemogcm fails when trying to get it.