Skip to content

Test grib #166

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Draft
wants to merge 6 commits into
base: master
Choose a base branch
from
Draft

Test grib #166

wants to merge 6 commits into from

Conversation

VictorPozsgay
Copy link
Contributor

@VictorPozsgay VictorPozsgay commented May 9, 2025

Caution

Negative potential consequences of an action.
DO NOT MERGE AS IT IS.

Important

Crucial information necessary for the branch to be merged.
Package compatibility needs to be ensured. Currently, installing 'cfgrib' introduces some package clashes.

Recent changes to the ERA5 download API mean that it is no longer possible to download bulk netCDF files, but GRIB files instead. As it is, globsim is not able to handle such requests. This branch requests and retrieves GRIB data, and converts all files into globsim-compliant netCDF files, ready for interpolation/scaling. Note that the conversion uses xarray with the engine='cfgrib', which needs to be installed. Currently, this clashes with some other packages on the master branch and the interpolation crashes with the ERROR: 'ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)'.

New Features

  • GRIB download supported for ERA5
  • seamless flow with conversion to netCDF (up to a branch change, which will hopefully be fixed soon)

Limitations

  • Package clash with the master branch
  • After successfully running the download, interpolate crashes with ERROR code:
ffi_prep_closure(): bad user_data (it seems that the version of the libffi library seen at runtime is different from the 'ffi.h' file seen at compile-time)

How to set up the environment(s)

Changes to libraries and supported python version means the globsim environment will have to be updated.

  1. Create a new conda environment globsim4 as explained in Globsim 4.0 #149
  2. Create a second conda environment, e.g. globsim4grib, with the exact same method.
  3. Activate globsim4grib and install cfgrib:
conda install -c conda-forge cfgrib
  1. Until further improvement, this creates a package clash with the master branch, we will then use the branch test_grib for the download command, and the branch master for interpolate and scale

How to use the globsim workflow

  1. Activate globsim4grib
  2. Go to the folder where globsim is installed
  3. Change branch to test_grib
git checkout test_grib
  1. Download as usual.
  2. Once the download is finished, deactivate the conda environment and switch back to the regular one, globsim4.
  3. Go back to the folder where globsim is installed
  4. Change branch back to master
git checkout master
  1. Interpolate and scale as usual.

@VictorPozsgay VictorPozsgay requested a review from nicholas512 May 9, 2025 17:55
@VictorPozsgay VictorPozsgay linked an issue May 9, 2025 that may be closed by this pull request
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Limitation change on netCDF ERA5 requests
1 participant