Skip to main content

fsspec implementation for ECMWF File Storage System

Project description

CI

ecmwfspec

This is work in progress! This unofficial repository aims to provide an fsspec driver for the ECMWF File Storage System

Pull requests are welcomed!

import fsspec

with fsspec.open("ec:///ec/res4/scratch/user/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

ecmwfspec-0.0.1.tar.gz (11.0 kB view details)

Uploaded Source

Built Distribution

ecmwfspec-0.0.1-py2.py3-none-any.whl (12.4 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file ecmwfspec-0.0.1.tar.gz.

File metadata

  • Download URL: ecmwfspec-0.0.1.tar.gz
  • Upload date:
  • Size: 11.0 kB
  • Tags: Source
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.18.2 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for ecmwfspec-0.0.1.tar.gz
Algorithm Hash digest
SHA256 fd9a3e0ef281b2dc2e9088fc3fcc6988d535619649492173e22551862885b652
MD5 7c52aa9034d00f30a0a0e324aa8f97ee
BLAKE2b-256 1f7275194b5bf075f2a746d6aaa83f87d1e7dff5395cc11b2e6b6f4ef759de4a

See more details on using hashes here.

File details

Details for the file ecmwfspec-0.0.1-py2.py3-none-any.whl.

File metadata

  • Download URL: ecmwfspec-0.0.1-py2.py3-none-any.whl
  • Upload date:
  • Size: 12.4 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? Yes
  • Uploaded via: pdm/2.18.2 CPython/3.10.12 Linux/6.5.0-1025-azure

File hashes

Hashes for ecmwfspec-0.0.1-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 a0d97c1598c9de1deea9531989182aef45e1a78bb6cb108b49fc292ff27894cb
MD5 3961c22d7ce6a04203a4af61bd6cb5c9
BLAKE2b-256 3488f0f42b45db7e63450177f292cd6402d94aba62f352a72718a55a7d7248ea

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page