Loading...
Loading...
Contributors:
Dataset URI:
10.5281/zenodo.23684658# Code and dataset for "Do the Time Constants of the Canadian Fire Weather Index System Hold in Humid Subtropical China?" This archive (Code S1 and Dataset S1 of the paper) holds the analysis and figure code behind the paper, together with the derived tables the figures and the paper's numbers are drawn from. ## What the code does The paper asks whether the time constants written into the Canadian Forest Fire Weather Index System (about 2/3 day for fine fuels, 15 days for duff, 53 days for deep organic matter) have a counterpart in humid subtropical China. The pipeline builds a daily 0.1 degree cell-day sample for Jiangxi Province over 2003-2024, trains a dilated convolutional network on 90 days of raw weather, recovers the memory kernel with integrated gradients, and cross-checks the result with three tests that do not depend on the network architecture. It also fits the fire-weather response of the two fire seasons and compares pooled against regime-specific models. ## Contents ``` README.md this file code/ 36 Python files, the analysis pipeline in run order requirements.txt package versions the results were produced with MANIFEST.csv script -> output -> figure/table mapping, machine readable LICENSE MIT dataset/ derived data (CC BY 4.0) tab_*.csv 27 tables the figures and the paper's numbers come from tab_precip_shap_share.csv share of each precipitation window in the precipitation-group SHAP (Figure 3c), transcribed from the log of 44_memory_check.py access_0p1.csv population and road covariates per 0.1 degree cell grid_mask.csv the 0.1 degree grid: cell centre, share of the cell inside Jiangxi (frac; the 1530 analysis cells have frac >= 0.5) and elevation statistics MANIFEST.csv list of the files in this archive with their sizes ``` ## Paths Every script writes to three directories that are referenced through short absolute paths at the top of the file: ```python INT = r'I:\jxwork\interim' # intermediate arrays OUT = r'I:\jxwork\out' # tables and logs FIG = r'I:\jxwork\paper2\fig' # figures ``` `I:\jxwork` was a junction to the working directory and `I:\jxdata` a junction to the raw data directory. To run the code elsewhere, edit those constants at the top of each file, or recreate the two junctions. The paths were left as they were run rather than rewritten for release, so that the deposited code is the code that produced the numbers. ## Environment Python 3.9 on Windows 10, 22 CPU threads, no GPU. The sequence models were trained on CPU. See `requirements.txt` for versions. Installation: ```bash pip install -r requirements.txt ``` `torch` is the CPU build. `captum` is needed only for the integrated-gradient scripts (42, 74, 84), `shap` only for 81, `statsmodels` and `patsy` only for 79. ## Input data None of the raw data is redistributed here. All of it is public. | Dataset | Source | |---|---| | MODIS C6.1 active fire (MCD14ML) | https://firms.modaps.eosdis.nasa.gov/download/ | | VIIRS SNPP VNP14IMG (screening cross-check only) | https://firms.modaps.eosdis.nasa.gov/download/ | | CMFD V2.0 meteorological forcing | https://data.tpdc.ac.cn/ | | CHM_PRE V2.1 daily precipitation | https://doi.org/10.6084/m9.figshare.21432123 | | MCD12Q1 V061 land cover | https://doi.org/10.5067/MODIS/MCD12Q1.061 | | 250 m NDVI and FVC over China | https://data.tpdc.ac.cn/ | | 1 km DEM of China | https://www.tpdc.ac.cn/ | | LandScan Global population | https://landscan.ornl.gov/ | | OpenStreetMap roads (ODbL) | retrieved through the Overpass API by `76_osm_roads_fetch.py` | | Jiangxi provincial boundary | provincial administrative boundary shapefile | ## Run order Scripts are numbered in the order they were run. Numbers are not consecutive because scripts that do not contribute to this paper's results are not included. **Stage 1, climate forcing and fire danger indices** | Script | Output | |---|---| | `01_extract_climate.py` | Jiangxi windows of the CMFD and CHM_PRE fields | | `06_build_fwi.py`, `fwi.py` | `jx_firewx_daily.nc`: FFMC, DMC, DC, ISI, BUI, FWI, VPD, CDD | **Stage 2, active-fire cleaning and PDWA screening** | Script | Output | |---|---| | `03_fire_prep.py` | `fire_clean.parquet`, the cleaned MODIS record | | `05_grid_mask.py` | `grid_mask.csv`, the 1530 analysis cells | | `09_fp_screen.py`, `10_persistent_px.py` | quality-threshold and pixel-recurrence screens | | `11_viirs_check.py`, `16_persistent_perpixel.py` | VIIRS cross-check of the candidate pixels | | `15_static_mask.py`, `17_persistent_nature.py` | day/night and drought-decoupling criteria | | `18_final_screen.py` | `fire_screened.parquet`, the response variable after removing 68 PDWA pixels | **Stage 3, covariates** | Script | Output | |---|---| | `28_ndvi_fvc.py`, `30_veg.py` | monthly NDVI and FVC per cell | | `35_landcover_frac.py` | `jx_lc_frac.parquet`, land-cover shares per cell | | `53_grid1km.py`, `54_grid1km_layers.py` | 1 km terrain, land cover and LandScan population grids | | `76_osm_roads_fetch.py` | OSM main roads and tracks over the Jiangxi bounding box | | `78_access_covariates.py` | `access_0p1.csv`, population and road covariates on the 0.1 degree grid | **Stage 4, analysis panel and feature matrix** | Script | Output | |---|---| | `19_panel.py` | `panel_grid_day.parquet`, 12,295,080 cell-days with indices and counts | | `36_ml_features.py` | `ml_X.npy`, `ml_cols.csv`, `ml_keys.parquet`, the 40-column feature matrix | **Stage 5, models** | Script | Output | Used for | |---|---|---| | `37_lgbm.py` | `tab_lgbm_skill.csv` | gradient boosting benchmark | | `38_tcn.py` | `tab_tcn_skill.csv` | sequence model, defines the architecture reused later | | `44_memory_check.py` | `tab_memory_univariate.csv`, `log_memcheck.txt` | Figure 3b,c; Section 3.2 | | `75_tcn_truncation.py` | `tab_tcn_truncation.csv` | Figure 3a; Section 3.2 | | `77_ablation_ci.py` | `tab_ablation_auc_ci.csv`, `tab_ablation_contrast_ci.csv`, `tab_ablation_folds.csv` | Table 4; Figure 5 | | `80_regime_models.py` | `tab_regime_split_ci.csv`, `tab_regime_split_folds.csv` | Table 6 | | `81_shap_regime.py` | `tab_shap_importance_v2.csv`, `tab_shap_dependence_v2.csv` | Figure 7; Section 3.7 | **Stage 6, memory kernel** | Script | Output | Used for | |---|---|---| | `42_memory_kernel.py` | `tab_memory_kernel.csv`, `tab_memory_depth.csv` | Figure 2a | | `74_memory_kernel_fit.py` | `tab_memory_kernel_fit.csv`, `tab_memory_kernel_boot.csv`, `tab_memory_kernel_shape.csv`, `tab_memory_kernel_window_sensitivity.csv` | Table 2; Figure 2b,c | | `84_kernel_arch_check.py` | `tab_memory_kernel_arch.csv` | Table 3; Section 3.1 | **Stage 7, regime tests** | Script | Output | Used for | |---|---|---| | `79_regime_shape_test.py` | `tab_matched_fwi_ci.csv`, `tab_regime_saturation_ratio.csv`, `tab_regime_highfwi_slope.csv`, `tab_regime_trend_highfwi.csv` | Table 5; Figure 6b,c | | `83_common_bin_rates.py` | `tab_common_bin_rates.csv` | Figure 6a | **Stage 8, figures** | Script | Output | |---|---| | `86_paper2_figs_en.py` | Figures 2, 3, 5, 6, 7 as PNG and vector PDF | | `87_paper2_maps_en.py` | Figures 1 and 4, plus `tab_cell_best_window.csv` and `tab_cell_window_map.csv` for Section 3.3 | ## Reproducing the figures without rerunning the pipeline The full pipeline needs the raw datasets and produces about 4 GB of intermediates. To redraw the figures from the deposited tables instead, set the environment variable `P2_OUT` to the `dataset/` folder (and `P2_FIG` to an output folder) and run `86_paper2_figs_en.py`. `87_paper2_maps_en.py` computes per-cell statistics from the feature matrix and therefore needs the pipeline to have run; its results are deposited in `dataset/` as `tab_cell_best_window.csv` and `tab_cell_window_map.csv`. ## Runtime On the machine described above, indicative wall-clock times: | Step | Time | |---|---| | `06_build_fwi.py` | ~10 min | | `36_ml_features.py` | ~15 min, writes a 2 GB array | | `38_tcn.py` | ~25 min, five folds on CPU | | `75_tcn_truncation.py` | ~2 h, five input lengths by five folds | | `77_ablation_ci.py` | ~10 min including the 2000-replicate bootstrap | | `79_regime_shape_test.py` | ~20 min | | `81_shap_regime.py` | ~40 min | | `84_kernel_arch_check.py` | ~8 min | ## Notes and caveats `54_grid1km_layers.py` has a third section that rasterises OSM power lines. That layer is not used by this paper. The script will stop there if the power-line extract is absent; run the first two sections, which produce the land cover and population grids this paper needs. `30_veg.py` also carries out a vegetation analysis that is not used by this paper. Only its `jx_veg_monthly.parquet` output feeds this pipeline. `42_memory_kernel.py` trains and caches an interpretation model as `tcn_interp.pt` if the file is absent, and `74` and `84` reuse it. Seeds are fixed, but results on a different BLAS or PyTorch build may differ in the last decimal place. `76_osm_roads_fetch.py` queries a live Overpass endpoint. The network changes over time, so a rerun will not return byte-identical data to the extract used in the paper. ## Changes in v1.1 (submission to *Fire*) The two figure scripts were updated to match the submitted figures; no number changed. - `87_paper2_maps_en.py`: the maps (Figures 1 and 4) have a full frame, a north arrow and a 100 km scale bar. - `86_paper2_figs_en.py`: the legend of Figure 2b gives the point estimate of *tau* from Table 2 instead of the bootstrap median (summer-autumn 1.85 d instead of 1.84 d); the dependence curves of Figure 7c are averaged over the three settings after interpolation to a common grid (grouping on raw x values had mixed the settings into a jagged line); the x axis of Figure 7c is labelled as the covariate value scaled to 0-1. - Both scripts read the output folders from the environment variables `P2_OUT` and `P2_FIG` when they are set. The script file names keep their working names (P2F1 ... P2F7); in the paper they are Figure 2 (P2F1), Figure 3 (P2F2), Figure 5 (P2F3), Figure 6 (P2F4), Figure 7 (P2F5), Figure 1 (P2F6) and Figure 4 (P2F7). ## What is deliberately not included Manuscript production code (Markdown to Word and PDF conversion, document property handling), reference verification utilities, and the Chinese-language variants of the figure scripts are not part of this deposit, because they produce the document rather than the results. Analyses that do not feed this paper are also excluded. ## License Code is released under the MIT License (`code/LICENSE`). The derived data in `dataset/` are released under CC BY 4.0. Redistribution terms of the input datasets are those of their respective providers; OpenStreetMap data is ODbL.
Keyword(s):
MeSH Term(s):
Grants and Funding:
No Grants or Funding Data Available
Associated Publication(s):
No Associated Publication Data Available
Supplementary Data:
No Supplementary Data Available
Related Dataset(s):
No Related Dataset Data Available
The National Library of Medicine (NLM) provides information about biomedical datasets. Inclusion on an NLM Web page does not imply endorsement of, or agreement with, the contents by NLM or the National Institutes of Health. Learn more: NLM Web Policies (nih.gov)