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 Amazon S3 bucket source #223

Closed
sandorkertesz opened this issue Oct 12, 2023 · 1 comment · Fixed by #484
Closed

Implement Amazon S3 bucket source #223

sandorkertesz opened this issue Oct 12, 2023 · 1 comment · Fixed by #484
Assignees
Labels
enhancement New feature or request

Comments

@sandorkertesz
Copy link
Collaborator

sandorkertesz commented Oct 12, 2023

Still work in progress.

The new source for an S3 bucket can be used like this:

import earthkit.data

# endpoint="s3.amazonaws.com"
bucket_name = "ecmwf-forecasts"
key = "20240111/00z/0p4-beta/oper/20240111000000-0h-oper-fc.grib2"

r = {"bucket": bucket_name, 
     "objects": [
         {"object":  key} 
          ],
   }

ds = earthkit.data.from_source("s3", r, stream=False, anon=True)
ds.ls()

More examples are available at: https://earthkit-data.readthedocs.io/en/feature-s3/examples/s3.html

  • Multiple buckets and objects can be used
  • A single part can be specified for an object as
"objects": [
         {"object": key, "start": 0, "range": 438714} 
          ],
  • The default endpoint is s3.amazonaws.com. Other endpoints can be specified in the request as:
r = {"bucket": bucket_name, 
      "endpoint": "my_endpoint",
     "objects": [
     ....
  • The stream option controls if the data is read as a stream or downloaded to a file. The default is stream=True
  • The anon option controls whether if it is an anonymous access or AWS credentials should be used. The default is anon=True. Handling the credentials requires the aws-requests-auth and botocore packages
@sandorkertesz sandorkertesz added the enhancement New feature or request label Oct 12, 2023
@sandorkertesz sandorkertesz self-assigned this Oct 12, 2023
@corentincarton
Copy link
Contributor

Tagging @chpolste as he could be interested by this for CLIMAAX.

@sandorkertesz sandorkertesz linked a pull request Oct 14, 2024 that will close this issue
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants