Skip to content

Commit

Permalink
Simplify handling of fx vars
Browse files Browse the repository at this point in the history
  • Loading branch information
zklaus committed Jun 9, 2021
1 parent 51d7f76 commit d8a42e3
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 21 deletions.
1 change: 0 additions & 1 deletion esmvalcore/_recipe.py
Expand Up @@ -328,7 +328,6 @@ 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(variable)
settings['remove_fx_variables'] = {}

return settings
Expand Down
28 changes: 8 additions & 20 deletions esmvalcore/preprocessor/_ancillary_vars.py
Expand Up @@ -16,21 +16,16 @@ def _load_fx(var_cube, fx_info, check_level):
"""Load and CMOR-check fx variables."""
fx_cubes = iris.cube.CubeList()

project = fx_info['project']
mip = fx_info['mip']
short_name = fx_info['short_name']
freq = fx_info['frequency']

for fx_file in fx_info['filename']:
loaded_cube = load(fx_file, callback=concatenate_callback)
short_name = fx_info['short_name']
project = fx_info['project']
dataset = fx_info['dataset']
mip = fx_info['mip']
freq = fx_info['frequency']
loaded_cube = fix_metadata(loaded_cube,
short_name=short_name,
project=project,
dataset=dataset,
mip=mip,
frequency=freq,
check_level=check_level,
**extra_facets)
**fx_info)
fx_cubes.append(loaded_cube[0])

fx_cube = concatenate(fx_cubes)
Expand All @@ -42,14 +37,7 @@ def _load_fx(var_cube, fx_info, check_level):
short_name=short_name, frequency=freq,
check_level=check_level)

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

fx_cube = cmor_check_data(fx_cube,
cmor_table=project,
Expand Down Expand Up @@ -151,7 +139,7 @@ def add_ancillary_variable(cube, fx_cube):
fx_cube.var_name, cube.var_name)


def add_fx_variables(cube, fx_variables, check_level, **extra_facets):
def add_fx_variables(cube, fx_variables, check_level):
"""Load requested fx files, check with CMOR standards and add the fx
variables as cell measures or ancillary variables in the cube containing
the data.
Expand Down

0 comments on commit d8a42e3

Please sign in to comment.