Skip to content

bug: model_variable lost during CMORizer rule expansion with DefaultPipeline #262

@pgierz

Description

@pgierz

Problem

When using DefaultPipeline with a config that sets model_variable: "temp" and cmor_variable: "thetao", the get_variable pipeline step fails with:

KeyError: "No variable named 'thetao'. Variables on the dataset include ['temp', ...]"

The model_variable attribute is correctly set during Rule.from_dict() (verified locally), but by the time get_variable runs, rule_spec.model_variable returns "thetao" (the cmor_variable) instead of "temp".

Reproduction

Happens in CI with the pycmor-test-data-fesom external package's config_cmip6_fesom_2p6.yaml:

rules:
  - name: "thetao_with_levels"
    cmor_variable: "thetao"
    model_variable: "temp"
    pipelines:
      - default
pipelines:
  - name: default
    uses: pycmor.core.pipeline.DefaultPipeline

Hypothesis

The model_variable dynamic attribute is likely lost during one of:

  • _rules_expand_drvs() -- creates new Rule objects via deep copy
  • _rules_depluralize_drvs() -- may reconstruct rules
  • Rule pickling/unpickling through Prefect task submission

Context

Discovered during #253 integration testing. All fesom_2p6 tests with DefaultPipeline fail. This is pre-existing behavior -- the external package is the first to exercise DefaultPipeline end-to-end with model_variable != cmor_variable.

Related

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions