windkit.time_series_wind_climate.read_timeseries_from_csv
- windkit.time_series_wind_climate.read_timeseries_from_csv(csv_filename, west_east, south_north, crs, time_col=0, height_to_columns=None, **kwargs)[source]
Reads a csv file into a time series wind climate xarray.Dataset. The file must have one time entry per row, a column with a time stamp and at least one wind speed and one wind direction. It allows to create a dataset for several heights.
- Parameters:
csv_filename (str) – file path to a csv file with wind speed and wind direction measurements for different timestamps.
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
time_col (int, str) – column position (integer) or header (str) where the timestamp is located. it can be overriden by using
pandas.read_csv
kwargs. Defaults to 0 (first column in the file).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 files. 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)
**kwargs (dict) – Optional arguments that are forwarded to
pandas.read_csv
for customizing its behavior.
- Returns:
da – Time series wind climate dataset with variables ‘wind_speed’ and ‘wind_direction’ and with a coordinate and dimension ‘time’.
- Return type:
- Raises:
RuntimeError – If the time column cannot be parsed or if the wind speed and wind direction columns cannot be detected.