Skip to content

Refactoring all providers into a single script#413

Open
siddharth7113 wants to merge 1 commit intoopenclimatefix:mainfrom
siddharth7113:generic_loaders
Open

Refactoring all providers into a single script#413
siddharth7113 wants to merge 1 commit intoopenclimatefix:mainfrom
siddharth7113:generic_loaders

Conversation

@siddharth7113
Copy link
Copy Markdown
Contributor

Pull Request

Fixes #147

Checklist:

  • My code follows OCF's coding style guidelines
  • I have performed a self-review of my own code
  • I have made corresponding changes to the documentation
  • I have added tests that prove my fix is effective or that my feature works
  • I have checked my code and corrected any misspellings

@siddharth7113 siddharth7113 requested a review from Sukh-P April 14, 2026 16:50
Comment on lines +3 to +4
All providers follow the same shape:
open zarr -> normalise dim/coord names -> shared post-processing.
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

Suggested change
All providers follow the same shape:
open zarr -> normalise dim/coord names -> shared post-processing.
All providers follow the same pipeline:
open zarr -> standardise dim/coord names -> shared post-processing.

Just a few suggestions on wording so it doesn't get confusing since shape often refers to the shape of the data and normalise to normalisation of data which we do elsewhere in this repo so avoiding those words in here to avoid confusion

"""Opens ECMWF IFS / MetOffice Global NWP data."""
ds = open_zarr_paths(zarr_path, backend="tensorstore")
# LEGACY SUPPORT - older zarrs use "init_time"/"variable" dim names
ds = ds.rename({"init_time": "init_time_utc", "variable": "channel"})
Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

So open_ifs and open_gdm are almost identical apart from the renaming, they could just be one generic open standard_lat_long grid with some checks to see if init_time or variable are in the ds and in each case if they are then rename them or use the rename map pattern which is in open_cloudcasting

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

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

I think there is one issue actually which is when using open_zarr_paths you have to specify whether to use init_time or init_time_utc but we could have a try/except in there which tries init_time and if not then init_time_utc

@Sukh-P
Copy link
Copy Markdown
Member

Sukh-P commented Apr 29, 2026

@siddharth7113 sorry for being slow to review this but it seems like a solid start, left some suggestions and ideas to simplify a bit more, thanks

@Sukh-P
Copy link
Copy Markdown
Member

Sukh-P commented Apr 29, 2026

I think you'll need to pull some of the latest changes in the library into your branch as well

@Sukh-P
Copy link
Copy Markdown
Member

Sukh-P commented Apr 30, 2026

@siddharth7113 just an FYI we are just updated access to raise PRs against some repos in OCF so we've sent you an invite to a team within OCF's github which will give you the correct access

@siddharth7113
Copy link
Copy Markdown
Contributor Author

@siddharth7113 just an FYI we are just updated access to raise PRs against some repos in OCF so we've sent you an invite to a team within OCF's github which will give you the correct access

Thanks Sukh, for the review as well as the invite, I'll make the changes soon.

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.

Generic NWP loader

2 participants