Skip to content

Commit

Permalink
Pass extra_facets also to fx variables
Browse files Browse the repository at this point in the history
  • Loading branch information
Klaus Zimmermann committed Jun 1, 2021
1 parent c76ba1a commit 398b6c6
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 5 deletions.
1 change: 1 addition & 0 deletions esmvalcore/_recipe.py
Original file line number Diff line number Diff line change
Expand Up @@ -335,6 +335,7 @@ def _get_default_settings(variable, config_user, derive=False):
'fx_variables': {},
'check_level': config_user.get('check_level', CheckLevels.DEFAULT)
}
settings['add_fx_variables'].update(extra_facets)
settings['remove_fx_variables'] = {}

return settings
Expand Down
10 changes: 5 additions & 5 deletions esmvalcore/preprocessor/_ancillary_vars.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
logger = logging.getLogger(__name__)


def _load_fx(fx_info, check_level):
def _load_fx(fx_info, check_level, **extra_facets):
"""Load and CMOR-check fx variables."""
fx_cubes = iris.cube.CubeList()

Expand All @@ -26,7 +26,7 @@ def _load_fx(fx_info, check_level):
loaded_cube = fix_metadata(loaded_cube, short_name=short_name,
project=project, dataset=dataset,
mip=mip, frequency=freq,
check_level=check_level)
check_level=check_level, **extra_facets)
fx_cubes.append(loaded_cube[0])

fx_cube = concatenate(fx_cubes)
Expand All @@ -37,7 +37,7 @@ def _load_fx(fx_info, check_level):

fx_cube = fix_data(fx_cube, short_name=short_name, project=project,
dataset=dataset, mip=mip, frequency=freq,
check_level=check_level)
check_level=check_level, **extra_facets)

fx_cube = cmor_check_data(fx_cube, cmor_table=project, mip=mip,
short_name=fx_cube.var_name, frequency=freq,
Expand Down Expand Up @@ -132,7 +132,7 @@ def add_ancillary_variable(cube, fx_cube):
fx_cube.var_name, cube.var_name)


def add_fx_variables(cube, fx_variables, check_level):
def add_fx_variables(cube, fx_variables, check_level, **extra_facets):
"""
Load requested fx files, check with CMOR standards and add the
fx variables as cell measures or ancillary variables in
Expand Down Expand Up @@ -162,7 +162,7 @@ def add_fx_variables(cube, fx_variables, check_level):
continue
if isinstance(fx_info['filename'], str):
fx_info['filename'] = [fx_info['filename']]
fx_cube = _load_fx(fx_info, check_level)
fx_cube = _load_fx(fx_info, check_level, **extra_facets)

measure_name = {
'areacella': 'area',
Expand Down

0 comments on commit 398b6c6

Please sign in to comment.