Skip to content

Using fx_files for preprocessor fails in rare cases #448

Description

@schlunma

Describe the bug
@bettina-gier found a funny bug: In some cases, using fx files in preprocessors (e.g for landsea_fraction_weighting) fails.

This recipe works:

preprocessors:

  land_fraction_weighting: &land_fraction_weighting
    weighting_landsea_fraction: &weighting_options
      area_type: land


diagnostics:

  diag_mvi_tas:
    variables:
      tas: &var_tas
        preprocessor: land_fraction_weighting
        project: CMIP5
        mip: Amon
        exp: historical
        ensemble: r1i1p1
        start_year: 1901
        end_year: 2005
    additional_datasets: &tas_datasets
      # - {dataset: CRU, project: OBS, type: reanaly, version: TS4.02, tier: 2}
      - {dataset: bcc-csm1-1}
    scripts:
      null

  diag_two_vars_scatter:
    variables:
      cSoil:
        preprocessor: land_fraction_weighting
        project: CMIP5
        mip: Lmon
        exp: historical
        ensemble: r1i1p1
        start_year: 1986
        end_year: 2005
        additional_datasets:
          - {dataset: HWSD, project: OBS, type: reanaly, version: 1.2, tier: 3, start_year: 2000, end_year: 2000}
    scripts:
      null

This one

preprocessors:

  land_fraction_weighting: &land_fraction_weighting
    weighting_landsea_fraction: &weighting_options
      area_type: land


diagnostics:

  diag_mvi_tas:
    variables:
      tas: &var_tas
        preprocessor: land_fraction_weighting
        project: CMIP5
        mip: Amon
        exp: historical
        ensemble: r1i1p1
        start_year: 1901
        end_year: 2005
        reference_dataset: CRU
        plot_units: degC
    additional_datasets: &tas_datasets
      - {dataset: CRU, project: OBS, type: reanaly, version: TS4.02, tier: 2}
      - {dataset: bcc-csm1-1}
    scripts:
      null

  diag_two_vars_scatter:
    variables:
      cSoil:
        preprocessor: land_fraction_weighting
        project: CMIP5
        mip: Lmon
        exp: historical
        ensemble: r1i1p1
        start_year: 1986
        end_year: 2005
        reference_dataset: HWSD
        plot_units: PgC
        additional_datasets:
          - {dataset: HWSD, project: OBS, type: reanaly, version: 1.2, tier: 3, start_year: 2000, end_year: 2000}
    scripts:
      null

fails with

Traceback (most recent call last):
  File "ESMValCore/esmvalcore/_main.py", line 220, in run
    conf = main(args)
  File "ESMValCore/esmvalcore/_main.py", line 156, in main
    process_recipe(recipe_file=recipe, config_user=cfg)
  File "ESMValCore/esmvalcore/_main.py", line 202, in process_recipe
    recipe = read_recipe_file(recipe_file, config_user)
  File "ESMValCore/esmvalcore/_recipe.py", line 74, in read_recipe_file
    recipe_file=filename)
  File "ESMValCore/esmvalcore/_recipe.py", line 1032, in __init__
    self.tasks = self.initialize_tasks() if initialize_tasks else None
  File "ESMValCore/esmvalcore/_recipe.py", line 1379, in initialize_tasks
    task_name=task_name,
  File "ESMValCore/esmvalcore/_recipe.py", line 985, in _get_preprocessor_task
    name=task_name,
  File "ESMValCore/esmvalcore/_recipe.py", line 792, in _get_single_preprocessor_task
    config_user=config_user,
  File "ESMValCore/esmvalcore/_recipe.py", line 739, in _get_preprocessor_products
    config_user=config_user)
  File "ESMValCore/esmvalcore/_recipe.py", line 506, in _update_fx_settings
    fx_dict = _get_landsea_fraction_fx_dict(variable, config_user)
  File "ESMValCore/esmvalcore/_recipe.py", line 459, in _get_landsea_fraction_fx_dict
    fx_file, _ = _get_correct_fx_file(variable, fx_var, config_user)
  File "ESMValCore/esmvalcore/_recipe.py", line 424, in _get_correct_fx_file
    fx_files = _get_input_files(fx_variable, config_user)
  File "ESMValCore/esmvalcore/_recipe.py", line 551, in _get_input_files
    drs=config_user['drs'])
  File "ESMValCore/esmvalcore/_data_finder.py", line 264, in get_input_filelist
    variable['end_year'])
  File "ESMValCore/esmvalcore/_data_finder.py", line 111, in select_files
    start, end = get_start_end_year(filename)
  File "ESMValCore/esmvalcore/_data_finder.py", line 99, in get_start_end_year
    'not be read from the file'.format(filename)
ValueError: File /mnt/lustre02/work/bd0854/DATA/ESMValTool2/OBS/Tier3/HWSD/OBS_HWSD_reanaly_1.2_fx_sftlf.nc dates do not match a recognized pattern and time can not be read from the file

Note the additional OBS dataset in the second case.

I will try to address this in #439. I think this bug was introduced in #432. @valeriupredoi

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Fields

No fields configured for issues without a type.

Projects

No projects

Milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions