Skip to content

Conversation

@icedoom888
Copy link
Contributor

@icedoom888 icedoom888 commented Jan 13, 2026

Description

Introduce a focus_area attribute to plot callbacks to focus the plot on a specific area.

Spawns from: #782

As a contributor to the Anemoi framework, please ensure that your changes include unit tests, updates to any affected dependencies and documentation, and have been tested in a parallel setting (i.e., with multiple GPUs). As a reviewer, you are also responsible for verifying these aspects and requesting changes if they are not adequately addressed. For guidelines about those please refer to https://anemoi.readthedocs.io/en/latest/

By opening this pull request, I affirm that all authors agree to the Contributor License Agreement.


📚 Documentation preview 📚: https://anemoi-training--799.org.readthedocs.build/en/799/


📚 Documentation preview 📚: https://anemoi-graphs--799.org.readthedocs.build/en/799/


📚 Documentation preview 📚: https://anemoi-models--799.org.readthedocs.build/en/799/

icedoom888 and others added 30 commits January 7, 2026 13:00
@JPXKQX
Copy link
Member

JPXKQX commented Jan 23, 2026

Hi Alberto, I have reviewed the changes. The implementation looks very clean now! I left some minor comments. I also have a more general question: how should the focus_area be specified in multiple datasets? I see different options:

  • You can only instantiate one focus_area, which is applied to all datasets.
  • Add a new dataset_names key under the focus_area field to specify in which datasets the focus area should be applied to.
  • A dict-like focus area similar to training_loss, validation_metrics, ... with the dataset_name as key.

@icedoom888
Copy link
Contributor Author

Hi Alberto, I have reviewed the changes. The implementation looks very clean now! I left some minor comments. I also have a more general question: how should the focus_area be specified in multiple datasets? I see different options:

  • You can only instantiate one focus_area, which is applied to all datasets.
  • Add a new dataset_names key under the focus_area field to specify in which datasets the focus area should be applied to.
  • A dict-like focus area similar to training_loss, validation_metrics, ... with the dataset_name as key.

@JPXKQX in the current code:


if focus_areas is None:
    focus_areas = [None] * len(self.dataset_names)

# Focus area for plotting
self.focus_masks = [
    build_spatial_mask(
        node_attribute_name=fa.get("mask_attr_name", None) if fa is not None else None,
        latlon_bbox=fa.get("latlon_bbox", None) if fa is not None else None,
    )
    for fa in focus_areas
]

So you can specify different focus areas for each dataset, do you still prefer the dict approach?

@icedoom888 icedoom888 requested a review from JPXKQX January 29, 2026 14:57
@icedoom888
Copy link
Contributor Author

Update the configs structure, now you can define focus areas for each dataset in the multi dataset setting, and all will be dispayed for each cllback. This also reduces the number of callbacks needed.

Here an example:

focus_areas:
      datasets:
        data: 
          - latlon_bbox: [30.0, -20.0, 60.0, 40.0]
          - latlon_bbox: [18.0, 73.0, 54.0, 135.0]
          - latlon_bbox: [0.0, -90.0, 180.0, 90.0]

Whic produces the following:

pred_val_sample_data_rstep00_batch0000_rank0_bbox_lat-30 0-60 0_lon--20 0-40 0_epoch000
pred_val_sample_data_rstep00_batch0000_rank0_bbox_lat-18 0-54 0_lon-73 0-135 0_epoch000
pred_val_sample_data_rstep00_batch0000_rank0_bbox_lat-0 0-180 0_lon--90 0-90 0_epoch000

@@ -0,0 +1,182 @@
{"type":"FeatureCollection","features":[
Copy link
Member

@JPXKQX JPXKQX Jan 29, 2026

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this change is intended?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is a new file alltogether, just downloaded and uploaded it

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

ATS Approval Not Needed No approval needed by ATS documentation Improvements or additions to documentation enhancement New feature or request training

Projects

Status: To be triaged

Development

Successfully merging this pull request may close these issues.

4 participants