Skip to content
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

Also read default custom CMOR tables if custom location is specified #2279

Merged
merged 5 commits into from
Jan 18, 2024

Conversation

schlunma
Copy link
Contributor

@schlunma schlunma commented Dec 13, 2023

Description

This PR makes sure that the default custom CMOR tables are always read, even when a custom location is specified.

Closes #2278

Link to documentation: https://esmvaltool--2279.org.readthedocs.build/projects/ESMValCore/en/2279/quickstart/configure.html#custom-cmor-tables


Before you get started

Checklist

It is the responsibility of the author to make sure the pull request is ready to review. The icons indicate whether the item will be subject to the 🛠 Technical or 🧪 Scientific review.


To help with the number pull requests:

@schlunma schlunma added the cmor Related to the CMOR standard label Dec 13, 2023
@schlunma schlunma added this to the v2.11.0 milestone Dec 13, 2023
@schlunma schlunma self-assigned this Dec 13, 2023
Copy link

codecov bot commented Dec 13, 2023

Codecov Report

All modified and coverable lines are covered by tests ✅

Comparison is base (f515169) 93.61% compared to head (073c38a) 93.61%.

Additional details and impacted files
@@           Coverage Diff           @@
##             main    #2279   +/-   ##
=======================================
  Coverage   93.61%   93.61%           
=======================================
  Files         238      238           
  Lines       13113    13113           
=======================================
  Hits        12276    12276           
  Misses        837      837           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@schlunma schlunma marked this pull request as ready for review December 13, 2023 12:53
@schlunma
Copy link
Contributor Author

@FranziskaWinterstein could you try if this solves your problem with the custom tables? Thanks!!

Copy link
Contributor

@valeriupredoi valeriupredoi left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

many thanks, Manu! A couple very minor points from me 🍺

doc/quickstart/configure.rst Outdated Show resolved Hide resolved
doc/quickstart/configure.rst Show resolved Hide resolved
esmvalcore/cmor/table.py Outdated Show resolved Hide resolved
Co-authored-by: Valeriu Predoi <valeriu.predoi@gmail.com>
@valeriupredoi
Copy link
Contributor

valeriupredoi commented Dec 14, 2023

BTW @schlunma I think this closes this issue too #1388 🍺

@schlunma
Copy link
Contributor Author

BTW @schlunma I think this closes this issue too #1388 🍺

Nah I don't think so, this PR only changes the behavior if a custom location for the custom location is specified, #1388 also appears with our default location for the custom tables (I think 😁).

@valeriupredoi
Copy link
Contributor

ah well, worth the try, am in Xmas cleaning mode 😁

@FranziskaWinterstein
Copy link
Contributor

FranziskaWinterstein commented Dec 18, 2023

@schlunma Thank you for taking care of this. However, I have difficulties in executing my recipe. I was able to reproduce the former error, but with your changes the following happens:

Traceback (most recent call last):
  File "/home/b/b309109/ESMValCore/esmvalcore/_main.py", line 518, in run
    fire.Fire(ESMValTool())
  File "/home/b/b309109/ESMValCore/esmvalcore/_main.py", line 319, in __init__
    self.__setattr__(entry_point.name, entry_point.load()())
  File "/work/bd1132/b309109/conda_envs/envs/esmvaltool/lib/python3.10/importlib/metadata/__init__.py", line 171, in load
    module = import_module(match.group('module'))
  File "/work/bd1132/b309109/conda_envs/envs/esmvaltool/lib/python3.10/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 1050, in _gcd_import
  File "<frozen importlib._bootstrap>", line 1027, in _find_and_load
  File "<frozen importlib._bootstrap>", line 1006, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 688, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 883, in exec_module
  File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
  File "/home/b/b309109/ESMValTool/esmvaltool/cmorizers/data/cmorizer.py", line 17, in <module>
    from esmvalcore._task import write_ncl_settings
  File "/home/b/b309109/ESMValCore/esmvalcore/_task.py", line 24, in <module>
    from ._citation import _write_citation_files
  File "/home/b/b309109/ESMValCore/esmvalcore/_citation.py", line 10, in <module>
    from .config._diagnostics import DIAGNOSTICS
  File "/home/b/b309109/ESMValCore/esmvalcore/config/__init__.py", line 11, in <module>
    from ._config_object import CFG, Config, Session
  File "/home/b/b309109/ESMValCore/esmvalcore/config/_config_object.py", line 242, in <module>
    CFG = Config._load_user_config(USER_CONFIG, raise_exception=False)
  File "/home/b/b309109/ESMValCore/esmvalcore/config/_config_object.py", line 70, in _load_user_config
    new.update(mapping)
  File "/work/bd1132/b309109/conda_envs/envs/esmvaltool/lib/python3.10/_collections_abc.py", line 999, in update
    self[key] = other[key]
  File "/home/b/b309109/ESMValCore/esmvalcore/config/_validated_config.py", line 65, in __setitem__
    raise InvalidConfigParameter(
esmvalcore.exceptions.InvalidConfigParameter: `offline` is not a valid config parameter.

@schlunma
Copy link
Contributor Author

It looks like you are using the removed option offline in one of your config files (could also be the default one at ~/.esmvaltool/config-user.yml). offline has been deprecated in v2.8 and removed just now for v2.10 (#2213). The new option is called search_esgf (details here).

@schlunma
Copy link
Contributor Author

See #2280

@FranziskaWinterstein
Copy link
Contributor

Okay, after solving all my config issues, the behaviour concerning the custom tables is as I would expect it, i.e. favouring the external folder over the internal only if duplicate tables are defined. Thank you!

@valeriupredoi
Copy link
Contributor

@schlunma - I approved this PR last year 😁 I can also merge if I get the nod of OK from you 👍

@schlunma
Copy link
Contributor Author

@schlunma - I approved this PR last year 😁 I can also merge if I get the nod of OK from you 👍

Yeah, please merge 😁

@valeriupredoi valeriupredoi merged commit e03d320 into main Jan 18, 2024
4 of 5 checks passed
@valeriupredoi valeriupredoi deleted the fix_custom_tables branch January 18, 2024 15:45
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cmor Related to the CMOR standard
Projects
None yet
Development

Successfully merging this pull request may close these issues.

If custom location for custom CMOR tables is used, default location is ignored
3 participants