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

Three minor bugfixes for data_config.yaml workflow #40

Merged
merged 5 commits into from
May 31, 2024

Conversation

sadamov
Copy link
Collaborator

@sadamov sadamov commented May 25, 2024

Summary

#31 introduced three minor bugs that are fixed with this PR:

  • coords_projection is a cached_property and as such is not callable (removed ())
  • r"" strings are not required in units of data_config.yaml
  • dictionaries cannot be passed as argsparse, rather JSON strings. This bug is related to the flag var_leads_metrics_watch

@sadamov sadamov requested a review from joeloskarsson May 25, 2024 17:34
@sadamov sadamov self-assigned this May 25, 2024
@sadamov sadamov added the bug Something isn't working label May 25, 2024
@sadamov sadamov added this to the v0.2.0 milestone May 25, 2024
@sadamov sadamov changed the title Three minor bugfixes for https://github.com/mllam/neural-lam/pull/31 Three minor bugfixes for data_config.yaml worklfow May 25, 2024
@sadamov sadamov changed the title Three minor bugfixes for data_config.yaml worklfow Three minor bugfixes for data_config.yaml workflow May 25, 2024
@leifdenby
Copy link
Member

While you are doing this I thought of something else with the config: Shouldn't num_forcing_features be derived as the length of the dataset.var_names list in the config https://github.com/mllam/neural-lam/blob/main/neural_lam/data_config.yaml#L57? I mean rather than being defined separately.

@leifdenby leifdenby mentioned this pull request May 28, 2024
8 tasks
@sadamov
Copy link
Collaborator Author

sadamov commented May 28, 2024

Hmm, the dataset.var_names are of the state not of the forcings though.
In the future when our yaml file covers state,forcings and boundaries I suggest something along these lines
https://github.com/mllam/neural-lam/blob/feature_dataset_yaml/neural_lam/data_config.yaml

      self.grid_dim = (
            2 * self.config_loader.num_data_vars("state")
            + grid_static_dim
            + self.config_loader.num_data_vars("forcing")
            * self.config_loader.forcing.window
        )

Note, that currently the forcings are calculate in parts in the dataset and in otherparts loaded from .npy files.

@leifdenby
Copy link
Member

Hmm, the dataset.var_names are of the state not of the forcings though.

Ah yes, of course you're right! But but isn't num_forcing_features == 16 too large then? I thought the forcing features were only radiation etc.

Also, I really like your suggestion about introducing a num_data_vars representation somewhere. Should I start a separate issue for this so we can discuss it in more detail?

@sadamov
Copy link
Collaborator Author

sadamov commented May 28, 2024

the forcings should be GRID_FORCING_DIM = 5 * 3 + 1 # 5 feat. for 3 time-step window + 1 batch-static (from original constants.py)

=16

  1. land sea mask (batch-static)
  2. top of atmosphere radiation (window)
  3. sin hour of day (window)
  4. cos hour of day (window)
  5. sin day in year (window)
  6. cos day in year (window)

@sadamov
Copy link
Collaborator Author

sadamov commented May 28, 2024

num_data_vars is already implemented in the Config class:

def num_data_vars(self):

Copy link
Collaborator

@joeloskarsson joeloskarsson left a comment

Choose a reason for hiding this comment

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

Good fixes, just a small thing about the dict argument.

train_model.py Outdated Show resolved Hide resolved
@joeloskarsson
Copy link
Collaborator

The coords_projection problem was fixed by merging #17, so merged main in here so we don't see that change.

@sadamov sadamov requested a review from joeloskarsson May 30, 2024 14:12
Copy link
Collaborator

@joeloskarsson joeloskarsson left a comment

Choose a reason for hiding this comment

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

All good now, tested and it works!

@joeloskarsson joeloskarsson merged commit 9d558d1 into main May 31, 2024
8 checks passed
@joeloskarsson
Copy link
Collaborator

Did not add explicitly to changelog as these are only fixes to #23

@joeloskarsson joeloskarsson deleted the bugfix_data_config_yaml branch May 31, 2024 10:13
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants