Created: Tuesday 31 January 2017 | github.com/rhyswhitley/fire_limitation |
In [1]:
# data munging and analytical libraries
import re
import os
import numpy as np
import pandas as pd
# graphical libraries
import matplotlib.pyplot as plt
import matplotlib.pylab as pylab
# default plot settings for notebook
from IPython.core.pylabtools import figsize
figsize(11, 9)
plt.style.use('ggplot')
%matplotlib inline
dataPath = "../data/globfire.csv"
In [2]:
DATAPATH = os.path.expanduser(dataPath)
fd = pd.read_csv(DATAPATH)
In [3]:
def ignition(lightning, pasture_area, pop_density, kp, kd1):
"""
Definition for the measure of ignition
"""
return lightning + kp*pasture_area + kd1*pop_density
def supression(crop_area, pop_density, kd2):
"""
Definition for the measure of fire supression
"""
return crop_area + kd2*pop_density
def np_sigmoid(x, a, b):
"""
Sigmoid function to describe limitation using tensor
"""
return 1.0/(1.0 + np.exp(a*x + b))
Determine the ignition and supression covariates as per the model documentation
In [4]:
fd['ignite'] = ignition(fd["lightning_ignitions"].values, \
fd["pasture"].values, \
fd["population_density"].values, \
500, 10)
fd['suppress'] = supression(fd["cropland"].values, \
fd["population_density"].values, \
10)
In [5]:
def pltVsFire(x, xlab):
plt.plot(x, fd.fire, 'o', alpha = 0.01)
plt.ylabel("Burnt area fraction")
plt.xlabel(xlab);
In [6]:
pltVsFire(fd.NPP, "NPP weight per area");
plt.xscale('log')
In [7]:
pltVsFire(fd.alpha, "Alpha")
In [8]:
pltVsFire(fd.lightning_ignitions, "lightning strikes")
plt.xscale('log')
In [9]:
pltVsFire(fd.cropland, "Crop cover")
In [10]:
pltVsFire(fd.pasture, "Pasture")
In [11]:
pltVsFire(fd.population_density, "Population Density")
plt.xscale('log')
In [ ]: