windkit.io.wasp.read_rsf#

windkit.io.wasp.read_rsf(filepath, encoding='infer')[source]#

Read a WAsP .rsf or .wrg resource file and return parsed data.

The WRG grid header is detected automatically, so both formats are read by this one function.

Parameters:
  • filepath (str, Path or file-like) – Path to the .rsf/.wrg file, or an open text stream.

  • encoding (str, optional) – File encoding. If "infer" (default), the encoding is detected automatically. Ignored for file-like input.

Returns:

Dictionary with keys:

  • "name" : ndarray, shape (n_points,), site names

  • "coords" : dict with "west_east", "south_north", "height" arrays of shape (n_points,)

  • "site_elev" : ndarray, shape (n_points,)

  • "A" : ndarray, shape (n_points, n_sectors), Weibull A [m/s]

  • "k" : ndarray, shape (n_points, n_sectors), Weibull k

  • "wdfreq" : ndarray, shape (n_points, n_sectors), sector frequencies as 0-1 fractions

  • "A_combined" : ndarray, shape (n_points,)

  • "k_combined" : ndarray, shape (n_points,)

  • "power" : ndarray, shape (n_points,), the power column exactly as stored in the file (power density [W/m2] or power production [Wh/y] — the file does not say which)

  • "header" : dict with "nx", "ny", "xmin", "ymin", "cell_size" when the file has a WRG grid header, otherwise None

Return type:

dict

Raises:

WindkitFileFormatError – If the file contains no data lines, the sector count cannot be read, or a fixed-width field holds a value that is not a number.