Gridpp a is post-processing tool for gridded weather forecasts. It consists of a library of commonly-used methods and a command-line tool that applies these methods to forecast fields in NetCDF files.
Gridpp is written in C++ but offers python bindings to the functions in the library. The tool is used at MET Norway to produce operational weather forecasts for Yr (https://www.yr.no).
Gridpp is currently under active development and the current version is a prototype for testing. Feedback is welcome, either by using the issue tracker in Github, or by contacting Thomas Nipen ([email protected]).
For information on how to use gridpp, check out the wiki at https://github.com/metno/gridpp/wiki. The API reference is found at https://metno.github.io/gridpp/.
- Methods for downscaling a forecast from a coarse grid to a fine grid
- Methods for calibrating a downscaled grid, such as quantile mapping
- Computationally efficient neighbourhood methods to compute neighbourhood min, mean, max, and any quantile.
- Data assimilation using optimal interpolation (OI) to merge observations and gridded forecasts (deterministic or ensemble)
- Efficient data structures for nearest location lookup in a vector or grid of locations
- Command-line client with support for Netcdf files with flexibility in how variables and dimensions are configured
The following computes a moving neighbourhood mean with a half-width of 7 gridpoints (i.e. 15x15 neighbourhood)
import gridpp
import numpy as np
import scipy.ndimage.filters
noise = np.random.randn(200, 300)
input = scipy.ndimage.filters.gaussian_filter(noise, sigma=5)
halfwidth = 7
output = gridpp.neighbourhood(input, halfwidth, gridpp.Mean)
On Ubuntu Bionic, these can be installed like this:
sudo apt-get update
sudo apt-get install libboost-all-dev
sudo apt-get install libarmadillo6 libarmadillo-dev
The easiest is to install the latest release of the package using pip. Provided you have installed the dependencies listed above, you can install the most recent release of the python package as follows:
pip3 install gridpp --user
To check that the installation worked, run the following in python3:
import gridpp
print(gridpp.version())
-
Either download the source code from the latest release, unzip the file and navigate into the extracted folder; or clone the repo from github.
-
Install extra requirements
These are only required when installing from source
sudo apt install swig cmake
- Set up cmake installation
mkdir build
cd build
cmake ..
- Install the C++ library
sudo make install
This will install the library in /usr/local/lib/libgridpp.so
and the gridpp command-line client in
/usr/local/bin/gridpp
. To specify a custom installation path, use the following in step 3:
cmake .. -DCMAKE_INSTALL_PREFIX=<custom path>
- Install the python bindings
make install-python-user
This installs the python bindings in
~/local/lib/python3.6/site-packages/gridpp.py
. To install the python bindings system-wide, use sudo make install-python
instead.
- Install the R bindings
make build-r
Currently, the R package is not installed centrally, but instead is placed in swig/R/gridpp.R
in the build directory.
- Extra dependencies The gridpp commando-line client requires the following extra dependencies:
On Ubuntu Bionic, these can be installed like this:
sudo apt-get install libgsl0-dev libblas-dev
sudo apt-get install netcdf-bin libnetcdf-dev
- Install the client
make gridpp-client
Copyright © 2014-2021 Norwegian Meteorological Institute. Gridpp is licensed under the GNU LEsser General Public License (LGPL). See LICENSE file.
E-mail: Thomas Nipen ([email protected])