Skip to content

Commit

Permalink
handle desertification
Browse files Browse the repository at this point in the history
  • Loading branch information
iamgiddyaboutgit committed Dec 12, 2023
1 parent 068a06e commit f6634c8
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 6 deletions.
12 changes: 7 additions & 5 deletions src/sim_world_functions.py
Original file line number Diff line number Diff line change
Expand Up @@ -104,9 +104,11 @@ def stoch_pro_lin(

return s

def prior_biome_before_desertification(rng:np.random.Generator):
def prior_biomes_before_desertification(n, rng:np.random.Generator):
"""Returns the prior biome.
Args:
n: int. The number of prior biomes wanted.
Returns:
str. Indicates what the biome was historically.
"""
Expand All @@ -118,9 +120,9 @@ def prior_biome_before_desertification(rng:np.random.Generator):
"Montane Grasslands & Shrublands",
"Temperate Broadleaf & Mixed Forests"
]
past_biome = rng.choice(
past_biomes = rng.choice(
a=other_biome_choices,
size=1
)[0]
size=n
).tolist()

return past_biome
return past_biomes
10 changes: 9 additions & 1 deletion src/sim_world_functions_test.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@

import numpy as np

rng = np.random.default_rng()
# print(
# swf.stoch_pro_lin(
# x_0=0,
Expand All @@ -23,4 +24,11 @@
# x=np.linspace(0, 1, 50),
# b=-6
# )
# )
# )

print(
swf.prior_biomes_before_desertification(
6,
rng
)
)

0 comments on commit f6634c8

Please sign in to comment.