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
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file ecmwfspec-0.0.5.tar.gz.
File metadata
- Download URL: ecmwfspec-0.0.5.tar.gz
- Upload date:
- Size: 12.5 kB
- Tags: Source
- Uploaded using Trusted Publishing? Yes
- Uploaded via: pdm/2.22.3 CPython/3.13.2 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
526760c7034c842108ae780f916e6a15189f64d1ff5e9b9a9e3a850c9d7e8360
|
|
| MD5 |
066746b88c43820a08862eb5a67098ef
|
|
| BLAKE2b-256 |
0bd261b63469567672d69860baf751f56aae50d8486b36ef40d947e1fd5fb069
|
File details
Details for the file ecmwfspec-0.0.5-py2.py3-none-any.whl.
File metadata
- Download URL: ecmwfspec-0.0.5-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.22.3 CPython/3.13.2 Linux/6.8.0-1021-azure
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
31e93ca841a8ea017e21ea4361d67cef6484d3daeeaec969af6dda622e5d02a9
|
|
| MD5 |
f8d7f3e7aebc84fafcab40d26305b006
|
|
| BLAKE2b-256 |
8f91f6e5c66f2d2f0c325be2badd8ff2a425a648bce8d1fa0cb3118960185572
|