Hi!
I am trying to use WindKit to create a .tab file via a binned wind climate. However, I get an error when I try and run the code.
The minimum working example is:
import windkit
import pandas as pd
import numpy as np
import random
import xarray as xr
# Function to make dummy dataframe
def dummy_df(size):
df = pd.DataFrame(zip([random.uniform(0, 25) for i in range(size)], [random.uniform(0, 360) for i in range(size)]),
index=pd.date_range("01-01-2023 00:00:00", periods=size, freq="10T"), columns=['wind_speed', 'wind_direction'])
df.index.name = 'time'
df = np.round(df, 2)
return df
# Dummy pandas dataframe
DF = dummy_df(144)
# Dataframe to xarray dataset
DS = xr.Dataset.from_dataframe(DF)
# Assign coords to dataset
DS = DS.assign_coords({"west_east":0,"south_north":0,"height":90.0})
# Add CRS to dataset
windkit.add_crs(DS, 4326)
# Create binned wind cliamte from timeseries
bwc = windkit.bwc_from_timeseries(
ts=DS
)
# Create .tab file from binned wind climate
windkit.binned_wind_climate.bwc_to_tabfile(
bwc=bwc
)
And I get the following error:
Traceback (most recent call last):
File "C:\Appl\venv\lib\site-packages\spyder_kernels\py3compat.py", line 356, in compat_exec
exec(code, globals, locals)
File "c:\users\nga\onedrive - equinor\documents\tab_files.py", line 30, in <module>
bwc = windkit.bwc_from_timeseries(
File "C:\Appl\venv\lib\site-packages\windkit\_validate.py", line 66, in validate
obj = args[0]
IndexError: tuple index out of range
Any advice on where I might be going wrong?
Thanks in advance,
Nils