Bases: BaseSubSystem, GeoSpace, NatureSystemProtocol
Base class for managing spatial components in an ABSESpy model.
This class serves as a container for different raster layers (PatchModules). It is not a raster layer itself, but manages multiple PatchModule instances.
Attributes:
| Name | Type | Description |
|---|---|---|
major_layer |
Optional[BaseModule]
|
Primary raster layer of the model. Defaults to first created layer. |
total_bounds |
Optional[BaseModule]
|
Spatial extent of the model's area of interest. |
crs |
CRS
|
Coordinate Reference System used by the nature module. |
layers |
CRS
|
Collection of all managed raster layers. |
modules |
dict[str, BaseModule]
|
Factory for creating and managing PatchModules. |
Note
By default, an initialized ABSESpy model will create an instance of BaseNature as its 'nature' module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
model
|
MainModelProtocol
|
Parent model instance this nature module belongs to. |
required |
name
|
str
|
Name identifier for this module (defaults to "nature"). |
'nature'
|
Source code in abses/space/nature.py
create_module ¶
Creates a new raster layer (PatchModule) in this nature module.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module_cls
|
Type[PatchModule]
|
Custom PatchModule subclass to instantiate. If None, uses base PatchModule. |
PatchModule
|
major_layer
|
bool
|
If True, sets created module as the major layer. |
False
|
write_crs
|
bool
|
If True, assigns nature's CRS to module if module's CRS is None. |
False
|
**kwargs
|
Any
|
Additional arguments passed to the creation method. |
{}
|
Returns:
| Type | Description |
|---|---|
PatchModule
|
Newly created PatchModule instance. |
Note
The first created module automatically becomes the major layer. The module is automatically added to nature's layers collection.
Source code in abses/space/nature.py
convert_crs ¶
Convert the CRS of a module to the space's CRS.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
module
|
PatchModule
|
The module to convert the CRS of. |
required |
write_crs
|
bool
|
If True, sets the module's CRS to the space's CRS. |
True
|
Returns:
| Type | Description |
|---|---|
|
The module with the converted CRS. |