windkit.time_series_wind_climate.read_timeseries_from_pandas

windkit.time_series_wind_climate.read_timeseries_from_pandas(pd_df, west_east, south_north, crs, height_to_columns=None)[source]

transforms a pandas.DataFrame into a time series wind climate xarray.Dataset. The dataframe must have an index with time format and at least one wind speed and one wind direction. It allows to create a dataset for several heights.

Parameters:
  • pd_df (pandas.DataFrame) – pandas dataframe with wind speed and wind direction measurements for different timestamps and heights.

  • west_east (float) – west east locaton of the measurement

  • south_north (float) – south north location of the measurement

  • crs (int, dict, str or pyproj.crs.CRS) – Value to initialize pyproj.crs.CRS

  • height_to_columns (dict) –

    dictionary to map the wind speed and directions to its corresponding height. The key is a float with the height, and the value is a tuple (str,str) with the header for the wind speed and the header for the wind direction, respectively. If the parameter is None, the columns are inferred from the column names in the dataframe. The function will find wind speeds for different heights and after that will look for wind direction columns, matching them to the closest height. Examples of autodetected header formats:

    • ws_10, ws_10_mean, ws10, WS10 (wind speed at 10 m)

    • windagl10, windagl_10, windagl_10_mean (wind speed at 10 m)

    • wd_15, wd_15_mean, w15, WD15 (wind direction at 15m)

    • wdiragl15, wdiragl_15, wdiragl_15_mean (wind direction at 15 m)

Returns:

da – Time series wind climate dataset with variables ‘wind_speed’ and ‘wind_direction’ and with a coordinate and dimension ‘time’.

Return type:

xarray.Dataset

Raises:

RuntimeError – If it fails to autodetect the columns