Skip to main content

A package for generating arbitrarily long weather time-series

Project description

wxgen is a command-line tool for generating arbitrarily long weather time-series. The generator produces gridded output for multiple variables (e.g. temperature, precipitation) and aims to have realistic covariances in space, time, and across variables.

The generator uses a database of past weather model simulations (e.g 15 day forecasts) and combines the segments stochastically. 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).



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 .

This will create the executable /usr/local/bin/wxgen. If /user/local/bin is not in your PATH environment variable, then add it (i.e add export PATH=/usr/local/bin/:$PATH to ~/.bashrc). If you do not have sudo privileges do:

pip install .

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

If you are working on the code, the -e flag ensures that you do not need to rerun pip install every time you make changes to the code:

sudo pip install -e .

Example use

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

wxgen sim -db examples/ -n 10 -t 1000 -o

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

wxgen truth -db examples/ -o

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 -m timeseries
wxgen verif -truth -m variance

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

Example plot

Project details

Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Files for wxgen, version 0.2.0a1
Filename, size File type Python version Upload date Hashes
Filename, size wxgen-0.2.0a1-py2-none-any.whl (32.1 kB) File type Wheel Python version py2 Upload date Hashes View
Filename, size wxgen-0.2.0a1.tar.gz (27.0 kB) File type Source Python version None Upload date Hashes View

Supported by

AWS AWS Cloud computing Datadog Datadog Monitoring Facebook / Instagram Facebook / Instagram PSF Sponsor Fastly Fastly CDN Google Google Object Storage and Download Analytics Huawei Huawei PSF Sponsor Microsoft Microsoft PSF Sponsor NVIDIA NVIDIA PSF Sponsor Pingdom Pingdom Monitoring Salesforce Salesforce PSF Sponsor Sentry Sentry Error logging StatusPage StatusPage Status page