Python package for downloading ECMWF reanalysis data and converting it into a time series format.

Overview

ecmwf_models

https://github.com/TUW-GEO/ecmwf_models/workflows/Automated%20Tests/badge.svg?branch=master https://coveralls.io/repos/github/TUW-GEO/ecmwf_models/badge.svg?branch=master https://readthedocs.org/projects/ecmwf-models/badge/?version=latest

Readers and converters for data from the ECMWF reanalysis models. Written in Python.

Works great in combination with pytesmo.

Citation

If you use the software in a publication then please cite it using the Zenodo DOI. Be aware that this badge links to the latest package version.

Please select your specific version at https://doi.org/10.5281/zenodo.593533 to get the DOI of that version. You should normally always use the DOI for the specific version of your record in citations. This is to ensure that other researchers can access the exact research artefact you used for reproducibility.

You can find additional information regarding DOI versioning at http://help.zenodo.org/#versioning

Installation

Install required C-libraries via conda. For installation we recommend Miniconda. So please install it according to the official installation instructions. As soon as you have the conda command in your shell you can continue:

conda install -c conda-forge pandas pygrib netcdf4 pyresample xarray

The following command will download and install all the needed pip packages as well as the ecmwf-model package itself.

pip install ecmwf_models

To create a full development environment with conda, the yml files inside the folder environment/ in this repository can be used. Both environements should work. The file latest should install the newest version of most dependencies. The file pinned is a fallback option and should always work.

git clone --recursive [email protected]:TUW-GEO/ecmwf_models.git ecmwf_models
cd ecmwf_models
conda env create -f environment/latest.yml
source activate ecmwf_models
python setup.py develop
pytest

Supported Products

At the moment this package supports

  • ERA Interim (deprecated)
  • ERA5
  • ERA5-Land

reanalysis data in grib and netcdf format (download, reading, time series creation) with a default spatial sampling of 0.75 degrees (ERA Interim), 0.25 degrees (ERA5), resp. 0.1 degrees (ERA5-Land). It should be easy to extend the package to support other ECMWF reanalysis products. This will be done as need arises.

Contribute

We are happy if you want to contribute. Please raise an issue explaining what is missing or if you find a bug. Please take a look at the developers guide.

Comments
  • Fix returned status code in case of partial data availability

    Fix returned status code in case of partial data availability

    Consider the case of downloading data for 6 months. This script does it month by month. If data does not exist for the last month the return code was -10 before this fix, indicating that no data at all is available.

    Now we only get a -10 return code if indeed no data at all is available in the requested period

    opened by cpaulik 5
  • Handle downloads no data available

    Handle downloads no data available

    Fixes https://github.com/TUW-GEO/ecmwf_models/issues/26

    If the CDS API does not have any data available we catch this with the error callback. Only the string Reason: Request returned no data is available to catch this. If the CDS package would ever change their error messages this would break.

    As a return code the python errno.ENODATA is used if no data is present. I've not been able to find more widely used default error codes so I would argue that also just using -10 by convention would be ok instead.

    Other changes

    I've also removed the usage of the * import in this MR.

    opened by cpaulik 4
  • Handle requests that fail because no data is available yet

    Handle requests that fail because no data is available yet

    Downloading e.g. era5-land data of the last month gives an error like the following

    era5_download /home/cpa/debugging/2021-10-20_era5_download/era5_land/ -s 2021-10-01 -e 2021-10-10 -p era5-land -var "volumetric_soil_water_layer_1" --h_steps 2
    Downloading era5-land netcdf files between 2021-10-01T00:00:00 and 2021-10-10T00:00:00 into folder /home/cpa/debugging/2021-10-20_era5_download/era5_land/
    2021-10-22 13:00:31,336 INFO Welcome to the CDS
    2021-10-22 13:00:31,337 INFO Sending request to https://cds.climate.copernicus.eu/api/v2/resources/reanalysis-era5-land
    2021-10-22 13:00:31,453 INFO Request is queued
    2021-10-22 13:12:55,443 INFO Request is failed
    2021-10-22 13:12:55,444 ERROR Message: no data is available within your requested subset
    2021-10-22 13:12:55,444 ERROR Reason:  Request returned no data
    2021-10-22 13:12:55,445 ERROR   Traceback (most recent call last):
    2021-10-22 13:12:55,445 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/cdshandlers/services/handler.py", line 55, in handle_request
    2021-10-22 13:12:55,445 ERROR       result = cached(context.method, proc, context, context.args, context.kwargs)
    2021-10-22 13:12:55,445 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/caching.py", line 108, in cached
    2021-10-22 13:12:55,445 ERROR       result = proc(context, *context.args, **context.kwargs)
    2021-10-22 13:12:55,445 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 118, in __call__
    2021-10-22 13:12:55,446 ERROR       return p(*args, **kwargs)
    2021-10-22 13:12:55,446 ERROR     File "/opt/cdstoolbox/cdscompute/cdscompute/services.py", line 59, in __call__
    2021-10-22 13:12:55,446 ERROR       return self.proc(context, *args, **kwargs)
    2021-10-22 13:12:55,446 ERROR     File "/home/cds/cdsservices/services/mars/mars.py", line 45, in internal
    2021-10-22 13:12:55,446 ERROR       return mars(context, request, **kwargs)
    2021-10-22 13:12:55,446 ERROR     File "/home/cds/cdsservices/services/mars/mars.py", line 17, in mars
    2021-10-22 13:12:55,447 ERROR       execute_mars(context, requests)
    2021-10-22 13:12:55,447 ERROR     File "/home/cds/cdsservices/services/mars/execute_mars.py", line 25, in execute_mars
    2021-10-22 13:12:55,447 ERROR       raise NoDataException("Request returned no data", '')
    2021-10-22 13:12:55,447 ERROR   cdsinf.exceptions.NoDataException: Request returned no data
    

    In the current implementation that means that the downloading is retried 5 times after which the program fails when trying to open the downloaded NetCDF or GRIB file.

    Ideally the CLI would show a error message and return with a negative exit code

    I think we could catch that by using an error_callback that cdsapi provides. But maybe another solution will be necessary.

    opened by cpaulik 2
  • pygrib 1.9.9

    pygrib 1.9.9

    Hey! I was just fixing some CI issues. All python versions are passing now, but I saw that there are CI environments for pygrib version 1.9.9 and version 2.0.1. Or at least there should be, because until now only version 2.0.1 was tested (which was installed last from the requirements.txt via pip install -r requirements.txt in .travis.yml).

    Now I have the 2 versions working, and tests fail for version 1.9.9 as some of the metadata stuff is handled differently it seems. e.g grbs.message(1)['levels'] returnsu'0-7' for v2.0.1 but u'7' for v1.9.9 (on the same file)

    Should we support and test v1.9.9? Otherwise I would just set pygrib>=2.0.1 as the required version if thats ok for you?

    opened by wpreimes 2
  • ERA 5

    ERA 5

    I think supporting ERA 5 download and ts generation would be a good idea (so that it works when the full data set is available in a few months). https://www.ecmwf.int/en/newsletter/147/news/era5-reanalysis-production

    opened by wpreimes 2
  • Restructure and new ERA5 API

    Restructure and new ERA5 API

    Tried to separate ERA Interim and ERA5 more, so that we can focus on developing the ERA5 part better in the future. era5_download uses the cds api (instead of ecmwf api). There are more options for downloading now, and we can add more if we want, also the download functions are tested now.

    opened by wpreimes 1
  • new download api

    new download api

    Looks like download of era5 from february on has to be done via a new api.

    "Access through ECMWF Web-API to dataset ERA5 and C3S Seasonal will be phased out, please migrate to the Climate Data Store (https://cds.climate.copernicus.eu/)."

    https://confluence.ecmwf.int/display/CKB/C3S+ERA5%3A+Web+API+to+CDS+API

    opened by wpreimes 1
  • Era5 and netcdf support

    Era5 and netcdf support

    Can we release this as a new version? I think there were some significant changes:

    • Add ERA5 support (download, reading, reshuffling)
    • Add netcdf support for ERA5 and ERA-Interim download (regular grid)
    • Netcdf download in regular grid, grib in gaussian grid -- download allows passing parameters for spatial resampling now (grib and nc)
    • Rework GRIB message storing (dont create a new file for each message, but save messages for each day in a distinct file)
    • Add more tests

    We should consider adding:

    • Grid reducion to land mask when creating TS (Land mask is already being downloaded automatically)
    • Lookup table for parameter ids and variable names (download now via parameter ids, reshuffling via variable names necessary as param ids not saved when downloading netcdf files)
    opened by wpreimes 1
  • A few more changes for downloading hourly data and regridding with CDO

    A few more changes for downloading hourly data and regridding with CDO

    • Option for a different stepsize than full months for downloads. For hourly data, the requests are too large otherwise
    • Removal of temporary files created by CDO after regridding, otherwise the temporary directory will be filled up when using jupyter notebooks.
    opened by s-scherrer 0
  • Regridding with CDO

    Regridding with CDO

    This adds the option to regrid data directly after downloading it using CDO. The regridding is done using pre-computed weights in a separate thread in order to not block the download.

    opened by s-scherrer 0
  • Fix grib and era5-land grid

    Fix grib and era5-land grid

    • Fix bug when creating 0.1 deg grid cells (floating point precision)
    • Missing variables in grib files are now replaced by empty images.
    • Read variable names from grib files from cfVarNameECMF instead of short_name field
    opened by wpreimes 0
Releases(v0.9.1)
  • v0.9.1(May 3, 2022)

  • v0.9.0(Mar 18, 2022)

  • v0.8.1(Feb 14, 2022)

  • v0.8(Nov 15, 2021)

    • Program era5_download returns exit code now (PR #27);
    • Program era5_reshuffle can now take a bounding box to reshuffle spatial subsets;
    • TravisCI was replaced by Github Actions;
    • Pyscaffold 4 is used; contributing guide added; pre-commit added;
    • Code formatting with black (line length 79);
    Source code(tar.gz)
    Source code(zip)
  • v0.7(Jun 19, 2020)

  • v0.6.1(Jan 9, 2020)

    • Fix bug when creating 0.1 deg grid cells (floating point precision)
    • Missing variables in grib files are now replaced by empty images.
    • Read variable names from grib files from cfVarNameECMF instead of short_name field
    Source code(tar.gz)
    Source code(zip)
  • v0.6(Sep 20, 2019)

    • Add support for downloading, reading, reshuffling era5-land
    • Add support for reading, reshuffling points over land only (era5 and era5-land)
    • Add function to create land definition files
    • Test with pinned environments
    Source code(tar.gz)
    Source code(zip)
  • v0.5(Jun 13, 2019)

    • Change default time steps to 6 hours.
    • Add more tests, also for download functions
    • Update documentation, add installation script
    • Fix bugs, update command line interfaces, update dependencies
    • Separate download programs for ERA5 and ERA Interim
    • Change the ERA5 download api to use cdsapi instead of ecmwf api
    • Update package structure to better separate between the ERA products
    • Add look-up-table file for more flexibility in variable names passed by user
    • Update readme
    Source code(tar.gz)
    Source code(zip)
  • v0.4(Dec 15, 2018)

    • Add ERA5 support (download, reading, TS conversion)
    • Add netcdf support for ERA5 and ERA-Interim download (regular grid)
    • Add new grid defintions: netcdf download in regular grid, grib in gaussian grid
    • Add Download with spatial resampling (grib and nc)
    • Update GRIB message storing (per day instead of per message)
    Source code(tar.gz)
    Source code(zip)
  • v0.3(Jan 20, 2017)

    • Fix help text in ecmwf_repurpose command line program.
    • Fix reading of metadata for variables that do not have 'levels'
    • Fix wrong import when trying to read the reformatted time series data.
    Source code(tar.gz)
    Source code(zip)
  • v0.2(Sep 5, 2016)

    • Add reading of basic metadata fields name, depth and units.
    • Fix reading of latitudes and longitudes - where flipped before.
    • Fix longitude range to -180, 180.
    • Add conversion to time series format.
    Source code(tar.gz)
    Source code(zip)
  • v0.1(Aug 30, 2016)

Owner
TU Wien - Department of Geodesy and Geoinformation
TU Wien - Department of Geodesy and Geoinformation
[WWW 2021] Source code for "Graph Contrastive Learning with Adaptive Augmentation"

GCA Source code for Graph Contrastive Learning with Adaptive Augmentation (WWW 2021) For example, to run GCA-Degree under WikiCS, execute: python trai

Big Data and Multi-modal Computing Group, CRIPAC 97 Jan 07, 2023
(AAAI2022) Style Mixing and Patchwise Prototypical Matching for One-Shot Unsupervised Domain Adaptive Semantic Segmentation

SM-PPM This is a Pytorch implementation of our paper "Style Mixing and Patchwise Prototypical Matching for One-Shot Unsupervised Domain Adaptive Seman

W-zx-Y 10 Dec 07, 2022
Neurolab is a simple and powerful Neural Network Library for Python

Neurolab Neurolab is a simple and powerful Neural Network Library for Python. Contains based neural networks, train algorithms and flexible framework

152 Dec 06, 2022
EquiBind: Geometric Deep Learning for Drug Binding Structure Prediction

EquiBind: geometric deep learning for fast predictions of the 3D structure in which a small molecule binds to a protein

Hannes Stärk 355 Jan 03, 2023
Pneumonia Detection using machine learning - with PyTorch

Pneumonia Detection Pneumonia Detection using machine learning. Training was done in colab: DEMO: Result (Confusion Matrix): Data I uploaded my datase

Wilhelm Berghammer 12 Jul 07, 2022
Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network.

Dewarping Document Image By Displacement Flow Estimation with Fully Convolutional Network

111 Dec 27, 2022
A PyTorch implementation of EfficientDet.

A PyTorch impl of EfficientDet faithful to the original Google impl w/ ported weights

Ross Wightman 1.4k Jan 07, 2023
GEP (GDB Enhanced Prompt) - a GDB plug-in for GDB command prompt with fzf history search, fish-like autosuggestions, auto-completion with floating window, partial string matching in history, and more!

GEP (GDB Enhanced Prompt) GEP (GDB Enhanced Prompt) is a GDB plug-in which make your GDB command prompt more convenient and flexibility. Why I need th

Alan Li 23 Dec 21, 2022
Implementation of Shape and Electrostatic similarity metric in deepFMPO.

DeepFMPO v3D Code accompanying the paper "On the value of using 3D-shape and electrostatic similarities in deep generative methods". The paper can be

34 Nov 28, 2022
Only valid pull requests will be allowed. Use python only and readme changes will not be accepted.

❌ This repo is excluded from hacktoberfest This repo is for python beginners and contains lot of beginner python projects for practice. You can also s

Prajjwal Pathak 50 Dec 28, 2022
Evaluating different engineering tricks that make RL work

Reinforcement Learning Tricks, Index This repository contains the code for the paper "Distilling Reinforcement Learning Tricks for Video Games". Short

Anssi 15 Dec 26, 2022
A PyTorch Implementation of the Luna: Linear Unified Nested Attention

Unofficial PyTorch implementation of Luna: Linear Unified Nested Attention The quadratic computational and memory complexities of the Transformer’s at

Soohwan Kim 32 Nov 07, 2022
SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab

CORNELLSASLAB SAS output to EXCEL converter for Cornell/MIT Language and acquisition lab Instructions: This python code can be used to convert SAS out

2 Jan 26, 2022
A task Provided by A respective Artenal Ai and Ml based Company to complete it

A task Provided by A respective Alternal Ai and Ml based Company to complete it .

Parth Madan 1 Jan 25, 2022
Simple reference implementation of GraphSAGE.

Reference PyTorch GraphSAGE Implementation Author: William L. Hamilton Basic reference PyTorch implementation of GraphSAGE. This reference implementat

William L Hamilton 861 Jan 06, 2023
Medical Image Segmentation using Squeeze-and-Expansion Transformers

Medical Image Segmentation using Squeeze-and-Expansion Transformers Introduction This repository contains the code of the IJCAI'2021 paper 'Medical Im

askerlee 172 Dec 20, 2022
QAHOI: Query-Based Anchors for Human-Object Interaction Detection (paper)

QAHOI QAHOI: Query-Based Anchors for Human-Object Interaction Detection (paper) Requirements PyTorch = 1.5.1 torchvision = 0.6.1 pip install -r requ

38 Dec 29, 2022
Implementation of Segformer, Attention + MLP neural network for segmentation, in Pytorch

Segformer - Pytorch Implementation of Segformer, Attention + MLP neural network for segmentation, in Pytorch. Install $ pip install segformer-pytorch

Phil Wang 208 Dec 25, 2022
Aalto-cs-msc-theses - Listing of M.Sc. Theses of the Department of Computer Science at Aalto University

Aalto-CS-MSc-Theses Listing of M.Sc. Theses of the Department of Computer Scienc

Jorma Laaksonen 3 Jan 27, 2022
Official implementation of YOGO for Point-Cloud Processing

You Only Group Once: Efficient Point-Cloud Processing with Token Representation and Relation Inference Module By Chenfeng Xu, Bohan Zhai, Bichen Wu, T

Chenfeng Xu 67 Dec 20, 2022