ruisdael-observatory / disdroDL

disdrometer data logger to NetCDF
GNU General Public License v3.0
0 stars 0 forks source link

DOI

tests

Repository wiki

Disdrometer data logging software

disdroDL is a Python software for logging data from the OTT Parsivel2 and Thies Clima optical disdrometers and export it to 24-hours NetCDF files. It was developed at TU Delft, within the framework of the Ruisdael Observatory.

_Parsivel2 disdrometer in the Cabauw tower, Netherlands. The signal attenuation caused by raindrops falling through the laser beam between the two plates can be used to estimate the size and velocity of hydrometeors._

Parsivel2 disdrometer in the Cabauw tower, Netherlands.

One of the key aspects in disdroDL is the decision to separate code logic from the NetCDF structure and metadata. During the creation of the NetCDFs, a Parsivel general yaml file or a Thies general yaml file containing the description of Parsivel/Thies telegram variables and dimensions, that is applicable to all the Parsivel/Thies devices; is combined with site-specific metadata files that describe the variable components of the metadata such as location, name, etc.

The software features a main script (main.py) for setting up a serial connection with the disdrometers, requesting data at regular time intervals, and storing the Telegram data in a local sqlite3 database file. And an export script (export_disdrodlDB2NC.py) that exports 1 day of disdrometer data, from the database onto a NetCDF file.

What data is included in the NetCDF depends on the configuration files and whether the exported netCDF is a light or full version (described in Outputs). The NetCDF files are self-descriptive, and include metadata information about dimensions, variables names and units.

The structure of the NetCDF file depends on the sensor type and two configuration files, a general and site-specific one. The general configuration files configs_netcdf/config_general_parsivel.yml and configs_netcdf/config_general_thies.yml are applicable to all sensors of the same type, while the specific configuration files, 1 file per sensor (in configs_netcdf/), describe the variable components such as site names, coordinates, etc.

The Parsivel2 measures the drop number concentrations for different diameter/velocity bins, with a temporal resolution of 1 minute. These raw spectra can be used to calculate many different state and flux variables, such as liquid water content, rainfall rate, mean drop diameter, radar reflectivity and kinetic energy.

Conventions

Requirements

If you have run a previous version of disdroDL, you might need to update the database schema. To do this, run the following script: python upgrade_db.py --config config_*.yml Make sure you run this script with the same config file that was used to run the previous version of disdroDL.

Manufacturers' Documentation:

Run scripts

Manually:

As Linux Systemd Service:

Outputs

Light vs full netCDFs

netCDF output

Note that some of the fields sent by the Parsivel are discarded during the creation of the NetCDF file. For example, all the 16bit fields are discarded and only the 32bit values are stored. Rainfall accumulation (field 24) is discarded because it is relative to an unknown starting time and can be re-calculated from the rain rate. Sensor time/date (fields 20-21) are replaced by the actual time (in UTC) of the computer running the logging software. This is more reliable than to use the internal clock of the Parsivel which can drift over time. Sample interval (field 9) is ignored, because it can be inferred from the time difference between successive measurements.

No quality control is applied to the output.

The NetCDF files are automatically compressed.

Software Operational Principals

main.py (often as service, see example disdrodl.service)

export_disdrodlDB2NC.py

disdrodl.service - Linux's systemd service file responsible for running main.py as a service

Auxiliary scripts

parse_disdro_csv_or_txt.py

Parser for historical Ruisdael's OTT Parsivel CSVs. Converts CSV to netCDF

For more information CONVERSIONS.md

Run: python parse_disdro_csv_or_txt.py -c configs_netcdf/config_007_CABAUW.yml -i sample_data/20231106_PAR007_CabauwTower.csv

Tests

run: pytest -s

Tests are run Github Actions. See .github/workflows/test_n_lint.yml

Debugging Serial communication

with 2 different screens (use tmux multiplexer or 2 different shells)

terminal one: listen to serial port tail -f /dev/ttyUSB0

terminal two: send commands to serial port echo -en "CS/L\r" > /dev/ttyUSB0

Authors

disdroDL is developed in the context of the Ruisdael Observatory by

License

GPLv3. See LICENSE