Plot of allometrically-scaled mass-specific metabolic rate


In [4]:
%matplotlib inline

import numpy as np
import matplotlib.pyplot as plt

# This plot shows how mass-specific metabolic rate falls off with body size
x = np.arange(1, 100)
plt.plot(x, x**-.25)
plt.xlabel("body size")
plt.ylabel("metabolic rate")


Out[4]:
<matplotlib.text.Text at 0x7f4ce5f03dd8>

Replicating allometrically-scaled calculated parameters

First attempt: metabolic rate x_i of Fish4 (Adult piscivorous fish) from (Boit et al. 2012), using constants and formulas from Brose et al. 2006. Resulting x_i does not match.


In [9]:
# Trying to replicate the calculations for metabolic rate x_i of Fish4 (Adult piscivorous fish)
# from (Boit et al. 2012).
# Formulas are from Brose et al. 2006

# Constants
a_r = 1      # Allometric constant for primary producer growth rate (Brose et al. 2006)
a_x = 0.88   # Allometric constant for ectotherm vertebrate metabolism (Brose et al. 2006)
M_P = 6.40e-5 # Body mass of Alg1 (Single cell algae) (Boit et al. 2012)
M_C = 7.04e+7 # Body mass of Fish4 (Adult piscivorous fish) (Boit et al. 2012)

R_P = a_r * M_P ** -.25  # Producer mass-specific growth rate, pre-time-normalization
X_C = a_x * M_C ** -.25  # Consumer mass-specific metabolic rate, pre-time-normalization

# Normalize by the time scale
r_i = 1         # Mass-specific growth rate of basal population is set to 1  (QUESTION: Why is r_i defined and not used?)
x_i = X_C / R_P # Mass-specific metabolic rate

print("R_P = {}, X_C = {}, x_i = {}".format(R_P, X_C, x_i))


R_P = 11.180339887498949, X_C = 0.009607037974265186, x_i = 0.0008592795989151533

Second attempt

Based on information on Biot 2012 supplementary info, Allometric Parameterization section.

$r_i$ for for producers are all slightly off.

$x_i$ for Fish1 and Fish2 match. Results for Fish3 and Fish4 are slightly off.


In [49]:
M_k = 6.40e-5       # Body mass of reference producer Alg1
a_Ti = 0.88         # Allometric constant for all fish species
a_rk = a_ri = 1     # Allometric constant for all producers
A_nonfish = 0.15    # Allometric scaling exponent for nonfish species
A_fish = 0.11       # Allometric scaling exponent for fish species

# M_i is body mass in micrograms carbon per individual
for producerName, M_i in (('Alg1', 6.4e-5), ('Alg2', 2.56e-4), ('Alg3', 3.2e-5), ('Alg4', 1.28e-4), ('Alg5', 8e-6),
                          ('APP', 2.5e-7)):
    r_i = (a_ri / a_rk) * ((M_k / M_i) ** A_nonfish)
    print("{} r_i = {}".format(producerName, r_i))

for fishName, M_i in (('Fish1', 1.1e+6), ('Fish2', 4.4e+6), ('Fish3', 3.52e+7), ('Fish4', 7.04e+7)):
    x_i = (a_Ti / a_rk) * ((M_k / M_i) ** A_fish)
    print("{} x_i = {}".format(fishName, x_i))


Alg1 r_i = 1.0
Alg2 r_i = 0.8122523963562356
Alg3 r_i = 1.109569472067845
Alg4 r_i = 0.9012504626108302
Alg5 r_i = 1.3660402567543954
APP r_i = 2.2973967099940698
Fish1 x_i = 0.06585811163402651
Fish2 x_i = 0.05654349835803428
Fish3 x_i = 0.04498944991190891
Fish4 x_i = 0.04168016953359994

Endotherm metabolic rates

From Williams et al. 2007


In [30]:
# "Mass-to-respiration conversion constant specific to animal species i's metabolic type"
# - definition from Cotter 2015
# - value for endotherms from Williams et al. 2007, originally from Yodzis and Innes
# - units: kg^.25 / year
a_Ti = 54.9

# f_ri is a "fractional constant used in metabolic and growth rate functions" (Cotter)
# k refers to the primary producer
# Where is its value?
# "value may be specified for each specific population or feeding interaction in a particular ecological context"
#  - (Williams)
# "f_r...would typically be on the order of 0.1 for a field population." (Y&I)
#f_rk = 0.1
f_rk = 1

# a_ri is a "mass-to-growth conversion constant specific to plant species i" (Cotter)
# k refers to the primary producer
# Trying the value for phytoplankton from the Williams/Y&I table
# - units: kg^.25 / year
#a_rk = 0.4
a_rk = 1

# Body mass of reference producer.
# Trying to replicate parameter values in WoB DB, so I'll use "Grass and Herbs" as the reference producer.
# Its "body mass" is 40 (units? Since it's divided by M_i, which has the same units, units cancel)
M_k = 40
#M_k = 1

# Body mass of Aardvark from WoB database
M_i = 66

# African Clawless Otter
#M_i = 13

#  x_i = (a_Ti / a_rk) * ((M_k / M_i) ** A_fish)
x_i = (a_Ti / (f_rk * a_rk)) * ((M_k / M_i) ** .25)

# This should be 0.0821097 (Aardvark)
print(x_i)
# Not even close

# Do some algebra
x_i = 0.0821097 # Aardvark
#x_i = 0.123252 # Otter
coef = x_i / ((M_k / M_i) ** .25)
print(coef)


48.43969036536332
0.09306051496198883

In [47]:
%matplotlib inline
import numpy as np
import pandas as pd

df = pd.read_csv('wob-database/species-table.csv')

df['metabolismUnscaled'] = 1 / df['biomass'] ** 0.25
df['ratio'] = df.metabolism / df.metabolismUnscaled

pd.pivot_table(df, index='category', values=['ratio'], aggfunc=[np.mean, np.std, np.median])
df.sort_values(by='category')


Out[47]:
species_id name organism_type cost description category biomass diet_type carrying_capacity metabolism trophic_level growth_rate model_id unlock node_id metabolismUnscaled ratio
57 58 Domestic Cat 0 10 Animal Animal 10.000000 1 0 0.500000 1.00000 0 0 0 58 0.562341 0.889140
53 54 Domestic Chicken 0 25 Bird Bird 10.000000 0 0 0.500000 1.00000 0 0 0 54 0.562341 0.889140
25 26 Yellow-Breasted Apalis 0 20 The Yellow-breasted Apalis is a species of bir... Bird 0.011000 0 0 0.722657 2.65786 0 67 0 26 3.087819 0.234035
26 27 Yellow-Bellied Eremomela 0 10 The Yellow-bellied Eremomela is a common breed... Bird 0.009000 0 0 0.759836 2.78074 0 68 2 27 3.246679 0.234035
27 28 Red-Faced Crombec 0 15 The Red-faced Crombec is a species of African ... Bird 0.010000 2 0 0.740083 2.00000 0 69 0 28 3.162278 0.234035
28 29 Three-Banded Plover 0 20 The Three-banded Plover or Three-banded Sandpl... Bird 0.035000 1 0 0.541082 3.25434 0 70 0 29 2.311974 0.234035
29 30 Dwarf Epauletted Bat 0 10 The Dwarf Epauletted Bat is a species of megab... Bird 0.029000 2 0 0.567128 2.00000 0 71 0 30 2.423263 0.234035
32 33 Cape Teal 0 20 The Cape Teal is a 44-46 cm long dabbling duck... Bird 0.400000 0 0 0.294283 2.29861 0 72 2 33 1.257433 0.234035
39 40 Yellow-Throated Sandgrouse 0 20 The Yellow-throated Sandgrouse is a species of... Bird 0.325000 2 0 0.309963 2.00000 0 76 0 40 1.324430 0.234035
41 42 African Grey Hornbill 0 20 The African Grey Hornbill is a hornbill. Hornb... Bird 0.205000 0 0 0.347810 2.66657 0 77 3 42 1.486146 0.234035
42 43 Coqui Francolin 0 20 The Coqui Francolin is a species of bird in th... Bird 0.030000 0 0 0.562341 2.25000 0 78 0 43 2.402811 0.234035
45 46 Little Grebe 0 20 The Little Grebe, also known as Dabchick, is a... Bird 0.140000 1 0 0.382603 3.56238 0 999 3 46 1.634813 0.234035
46 47 White-Bellied Bustard 0 10 The White-bellied Bustard or White-bellied Kor... Bird 5.450000 0 0 0.153173 2.91940 0 55 3 47 0.654487 0.234035
48 49 African Marsh Owl 0 20 The African Marsh Owl is a species of owl whic... Bird 0.355000 1 0 0.303196 3.66074 0 35 4 49 1.295516 0.234035
50 51 Hooded Vulture 0 20 The Hooded Vulture is an Old World vulture in ... Bird 2.050000 1 0 0.195588 3.50814 0 54 4 51 0.835721 0.234035
55 56 Marabou Stork 0 20 The Marabou Stork, Leptoptilos crumeniferus, i... Bird 6.250000 1 0 0.148017 3.58348 0 85 0 56 0.632456 0.234035
56 57 Southern Ground Hornbill 0 20 The Southern Ground Hornbill or cafer, is one ... Bird 4.200000 1 0 0.163481 3.56295 0 86 4 57 0.698534 0.234034
84 85 Ostrich 0 20 The Ostrich is one or two species of large fli... Bird 108.000000 2 0 0.072598 2.12500 0 38 7 85 0.310202 0.234035
62 63 Lappet-Faced Vulture 0 20 The Lappet-faced Vulture or Nubian Vulture is ... Bird 7.850000 1 0 0.139818 3.49293 0 54 5 63 0.597424 0.234035
64 65 Kori Buskard 0 60 The Kori Bustard is a large bird native to Afr... Bird 13.000000 0 0 0.123252 2.61792 0 30 0 65 0.526640 0.234034
24 25 Gray Flycatcher 0 15 The African Grey Flycatcher is a species of bi... Bird 0.012500 1 0 0.699927 3.13492 0 66 3 25 2.990698 0.234035
22 23 Banana Pipistrelle 0 20 The Banana Pipistrelle is a species of vesper ... Bird 0.003000 1 0 1.000000 3.00000 0 42 0 23 4.272870 0.234035
38 39 Pearl-Spotted Owlet 0 20 The Pearl-Spotted Owlet is an owl which breeds... Bird 0.085000 1 0 0.433437 3.56358 0 75 0 39 1.852018 0.234035
2 3 African Fish Eagle 0 10 The African Fish Eagle is a large species of e... Bird 2.800000 1 0 0.180922 3.78486 0 3 4 53 0.773055 0.234035
23 24 Scorpion 0 15 Scorpions are predatory arthropod animals of t... Insect 0.005000 1 0 0.008001 3.46251 0 47 1 24 3.760603 0.002128
13 14 Crickets 0 14 Crickets, family Gryllidae, are insects somewh... Insect 20.000000 0 0 0.001006 2.12500 0 999 2 14 0.472871 0.002128
10 11 Ants 0 10 Ants are social insects of the family Formicid... Insect 0.000004 0 0 0.047574 2.16667 0 999 0 11 22.360680 0.002128
9 10 Orb-Weaver Spider 0 15 The "typical" orb-weaver spiders are the most ... Insect 0.004000 1 0 0.008460 3.38753 0 999 2 10 3.976354 0.002128
8 9 Rove and Ground Beetles 0 10 The rove beetles are a large family of beetles... Insect 0.071000 1 0 0.004122 2.51786 0 999 0 9 1.937249 0.002128
12 13 Flies 0 5 True flies are insects of the order Diptera. T... Insect 0.000012 0 0 0.036535 2.00000 0 999 1 13 17.172184 0.002128
... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
106 1009 Baobab 1 75 Baobab is a genus of eight species of tree, si... Plant 4400.000000 0 10000 0.500000 1.00000 1 5 10 7 0.122783 4.072238
105 1009 Baobab 1 75 Baobab is a genus of eight species of tree, si... Plant 4400.000000 0 10000 0.500000 1.00000 1 5 10 4 0.122783 4.072238
88 89 Decaying Material 0 20 Decaying Materials are great sources of food f... Resource 1000.000000 0 10000 0.500000 1.00000 1 999 1 1 0.177828 2.811707
44 45 Four Toed African Hedgehog 0 50 Four Toed African Hedgehog is a species of hed... Small Animal 0.425000 0 0 0.289857 2.86570 0 27 3 45 1.238519 0.234035
5 6 Black Mamba 0 50 The black mamba, also called the common black ... Small Animal 1.590000 1 0 0.008716 3.57098 0 6 7 75 0.890534 0.009787
19 20 Dwarf Puddle Frog 0 25 The Dwarf Puddle Frog is a species of frog in ... Small Animal 0.040000 1 0 0.021884 3.28284 0 23 1 20 2.236068 0.009787
21 22 Shrew 0 50 A shrew or shrew mouse is a small molelike mam... Small Animal 0.680000 1 0 0.257723 3.28284 0 49 0 22 1.101217 0.234035
30 31 Tree Mouse 0 50 Tree Mouse, Prionomys batesi, is a poorly unde... Small Animal 0.007500 0 0 0.795271 2.38095 0 53 1 31 3.398088 0.234035
31 32 Mueller's Clawed Frog 0 50 Mueller's Clawed Frog is a species of South Af... Small Animal 0.130000 1 0 0.016299 2.94526 0 23 0 32 1.665383 0.009787
33 34 Cape Dwarf Gecko 0 50 The Cape Dwarf Gecko is a species of dwarf gec... Small Animal 0.070900 1 0 0.018966 3.23584 0 24 2 34 1.937932 0.009787
34 35 Crab 0 25 True crabs are decapod crustaceans of the infr... Small Animal 250.000000 1 0 0.058857 2.25000 0 15 5 35 0.251487 0.234035
35 36 Creek Rat 0 50 Creek Rate is a species of rodent in the famil... Small Animal 3.500000 1 0 0.007155 2.72169 0 73 0 36 0.731110 0.009787
36 37 Catfish 0 20 Catfishes are a diverse group of ray-finned fi... Small Animal 0.200000 1 0 0.014635 2.50000 0 74 5 37 1.495349 0.009787
37 38 Dwarf Sand Snake 0 50 The Dwarf Sand Snake is a very small, slender ... Small Animal 0.085000 1 0 0.018125 3.79062 0 19 2 38 1.852018 0.009787
40 41 Striped Weasel 0 50 The Striped Weasel, the lone member of genus P... Small Animal 0.287000 1 0 0.319749 3.52954 0 79 0 41 1.366248 0.234034
43 44 Rufous Beaked Snake 0 25 The Rufous Beaked Snake is a species of colubr... Small Animal 0.028000 1 0 0.023925 3.50856 0 46 3 44 2.444615 0.009787
0 1 Aardvark 0 50 The aardvark is a medium-sized, burrowing, noc... Small Animal 66.000000 1 0 0.082110 3.08333 0 1 7 79 0.350844 0.234035
47 48 Bush Hyrax 0 25 The yellow-spotted rock hyrax or bush hyrax is... Small Animal 4.490000 2 0 0.160775 2.00000 0 9 4 48 0.686971 0.234035
49 50 Dwarf Mongoose 0 50 The common dwarf mongoose, sometimes just call... Small Animal 0.349000 0 0 0.304491 2.94236 0 18 3 50 1.301049 0.234035
51 52 Smith's Red Hock Hare 0 50 Smith's Red Hock Hare is a species of mammal i... Small Animal 7.000000 2 0 0.143882 2.00000 0 26 4 52 0.614788 0.234035
54 55 Greater Bushbaby 0 50 Greater Bushbabies are small, nocturnal primat... Small Animal 0.213000 0 0 0.344497 2.62173 0 8 0 55 1.471991 0.234035
60 61 Leopard Tortoise 0 25 The Leopard tortoise is a large and attractive... Small Animal 54.000000 0 0 0.003610 2.78568 0 32 5 61 0.368894 0.009787
63 64 Nile Monitor Lizard 0 50 The Nile Monitor, Water Leguaan, or River Legu... Small Animal 10.400000 1 0 0.005450 3.48947 0 36 5 64 0.556854 0.009787
67 68 Ground Pangolin 0 60 The Ground Pangolin, also known as Temminck's ... Small Animal 15.900000 1 0 0.117201 3.08333 0 41 6 68 0.500784 0.234035
83 84 Human 0 150 animal animal 10.000000 0 0 0.500000 1.00000 0 0 0 84 0.562341 0.889140
80 81 Domestic Sheep 0 20 animal animal 10.000000 2 0 0.500000 1.00000 0 0 0 81 0.562341 0.889140
75 76 Domestic Dog 0 20 The domestic dog, is a subspecies of the gray ... animal 10.000000 0 0 0.500000 1.00000 0 0 0 76 0.562341 0.889140
77 78 Domestic Goat 0 25 animal animal 2500.000000 2 0 0.500000 1.00000 0 0 0 78 0.141421 3.535534
78 79 Domestic Cattle 0 50 animal animal 10.000000 2 0 0.500000 1.00000 0 0 0 90 0.562341 0.889140
61 62 African White-Backed Vulture 0 25 African White-Backed Vulture is an Old World v... excluded bird 4000.000000 1 0 0.690000 1.00000 0 54 0 62 0.125743 5.487368

107 rows × 17 columns


In [5]:
text = "one\ntwo"
for line in text.split('\n'):
    print(line)


one
two