Skip to content

Working icechunk opening #42

@maxrjones

Description

@maxrjones
# Configure the repository to know how to read virtual chunks from S3:
import icechunk
import earthaccess

earthaccess.login()

shortname = "MUR25-JPL-L4-GLOB-v04.2"
credentials_url = "https://archive.podaac.earthdata.nasa.gov/s3credentials"
bucket = "s3://podaac-ops-cumulus-protected"

config = icechunk.RepositoryConfig.default()
config.set_virtual_chunk_container(
    icechunk.VirtualChunkContainer(
        bucket + "/",
        icechunk.s3_store(region="us-west-2"),
    )
)

# Get temporary S3 credentials for reading the actual data:
s3_creds = earthaccess.get_s3_credentials(daac="PODAAC")
credentials = icechunk.containers_credentials({
    bucket + "/": icechunk.s3_credentials(
        access_key_id=s3_creds["accessKeyId"],
        secret_access_key=s3_creds["secretAccessKey"],
        session_token=s3_creds["sessionToken"],
    )
})

# Open the existing repository:
storage = icechunk.local_filesystem_storage(shortname+".icechunk")
repo = icechunk.Repository.open(
    storage=storage,
    config=config,
    authorize_virtual_chunk_access=credentials,
)

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions