This repository contains a Python package designed for postprocessing outputs from the WRF model within the context of the Agrilac project.
- Extract variables from WRF model outputs in NetCDF format.
- Convert extracted variables into daily raster images.
- Generate PNG images from the transformed raster data for visualization and analysis.
- Python >=3.9
- Dependencies listed in requirements.txt
You should create a env to run the code and install the requeriments. Run the following commands in the prompt
pip install virtualenv
venv env
pip install -r requirements.txt
To use this package as a library in your Python projects, install it via pip:
pip install git+https://github.com/CIAT-DAPA/agrilac_wrf_postprocessing
Configure input and output paths before running the script:
-
-i, --inputs: Path to directory containing WRF model output NetCDF files. Within the path you should have 3 folders wrf/ where the NedCDF files will be, shapefile/ where the shapefiles will be to divide the map and data/ where the logo will be and the folder ranges/ with the color ranges of each variable.
-
-o, --outputs: Path where processed raster and PNG files will be saved.
Note
You can copy the content of the data folder found in this repository into the input path that you will pass as a parameter to follow the folder format and add the wrf folder with the NedCDF files.
Run the script wrf_postprocessing with the following parameters:
wrf_postprocessing -i "/path/to/input/" -o "/path/to/output/"
-i, --inputs: Path to directory containing WRF model output NetCDF files. -o, --outputs: Path where processed raster and PNG files will be saved.
wrf_postprocessing -i "/home/user/data/WRF_outputs" -o "/home/user/data/processed_outputs"
This command processes NetCDF files from /home/user/data/WRF_outputs, converts them into daily raster images, and saves the resulting PNG files in /home/user/data/processed_outputs.