Skip to content
Thomas Nipen edited this page Apr 15, 2019 · 34 revisions

This wiki describes how to use Wxgen. Wxgen creates weather time-series that are:

  • gridded
  • arbitrarily long
  • with multiple weather variables.

The program offers many different options for creating these time-series and includes a verification component to evaluate the time-series.

The generator uses an archive of historical weather forecasts and stochastically joins these into long continuous weather sequences. Although any archive of weather model could be used, we have tested it with a ECMWF's reforecast dataset, which are reruns of their operational medoum-range (up to 15 days) ensemble forecast system. With this dataset, the generator created gridded scenarios with 6 hour timesteps and 0.2° by 0.2° spatial resolution. The scenarios can contain any variable that is output by the weather model.

Below is an example of 10 simulations of 1000 day length for temperature and precipitation for a single point (Oslo):

Example dataset

To use Wxgen, you will need to download the ECMWF-based database:

The gridded database contains data on a lat/lon grid for southern Norway and is the main database for creating scenarios. The aggregated database provides the average value for the whole domain and is only useful for demonstrating the verification part of Wxgen. For more information about how these databases were created, check this wiki page.

The databases have the following variables:

  • 2m temperature (K)
  • precipitation (mm)
  • sea level pressure (Pa)
  • cloud area fraction (0-1)
  • zonal wind speed (m/s)
  • meridional wind speed (m/s)
  • incoming solar radiation (W/m2)

These are all daily averages, except precipitation, which is a daily total.

To run the examples in the wiki, you should therefore have two files:

$ ls
db.nc   db_agg.nc

Basic usage

Wxgen is a command-line program with three modes: 1. simulation 1. truth 1. verification.

The simulation mode creates one or more scenarios of a desired length, and is run as follows:

wxgen sim [options]

The output from this is a gridded NetCDF file that could be used for hydrological modelling.

The truth mode assembles a scenario that best represents the truth, based on the database. It connects the day 0 forecasts from the database (using ensemble member 0). When a day 0 forecast is not available, it will use the day 1 forecast from the previous initialization (and so forth until it finds one).

wxgen truth [options]

Finally, the scenarios can be evaluated and plotted using the verification mode as follows:

wxgen verif [options]

Memory usage

Creating scenarios can require a large amount of memory. However, the -mem option can be used to limit the amount of memory used. For example -mem 5 will force wxgen to only load about 5 GB of data from the database at once. This will in general mean that it will take longer to produce scenarios, since data may have to be read multiple times.

About this tutorial

The first part (creating scenarios) goes through the command-line options for creating scenarios. This part shows verification examples of why each option is beneficial. The third part is designed to be a reference for the different verification options.