Jump to content

Nils Joseph Gaukroger

Members
  • Posts

    2
  • Joined

  • Last visited

Recent Profile Visitors

The recent visitors block is disabled and is not being shown to other users.

Nils Joseph Gaukroger's Achievements

  1. Hi Rogier, Thanks for the quick reply, that's working for me too now 🙂 Just wanted to point out also that: The same thing appears to happen with bwc_to_tabfile(), i.e. # Create .tab file from binned wind climate windkit.binned_wind_climate.bwc_to_tabfile( bwc, path="C:/Users/nga/OneDrive - Equinor/Documents/Projects/TAB_files/test.tab" ) works fine, but # Create .tab file from binned wind climate windkit.binned_wind_climate.bwc_to_tabfile( bwc=bwc, path="C:/Users/nga/OneDrive - Equinor/Documents/Projects/TAB_files/test.tab" ) gives me the following error: Traceback (most recent call last): File "C:\Users\nga\OneDrive - Equinor\Documents\Projects\TAB_files\tab_files.py", line 35, in <module> windkit.binned_wind_climate.bwc_to_tabfile( File "C:\Appl\venv\wind\lib\site-packages\windkit\binned_wind_climate.py", line 112, in wv_count_to_bwc obj = args[0] IndexError: tuple index out of range and 2. I was following the WindKit API when I omitted the path, assuming it would be set to the current working directory, and that appears to work fine too. It just writes a file called 'bwc.tab' to the current working directory if you use: # Create .tab file from binned wind climate windkit.binned_wind_climate.bwc_to_tabfile( bwc )
  2. 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
×
×
  • Create New...