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

Fix broken recipes and tests due to new ESMValCore release v2.0.6b #1523

Merged
merged 6 commits into from
Feb 13, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion environment.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ channels:
dependencies:
# Python packages that cannot be installed from PyPI:
- gdal
- esmvalcore>=2.0.0b5,<2.1
- esmvalcore>=2.0.0b6,<2.1
# Non-Python dependencies
- graphviz
- cdo>=1.9.7
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ diagnostics:
rsutcs: # TOA SW up clear sky
preprocessor: pp_rad
additional_datasets:
- {dataset: CERES-EBAF, project: obs4mips, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
- {dataset: CERES-EBAF, project: obs4mips, mip: Amon, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_all:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -86,7 +86,7 @@ diagnostics:
rldscs: # Surf LW down clear sky
preprocessor: pp_rad
additional_datasets:
- {dataset: JRA-55, project: ana4mips, type: reanalysis, start_year: 2001, end_year: 2005, tier: 1}
- {dataset: JRA-55, project: ana4mips, mip: Amon, type: reanalysis, start_year: 2001, end_year: 2005, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_all:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -103,7 +103,7 @@ diagnostics:
prw: # Column Water vapour
preprocessor: pp_rad
additional_datasets:
- {dataset: SSMI-MERIS, project: obs4mips, level: L3, version: v1-00, start_year: 2003, end_year: 2008, tier: 1}
- {dataset: SSMI-MERIS, project: obs4mips, mip: Amon, level: L3, version: v1-00, start_year: 2003, end_year: 2008, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_all:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -120,7 +120,7 @@ diagnostics:
pr: # Precipitation
preprocessor: pp_rad
additional_datasets:
- {dataset: GPCP-SG, project: obs4mips, level: L3, version: v2.2, start_year: 2001, end_year: 2009, tier: 1}
- {dataset: GPCP-SG, project: obs4mips, mip: Amon, level: L3, version: v2.2, start_year: 2001, end_year: 2009, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_all:
script: autoassess/autoassess_radiation_rms.py
Expand Down
16 changes: 8 additions & 8 deletions esmvaltool/recipes/recipe_autoassess_radiation_rms_Amon_obs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -68,8 +68,8 @@ diagnostics:
rsutcs: # TOA SW up clear sky
preprocessor: pp_rad
additional_datasets:
- {dataset: CERES-EBAF, project: obs4mips, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
- {dataset: CERES-SYN1deg, project: OBS, type: sat, version: Ed3A, start_year: 2001, end_year: 2015, tier: 3}
- {dataset: CERES-EBAF, project: obs4mips, mip: Amon, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
- {dataset: CERES-SYN1deg, project: OBS, mip: Amon, type: sat, version: Ed3A, start_year: 2001, end_year: 2015, tier: 3}
scripts:
autoassess_Radiation_rms_Amon_obs:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -88,8 +88,8 @@ diagnostics:
rldscs: # Surf LW down clear sky
preprocessor: pp_rad
additional_datasets:
- {dataset: JRA-55, project: ana4mips, type: reanalysis, start_year: 2001, end_year: 2005, tier: 1}
- {dataset: CERES-SYN1deg, project: OBS, type: sat, version: Ed3A, start_year: 2001, end_year: 2015, tier: 3}
- {dataset: JRA-55, project: ana4mips, mip: Amon, type: reanalysis, start_year: 2001, end_year: 2005, tier: 1}
- {dataset: CERES-SYN1deg, project: OBS, mip: Amon, type: sat, version: Ed3A, start_year: 2001, end_year: 2015, tier: 3}
scripts:
autoassess_Radiation_rms_Amon_obs:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -106,8 +106,8 @@ diagnostics:
prw: # Column Water vapour
preprocessor: pp_rad
additional_datasets:
- {dataset: SSMI-MERIS, project: obs4mips, level: L3, version: v1-00, start_year: 2003, end_year: 2008, tier: 1}
- {dataset: SSMI, project: obs4mips, level: L3, version: RSSv07r00, start_year: 1988, end_year: 2006, tier: 1}
- {dataset: SSMI-MERIS, project: obs4mips, mip: Amon, level: L3, version: v1-00, start_year: 2003, end_year: 2008, tier: 1}
- {dataset: SSMI, project: obs4mips, mip: Amon, level: L3, version: RSSv07r00, start_year: 1988, end_year: 2006, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_obs:
script: autoassess/autoassess_radiation_rms.py
Expand All @@ -124,8 +124,8 @@ diagnostics:
pr: # Precipitation
preprocessor: pp_rad
additional_datasets:
- {dataset: GPCP-SG, project: obs4mips, level: L3, version: v2.2, start_year: 2001, end_year: 2009, tier: 1}
- {dataset: TRMM-L3, project: obs4mips, level: v7, version: 7A, start_year: 1998, end_year: 2013, tier: 1}
- {dataset: GPCP-SG, project: obs4mips, mip: Amon, level: L3, version: v2.2, start_year: 2001, end_year: 2009, tier: 1}
- {dataset: TRMM-L3, project: obs4mips, mip: Amon, level: v7, version: 7A, start_year: 1998, end_year: 2013, tier: 1}
scripts:
autoassess_Radiation_rms_Amon_obs:
script: autoassess/autoassess_radiation_rms.py
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ diagnostics:
derive: true
force_derivation: false
additional_datasets:
- {dataset: ISCCP, project: obs4mips, level: L3, version: V1.0, start_year: 1985, end_year: 1988, tier: 1}
- {dataset: ISCCP, project: obs4mips, mip: Amon, level: L3, version: V1.0, start_year: 1985, end_year: 1988, tier: 1}
scripts:
autoassess_Radiation_rms_cfMon_all:
script: autoassess/autoassess_radiation_rms.py
Expand Down
2 changes: 1 addition & 1 deletion esmvaltool/recipes/recipe_validation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ diagnostics:
rsut: # TOA SW up all sky
preprocessor: pp_rad
additional_datasets:
- {dataset: CERES-EBAF, project: obs4mips, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
- {dataset: CERES-EBAF, project: obs4mips, mip: Amon, level: L3B, version: Ed2-7, start_year: 2001, end_year: 2012, tier: 1}
scripts:
lat_lon:
script: validation.py
Expand Down
2 changes: 1 addition & 1 deletion esmvaltool/recipes/recipe_validation_CMIP6.yml
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ diagnostics:
tas:
preprocessor: pp_rad
additional_datasets:
- {dataset: ERA-Interim, project: OBS6, type: reanaly, version: 1, start_year: 1980, end_year: 2000, tier: 3}
- {dataset: ERA-Interim, project: OBS6, mip: Amon, type: reanaly, version: 1, start_year: 1980, end_year: 2000, tier: 3}
scripts:
lat_lon:
script: validation.py
Expand Down
2 changes: 1 addition & 1 deletion meta.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@ requirements:
- ecmwf-api-client # in esmvalgroup channel
- eofs
- esmpy
- esmvalcore>=2.0.0b5,<2.1 # in esmvalgroup channel
- esmvalcore>=2.0.0b6,<2.1 # in esmvalgroup channel
- jinja2
- matplotlib
- nc-time-axis
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
'cython',
'ecmwf-api-client',
'eofs',
'esmvalcore>=2.0.0b5,<2.1',
'esmvalcore>=2.0.0b6,<2.1',
'fiona',
'jinja2',
'matplotlib<3',
Expand Down
19 changes: 16 additions & 3 deletions tests/integration/test_recipes_loading.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,12 @@
import numpy as np
import pytest

import esmvalcore
import esmvaltool
from esmvalcore import _data_finder, _recipe_checks
from esmvalcore._config import read_config_user_file
from esmvalcore._recipe import read_recipe_file

import esmvaltool

from .test_diagnostic_run import write_config_user_file


Expand Down Expand Up @@ -137,8 +137,21 @@ def extract_shape(settings):
monkeypatch.setattr(_recipe_checks, 'extract_shape', extract_shape)


@pytest.fixture
def patched_get_reference_levels(monkeypatch):
"""Replace `_regrid.get_reference_levels`.

Return a random set of reference levels
"""
def get_reference_levels(*_, **_a):
return [1, 2]

monkeypatch.setattr(esmvalcore._recipe, 'get_reference_levels',
get_reference_levels)


@pytest.mark.parametrize('recipe_file', _get_recipes())
def test_diagnostic_run(recipe_file, config_user, patched_datafinder,
patched_extract_shape):
patched_extract_shape, patched_get_reference_levels):
"""Check that recipe files are valid ESMValTool recipes."""
read_recipe_file(recipe_file, config_user)
24 changes: 19 additions & 5 deletions tests/unit/test_naming.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,17 @@
import os
import unittest

IGNORE = {
'.git',
'.github',
'.eggs',
'__pycache__',
'test-reports',
}


class TestNaming(unittest.TestCase):
"""Test naming of files and folders"""

def setUp(self):
"""Prepare tests"""
folder = os.path.join(__file__, '..', '..', '..')
Expand All @@ -25,6 +32,9 @@ def test_windows_reserved_names(self):
}

for dirpath, dirnames, filenames in os.walk(self.esmvaltool_folder):
for dirname in dirnames:
if dirname in IGNORE:
dirnames.remove(dirname)
error_msg = 'Reserved windows name found at {}.' \
' Please rename it ' \
'(Windows reserved names are: {})' \
Expand All @@ -33,8 +43,8 @@ def test_windows_reserved_names(self):
self.assertTrue(reserved_names.isdisjoint(filenames), error_msg)
without_extensions = (os.path.splitext(filename)[0]
for filename in filenames)
self.assertTrue(
reserved_names.isdisjoint(without_extensions), error_msg)
self.assertTrue(reserved_names.isdisjoint(without_extensions),
error_msg)

def test_avoid_casing_collisions(self):
"""
Expand All @@ -43,6 +53,9 @@ def test_avoid_casing_collisions(self):
This includes folders differing from files
"""
for dirpath, dirnames, filenames in os.walk(self.esmvaltool_folder):
for dirname in dirnames:
if dirname in IGNORE:
dirnames.remove(dirname)
self.assertEqual(
len(filenames) + len(dirnames),
len({name.lower()
Expand All @@ -60,8 +73,9 @@ def test_no_namelist(self):
exclude_paths = ['esmvaltool/diag_scripts/cvdp/cvdp']

for dirpath, dirnames, filenames in os.walk(self.esmvaltool_folder):
if '.git' in dirpath.split(os.sep):
continue
for dirname in dirnames:
if dirname in IGNORE:
dirnames.remove(dirname)
if any([item in dirpath for item in exclude_paths]):
continue
self.assertFalse(
Expand Down