Merged
Conversation
dfulu
commented
Mar 24, 2026
| "time": "time_utc", | ||
| }, | ||
| ) | ||
| for old_name, new_name in list(rename_dict.items()): |
Member
Author
There was a problem hiding this comment.
This bit is to allow for the new satellite data where the channel dimension is already called channel
dfulu
commented
Mar 24, 2026
| ds = ds.transpose("time_utc", "channel", "x_geostationary", "y_geostationary") | ||
|
|
||
| data_array = get_xr_data_array_from_xr_dataset(ds) | ||
| da = get_xr_data_array_from_xr_dataset(ds) |
Member
Author
There was a problem hiding this comment.
I renamed data_array --> da to make the style here more consistent
dfulu
commented
Mar 24, 2026
| channel_mins = self.clip_min_dict["sat"] | ||
| channel_maxs = self.clip_max_dict["sat"] | ||
| dataset_dict["sat"].data = ( | ||
| (dataset_dict["sat"].data.clip(channel_mins, channel_maxs) - channel_means) |
Member
Author
There was a problem hiding this comment.
This applies a different clip value per channel
felix-e-h-p
requested changes
Mar 25, 2026
Contributor
felix-e-h-p
left a comment
There was a problem hiding this comment.
Looks great - noticed something that may potentially be a silent issue RE clip_min/max for NWP and Sat.
ocf_data_sampler/torch_datasets/utils/config_normalization_values_to_dicts.py
Outdated
Show resolved
Hide resolved
felix-e-h-p
approved these changes
Mar 26, 2026
|
|
||
| means_list.append(norm_conf.mean) | ||
| stds_list.append(norm_conf.std) | ||
| clip_min_list.append(-np.inf if norm_conf.clip_min is None else norm_conf.clip_min) |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Pull Request
Description
This PR introduces an optional clip for the NWP and satellite data which is controlled from the data config. The clip is applied before the data is standardised so the clip values are more physically interpretable. Clipping before applying the normalisation means the clip range is not independent of the mean and std values used.
The clip is optional and backwards compatible since it defaults to no clip.
Also in this PR (sorry):
How Has This Been Tested?
I've run the data-sampler locally to make sure the results look sensible. Basically, I set up a config and whilst looking at ECMWF temperature I made sure the maxes and mins of the samples were as expected when I included/excluded the clipping
Checklist: