Skip to content

Datastructure for FE conditioning - #2706

Open
SavvasMel wants to merge 6 commits into
ecmwf:developfrom
SavvasMel:SavvasMel/develop/multisampler_cond
Open

Datastructure for FE conditioning#2706
SavvasMel wants to merge 6 commits into
ecmwf:developfrom
SavvasMel:SavvasMel/develop/multisampler_cond

Conversation

@SavvasMel

@SavvasMel SavvasMel commented Jul 31, 2026

Copy link
Copy Markdown
Contributor

Description

This PR closes the first subtasks of having forcing in WeatherGen. It included scalar and field data reading and loading.

Run with:

--options streams_directory="./config/streams/era5_1deg_forecasting_conditioning/"

Issue Number

Closes #2536 #2537

Checklist before asking for review

  • I have performed a self-review of my code
  • My changes comply with basic sanity checks:
    • I have fixed formatting issues with ./scripts/actions.sh lint
    • I have run unit tests with ./scripts/actions.sh unit-test
    • I have documented my code and I have updated the docstrings.
    • I have added unit tests, if relevant
  • I have tried my changes with data and code:
    • I have run the integration tests with ./scripts/actions.sh integration-test
    • (bigger changes) I have run a full training and I have written in the comment the run_id(s): launch-slurm.py --time 60
    • (bigger changes and experiments) I have shared a hegdedoc in the github issue with all the configurations and runs for this experiments
  • I have informed and aligned with people impacted by my change:
    • for config changes: the MatterMost channels and/or a design doc
    • for changes of dependencies: the MatterMost software development channel

@SavvasMel

Copy link
Copy Markdown
Contributor Author

@evenmn could you have a look?

@github-actions github-actions Bot added data Anything related to the datasets used in the project model Related to model training or definition (not generic infra) labels Jul 31, 2026

@evenmn evenmn left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Looks good to me, just a few comments. The splitting of streams_datasets could perhaps be moved to keep the changes in _init_stream_datasets minimal, but I don't think it's a big issue. I'm looking forward to testing this!

self.conditioning_type = stream_info.get("conditioning_type", "time_based")
value_type = stream_info.get("value_type", "hour")
if isinstance(value_type, list):
self.value_types = value_type

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

When will value_type be a list? Can a stream have multiple value types?

self.mean = np.array([0.0], dtype=np.float32)
self.stdev = np.array([1.0], dtype=np.float32)
self.mean_geoinfo = np.zeros(0, dtype=np.float32)
self.stdev_geoinfo = np.ones(0, dtype=np.float32)

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

For consistency we could use either

self.mean = np.array([0.0], dtype=np.float32)
self.stdev = np.array([1.0], dtype=np.float32)
self.mean_geoinfo = np.array([], dtype=np.float32)
self.stdev_geoinfo = np.array([], dtype=np.float32)

or

self.mean = np.zeros(1, dtype=np.float32)
self.stdev = np.ones(1, dtype=np.float32)
self.mean_geoinfo = np.zeros(0, dtype=np.float32)
self.stdev_geoinfo = np.ones(0, dtype=np.float32)

values = []
for vt in self.value_types:
if self.conditioning_type == "time_based":
if vt == "hour":

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can we add a comment here stressing that value here is the fraction of the day (e.g. 0.75 at 6 PM)? And same for vt == "day"?

filenames_cfg = stream_info.get("filenames", [pathlib.Path()])
conditioning_cfg = stream_info.get("conditioning", False)

if conditioning_cfg:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

Can this logic be moved to DataReaderTimeConditioning, too avoid logics in multi_stream_data_sampler.py that is specific for a data reader?

conditioning_cfg = stream_info.get("conditioning", False)

if conditioning_cfg:
if filenames_cfg is None or len(filenames_cfg) == 0:

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

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

This handles filenames when it is explicitly set to null/None. However, when the entry is omitted, it defaults to [pathlib.Path()], so this if-statement is not invoked.

Since the default is needed by the processing below, should this condition handle both cases?

if filenames_cfg is None or filenames_cfg == [pathlib.Path()]:

@github-project-automation github-project-automation Bot moved this to In Progress in WeatherGen-dev Jul 31, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

data Anything related to the datasets used in the project model Related to model training or definition (not generic infra)

Projects

Status: In Progress

Development

Successfully merging this pull request may close these issues.

Create configs related to FE conditioning

2 participants