Skip to content

Diagnostics config common copy #1958

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

Draft
wants to merge 5 commits into
base: main
Choose a base branch
from
Draft

Diagnostics config common copy #1958

wants to merge 5 commits into from

Conversation

mnurisso
Copy link
Collaborator

@mnurisso mnurisso commented May 28, 2025

PR description:

The PR proposes to add the 'diagnostics' folder to the list of folders copied/linked by the console. This is a solution that will totally replace the manual addition of individual config files done so far for all the diagnostics.

Note:

The link solution will make appear the files that are now not natively in the config folder as untracked for git. This is expected, but not very nice for the development, since it add noise to the file list.

People involved:

cc @oloapinivad

  • Tests are included if a new feature is included.
  • Documentation is included if a new feature is included.
  • Docstrings are updated if needed.
  • Changelog is updated.
  • Diagnostic config files path are updated in the console if needed

@mnurisso mnurisso self-assigned this May 28, 2025
@mnurisso mnurisso added diagnostic framework functions common to all diagnostics improvement Improvement to existing functionality labels May 28, 2025
@mnurisso mnurisso added the run tests Set this up to let test run label May 28, 2025
Copy link

codecov bot commented May 28, 2025

❌ 9 Tests Failed:

Tests completed Failed Passed Skipped
295 9 286 0
View the top 3 failed test(s) by shortest run time
tests/teleconnections/test_nao.py::test_class_NAO
Stack Traces | 0.024s run time
@pytest.mark.diagnostics
    def test_class_NAO():
        """
        Test that the NAO class works
        """
        telecname = 'NAO'
        model = 'IFS'
        exp = 'test-tco79'
        source = 'teleconnections'
        interface = 'teleconnections-ci'
    
>       telec = Teleconnection(model=model, exp=exp, source=source,
                               loglevel=loglevel, telecname=telecname,
                               interface=interface)

tests/teleconnections/test_nao.py:20: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../aqua_diagnostics/teleconnections/tc_class.py:119: in __init__
    self._load_namelist(configdir=configdir, interface=interface)
.../aqua_diagnostics/teleconnections/tc_class.py:368: in _load_namelist
    self.namelist = config.load_namelist()
.../teleconnections/tools/tools.py:43: in load_namelist
    namelist = load_yaml(self.config_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

infile = '....../github/home/.aqua.../teleconnections/config/teleconnections-ci.yaml'
definitions = None, jinja = True

    def load_yaml(infile, definitions=None, jinja=True):
        """
        Load yaml file with template substitution
    
        Args:
            infile (str): a file path to the yaml
            definitions (str or dict, optional): name of the section containing string template
                                                 definitions or a dictionary with the same content
            jinja: (bool): jinja2 templating is used instead of standard python templating. Default is true.
        Returns:
            A dictionary with the yaml file keys
        """
    
        if not os.path.exists(infile):
>           raise ValueError(f'ERROR: {infile} not found: you need to have this configuration file!')
E           ValueError: ERROR: ....../github/home/.aqua.../teleconnections/config/teleconnections-ci.yaml not found: you need to have this configuration file!

.../aqua/util/yaml.py:100: ValueError
tests/teleconnections/test_teleconnections.py::test_namelist
Stack Traces | 0.024s run time
@pytest.mark.diagnostics
    def test_namelist():
        """
        Test that the namelist can be loaded
        """
    
        # configdir = "..../diagnostics/teleconnections/config"
        config = TeleconnectionsConfig()
>       namelist = config.load_namelist()

tests/teleconnections/test_teleconnections.py:30: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../teleconnections/tools/tools.py:43: in load_namelist
    namelist = load_yaml(self.config_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

infile = '....../github/home/.aqua....../teleconnections/config/teleconnections-destine.yaml'
definitions = None, jinja = True

    def load_yaml(infile, definitions=None, jinja=True):
        """
        Load yaml file with template substitution
    
        Args:
            infile (str): a file path to the yaml
            definitions (str or dict, optional): name of the section containing string template
                                                 definitions or a dictionary with the same content
            jinja: (bool): jinja2 templating is used instead of standard python templating. Default is true.
        Returns:
            A dictionary with the yaml file keys
        """
    
        if not os.path.exists(infile):
>           raise ValueError(f'ERROR: {infile} not found: you need to have this configuration file!')
E           ValueError: ERROR: ....../github/home/.aqua....../teleconnections/config/teleconnections-destine.yaml not found: you need to have this configuration file!

.../aqua/util/yaml.py:100: ValueError
tests/teleconnections/test_teleconnections.py::test_regional_mean[1]
Stack Traces | 0.024s run time
months_window = 1

    @pytest.mark.diagnostics
    @pytest.mark.parametrize("months_window", [1, 3])
    def test_regional_mean(months_window):
        """
        Test that the regional_mean method works
        """
    
        filepath = "..../IFS/teleconnections/enso_test.nc"
        # configdir = "..../diagnostics/teleconnections/config"
        telecname = 'ENSO'
        interface = 'teleconnections-ci'
        rtol = approx_rel
        atol = approx_rel
    
        # 1. -- Opening yaml file
        config = TeleconnectionsConfig(interface=interface)
>       namelist = config.load_namelist()

tests/teleconnections/test_teleconnections.py:75: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
.../teleconnections/tools/tools.py:43: in load_namelist
    namelist = load_yaml(self.config_file)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

infile = '....../github/home/.aqua....../teleconnections/config/teleconnections-ci.yaml'
definitions = None, jinja = True

    def load_yaml(infile, definitions=None, jinja=True):
        """
        Load yaml file with template substitution
    
        Args:
            infile (str): a file path to the yaml
            definitions (str or dict, optional): name of the section containing string template
                                                 definitions or a dictionary with the same content
            jinja: (bool): jinja2 templating is used instead of standard python templating. Default is true.
        Returns:
            A dictionary with the yaml file keys
        """
    
        if not os.path.exists(infile):
>           raise ValueError(f'ERROR: {infile} not found: you need to have this configuration file!')
E           ValueError: ERROR: ....../github/home/.aqua....../teleconnections/config/teleconnections-ci.yaml not found: you need to have this configuration file!

.../aqua/util/yaml.py:100: ValueError

To view more test analytics, go to the Test Analytics Dashboard
📋 Got 3 mins? Take this short survey to help us improve Test Analytics.

@mnurisso mnurisso marked this pull request as draft May 28, 2025 10:28
@mnurisso
Copy link
Collaborator Author

Stanby

@mnurisso mnurisso removed the run tests Set this up to let test run label Jun 9, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
diagnostic framework functions common to all diagnostics improvement Improvement to existing functionality
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant