Skip to content

Commit

Permalink
fix tests
Browse files Browse the repository at this point in the history
  • Loading branch information
larsbuntemeyer committed Jun 23, 2024
1 parent ab65d17 commit 1464f31
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 8 deletions.
13 changes: 6 additions & 7 deletions cordex/cmor/cmor.py
Original file line number Diff line number Diff line change
Expand Up @@ -512,13 +512,12 @@ def prepare_variable(
# ds = xr.decode_cf(ds, decode_coords="all")

# no mapping table provided, we assume datasets has already correct out_names and units.
if out_name not in mapping_table:
try:
var_ds = ds[[out_name]]
except Exception:
raise Exception(
f"Could not find {out_name} in dataset. Please make sure, variable names and units have CF standard or pass a mapping table."
)
if out_name in ds.data_vars:
var_ds = ds[[out_name]]
elif mapping_table and out_name not in mapping_table:
raise Exception(
f"Could not find {out_name} in dataset. Please make sure, variable names and units have CF standard or pass a mapping table."
)
else:
varname = mapping_table[out_name]["varname"]
# cf_name = varinfo["cf_name"]
Expand Down
2 changes: 1 addition & 1 deletion tests/test_cmor.py
Original file line number Diff line number Diff line change
Expand Up @@ -220,7 +220,7 @@ def test_cmorizer_mon():

def test_cmorizer_mon_sdepth():
ds = create_sdepth_ds()
filename = run_cmorizer(ds, "tsl", "EUR-11", "mon")
filename = run_cmorizer(ds, "tsl", "EUR-11", "day")
return filename


Expand Down

0 comments on commit 1464f31

Please sign in to comment.