<jupyter_start><jupyter_text>Created: Tuesday 31 January 2017github.com/rhyswhitley/fire_limitationQuantifying the uncertainity of a global fire limitation model using Bayesian inferencePart 3: Data visualisation1,* <NAME>, 2 <NAME>, 3, 4 <NAME>, 1 <NAME>,5 Rhys Whitley1 Centre for Ecology and Hydrology, Maclean Building, Crowmarsh Gifford, Wallingford, Oxfordshire, United Kingdom2 Vrije Universiteit Amsterdam, Faculty of Earth and Life Sciences, Amsterdam, Netherlands3 Met Office United Kingdom, Exeter, United Kingdom4 Geography, University of Exeter, Exeter, United Kingdom5 Natural Perils Pricing, Commercial & Consumer Portfolio & Pricing, Suncorp Group, Sydney, Australia  Load libraries<jupyter_code># 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"<jupyter_output><empty_output><jupyter_text>Import data<jupyter_code>DATAPATH = os.path.expanduser(dataPath)

fd = pd.read_csv(DATAPATH)<jupyter_output><empty_output><jupyter_text>Function definitions<jupyter_code>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))<jupyter_output><empty_output><jupyter_text>Extra model covariates determined Determine the ignition and supression covariates as per the model documentation<jupyter_code>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)<jupyter_output><empty_output><jupyter_text>Data viz below  Base Data<jupyter_code>def pltVsFire(x, xlab):
    plt.plot(x, fd.fire, 'o', alpha = 0.01)
    plt.ylabel("Burnt area fraction")
    plt.xlabel(xlab);
pltVsFire(fd.NPP, "NPP weight per area");
plt.xscale('log')
pltVsFire(fd.alpha, "Alpha")
pltVsFire(fd.lightning_ignitions, "lightning strikes")
plt.xscale('log')
pltVsFire(fd.cropland, "Crop cover")<jupyter_output><empty_output><jupyter_text>Secondary Data<jupyter_code>pltVsFire(fd.pasture, "Pasture")
pltVsFire(fd.population_density, "Population Density")
plt.xscale('log')<jupyter_output><empty_output>
{'fraction_non_alphanumeric': 0.10598591549295774, 'fraction_numerical': 0.013732394366197184, 'mean_word_length': 5.285398230088496, 'pattern_counts': {'":': 0, '<': 29, '<?xml version=': 0, '>': 29, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'chain_length': '6', 'dir': 'jupyter-structured-clean-dedup', 'id': '600021', 'license': 'BSD-3-Clause', 'n_tokens_mistral': 983, 'n_tokens_neox': 913, 'n_words': 231, 'path': 'notebooks/data_viz.ipynb', 'repo_name': 'rhyswhitley/fire_limitation', 'size': '2877'}