Skip to content

Make it possible to use Python functions outside of ESMValCore as preprocessor functions #3085

@bouweandela

Description

@bouweandela

It could be convenient if users could define their own preprocessor functions and use those from the recipe instead of being limited by what is available in ESMValCore. For example:

preprocessors:
  # See https://docs.esmvaltool.org/projects/esmvalcore/en/latest/recipe/preprocessor.html
  # for a description of the preprocessor functions.

  annual_mean_amsterdam:
    extract_location:
      location: Amsterdam
      scheme: linear
    annual_statistics:
      operator: mean
    esmvaltool.diag_scripts.example.some_function:
      example_argument: 10
    multi_model_statistics:
      statistics:
        - mean
      span: overlap
    convert_units:
      units: degrees_C

where esmvaltool.diag_scripts.example.some_function is a Python function in the module esmvaltool.diag_scripts.example with the function signature

def some_function(cube: iris.cube.Cube, example_argument: int) -> iris.cube.Cube:

This would make using the preprocessing capabilities of the recipe more powerful because recipe authors can include their own Python functions that may not need to be of general interest.

@ESMValGroup/technical-lead-development-team Opinions anyone?

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or requestpreprocessorRelated to the preprocessor

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions