pywasp.wasp.Config

class pywasp.wasp.Config(par_set='WAsP_12.8')[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.8” 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

The above numbers are the parameter when calling Config.climate.set_profile_model and Config.terrain.set_terrain_analysis respectively.

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:

  1. .set_terrain_analysis(index), which set the terrain analysis. It has two options: - 0: for classic analysis - 1: for “spider” analysis.

  2. .use_displacement_height(flag), which sets the displacement heights. Options are True or False.

The full list of parameters for the terrain model is:

index

short_name

valid_min

valid_max

default_value

definition

2

c_zone_width

5000

50000

10000

Width of coastal interpolation/transition zone

6

inv_height

100

5000

1000

Height of top (virtual ‘inversion’) in BZ model

7

inv_softness

0

1

1

Softness of inversion in BZ model (0–1)

8

k

0.35

0.42

0.4

In fluid dynamics, the von K'arm'an constant ($k$ or $kappa$) is a dimensionless constant involved in the logarithmic law describing the profile of the longitudinal velocity in the wall-normal direction of a turbulent fluid flow near a boundary with a no-slip condition. Clasically, it is taken to be 0.4.

24

lp_filter_len

0

inexact; roughly domain size/10

0

Low-pass filter scale (length) in BZ terrain model (0 for off)

26

0.27

Factor $c$ in BZ inner layer eqn.

27

0.3

Outer layer scaling factor in BZ: texttt{xl=r*vls(iz)*xlf}

28

const_wind_h

0

1000

Height at which undisturbed wind is constant in BZ model

29

5.0

outer roughness area / outer layer factor, to find mean roughness used in inner-scale relation of IBZ

30

0.67

Exponent in inner layer power law (over surface inhomogeneities) if p(26) is positive; otherwise is exponent in original inner-length scale law

31

decay_length

1000

1000000

10000

Decay-length for importance of roughness relative to distance from center

32

-1

Method/type choice for calculating mean roughnesses in the IBL model

33

1.06

Drag-law stability offset factor

38

3 (suggested by M.Kelly, 2018)

$sim30$

10.0

Minimum $h_textrm{IBL}/z_0$ in IBL depth calculation

39

suggested: 0.5 (1.25$kappa$)

suggested: 1.0 (2.5$kappa$)

0.9

Coefficient on $x/z’_0$ in IBL depth

40

upper_kink_ibl_profile

0.3

Factor for upper kink in roughness change wind profile in the ibl

41

lower_kink_ibl_profile

$sim$10*max[$z_{0,1},z_{0,2}$]

$c_1$

0.09

Factor for lower kink in roughness change wind profile in the ibl

42

5

Azimuth resolution in BZ (>1 deg, default 5 deg)

63

5e-6 ($5times10^{-6}$)

deviation angle that prevents erroneous sequence of rchs

65

sub_sector_no

1

9

9

Sub-sectors in roughness map analysis

66

10.0

displacement factor (d=factor*z0) used in atlas_nt,wprms_nt and hsp

67

max_no_roughness_changes

1

20

10

Max number of roughness changes/sector. See cite{Floors2018b} for description and sensitivity. This array is dimensioned in the variable mrchs in dimpar.f90.

68

max_rms_error

0

3

0.3

Maximum root-mean square (rms) error in log(roughness) analysis of roughness changes for a given sector. Setting a lower error threshold will allow a higher number of roughness changes to be taken into consideration, for each sector. Choosing 0 causes this parameter to become inactive, with the maximum number of changes then set by parameter~67.

69

use_displacement_height

1

add displacements to orographic grid if = 1, and reduce displacement slope near origin to parameter~70

70

0.2

max slope for the BZ grid that is added to the original BZ when p(69)=1

72

1.2

Standard RIX slope value (percent per percent of dRIX)

73

0

RIX azimuthal averaging. 0=unweighted, 1=sector-mean weighted,

74

finest resolution (first radial distance in meters) in BZ grid

75

20000

if > 0.0 height contours ignored beyond this distance (BZ model)

76

0.5

Ratio for outer padding in BZ-model (do not change)

79

100

10000

3500

RIX radius in meters

80

0.005

1

0.3

RIX threshold slope

81

5.0

percent increase in rou area size per r-grid step

82

roughness_analysis

1

rou analysis version: 0=old, =1 use spiderweb with old rou maps

83

outer radius in rou-spg is param(31)*param(83)

84

first radius in spiderweb routine

85

0

if > 0: use ibltable instead of ibl iteration

97

water_roughness_length

0.000006

0.1

0.0002 ($2times10^{-4}$)

water roughness length used in program

98

0

nominal value for setting water attribute (roughness, slf, stability)

99

10max[$z_0$]

$0.99z_2$

height used in atlas_nt for initial downward extrapolation

100

0

0.1

slope in triangular weight function for displacement averaging in rou_spg

101

0.1

slope of displacement decay downwind in rou_spg

102

0.1

slope of displacement growth upwind in rou_spg

103

4.0

Power to raise displacements to before averaging

Climate model config

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

  • -1: WAsP 11 profile model using c_g=1.65 and powerlaw estimation for reversal height

  • 0: WAsP 12 profile model with c_g solved by iteration and dA/dmu set such that it corresponds with the old profile model

  • 1: WAsP 12 profile model, as version 0 but including baroclinicity

  • 2: WAsP 12 profile model, including sectorwise stability as described in mesoclimate class

  • 3: WAsP 12 profile model, including sectorwise stability and baroclinicity as described in mesoclimate class

The full list of parameters for the climate model is:

index

short_name

valid_min

valid_max

default_value

definition

1

1005.0

Specific heat of dry air

4

fmin

0.0

should be $ll1$

0.0001

Sectorwise frequency of occurence, i.e.probability, below which we do not attempt to fit a Weibull distribution: a sector is ‘empty’ (ignored) if the frequency of occurence falls below this value.

8

vonk

0.35

0.42

0.40

von K'arm'an constant ($k$ or $kappa$) is the ratio of $U/z$ to $dU/dz$ in ideally neutral conditions over a rough surface: i.e., the proportionality constant in the law-of-the-wall.

9

0.485

Constant in simplified reverse geostrophic drag law of cite{Jensen1984}

10

a0

0

4

1.8

$A_{0}$-parameter in geostrophic drag law under neutral conditions

11

b0

2

8

4.5

$B_0$-parameter in neutral geostrophic drag law

38

min ibl/z0max in ibl calculation

44

f_lim

0

90

10

Lower limit of absolute latitude for f in Rossby number

48

def_hfx

0

If 0 the input of heatflux parameters is taken as default from the parameter list (see parameter 56-59). If 2, the heat flux parameters are passed into stability routines from the specified ‘mesoscale climate’ in PyWAsP.

54

0.001

0.006

0.0002

Factor in height of minimum stab induced variance cite[EWA has 0.002][]{Troen1989}. When set negative, Eq.~8.10 is solved by iteration without approximations.

55

hfx_pert

1

5

Factor in heatflux induced perturbation of $u_*$ (was 1.65, default 2.50).

56

rms_hfx_land

0

300

100

Root mean square of heat flux over land

57

rms_hfx_water

0

100

30

Rms Heatflux over water

58

off_hfx_land

-200

200

-40

Offset (mean) heatflux over land

59

off_hfx_water

-100

100

-8

Offset (mean) heatflux over water

60

stab_lim_land

0.25

4

1

Factor on geostrophic height for stab envelope limiting

61

Form factor in heatflux distribution over land

62

Form factor in heatflux distribution over water

64

minimum Geostrophic wind (land) in stability calculation

66

displacement factor (d=factor*z0) used in atlas_nt,wprms_nt and hsp

70

pblh_water

100

2000

[1000]

Boundary layer height over sea in meters

71

pblh_land

100

2000

[600]

Boundary layer height over land in meters

77

stab_lim_water

0.25

4

1

Factor on geostrophic height (sea) for stab envelope limiting

78

power law in stab height limiting (land and sea)

85

if > 0: use ibltable instead of ibl iteration

86

f_cor

0.0001

absolute value of Coriolis parameter in stab, calculated internally from latitude if < 0.0

87

factor ch in ch*ustar/f boundary layer height estimate

88

dA/dmy in barotropic drag law

89

dB/dmy in barotropic drag law

90

geometrical factor from integral of geo-shear in ABL, u-component

91

geometrical factor from integral of geo-shear in ABL, v-component

92

m_geo_shear

0

0.010

dgdz: magnitude of dG/dz at surface

93

beta

0

360

beta: direction of dG/dz at surface

94

delta: thermal wind turning angle(degs)

95

ef: factor in linear “Ekman” correction to wind profile, u=log+psi+ef*(z-d)*f

96

ch: factor in expression for BL height: H=ch*ustar/f

97

water_roughness_length

water roughness length used in program

98

nominal value for setting water attribute (roughness, slf, stability)

99

height used in atlas_nt for initial downward extrapolation

100

use_tscale

0

Use temperature scale with units K (1) or heat flux in W m$^{-2}$ (0)

101

Factor to emulate WAsP 11 behaviour

102

-1

Slope of psi function under neutral conditions, -1 is old WAsP 12.

103

Limit for dgdz

104

Number of degrees used for averaging of sectorwise A/B

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)
Config
>>> conf.climate[10] = 1.8  # Set the climate parameter 10 (A0) value to 1.8
>>> conf.set_profile_model(-1)  # Use the WAsP 11 profile model
>>> conf.terrain.set_terrain_analysis  # 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.