Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
24 commits
Select commit Hold shift + click to select a range
dceabaa
Array resources implementation
davidorme Feb 6, 2026
e582ee9
Wiring in array resources
davidorme Feb 11, 2026
5016775
Adding array resources into multiple different data fixtures
davidorme Feb 11, 2026
4357901
Correcting target resource arrays
davidorme Feb 12, 2026
d51b2a3
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
davidorme Feb 13, 2026
6f3117f
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
davidorme Feb 13, 2026
8b9a592
fixing tests
davidorme Feb 13, 2026
d42db1f
Temp noqa on unused variable
davidorme Feb 13, 2026
a55c86f
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
TaranRallings Feb 16, 2026
421c8ea
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
TaranRallings Feb 18, 2026
b9d9a3b
Wired array resources into foraging loop and updated testing.
TaranRallings Feb 18, 2026
03b15ca
Added doc file for array_resources.
TaranRallings Feb 18, 2026
857db0f
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
TaranRallings Feb 18, 2026
7c2a2cf
Removed unused plant resources files, updated docs.
TaranRallings Feb 18, 2026
0a670f8
[pre-commit.ci] auto fixes from pre-commit.com hooks
pre-commit-ci[bot] Feb 18, 2026
57954ad
Updated testing.
TaranRallings Feb 19, 2026
9b00726
Resolved merge
TaranRallings Feb 19, 2026
7dc619c
Added a seed consumer to example functional groups.
TaranRallings Feb 19, 2026
f0b9b37
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
TaranRallings Feb 19, 2026
b92a703
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
davidorme Feb 23, 2026
a317542
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
TaranRallings Feb 25, 2026
0fcd533
Merge branch '1316-plant-piping-2-the-final-chapter' of https://githu…
TaranRallings Feb 25, 2026
c8849cc
Merge branch 'develop' into 1316-plant-piping-2-the-final-chapter
davidorme Feb 25, 2026
7c8c386
Animal model init_var fix
davidorme Feb 25, 2026
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/source/_toc.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -162,8 +162,8 @@ subtrees:
title: The decay submodule
- file: api/models/animal/functional_group
title: The functional_group submodule
- file: api/models/animal/plant_resources
title: The plant_resources submodule
- file: api/models/animal/array_resources
title: The array_resources submodule
- file: api/models/animal/protocols
title: The protocols submodule
- file: api/models/animal/scaling_functions
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ language_info:
version: 3.11.9
---

# API for the {mod}`~virtual_ecosystem.models.animal.plant_resources` module
# API for the {mod}`~virtual_ecosystem.models.animal.array_resources` module

```{eval-rst}
.. automodule:: virtual_ecosystem.models.animal.plant_resources
.. automodule:: virtual_ecosystem.models.animal.array_resources
:autosummary:
:members:
:exclude-members: model_name
101 changes: 85 additions & 16 deletions tests/models/animals/conftest.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,28 @@ def animal_data_for_model_instance(fixture_core_components):
)
data["air_temperature"] = air_temperature

# Array resource pools
pfts = np.array(["pioneer", "canopy", "emergent"])
cell_ids = np.arange(data.grid.n_cells)
elements = np.array(["C", "N", "P"])

leaf_mass = DataArray(
np.ones((data.grid.n_cells, elements.size, pfts.size)),
dims=("cell_id", "element", "pft"),
coords=dict(
cell_id=cell_ids,
element=elements,
pft=pfts,
),
) * DataArray([20, 2, 1], dims="element", coords=dict(element=elements))

data["subcanopy_vegetation_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)
data["subcanopy_seedbank_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)

return data


Expand Down Expand Up @@ -332,6 +354,28 @@ def dummy_animal_data(animal_fixture_core_components):
np.zeros(data.grid.n_cells), dims="cell_id"
)

# Array resource pools
pfts = np.array(["pioneer", "canopy", "emergent"])
cell_ids = np.arange(data.grid.n_cells)
elements = np.array(["C", "N", "P"])

leaf_mass = DataArray(
np.ones((data.grid.n_cells, elements.size, pfts.size)),
dims=("cell_id", "element", "pft"),
coords=dict(
cell_id=cell_ids,
element=elements,
pft=pfts,
),
) * DataArray([20, 2, 1], dims="element", coords=dict(element=elements))

data["subcanopy_vegetation_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)
data["subcanopy_seedbank_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)

return data


Expand Down Expand Up @@ -720,25 +764,28 @@ def excrement_pools_by_cell_instance():


@pytest.fixture
def plant_instance(plant_data_instance, constants_instance):
"""Fixture for a plant community used in tests."""
from virtual_ecosystem.models.animal.plant_resources import PlantResources

return PlantResources(
data=plant_data_instance, cell_id=4, constants=constants_instance
)
def array_plant_list_instance():
"""Return a list of CellResource objects usable as plant_list."""
import numpy as np


@pytest.fixture
def plant_list_instance(plant_data_instance, constants_instance):
"""Fixture providing a list of plant resources."""
from virtual_ecosystem.models.animal.plant_resources import PlantResources
from virtual_ecosystem.models.animal.animal_traits import VerticalOccupancy
from virtual_ecosystem.models.animal.array_resources import CellResource

return [
PlantResources(
data=plant_data_instance, cell_id=4, constants=constants_instance
)
for idx in range(3)
CellResource(
resource=object(),
available_elemental_masses=np.array([1.0, 0.0, 0.0], dtype=float),
consumed_total_mass=np.zeros(3, dtype=float),
vertical_occupancy=VerticalOccupancy.GROUND,
cell_id=0,
),
CellResource(
resource=object(),
available_elemental_masses=np.array([1.0, 0.0, 0.0], dtype=float),
consumed_total_mass=np.zeros(3, dtype=float),
vertical_occupancy=VerticalOccupancy.GROUND,
cell_id=1,
),
]


Expand Down Expand Up @@ -835,6 +882,28 @@ def litter_soil_data_instance(fixture_core_components):
for var_name, var_values in data_values.items():
data[var_name] = DataArray(var_values, dims=["cell_id"])

# Array resource pools
pfts = np.array(["pioneer", "canopy", "emergent"])
cell_ids = np.arange(data.grid.n_cells)
elements = np.array(["C", "N", "P"])

leaf_mass = DataArray(
np.ones((data.grid.n_cells, elements.size, pfts.size)),
dims=("cell_id", "element", "pft"),
coords=dict(
cell_id=cell_ids,
element=elements,
pft=pfts,
),
) * DataArray([20, 2, 1], dims="element", coords=dict(element=elements))

data["subcanopy_vegetation_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)
data["subcanopy_seedbank_cnp"] = (
leaf_mass.sel(pft="pioneer").drop_vars("pft").copy()
)

return data


Expand Down
Loading