Skip to content

Data time subsetting - #64

Merged
SarahAlidoost merged 13 commits into
mainfrom
data_time_subsetting
Jul 14, 2026
Merged

Data time subsetting#64
SarahAlidoost merged 13 commits into
mainfrom
data_time_subsetting

Conversation

@SarahAlidoost

@SarahAlidoost SarahAlidoost commented Jul 1, 2026

Copy link
Copy Markdown
Member

closes #62
closes #42

🔴 this branch should be merged after #63

In this PR:

  • monthly data are integrated to batch dimension
  • the bias/scale (per-month parameters) are removed to make the model more flexible. We are using residuals training, so the mean seasonal signal is already removed. We are also injecting strong seasonal structure inside the network via cyclic time embedings, temporal attention over days, cross-month mixing in the aggregator.
    So the model is already learning a seasonal climatology and modulation, not relying on a fixed per-month correction.

@meiertgrootes

Copy link
Copy Markdown
Collaborator

See comment in PR #54 on replacing month positional encoding with a month-of-year feature in cyclical time embedding

@SarahAlidoost SarahAlidoost mentioned this pull request Jul 3, 2026
@SarahAlidoost
SarahAlidoost marked this pull request as ready for review July 7, 2026 07:00
@SarahAlidoost

SarahAlidoost commented Jul 7, 2026

Copy link
Copy Markdown
Member Author

@meiertgrootes and @rogerkuou Hi, this PR is ready for review. Thanks! After merging #63 , I can update the notebook in this PR.

@rogerkuou rogerkuou mentioned this pull request Jul 7, 2026

@rogerkuou rogerkuou left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Hi @SarahAlidoost, thanks for the nice implementation.

I just have two small comments on an inline doc, and use of pytest fixture. Please feel free to merge after fixing them.

Comment thread climanet/dataset.py Outdated
Comment thread tests/test_train.py Outdated
Comment thread tests/test_train.py Outdated
@SarahAlidoost SarahAlidoost mentioned this pull request Jul 9, 2026

@meiertgrootes meiertgrootes left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

A very nice implementation. Just some minor comments and a suggestion on an elaborated inline documentation.

Comment thread climanet/st_encoder_decoder.py
Comment thread climanet/train.py
return compute_masked_loss(pred, batch["monthly_patch"], batch["land_mask_patch"])


def _compute_stats(dataset: Dataset):

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I'm ok with this, but why are we dropping this at this iteration?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

The reason is the second point in this comment about bias/scale, with removing the initializer, we don't need this function anymore.

Comment thread climanet/dataset.py
time_dim: str = "time",
spatial_dims: Tuple[str, str] = ("lat", "lon"),
patch_size: Tuple[int, int] = (16, 16), # (lat, lon)
patch_size: Tuple[int, int, int] = (1, 16, 16), # (Month, lat, lon)

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Here and in the following the implementation itself is fine. However, it is easily confusing for a non-initiated user. We refer to the basic time unit as a month, but in the dataset itself the basic time unit is either a day or an hour. This is only resolved by restructuring the dataset.
Wit that being the case, at this point it is also certainly conceiveable for the user that a non-integer (and even <1) value for the patch size in time would be permissible. This is clarified further below, but can still be significantly confusing.
I would suggest prefacing this section (or the dataset.py module as a whole) with a brief overview description of the approach adopted, i.e. that dataset.py reformats to a month dimension, that this must be integer and >0 and that the time dimension as present in the data is then folded in to monthly blocks.

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

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

good point! I 'll add documentation.

@SarahAlidoost
SarahAlidoost merged commit dd441c6 into main Jul 14, 2026
6 checks passed
@SarahAlidoost
SarahAlidoost deleted the data_time_subsetting branch July 14, 2026 15:20
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add support for patching in time in dataset Improve the dataset patching

3 participants