Skip to content

ecmwf/cfgrib.jl

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

CfGRIB.jl

lifecycle latest release Apache 2 license

Build Status Build Status Codecov

Code Style: Blue

Description

CfGRIB.jl is a julia interface to map GRIB files to the Unidata's Common Data Model v4 following the CF Conventions.

This package is based on the python implementation in cfgrib.py and closely follows the approaches of that package, but in Julia instead. Parity tests are automatically performed between the two to ensure that the data returned by the Julia version is equivalent to that from Python.

In Python xarray has come out to be a standard way to implement named arrays, however as Julia is a much younger language no stable array interface has been adopted by the community yet, so the approach here is more flexible and allows for multiple array backends to be used.

Currently two array backends are supported:

If a backend is found to be installed then its functionality will automatically be enabled, otherwise only the built-in bare data types will be returned.

Low level access and decoding is performed by calling GRIB.jl which itself calls the ECMWF ecCodes library.

Installation

The package is currently under heavy development so it has not been added to the Julia package registry yet. To install the package first clone this repository:

git clone https://github.com/ecmwf/cfgrib.jl/
cd CfGRIB.jl

Then start Julia, enter the pkg mode, activate the project (projects are similar to python venv's), install the GRIB.jl package (as it is also not on the registry), and then finally you can instantiate CfGRIB.jl to get the rest of the dependencies:

#  Activate the current directory as a project
activate .
#  To enable backend support
add AxisArrays
add DimensionalData
instantiate

Finally exit pkg mode by pressing backspace, and use the package as usual:

using CfGRIB

Development and Contribution

To install the package for development you can run:

git clone https://github.com/ecmwf/cfgrib.jl/
cd CfGRIB.jl

Then in Julia:

] activate .
] develop .

Will install the package as a development package. When you run ] test the tests will run locally. If you want to run the tests within a container similar to the ones used when the CI runs via GitHub, then install nektos/act and run the command act -P ubuntu-latest=nektos/act-environments-ubuntu:18.04 -j tests, this will set up a docker container and run the full test suite within it.