In [1]:
#import the modules you need
import numpy as np
from IPython.display import Image
print "Let's run some numbers on palm oil!"
Let's run some numbers on palm oil!
In [2]:
Image(url = 'https://upload.wikimedia.org/wikipedia/commons/8/8d/Oilpalm_malaysia.jpg', width=227, height=170)
Out[2]:
In [3]:
willing = .15;         # percent increase you're willing to pay
price = 7.995;         # price for 1 L palm oil on amazon.com
nL = 0.473176          # how many liters you buy (16 fluid oz = 0.473176 L)
In [4]:
# Unit conversions
tph = 3.5              # tonnes oil per hectare. source: WWF%20Profitability%20and%20Sustainability%20in%20Palm%20Oil%20Production%202012.pdf
kgpt = 1000            # kg per tonne 
hapm2 = 10000          # 1 hectare = 100000 square meters
rhop = 890             # density of palm oil, kg/m^3 source:http://www.chempro.in/palmoilproperties.htm
m3ph = tph*kgpt/rhop   # m^3 per hectare
Lph = m3ph/.001        # L per ha (1 L = .001 m^3)
inpm = 39.3701         # meters per inch

# Numbers from PNAS paper
At = 32000.            # total hectacres
Ac = 5000.             # conserved hectares
ngibbon = 1337.        # gibbons in conserved area
npangolin = 31.        # pangolins ''
nlmacaque = 1457       # macaques ''

# computations
Lt = Lph*(At-Ac);      # total liters per plantation

myfrac = nL/Lt;        # fraction of liters produced you buy
myland = myfrac*Ac;    # fraction of land you contribute
m = myland*hapm2
In [5]:
s = "/                                  /"
print "Estimated prodcution is %.1f liters palm oil per hectare per year"%Lph
print "Plantation with %d acres, of which %d conserved, produces %.1f liters\n"%(At,Ac, Lt)

print "My price increase of %.0f%% on %.2f liters at $%.2f per liter is %.2f" %(willing*100,nL, price, price*willing)
print "My extra $%.2f contributes to %.6f acres conserved"%(price*willing, myland)

print "That's %f square meteres: e.g. %f in by %f in\n" %(m, np.sqrt(m)*inpm, np.sqrt(m)*inpm)

print "On average, this sqaure is home to: \n" 
print "<-------------- %.0f in -------------->"%(np.sqrt(m)*inpm)
#print "-----------------------------------"
print "////////////////////////////////////   ^"
s = "/                                  /   |"
for i in range(3): print s
print "/ %.7f gibbons                /   |"%((myfrac*ngibbon))
print "/ %.7f pangolins              /  %.0f in "%((myfrac*npangolin), np.sqrt(m)*inpm)
print "/ %.7f long-tailed macaques   /   |"%((myfrac*nlmacaque))
for i in range(3): print s
print "////////////////////////////////////   v"
print "Here's what a pangolin looks like:"
Estimated prodcution is 3932.6 liters palm oil per hectare per year
Plantation with 32000 acres, of which 5000 conserved, produces 106179775.3 liters

My price increase of 15% on 0.47 liters at $8.00 per liter is 1.20
My extra $1.20 contributes to 0.000022 acres conserved
That's 0.222818 square meteres: e.g. 18.584119 in by 18.584119 in

On average, this sqaure is home to: 

<-------------- 19 in -------------->
////////////////////////////////////   ^
/                                  /   |
/                                  /   |
/                                  /   |
/ 0.0000060 gibbons                /   |
/ 0.0000001 pangolins              /  19 in 
/ 0.0000065 long-tailed macaques   /   |
/                                  /   |
/                                  /   |
/                                  /   |
////////////////////////////////////   v
Here's what a pangolin looks like:
In [6]:
from IPython.display import Image
Image(url = 'https://upload.wikimedia.org/wikipedia/commons/f/fe/Tree_Pangolin.JPG', width=400, height=300)
Out[6]: