The Tall Tower is an open database aimed at boosting the use of hub-height wind observations from meteorological towers. The Tower2csv.py class scans netCDF files from a Tall Tower database and joins all of them into a single .CSV file.
Creating a virtual environment is strongly advisable to avoid errors when running the Tower2csv. It can be done using the "virtualenv" library. Use the following command lines in your terminal to install "virtualenv" and configurate a new virtual environment:
pip install virtualenv
For creating a new virtual environment called "venv":
python -m venv venv
Now, for activating the new virtual environment:
.\venv\Scripts\activate
Then, for installing the requirements.txt:
pip install -r requirements.txt
In the main.py script you can set the netCDF files directory and the name of the output .csv file. Example data can be found in the owez folder.
from modules.Tower2csv import Tower2csv
if __name__ == "__main__":
netcdf_dir = r".\owez\10minutely" # directory of the netCDF files
save_file_path = r".\owez" # directory to save the .csv file
T = Tower2csv(netcdf_dir, save_file_path)
Once the new environment is activated, you can run the Tower2csv by this simple command line call:
python .\main.py
The Tower2csv requires two inputs:
-
netcdf_dir = Directory of the netCDF files (string).
-
save_file_path = Name of the .CSV file where the output data will be saved (string).
Data from the OWEZ offshore meteorological tower are used to exemplify the Tower2csv applicability (owez). You can find data from other sites at the following link:
https://talltowers.bsc.es/access-the-data
Now, let's continue by understanding the dataset structure using the data example which is uploaded here. When opening the owez folder, there is a subfolder called 10minutely:
The data are organized in different subfolders inside 10minutely, which are named according to the sensor type:
For instance, in the humidity-sensor folder "huragl116S1", you will see that there is one netCDF file for each month:
One output example is in owez.csv. When running the Tower2csv.py via main.py, all netCDF files from all subfolders are joined, and then, saved into a single .CSV file. Data from each sensor are stored in different comma-separated columns as follows: