Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[feature] Expand node attributes #68

Open
wants to merge 11 commits into
base: develop
Choose a base branch
from

Conversation

JPXKQX
Copy link
Member

@JPXKQX JPXKQX commented Oct 23, 2024

This PR extends some of the current functionality:

  • It refactors the current node builders, adding a class attribute hidden_attributes to define the attributes of the class that are stored in the graph during creation, and are deleted after the graph is built. These attributes are stored in their respective nodes with a prefixed "_".
  • We remove the CutOutZarrDatasetNodes. Now the cutout is passed directly to ZarrDatasetNodes. We extract the cutout mask definition from the node builder into a special node attribute builder, CutOutMask.
  • 2 new node attribute builders, MissingZarrVariable and NotMissingZarrVariable are added. They create a boolean node attribute corresponding to whether or not a particular variable is NaN in the first sample of the dataset. This will allow the user to define graphs only where ocean variables are defined.

Below I show an example of how the LAM config file is changed:

Before

nodes:
  data:
    node_builder:
      _target_: anemoi.graphs.nodes.CutOutZarrDatasetNodes
      lam_dataset: ${hardware.paths.data}/${hardware.files.dataset}
      forcing_dataset: ${hardware.paths.data}/${hardware.files.forcing_dataset}
      thinning: 25

Now

nodes:
  data:
    node_builder:
      _target_: anemoi.graphs.nodes.ZarrDatasetNodes
      dataset: 
        cutout:
        - dataset:${hardware.paths.data}/${hardware.files.dataset}
          thinning: 25
        - dataset: ${hardware.paths.data}/${hardware.files.forcing_dataset}
        adjust: all
    attributes:
      cutout:
        _target_: anemoi.graphs.nodes.attributes.CutOutMask

@JPXKQX JPXKQX self-assigned this Oct 23, 2024
@JPXKQX JPXKQX mentioned this pull request Oct 23, 2024
@JPXKQX JPXKQX added the enhancement New feature or request label Oct 24, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants