wxgen

A package for generating arbitrarily long weather time-series


Keywords
meteorology, generator, stochastic, weather, simulation
License
LGPL-3.0
Install
pip install wxgen==0.2.0a1

Documentation

Hybrid weather generator

https://travis-ci.org/tnipen/wxgen.svg?branch=master https://coveralls.io/repos/tnipen/wxgen/badge.svg?branch=master&service=github

wxgen is a command-line tool that generates arbitrarily long trajectories (time-series) of weather sequences. It is a hybrid approach as it uses data from weather models and combines sequences in a stochastic way. Weather model data is stored in a database of short weather sequences (e.g. 15 days). Longer trajectories are created by concatenating the shorter trajectories from the database. This is done by matching the end state of one trajectory with the beginning state of another. The matching is done using a specified metric, such as the sum of the square differences between states (with some kind of normalization strategy as each atmospheric variable has different variances).

Installation

Ubuntu

Install the required pacakges:

sudo apt-get update
sudo apt-get install netcdf-bin libnetcdf-dev libhdf5-serial-dev
sudo apt-get install python-setuptools python-pip
sudo apt-get install python-numpy python-scipy python-matplotlib python-mpltoolkits.basemap

Then install wxgen by executing the following inside the extracted folder:

sudo pip install -r requirements.txt
sudo python setup.py install

This will create the executable /usr/local/bin/wxgen. Add this to your PATH environment variable if necessary (i.e add export PATH=/usr/local/bin/:$PATH to ~/.bashrc). If you do not have sudo privileges do:

sudo python setup.py install --user

This will create the executable ~/.local/bin/wxgen. Add the folder to your PATH environment variable.

Example use

Wxgen has three commands. The first simulates sequences of weather as follows:

wxgen sim --db database.nc -n 10 -t 100 -o output.nc

This command uses a NetCDF database file and creates 10 trajectories that are 100 days long. Results are stored in output.nc. In order to evaluate the performance of the generated data, a "truth" file can be created using the following command:

wxgen truth --db database.nc -o truth.nc

This command uses the day 1 forecasts from the database as the truth, and joins these together into a sequence that spans the dates in the dataset.

Finally, the generated sequences can be evaluated using th verif command:

wxgen verif -truth truth.nc output.nc -m timeseries

The -m switch selects the verification metric, in this case a timeseries.

Example plot