Created
November 30, 2012 01:01
-
-
Save rywall/4173040 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
DISPERSION_FACTORS = {50 => 0.5341, 100 => 0.3610, 200 => 0.5145, 500 => 0.9159, 1000 => 0.9088, 5000 => 4.662} | |
# Calculate the intake fraction where iF = SUM(popN * DispN) / 1000 | |
# where popN is the population in an N meter buffer minus the previous population buffer | |
def intake_fraction | |
fraction = 0 | |
inner_pop = 0 | |
DISPERSION_FACTORS.each do |buffer, value| | |
pop_in_buffer = send("pop#{buffer}m").to_i | |
fraction += (pop_in_buffer - inner_pop) * value * 0.62 * 14.5 | |
inner_pop = pop_in_buffer | |
end | |
return fraction / 1000 | |
end |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment