This repository contains a series of R scripts and functions developed to analyze and visualize spatio-temporal patterns of fires and weather extremes in Mato Grosso do Sul (MS), Brazil. The primary focus is on understanding the environmental drivers—particularly in the Pantanal region, one of Brazil’s most fire-prone biomes—and how extreme weather events, such as prolonged droughts and elevated temperatures, may be associated with increased fire occurrences.
Note: This project is a work in progress. Further analyses—such as refined station selection based on continuous data coverage and advanced econometric investigations to determine causality—are underway.
-
Fire Mapping & Density Analysis:
Generate spatial maps and heatmaps of fire occurrences using data from 2017, 2018, and 2021. These years were chosen because they include periods when fire activity in the Pantanal and adjacent MS biomes peaked. -
Weather and Drought Trends:
Analyze weather trends by summarizing extreme temperature events (days above 35°C) and extended drought periods (30+ consecutive days without precipitation) using INMET data. -
Data Consistency Assessment:
Evaluate the temporal consistency of weather stations to restrict analyses to those with reliable, long-term records.
Over recent years, the Pantanal and other biomes in MS have experienced a notable increase in fire events. Climatic factors—such as extended dry spells and rising temperatures—are believed to contribute to this trend. Although our initial analyses reveal correlations between these environmental conditions and fire incidents, further econometric studies are necessary to rigorously establish causality.
-
Data Acquisition & Preparation:
- 00_setup.R: Loads and installs required packages.
- 01_import_data.R: Imports raw data from online repositories.
- 02_clean_data.R: Cleans and preprocesses the fire and weather datasets.
-
Data Processing:
- 03_process_fires.R: Converts fire incident data into a spatial format.
- 04_process_weather.R: Aggregates weather data and identifies extended drought periods as well as available data from weather stations.
-
Visualization:
- 05_visualize_fires.R: Generates annual fire maps and density heatmaps.
- 06_drought_trend.R: Analyzes and visualizes trends in extended drought periods.
- 07_weather_trends.R: Analyzes and visualizes trends in extreme temperature days.
-
Helper Functions (located in
code/functions/):- create_fire_map.R: Constructs fire location maps.
- create_heatmap.R: Creates fire density heatmaps.
- plot_drought_trend.R: Plots the evolution of extended drought periods.
- plot_temperature_trend.R: Plots trends in extreme temperature days.
All plots are saved as PDF files in the output folder. Below are the primary visualizations along with their scientific interpretations:
These maps display the spatial distribution of fire incidents across MS for key years:
-
2017 Fires

Total fires: 5,737
Interpretation: The map shows a significant concentration of fire spots in areas corresponding to the Pantanal region, indicating heightened fire activity during 2017. :contentReference[oaicite:0]{index=0} -
2018 Fires

Total fires: 2,380
Interpretation: Compared to 2017, 2018 exhibits fewer fire events, though spatial clustering suggests that certain regions consistently experience elevated fire risks. :contentReference[oaicite:1]{index=1} -
2021 Fires

Total fires: 9,377
Interpretation: The 2021 map indicates an even higher incidence of fires, with a broader distribution across the state. This surge may reflect a combination of climatic extremes and other environmental stressors. :contentReference[oaicite:2]{index=2}
Heatmaps provide a density-based view of fire occurrences, highlighting hotspots:
-
2017 Fire Density

Interpretation: High fire density areas are clearly demarcated, particularly within the Pantanal region, reinforcing the spatial patterns observed in the fire maps. :contentReference[oaicite:3]{index=3} -
2018 Fire Density

Interpretation: The 2018 heatmap shows lower overall density compared to 2017, though the focal areas of activity remain consistent. :contentReference[oaicite:4]{index=4} -
2021 Fire Density

Interpretation: In 2021, the heatmap reveals broader and more intense areas of fire density, which may be associated with extreme weather conditions. :contentReference[oaicite:5]{index=5}
- Stations Through Time

Interpretation: This visualization highlights the presence/absence of weather stations across the study period. Consistent station data are crucial for robust temporal analyses of weather trends. :contentReference[oaicite:6]{index=6}
-
Temperature Trend

Interpretation: The plot displays the annual count of days with maximum temperatures exceeding 35°C. An upward trend in extreme heat events is observable over time; however, further econometric analysis is necessary to evaluate causal links. :contentReference[oaicite:7]{index=7} -
Drought Trend

Interpretation: This plot shows the evolution of extended drought periods (30+ consecutive days without rain) over the years. Variability in the proportion of stations experiencing multiple drought spells indicates that drought severity and frequency have not been uniform over time. :contentReference[oaicite:8]{index=8}
-
Data Acquisition & Preparation:
Raw data from fire (INPE) and weather (INMET) sources are downloaded and processed. Preprocessing includes merging weather data with station metadata and converting fire data to spatial formats. -
Visualization & Spatial Analysis:
Fire maps and heatmaps are generated using spatial visualization libraries (e.g., sf, ggplot2, rnaturalearth). These visualizations help identify spatial clusters and trends in fire occurrences. -
Weather and Drought Trends:
Daily weather data are aggregated to capture extreme temperature events and drought spells. The derived trends are visualized to illustrate long-term shifts in weather patterns in MS. -
Future Analysis:
A crucial ongoing task is refining the weather station selection to include only those with continuous data. Additionally, while initial correlations between weather extremes and fire occurrences have been observed, rigorous econometric analyses are planned to investigate causality.
- R (version ≥ 4.0)
- Required R packages:
tidyverse,sf,ggplot2,lubridate,ggthemes,geobr,viridis, among others (see00_setup.R).
- Setup:
Run00_setup.Rto install and load all necessary packages. - Data Import:
Execute01_import_data.Rto download or load existing data. - Data Cleaning & Processing:
Run02_clean_data.Rfollowed by03_process_fires.Rand04_process_weather.R. - Visualization:
Generate the fire maps, heatmaps, and weather trend plots by running05_visualize_fires.R,06_drought_trend.R, and07_weather_trends.R.
Each script produces outputs in the input or output folders, and all generated PDFs can be viewed for further analysis.
- Enhanced Station Filtering: Further refine the dataset to include only those weather stations with consistent, long-term data.
- Causal Analysis: Employ advanced econometric techniques to rigorously test causal relationships between climatic variables and fire occurrences.
- Interactive Visualizations: Develop interactive dashboards for more dynamic exploration of the data.
This project is released under the MIT License.