This repository contains API scripts for exploring, reading and writing to the WindLab data and knowledge hub.
This work originates from the three following European funded projects:
- AIRE: Aire project works to improve efficiency of the wind energy sector by studying wind flows at different altitudes and weather conditions, providing better design, durability and performance of the wind turbines and farms. Funded under HORIZON-CL5-2021-D3-03 programme (https://aire-project.eu/)
- Meridional: MERIDIONAL provides a comprehensively validated toolchain based on an open source Platform, which draws on an integrated knowledge and data hub to allow the efficient and accurate assessment of the performance and loads experienced by onshore, offshore, and airborne wind energy system. Funded under HORIZON-101084216 (https://meridional.eu/)
- FLOW: FLOW is developing new and innovative prediction methods for production statistics and load performance of modern offshore and onshore wind energy systems. Funded under the HORIZON- (https://flow-horizon.eu/)
https://github.com/jdlr01/WindLab
python 3.12.4
pip install -r requirements.txt
In the CKAN_API_Demo.py the following functionalities are demonstrated, which are applicable with respect to the provided token:
- Get a list of all organization names
- Get the ID of a desired WindLab entry by providing a search term
- Delete an entry from WindLAb (using the ID)
- Read a WindLab entry
- Write an entry to the WindLab
To set up your CKAN_API.Demo.py, you need to provide the link to your token:
ckan_url, api_token, windlab_data, verbose, errorVal = \
CK_helper.read_setup(dir_file_name = 'default.yml') # PLEASE PROVIDE YOUR TOKEN HERE
Please only set the variable associated with the job you want to excecute to 1 and others to 0 in the CKAN_API_Demo.py file. In the following the excecution of the jobs are elaborated.
You can get all the organization names that currently exist on WinLab by setting get_org_names to 1 and running the script.
Set the title_str_4_id to the term you want to search in WindLab in string format.
Set get_all_ids to 1 and run the script. The found entries with their ID will be printed.
Your rights associated with the provided token allows you to delete entries on WindLab.
To delete an entry, find the ID using the method described in the last section.
Set data_set_id in the script to the ID of the entry you want to delete. Set delete_data_with_id to 1 and run the script.
Alternatively you can copy the ID to data_set_id in './setup_files/WindDemo/Delete_DataSets_using_ID.yml'. In this case you should set delete_data_with_file to 1 and run the script.
The entries that were read to files are stored in '..\temp' directory. You also have the option to read the entries in memory. To read an entry please set read_data to 1.
You have five possibilities under to read data:
- if you want to read an entry with a link to dataset, please change the 'if' statement to be True for this section. Then open './setup_files/WindDemo/Read_DataSets_Link.yml' and modify the tag_strings for a desired search term.
- if you want to load the data into memory, please change the 'if' statement to be True for this section. Then open './setup_files/WindDemo/Read_DataSets_File_2Memory.yml' and modify the tag_strings for a desired search term. Please note that you cannot read WindIO conform files into memeory. Please use the following methods to read them.
- if you want to load the data on your local machine, please change the 'if' statement to be True for this section. Then open './setup_files/WindDemo/Read_DataSets_File_2File.yml' and modify the tag_strings for a desired search term.
- if you want to load WindIO conform data on your local machine, please change the 'if' statement to be True for this section. Then open './setup_files/WindDemo/Read_DataSets_File_2File_windIO.yml' and modify the tag_strings for a desired search term.
- if you do not want to use the setup_files you can use the last section under read_data to setup your own search.
Note: please avoid underline in the keyword you search.
To read an entry please set write_data to 1. Your rights associated with the provided token allows you to add entries on WindLab.
- if you want to add an entry with a link to dataset, please change the 'if' statement to be True for this section. This addes the 'Write_DataSet_Sample_Link.yml' file as a sample provided for you in './setup_files/WindDemo/' to WindLab. You can modify 'Write_DataSet_Link.yml' to link to your desired entry.
- if you want to add an entry with data or metadata, please change the 'if' statement to be True for this section. This addes the 'Write_DataSet_Sample_File.yml' file as a sample provided for you in './setup_files/WindDemo/' to WindLab. You can modify 'Write_DataSet_File.yml' to link to your desired entry.
- if you want to add a WindIO conform entry with data or metadata, please change the 'if' statement to be True for this section. This addes the 'Write_DataSet_Sample_File_WindIO.yml' file as a sample provided for you in './setup_files/WindDemo/' to WindLab. You can modify 'Write_DataSet_File_WindIO.yml' to link to your desired WindIO conform entry.
For more information regarding how to read, write or delete resources using API please refer to Excecute_DEMO.pdf.
For more information on how to prepare the resource to be uploaded to WindLAb please refer to Prepare_Resource.pdf.