fsspec implementation for ECMWF File Storage System
Project description
ecmwfspec
This is work in progress! This unofficial repository aims to provide an fsspec driver for the ECMWF File Storage System.
Pull requests (also for additional protocols like MARS and FDB) are welcomed!
import fsspec
with fsspec.open("ec:/<user>/path/to/file", "r") as f:
print(f.read())
Loading datasets
import fsspec
import xarray as xr
url = fsspec.open("ec:/arch/project/file.grib").open()
ds = xr.open_dataset(url, engine='cfgrib') # does not work until https://github.com/ecmwf/cfgrib/issues/326 is solved
Usage in connection with gribscan
This is just an example what ecmwfspec can be used for.
import gribscan
import json
import xarray as xr
file_to_scan = "ec:///path/to/some/grib/file/forecast+0038.grib2"
index_file = "index.json"
reference_file = "reference.json"
gribscan.write_index(gribfile=file_to_scan, idxfile=index_file) # required currently patch https://github.com/gribscan/gribscan/commit/7a5e595759f48e3118964091358f1b2e9eb32b37 to work with fsspec paths
magician = gribscan.magician.HarmonieMagician() # use magician fitting the grib file
refs = gribscan.grib_magic(
filenames=[index_file],
magician=magician,
global_prefix="",
)
with open(reference_file, "w") as outfile:
json.dump(refs["heightAboveGround"], outfile)
ds = xr.open_zarr(f"reference::{reference_file}")
ds.u.max() # with the help of ecmwfspec the data is now fetched if it is not locally cached
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
ecmwfspec-0.0.3.tar.gz
(12.4 kB
view details)
Built Distribution
File details
Details for the file ecmwfspec-0.0.3.tar.gz
.
File metadata
- Download URL: ecmwfspec-0.0.3.tar.gz
- Upload date:
- Size: 12.4 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.20.0 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 837b4eea016cd6066c2ce6468f9e374537fa32dc14b4595acf1e55281bd3cbc3 |
|
MD5 | 6f8c9271473db42cd130344be0a3b175 |
|
BLAKE2b-256 | ec0cf31a73a6b2aa18a0e9759eb78a62d78c518b9810c757baabaccc1ebd4743 |
File details
Details for the file ecmwfspec-0.0.3-py2.py3-none-any.whl
.
File metadata
- Download URL: ecmwfspec-0.0.3-py2.py3-none-any.whl
- Upload date:
- Size: 14.1 kB
- Tags: Python 2, Python 3
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.20.0 CPython/3.10.12 Linux/6.5.0-1025-azure
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 64ebb2eff91942001c00d3d40616ec349f4e844efe194c31dfb51d253d68bb65 |
|
MD5 | f45648b20fe7db4b9fad92fbc84aa69f |
|
BLAKE2b-256 | c21b3c2d050ce46dd7a131acb2f24decdfd4723c7a5aa185e4d3e9aee9961a16 |