This tool processes NC files, either directly or within PJNZ files, updating coverage rates based on a provided configuration.
- Python 3.6 or higher
- Required Python packages (install via
pip install -r requirements.txt
):- csv
- json
- logging
- typing
- zipfile
.
├── src/
│ ├── main.py
│ └── nc_processor.py
├── data/
│ ├── constants.csv
│ └── mapped_risk_ids.csv
├── config/
│ └── your_config_file.json
├── tmp/
│ └── (output files will be saved here)
└── README.md
The tool can be used in two modes:
To process a PJNZ file, extracting and updating its NC content:
python -m src.main pjnz <path_to_pjnz_file> <path_to_config_file>
Example:
python -m src.main pjnz ./data/example.PJNZ ./config/all_scenarios.json
To process an NC file directly:
python -m src.main nc <path_to_nc_file> <path_to_config_file>
Example:
python -m src.main nc ./data/example.NC ./config/all_scenarios.json
This repository contains scripts for processing configuration templates and generating outputs. Here's a quick guide on how to use it:
create_and_run_configurations.sh
: The main shell script that orchestrates the entire process.scripts/create_configurations.py
: Python script for creating configurations from templates.scripts/batch_individual_json_configs.sh
: Shell script for processing individual JSON configs.
-
Open a terminal and navigate to the repository root.
-
Run the main script:
./create_and_run_configurations.sh
-
Follow the prompts to select a configuration template.
- The script lists available templates from
./templates/*.json
. - You select a template.
- The script runs
python -m scripts.create_configurations
with your selected template. - It then processes the baseline configurations using
./scripts/batch_individual_json_configs.sh
. - Finally, it processes the scaleup configurations using the same script.
- Templates:
./templates/*.json
- Output:
./config/{scenario}/{config_type}/
- Ensure all scripts are executable (
chmod +x script_name.sh
). - Check that Python and required dependencies are installed.
- Make sure your template JSON files are in the
./templates/
directory.
Remember, this script automates the entire process from template selection to final output generation. If you need to run individual steps, you can use the component scripts directly.
The tool will generate the following outputs in the ./tmp
directory:
- For PJNZ processing: An updated PJNZ file and a log file
- For direct NC processing: An updated NC file and a log file
Output files are named based on the input file or configuration file name.
The configuration file (JSON format) should specify:
- Treatment associations
- Prevention associations
- Risk factors
Refer to the existing configuration files in the config/
directory for the correct structure.
Ensure that constants.csv
and mapped_risk_ids.csv
are present in the data/
directory. These files are used for lookups during processing.
Detailed logs of the processing are saved alongside the output files in the ./tmp
directory.
For bug reports or feature requests, please open an issue on the project's GitHub repository.