This package provides R scripts for exporting active fire data ( VNP14 and VNP14IMG ) to text files compatible with PREP-CHEM-SRC.
PREP-CHEM-SRC is a preprocessor of trace gas and aerosol emission fields for regional and global atmospheric chemistry models (Freitas et al., 2011). In other words, it’s a numerical tool developed at the National Institute for Space Research in Brazil (INPE) whose function is to estimate atmospheric pollutant emissions from biomass burning, photosynthesis, or other forest transformation processes, such as combustion of oil-based products by vehicles or industry, charcoal production, etc. PREP-CHEM-SRC can be downloaded from here, and its guide is available here.
Regarding the input data (VNP14 & VNP14IMG), their user’s guide is available here. These products correspond to the Soumi National Polar-Orbiting Partnership Visible Infrared Image Radiometer Suite S-NPP/VIIRS at 375(VNPIMG) and 50 (VNP) meter resolutions. Their data sets are available online for download (VNP14, VNP14IMG ).
You can install the development version of processactivefires from GitHub with:
# install.packages("pak")
pak::pak("albhasan/processactivefires")Active fire data products are freely available online: VNP14, VNP14IMG. They can be downloaded using the Command-line Interface (CLI) as follows:
For VNP14:
wget -e robots=off -m -np -R .html,.tmp -nH --cut-dirs=3 "https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/5200/VNP14/" --header "Authorization: Bearer INSERT_EDL_TOKEN_HERE" -P .For VNP14IMG:
wget -e robots=off -m -np -R .html,.tmp -nH --cut-dirs=3 "https://ladsweb.modaps.eosdis.nasa.gov/archive/allData/5200/VNP14IMG/" --header "Authorization: Bearer INSERT_EDL_TOKEN_HERE" -P .To get an Earthdata Download Token (EDL), open a new account by following this link.
This package implements the function get_file_metadata that gathers the data required by process_data, which exports the active fires to a text file:
library(processactivefires)
f_md <- get_file_metadata("VNP14.A2015248.0048.002.2023145142000.nc")
process_data(
x = f_md$file_path,
adate = f_md$adate,
file_out = paste0(f_md$file_path, ".txt"),
var_names = VAR.NAMES.375,
fire_codees = FIRE.CODES
)This package also provides executable R scripts, which are available here.
The main script, which is called processor.R, can be called directly from the Command-line Interface (CLI). This enables users with no knowledge of R, to export data, as follows:
Rscript --vanilla processor.R --file /home/myuser/data/VNP14.A2015248.0048.002.2023145142000.nc --resolution 750 --out /home/myuser/resultsIt is also possible to use the operating systems tools to process files
in batch, or even, in parallel, usign GNU
Parallel. The following lines of
bash find all the data files under the data directory and process them
in parallel using 16 jobs:
find /home/myuser/data -type f -iname "*.nc" | parallel -j16 Rscript --vanilla ./processor.R --resolution 750 --out /home/myuser/results --file {}We also provide an script to process data files sequentially, called run_sequentially.R, which you can modify to fit your purposes. It runs a loop over the data files calling processor.R on each of them.
[1] S. R. Freitas et al., “PREP-CHEM-SRC – 1.0: a preprocessor of trace gas and aerosol emission fields for regional and global atmospheric chemistry models” Geosci. Model Dev., vol. 4, no. 2, pp. 419–433, May 2011, doi: 10.5194/gmd-4-419-2011.