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

Incorporate SiteSample and UKRegionalSample into save/load #311

Merged
merged 10 commits into from
Jan 30, 2025

Conversation

felix-e-h-p
Copy link

save_samples.py, site_datamodule.py and uk_regional_datamodule.py updated accordingly to utilise new SiteSample and UKRegionalSample save/load functionality.

Additional test added for clarity and version update stated in dependencies.

@felix-e-h-p felix-e-h-p changed the title Incorporate SiteSample and UKRegionalSample into data handling and sa… Incorporate SiteSample and UKRegionalSample into save/load Jan 29, 2025
@felix-e-h-p felix-e-h-p requested a review from Sukh-P January 29, 2025 13:09
sample = convert_netcdf_to_numpy_sample(ds)
return sample
sample = SiteSample.load(self.sample_paths[idx])
return sample.to_numpy()
Copy link
Contributor

Choose a reason for hiding this comment

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

perfect

Copy link
Contributor

@peterdudfield peterdudfield left a comment

Choose a reason for hiding this comment

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

See comment that you could add for extra clarity

Copy link

codecov bot commented Jan 29, 2025

Codecov Report

All modified and coverable lines are covered by tests ✅

Please upload report for BASE (dev-data-sampler@4d11931). Learn more about missing BASE report.

Additional details and impacted files
@@                 Coverage Diff                 @@
##             dev-data-sampler     #311   +/-   ##
===================================================
  Coverage                    ?   60.86%           
===================================================
  Files                       ?       28           
  Lines                       ?     1817           
  Branches                    ?        0           
===================================================
  Hits                        ?     1106           
  Misses                      ?      711           
  Partials                    ?        0           

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

@Sukh-P
Copy link
Member

Sukh-P commented Jan 29, 2025

So I reckon as @dfulu had previously suggested here #301 (comment) for the loading and to_numpy bits this can be abstracted a bit more to essentially one PremadeSamplesDataset as the comment showed and that could live in the base_datamodule file and then in these bits for the site and uk_regional data module you just need to use that PremadeSamplesDataset and pass in the correct sample class, either the site one or the uk_regional one

scripts/save_samples.py Outdated Show resolved Hide resolved
Copy link
Member

@Sukh-P Sukh-P left a comment

Choose a reason for hiding this comment

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

Thanks for adding these changes in, I think just needs a bit more refactoring to get the full benefit of having the generalised interface

Copy link
Member

@Sukh-P Sukh-P left a comment

Choose a reason for hiding this comment

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

Looks great, thanks for adding this!

@felix-e-h-p felix-e-h-p marked this pull request as ready for review January 30, 2025 11:39
@felix-e-h-p felix-e-h-p merged commit 5b7711b into dev-data-sampler Jan 30, 2025
3 checks passed
@felix-e-h-p felix-e-h-p deleted the Save-load-sample-incorporation branch January 30, 2025 11:58
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.

3 participants