Read-only mirror of https://github.com/MeteoSwiss/grixraz — MeteoSwiss. Issues & pull requests at the source.
  • Jupyter Notebook 99.7%
  • Python 0.3%
Find a file
Repository files (latest commit first)
Filename Latest commit message Latest commit date
2024-04-19 15:08:08 +02:00
.github/workflows Run tests also on pull requests 2024-04-19 14:14:57 +02:00
grixraz Merge branch 'main' into defs_path 2024-04-19 10:19:37 +02:00
notebooks Ran the benchmarks. 2024-04-19 13:49:08 +02:00
tests Use designated test file 2024-04-19 11:05:45 +02:00
.gitignore first commit 2023-12-23 15:43:19 +01:00
.pre-commit-config.yaml add newline to eof 2024-04-18 12:13:08 +02:00
environment.yaml add setup env 2024-04-18 15:16:12 +02:00
install_micromamba.sh fix tar 2024-04-18 15:27:27 +02:00
LICENSE Create LICENSE 2024-04-04 11:30:45 +02:00
poetry.lock Update dependencies 2024-04-19 14:04:25 +02:00
pyproject.toml Update dependencies 2024-04-19 14:04:25 +02:00
README.md Add coverage comment 2024-04-19 14:09:57 +02:00
setup_env.sh Switch to https because of permissions 2024-04-19 13:31:41 +02:00

grixraz: mch GRIB archives as virtual Zarr stores

Tests

This is a proof-of-concept library that uses kerchunk to represent MeteoSwiss GRIB archives of NWP data as virtual Zarr stores: no extracting, moving or copying.

You can find a demo in notebooks/demo.ipynb and an example of a reference file in notebooks/example_reference_file.json.

Installation

On a CSCS machine:

  • Run source install_micromamba.sh in order to install micromamba.
  • Inside your source code folder, run micromamba create -f environment.yaml in order to setup the micromamba environment.
  • Activate your environment by micromamba activate grixraz. Now you have installed eccodes and poetry.
  • Install the dependencies managed by poetry: poetry install
  • Setup the eccodes COSMO definitions env var: source setup_env.sh

As a developer

  • also install the pre-commit hooks: pre-commit install

Opening the reference file from the demo

If you're in a rush and don't want to go through the demo, you can also just install fsspec (+ xarray and zarr) in your python environment and read the reference file from the example (it's on tsa).

import json
import fsspec
import xarray as xr

with open("/scratch/fzanetta/grixraz/examples/kenda_anasurf_202306.json", "r") as f:
    ref = json.load(f)

fs = fsspec.filesystem("reference", fo=ref)
ds = xr.open_dataset(fs.get_mapper(""), engine="zarr", backend_kwargs=dict(consolidated=False),
                      chunks={'valid_time':1})