pywasp.wasp.Config#

class pywasp.wasp.Config(par_set='WAsP_12.10')[source]#

Configuration class for the WAsP model parameters

Due to the structure of the original fortran testbench code, parameters from the WAsP model are set in a long array with integers in a Fortran data block. Here we initialize both the climate and terrain parameters. The obstacle model does not, yet, have a similar structure to that of the climate and terrain models. Parameter can be set with a parameter-suite name, like “WAsP_12.8” for the parameters corresponding to WAsP version 12.8. Individual parameters can also be set manually through the methods of the .terrain and .climate class attributes (see below). By default, “WAsP_12.10” is used.

Parameters:

par_set (str) – Named parameter set with different defaults:

  • WAsP_11.4 – Profile model -1; terrain analysis 0

  • WAsP_12.6 – Profile model 1; terrain analysis 0

  • WAsP_12.7 – Profile model 1; terrain analysis 1

  • WAsP_12.8 – Profile model 3; terrain analysis 1

  • WAsP_12.10 – Profile model 3; terrain analysis 1 (default)

The above numbers are the parameter when calling Config.climate.set_profile_model and Config.terrain.set_terrain_analysis respectively. The WAsP 11 and 12 sets use the WAsP GUI’s power of 0.3333 in the Weibull fit (climate parameter 111); sets below 11 keep the core’s 1/3.

Notes

The .terrain and .climate class attributes each respectively hold the parameters for the terrain and climate analysis in WAsP. The attributes are themselves classes with associated methods described below. To interact with the parameters, both terrain and .climate acts as lists, allowing to get and set parameters by indicies:

from pywasp.wasp import Config

conf = Config()
conf.climate[10] = 1.8  # Set the climate parameter 10 (A0) value to 1.8
decay_length = conf.terrain[31]  # get the decay length parameter from the terrain model

Terrain model config

The terrain model allows users to set the terrain analysis parameter-set and whether toggle whether displacement heights are used. This is done through the two methods:

  • .set_terrain_analysis(index): Set terrain analysis (0=classic, 1=spider)

  • .use_displacement_height(flag): Enable/disable displacement heights (True/False)

Climate model config

The climate model config allows users to set the profile model through .set_profile_model(model). Options are:

  • -1: WAsP 11 profile model (c_g=1.65, powerlaw reversal height)

  • 0: WAsP EWA profile model, excluding geostrophic wind shear (all values set to 0 in the WAsP GUI)

  • 1: WAsP EWA profile model, including geostrophic wind shear

  • 2: WAsP T-star profile model, including sectorwise stability, excluding geostrophic wind shear (all values set to 0 in the WAsP GUI)

  • 3: WAsP T-star profile model, including sectorwise stability and geostrophic wind shear (default)

To see all available parameters, print the Config object or see the WAsP Parameters Reference.

Examples

Config objects can be instantiated with a standard parameter-suite, for example WAsP 12.8:

>>> import pywasp as pw
>>> conf = pw.wasp.Config("WAsP_12.8")
>>> print(conf)  # Lists the climate and terrain parameters
>>> conf.climate[10] = 1.8  # Set the climate parameter 10 (A0) value to 1.8
>>> conf.climate.set_profile_model(-1)  # Use the WAsP 11 profile model
>>> conf.terrain.set_terrain_analysis(1)  # Use spider analysis terrain model
...
>>> # Use the Config in a WAsP model-call
>>> wwc = pw.wasp.downscale(gwc, topo_map, output_locs, conf=conf)

Methods

__init__([par_set])

from_dict(d)

Initialize class from dictionary

read_file(filepath)

Initialize class from exported JSON file

to_dict()

Export WAsP configuration parameters to dictionary.

to_file(filepath)

Export WAsP configuration parameters to file.