-
Notifications
You must be signed in to change notification settings - Fork 0
Usage: Python App
The recommended way to run BUVIC is to use docker but it is also possible to run BUVIC directly as a python app. Note that you will probably need docker anyway to execute LibRadtran.
BUVIC requires python >= 3.7 and the libraries listed in requirements.txt. These libraries can be installed with the pip command:
pip install -r requirements.txt
In addition, you will need docker to execute LibRadtran. It might be possible to edit the file libradtran_command.py to use a direct installation of LibRadtran but this has not been tested.
The directory structure required is the same as for docker.
Both folders instr and uvdata must be in the same directory which we will call input directory.
By default, the input directory is data and the output_dir folder is at out.
The following environment variables are supported:
-
DARKSKY_TOKEN: your darksky.net token
Start the application with the command:
python run.pyIt is possible to run BUVIC in the terminal without a GUI. The command line offers 3 different possibilities to perform irradiance calculations.
- Calculate for dates and brewer id
- Calculate for given files
- Calculate for all files of a given directory
- Watch a directory for new/changed files and convert them automatically
Instructions:
Help about the command line can be shown with:
python run_cmd.py -h
or
python run_cmd.py --help
which yields the result:
usage: run_cmd.py [-h]
(--dates-and-brewer-id DATE_START DATE_END BREWER_ID | --paths UV_FILE B_FILE UVR_FILE ARF_FILE | --all | --watch)
[--input-dir INPUT_DIR] [--output-dir OUTPUT_DIR]
[--config CONFIG]
Brewer UV Irradiance Calculator
optional arguments:
-h, --help show this help message and exit
--dates-and-brewer-id DATE_START DATE_END BREWER_ID, -d DATE_START DATE_END BREWER_ID
The dates, in iso format (e.g. 2019-03-24, and the id
of the brewer to get the data from
--paths UV_FILE B_FILE UVR_FILE ARF_FILE, -p UV_FILE B_FILE UVR_FILE ARF_FILE
The paths to the files. UV_FILE: The file containing
the raw uv measurements. B_FILE: The file containing
the ozone measurements. UVR_FILE: The UVR file
containing calibration data. ARF_FILE: The file
containing the arf data
--all Finds and converts all UV files in the input directory
--watch, -w Watches the input directory for file changes and
automatically converts changed UV files
--input-dir INPUT_DIR, -i INPUT_DIR
The directory to get the files from. It must contain
two subdirectories called 'instr' and 'uvdata'
--output-dir OUTPUT_DIR, -o OUTPUT_DIR
The directory to save the results in
--config CONFIG, -c CONFIG
The path to the setting file to use
The options --days-and-brewer-id, --paths, --all and --watch correspond to the 4 different ways to run the tool and only one can be used at a time.
The options --input-dir, --output-dir and --config are optional parameters and can be used with any of the 3 options cited above.
If not specified, default values will be used.
More info about setting file can be found on the wiki page Settings.
This command search for measurements between two dates for a brewer id from a preset of files.
The dates are given in iso format yyyy-mm-dd
Examples:
Run the calculation for brewer 070 on June 24th, 25th and 26th and write the output in the output_files directory:
python run_cmd.py --days-and-brewer-id 2019-06-24 2019-06-26 070 --output-dir output_files/ --config settings.json
Note that if --input-dir (or -i) is not specified, the measurement files will be taken from data/.
This command executes the calculation for four given measurement files:
- UV File: Raw uv measurements
- B File: For ozone measurements
- UVR File: The instrument calibration data
- ARF File: The angular response of the instrument
Examples:
Run the calculation for the four files in the directory my_measurement_files:
python run_cmd.py --input-dir my_measurement_files/ --paths UV17519.070 B17519.070 UVR17319.070 arf_070.dat
Note that if --input-dir (or -i) is not specified, the file paths are relative to the working directory.
Find all pair of UV and B files in a directory and run calculations for each them. Calculations will be skipped if UVR and ARF files are not available.
Examples:
Run the calculations for all the files found in the data directory and write the output to the output directory:
python run_cmd.py --all -i data/ -o output/
Note that if --input-dir (or -i) is not specified, the file paths are relative to the working directory.
Monitor a directory for new files and run the calculation for every new/modified UV file. Calculations will be skipped if UVR file is not available.
Examples:
Watch the directory measurements for new files:
python run_cmd.py --watch --input-dir measurements/
Note that if --input-dir is not specified, the measurement files will be taken from data/.