Quantcast
Channel: Earthdata Forum
Viewing all articles
Browse latest Browse all 1559

Home • Re: examples/instructs for virtual Zarr stores

$
0
0
Hi,

Dean here from PO.DAAC. A few thoughts

1. This is the function I usually use for opening a data set with a kerchunk virtual reference file, give it a try. I think it has a few more steps and kwargs than what you tried.

Code:

import earthaccessimport fsspecimport xarray as xrdef opendf_withref(ref, fs_data):        """        "ref" is the path to a reference file or object. "fs_data" is a filesystem with credentials to        access the actual data files.         """        storage_opts = {"fo": ref, "remote_protocol": "s3", "remote_options": fs_data.storage_options}        fs_ref = fsspec.filesystem('reference', **storage_opts)        m = fs_ref.get_mapper('')        data = xr.open_dataset(            m, engine="zarr", chunks={},            backend_kwargs={"consolidated": False}            )        return data
So in your case you would go

Code:

opendf_withref(u, fs)
2. You can also try out this PR we're working on for earthaccess that has the functionality built in, e.g.

Code:

pip install git+https://github.com/DeanHenze/earthaccess.git
Then

Code:

earthaccess.login()mapper_ccmp = earthaccess.get_virtual_reference(short_name = "CCMP_WINDS_10M6HR_L4_V3.1", format="json")ds_ccmp = xr.open_dataset(mapper_ccmp, engine="zarr", chunks={}, backend_kwargs={"consolidated":False})
Let me know if either of those options work.

Thanks,

- Dean

Statistics: Posted by PODAAC - deanh808 — Mon May 12, 2025 6:34 pm America/New_York



Viewing all articles
Browse latest Browse all 1559

Trending Articles