Skip to content

Commit

Permalink
also add black while we're at it - setting pixi interpreter working n…
Browse files Browse the repository at this point in the history
…icely
  • Loading branch information
GondekNP committed Jan 9, 2025
1 parent 51b469b commit ef92c5a
Show file tree
Hide file tree
Showing 8 changed files with 163 additions and 54 deletions.
79 changes: 79 additions & 0 deletions pixi.lock

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

1 change: 1 addition & 0 deletions pixi.toml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ platforms = ["linux-64"]

[dependencies]
pytest = ">=7.4.4,<7.5"
black = ">=24.8.0,<24.9"

[target.linux-64.dependencies]
python = "3.11.*"
Expand Down
16 changes: 7 additions & 9 deletions vegetation/app.py
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
from mesa_geo.visualization import make_geospace_component
from patch.model import Vegetation, JoshuaTreeAgent
from patch.space import VegCell

# from patch.management import init_tree_management_control
from config.stages import LIFE_STAGE_RGB_VIZ_MAP

Expand All @@ -32,7 +33,9 @@

model_params = {
"num_steps": Slider("total number of steps", 20, 1, 100, 1),
"management_planting_density": Slider("management planting density", 0.1, 0.01, 1.0, 0.01),
"management_planting_density": Slider(
"management planting density", 0.1, 0.01, 1.0, 0.01
),
"export_data": False,
"bounds": TST_JOTR_BOUNDS,
}
Expand All @@ -53,15 +56,14 @@ def cell_portrayal(agent):
max_stage = max(patch_life_stages)
rgba = LIFE_STAGE_RGB_VIZ_MAP[max_stage]


else:
if not agent.refugia_status:
debug_normalized_elevation = int((agent.elevation / 5000) * 255)
rgba = (
debug_normalized_elevation,
debug_normalized_elevation,
debug_normalized_elevation,
.25,
0.25,
)
else:
rgba = (0, 255, 0, 1)
Expand All @@ -85,19 +87,15 @@ def cell_portrayal(agent):
model = Vegetation(bounds=TST_JOTR_BOUNDS)

tree_management = GeomanDrawControl(
drag=False,
cut=False,
rotate=False,
polyline={},
circlemarker={}
drag=False, cut=False, rotate=False, polyline={}, circlemarker={}
)
tree_management.on_draw(model.add_agents_from_management_draw)

page = SolaraViz(
model,
name="Veg Model",
components=[
make_geospace_component(cell_portrayal, zoom=14, controls = [tree_management]),
make_geospace_component(cell_portrayal, zoom=14, controls=[tree_management]),
make_plot_component(
[
"Mean Age",
Expand Down
14 changes: 7 additions & 7 deletions vegetation/batch.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,22 +3,22 @@
from numpy import arange
from config.paths import LOCAL_STAC_CACHE_FSTRING, SAVE_LOCAL_STAC_CACHE, DEM_STAC_PATH

#TODO: Batch run can't see local cache
#Issue URL: https://github.com/SchmidtDSE/mesa_abm_poc/issues/16
# TODO: Batch run can't see local cache
# Issue URL: https://github.com/SchmidtDSE/mesa_abm_poc/issues/16

#TODO: Implement early stopping when all the JOTR die off
#Issue URL: https://github.com/SchmidtDSE/mesa_abm_poc/issues/18
# TODO: Implement early stopping when all the JOTR die off
# Issue URL: https://github.com/SchmidtDSE/mesa_abm_poc/issues/18

TST_JOTR_BOUNDS = [-116.326332, 33.975823, -116.289768, 34.004147]

model_params = {
"num_steps": [100],
"management_planting_density": arange(0, 1, .05),
"management_planting_density": arange(0, 1, 0.05),
"export_data": [False],
"bounds": [TST_JOTR_BOUNDS],
}

if __name__ == '__main__':
if __name__ == "__main__":
results = batch_run(
Vegetation,
parameters=model_params,
Expand All @@ -27,4 +27,4 @@
number_processes=1,
data_collection_period=1,
display_progress=True,
)
)
4 changes: 3 additions & 1 deletion vegetation/config/paths.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
INITIAL_AGENTS_PATH = "/workspaces/mesa_abm_poc/vegetation/data/initial_agents.json"
DEM_STAC_PATH = "https://planetarycomputer.microsoft.com/api/stac/v1/"
LOCAL_STAC_CACHE_FSTRING = "/workspaces/mesa_abm_poc/.local_dev_data/{band_name}_{bounds_md5}.tif"
LOCAL_STAC_CACHE_FSTRING = (
"/workspaces/mesa_abm_poc/.local_dev_data/{band_name}_{bounds_md5}.tif"
)
SAVE_LOCAL_STAC_CACHE = True
Loading

0 comments on commit ef92c5a

Please sign in to comment.