Key Observations

In 2021, the top 5 states with the highest number of fire incidences were as follows:

  • Punjab had the highest number of fire incidences, with 1,77,000 - a majority of these were caused by man-made stubble burning during the winter season.

  • Madhya Pradesh had 1,43,923 fire incidences.

  • Odisha had 1,03,919 fire incidences.

  • Chhattisgarh had 87,437 fire incidences.

  • Maharashtra had 75,543 fire incidences.

Fires peak in March and April for Madhya Pradesh, Odisha, Chhattisgarh, and Maharashtra, coinciding with the forest fire season in India.

While the media covers the crop-burning season in Punjab extensively every year, there is a complete lack of coverage on other types of fire incidences, such as forest fires. One primary reason for this lack of coverage is that forest fires in India are generally considered one-off instances and not a regular phenomenon.

To highlight this problem, we have written this tutorial which will teach you how to make API calls on our forest fire dataset to get relevant data and analyze the forest fire-prone areas in India in 2021.


You will need the following to complete this tutorial.

  • Python

  • Jupyter Notebook

  • Python Packages (Requests, Pandas, Plotnine)

If you need help with installing or setting up Python or Jupyter Notebook, please refer to our previous tutorial, where we have explained this in detail.

Open your Terminal and then type plotnine

pip install requests
pip install pandas
pip install plotnine

Getting the data

  • Start your Jupyter notebook. You do this by going to the Terminal and typing jupyter notebook.

  • Once the notebook opens, start by importing a few python packages.

    # This package helps you reach out to the API
    import requests 
    # This package is necessary to ensure you receive data in a JSON format
    import json 
  • Once the packages are imported, review our documentation to determine the endpoint for getting data on fire incidences. According to the documentation, the data you are looking for is at the below-mentioned endpoint.{INSERT YOUR KEY HERE}
  • Enter the following parameters in the endpoint.

    params = {
        "api-key": "#INSERT YOUR KEY HERE", 
          # Enter your API key
        "region": "India",  # Enter a place or region name
        "spaceBucket": "state",  # Enter whether it is a district or a state
        "startDate": "2021-01-01T00:00:00.000Z",
        "endDate": "2021-12-31T00:00:00.000Z",
        "timeBucket": "1m",
        "filter": "source:VIIRS",

    The above parameters are for getting data on fires for the whole of India at a state level between the 1st January 2021 and 31st of December 2021. You can filter further to choose a particular satellite as the data source. For this tutorial, we have chosen VIIRS because it provides high-resolution satellite imagery and can capture small and low-temperature fires. You can read more about VIIRS here.

  • Make your API call in the following manner.

    #Making an API call and displaying the output.
    request=requests.get("", params = paramas).json()
    print(json.dumps(request, indent=2))
  • You will receive the following output.

    HTTP/1.1 200 OK
    Content-Type: application/json
      "data": [
          "state": "Madhya Pradesh",
          "fires": "3051",
          "co2_emission_estimate": "389507.1330",
          "frp": "4.5385447394296952",
          "datetime": "2021-01-12T00:00:00.000Z"
          "state": "NCT of Delhi",
          "fires": "20",
          "co2_emission_estimate": "574.0810",
          "frp": "1.5345000000000000",
          "datetime": "2021-12-08T00:00:00.000Z"
      "meta": {
        "startTime": "2021-01-01T00:00:00.000Z",
        "endTime": "2021-12-31T23:59:59.999Z",
        "region": "India"

    The above output contains the number of fires, an estimation of CO2 emissions from these fires, and the average fire radiative power (”FRP”)(an indicator of the intensity of fires). In this tutorial, you will work with fire incidence. CO2 emissions and FRP will be covered in a different tutorial in the future.

Formatting Data for Analysis

To analyse the above data, you need to convert it into a pandas dataframe which can be done by following the below-mentioned steps.

  • Import pandas.

    import pandas as pd
  • Convert the JSON object into a dataframe.

    df = pd.DataFrame(request['data'])
  • Inspect the dataframe using df.head(), which will give you a table with the following columns - state, fires, co2_emission_estimate, and average frp values.

    Top 5 rows in the generated output show fires, CO2 emissions, and FRP values for Madhya Pradesh.

    Top 5 rows in the generated output show fires, CO2 emissions, and FRP values for Madhya Pradesh.

  • The table looks great. However, as pandas convert the numbers to strings, this needs to be reconverted back into numbers to analyze. To do this, you have to input the following code.

    df['datetime'] = pd.to_datetime(df['datetime']) #This converts the datetime column to a date format
    df['MY']=df['datetime'].dt.strftime('%m/%Y') #This generates a new column with the month and the year
    df['fires'] = pd.to_numeric(df['fires']) #This converts the fires column into a number
    df['co2_emission_estimate'] = pd.to_numeric(df['co2_emission_estimate']) #Likewise
    df['frp'] = pd.to_numeric(df['frp']) #Likewise

    The above code converts the date column into a DateTime format and the other columns into numbers.

Counting the Number of Fires and Plotting Them

  • Once the data is ready, you will create a table that shows the total number of fires for every month and every state. You make a pivot table that plots states and the sum of fires in them.

    pd.pivot_table(df, values='fires', index='MY', columns='state', aggfunc='sum', dropna=True)

The total number of fires for all Indian states for 2021.

The total number of fires for all Indian states for 2021.

Analysing the data with visualisations

One way to analyse the above data is with a chart. To make a chart, the first step is to import the following packages.

import plotnine #This is the plotting library being used to plot a chart
from plotnine import *
from mizani.breaks import date_breaks #The following two packages assist with some formatting in the chart
from mizani.formatters import date_format

You can plot the total number of fires that have happened across states in the country in 2021 by using the following code. Plotnine is a graphing/charting library that helps you plot. Read here for more details about the library.

#We plot the date and the number of fires at a state level
display(ggplot(df, aes('datetime', 'fires')) + geom_line()
        + facet_wrap('state', nrow=11, ncol=3)
        + scale_x_datetime(breaks=date_breaks('1 month'),
        labels=date_format('%m')) + theme(figure_size=(10, 20)))

Statistical Representation for all Indian states in 2021.

Statistical Representation for all Indian states in 2021.


  • A glance at these charts will show you that Punjab, Madhya Pradesh, Odisha, and Chhattisgarh see massive fire seasons.

  • In the case of Punjab, the fire peaks from October to December, i.e., when stubble burning occurs.

  • In the case of forest-heavy states like Chhattisgarh, Madhya Pradesh, and Odisha - the fires peaked from February to April - which is the wildfire season.

For our following tutorial, we will closely examine Madhya Pradesh - a state whose fire problem is not discussed enough. The state had nearly 150,000 fires in 2021 - most of which happened in the forested southern parts - a region that is home to some of India’s most pristine forests and national parks. Monitoring these fires is essential and crucial to protecting our biodiversity.