windkit.io.wasp.format_rsf#

windkit.io.wasp.format_rsf(A, k, wdfreq, A_combined, k_combined, power, site_elev, coords, name=None, header=None, power_decimals=4)[source]#

Format resource-file data as .rsf/.wrg file content string.

Sector-wise values are rescaled to the format’s storage units (A * 10, k * 100, wdfreq * 1000), rounding to the format’s precision first as WAsP does.

Parameters:
  • A (array_like, shape (n_points, n_sectors)) – Sector-wise Weibull A parameters [m/s].

  • k (array_like, shape (n_points, n_sectors)) – Sector-wise Weibull k parameters.

  • wdfreq (array_like, shape (n_points, n_sectors)) – Sector frequencies as 0-1 fractions.

  • A_combined (array_like, shape (n_points,)) – Weibull A of the total distribution [m/s].

  • k_combined (array_like, shape (n_points,)) – Weibull k of the total distribution.

  • power (array_like, shape (n_points,)) – The power column, in the units it should be stored in (power density [W/m2] or power production [Wh/y]).

  • site_elev (array_like, shape (n_points,)) – Site elevation [m].

  • coords (dict) – Dictionary with "west_east", "south_north" and "height" arrays of shape (n_points,).

  • name (array_like of str, optional) – Site names, at most 10 characters each. Defaults to "GridPoint" for every site.

  • header (dict, optional) – WRG grid header with "nx", "ny", "xmin", "ymin" and "cell_size". When given, the header line is prepended (producing .wrg content). No grid consistency check is made — computing the header from the data is the caller’s job.

  • power_decimals (int, optional) – Preferred number of decimals for the power column: 4 suits power density, 0 suits power production. Fewer decimals are used when needed to fit the field. When every value is the -9999 missing-value sentinel the column is written as integers, as WAsP does (a column merely containing some -9999 values is not treated specially). Defaults to 4.

Returns:

File content string (with \n line endings and no trailing newline).

Return type:

str

Raises:

ValueError – If a name is longer than 10 characters, there are more than 99 sectors, array shapes are inconsistent, power_decimals is negative, or a value cannot fit its fixed-width field.