diff --git a/CHANGES.rst b/CHANGES.rst index 7064c1ec..4e620dac 100644 --- a/CHANGES.rst +++ b/CHANGES.rst @@ -4,11 +4,13 @@ Changelog v0.9.1 (unreleased) ------------------- -Contributors to this version: Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`). +Contributors to this version: Pascal Bourgault (:user:`aulemahal`), Trevor James Smith (:user:`Zeitsperre`), Juliette Lavoie (:user:`juliettelavoie`). Bug fixes ^^^^^^^^^ -* Fixed defaults for ``xr_combine_kwargs`` in ``extract_dataset``. (:pull:`402`). +* Fixed defaults for ``xr_combine_kwargs`` in ``extract_dataset`` (:pull:`402`). +* Fixed bug with `xs.utils.update_attr`(:issue:`404`, :pull:`405`). +* Fixed template 1 bugs due to changes in versions of dependencies. ( :pull:`405`). Internal changes ^^^^^^^^^^^^^^^^ diff --git a/templates/1-basic_workflow_with_config/config1.yml b/templates/1-basic_workflow_with_config/config1.yml index 9d4f7f1d..1d0c480b 100644 --- a/templates/1-basic_workflow_with_config/config1.yml +++ b/templates/1-basic_workflow_with_config/config1.yml @@ -138,6 +138,7 @@ extract: - '1950' - '2100' other_search_criteria: # put the simulations you want here + processing_level: raw mip_era: CMIP6 experiment: - ssp245 @@ -540,7 +541,7 @@ logging: # general logging args class : logging.StreamHandler formatter: default level : INFO -# file: +# file: #Uncomment if you want a log file, don't forget to also uncomment the filename in paths1.yml. # class: logging.FileHandler # formatter: default # level : DEBUG diff --git a/templates/1-basic_workflow_with_config/paths1_example.yml b/templates/1-basic_workflow_with_config/paths1_example.yml index 217ef9a4..208f1ab5 100644 --- a/templates/1-basic_workflow_with_config/paths1_example.yml +++ b/templates/1-basic_workflow_with_config/paths1_example.yml @@ -54,10 +54,10 @@ dask: local_directory: DASK_PATH dashboard_address: YOUR_RANDOM_NUMBER -logging: - handlers: - file: - filename: PATH/logger.log +#logging: #Uncomment if you want a log file +# handlers: +# file: +# filename: PATH/logger.log utils: stack_drop_nans: diff --git a/templates/1-basic_workflow_with_config/workflow1.py b/templates/1-basic_workflow_with_config/workflow1.py index ac8f70a4..9cad6bb4 100644 --- a/templates/1-basic_workflow_with_config/workflow1.py +++ b/templates/1-basic_workflow_with_config/workflow1.py @@ -105,7 +105,8 @@ ds, ds[list(ds.data_vars)[0]] .isel(time=0, drop=True) - .notnull(), + .notnull() + .compute(), ) # Prepare the filename for the zarr file, using the format specified in paths1.yml path = CONFIG["paths"]["task"].format(**cur) diff --git a/xscen/utils.py b/xscen/utils.py index c354e9ec..2171bd03 100644 --- a/xscen/utils.py +++ b/xscen/utils.py @@ -133,20 +133,23 @@ def update_attr( others = others or [] # .strip(' .') removes trailing and leading whitespaces and dots if attr in ds.attrs: - others = { + + others_attrs = { f"attr{i}": dso.attrs.get(attr, "").strip(" .") for i, dso in enumerate(others, 1) } - ds.attrs[attr] = new.format(attr=ds.attrs[attr].strip(" ."), **others, **fmt) + ds.attrs[attr] = new.format( + attr=ds.attrs[attr].strip(" ."), **others_attrs, **fmt + ) # All existing locales for key in fnmatch.filter(ds.attrs.keys(), f"{attr}_??"): loc = key[-2:] - others = { + others_attrs = { f"attr{i}": dso.attrs.get(key, dso.attrs.get(attr, "")).strip(" .") for i, dso in enumerate(others, 1) } ds.attrs[key] = TRANSLATOR[loc](new).format( - attr=ds.attrs[key].strip(" ."), **others, **fmt + attr=ds.attrs[key].strip(" ."), **others_attrs, **fmt )