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
This is a collection of our NAS and Vision Transformer work.

This is a collection of our NAS and Vision Transformer work.

Microsoft 828 Dec 28, 2022
Numba-accelerated Pythonic implementation of MPDATA with examples in Python, Julia and Matlab

PyMPDATA PyMPDATA is a high-performance Numba-accelerated Pythonic implementation of the MPDATA algorithm of Smolarkiewicz et al. used in geophysical

Atmospheric Cloud Simulation Group @ Jagiellonian University 15 Nov 23, 2022
Deep Image Search is an AI-based image search engine that includes deep transfor learning features Extraction and tree-based vectorized search.

Deep Image Search - AI-Based Image Search Engine Deep Image Search is an AI-based image search engine that includes deep transfer learning features Ex

139 Jan 01, 2023
Import Python modules from dicts and JSON formatted documents.

Paker Paker is module for importing Python packages/modules from dictionaries and JSON formatted documents. It was inspired by httpimporter. Important

Wojciech Wentland 1 Sep 07, 2022
This project provides the code and datasets for 'CapSal: Leveraging Captioning to Boost Semantics for Salient Object Detection', CVPR 2019.

Code-and-Dataset-for-CapSal This project provides the code and datasets for 'CapSal: Leveraging Captioning to Boost Semantics for Salient Object Detec

lu zhang 48 Aug 19, 2022
Exploring Visual Engagement Signals for Representation Learning

Exploring Visual Engagement Signals for Representation Learning Menglin Jia, Zuxuan Wu, Austin Reiter, Claire Cardie, Serge Belongie and Ser-Nam Lim C

Menglin Jia 9 Jul 23, 2022
Bagua is a flexible and performant distributed training algorithm development framework.

Bagua is a flexible and performant distributed training algorithm development framework.

786 Dec 17, 2022
Official PyTorch Implementation of Hypercorrelation Squeeze for Few-Shot Segmentation, arXiv 2021

Hypercorrelation Squeeze for Few-Shot Segmentation This is the implementation of the paper "Hypercorrelation Squeeze for Few-Shot Segmentation" by Juh

Juhong Min 165 Dec 28, 2022
Sequence-to-Sequence learning using PyTorch

Seq2Seq in PyTorch This is a complete suite for training sequence-to-sequence models in PyTorch. It consists of several models and code to both train

Elad Hoffer 514 Nov 17, 2022
A coin flip game in which you can put the amount of money below or equal to 1000 and then choose heads or tail

COIN_FLIPPY ##This is a simple example package. You can use Github-flavored Markdown to write your content. Coinflippy A coin flip game in which you c

2 Dec 26, 2021
Banglore House Prediction Using Flask Server (Python)

Banglore House Prediction Using Flask Server (Python) 🌐 Links 🌐 📂 Repo In this repository, I've implemented a Machine Learning-based Bangalore Hous

Dhyan Shah 1 Jan 24, 2022
A lightweight python AUTOmatic-arRAY library.

A lightweight python AUTOmatic-arRAY library. Write numeric code that works for: numpy cupy dask autograd jax mars tensorflow pytorch ... and indeed a

Johnnie Gray 62 Dec 27, 2022
A simple command line tool for text to image generation, using OpenAI's CLIP and a BigGAN.

Ryan Murdock has done it again, combining OpenAI's CLIP and the generator from a BigGAN! This repository wraps up his work so it is easily accessible to anyone who owns a GPU.

Phil Wang 2.3k Jan 09, 2023
Unified learning approach for egocentric hand gesture recognition and fingertip detection

Unified Gesture Recognition and Fingertip Detection A unified convolutional neural network (CNN) algorithm for both hand gesture recognition and finge

Mohammad 227 Dec 25, 2022
Automatic 2D-to-3D Video Conversion with CNNs

Deep3D: Automatic 2D-to-3D Video Conversion with CNNs How To Run To run this code. Please install MXNet following the official document. Deep3D requir

Eric Junyuan Xie 1.2k Dec 30, 2022
Extract MNIST handwritten digits dataset binary file into bmp images

MNIST-dataset-extractor Extract MNIST handwritten digits dataset binary file into bmp images More info at http://yann.lecun.com/exdb/mnist/ Dependenci

Omar Mostafa 6 May 24, 2021
A high performance implementation of HDBSCAN clustering.

HDBSCAN HDBSCAN - Hierarchical Density-Based Spatial Clustering of Applications with Noise. Performs DBSCAN over varying epsilon values and integrates

2.3k Jan 02, 2023
This is the workbook I created while I was studying for the Qiskit Associate Developer exam. I hope this becomes useful to others as it was for me :)

A Workbook for the Qiskit Developer Certification Exam Hello everyone! This is Bartu, a fellow Qiskitter. I have recently taken the Certification exam

Bartu Bisgin 66 Dec 10, 2022
[CVPR 2021] MetaSAug: Meta Semantic Augmentation for Long-Tailed Visual Recognition

MetaSAug: Meta Semantic Augmentation for Long-Tailed Visual Recognition (CVPR 2021) arXiv Prerequisite PyTorch = 1.2.0 Python3 torchvision PIL argpar

51 Nov 11, 2022
Caffe models in TensorFlow

Caffe to TensorFlow Convert Caffe models to TensorFlow. Usage Run convert.py to convert an existing Caffe model to TensorFlow. Make sure you're using

Saumitro Dasgupta 2.8k Dec 31, 2022