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

Implement parts for file source for GRIB and BUFR data #293

Merged
merged 2 commits into from
Feb 5, 2024

Conversation

sandorkertesz
Copy link
Collaborator

@sandorkertesz sandorkertesz commented Feb 3, 2024

Fixes #292

This PR enables the file source to use parts (byte ranges) in the same way as implemented for the url source. At the moment, it works for GRIB and BUFR files.

Documentation was added for both the sources.

Notebook example: https://earthkit-data.readthedocs.io/en/develop/examples/grib_file_parts.html

Examples:

ds = earthkit.data.from_source("file", "my.grib", parts=(0, 150))
ds = earthkit.data.from_source("file", "my.grib", parts=[(0, 150), (400, 160)])

ds = earthkit.data.from_source("file", [
    ("a.grib", (0, 150)),
    ("b.grib", (240, 120)),
    ("c.grib", None),
    ("d.grib", [(240, 120), (720, 120)])
    ])

@sandorkertesz sandorkertesz marked this pull request as draft February 3, 2024 16:37
@sandorkertesz sandorkertesz marked this pull request as ready for review February 5, 2024 09:34
@sandorkertesz sandorkertesz merged commit 1a1d311 into develop Feb 5, 2024
58 checks passed
@sandorkertesz sandorkertesz deleted the feature/file-part branch February 5, 2024 09:48
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.

Implement parts reading option for file source
1 participant