geolib.models.base_model¶
This module contains the primary objects that power GEOLib.
Functions
|
|
Classes
|
|
|
Hold multiple models that can be executed in parallel. |
- class geolib.models.base_model.BaseModel(**data)¶
- Parameters:
data (
Any
) –
- property console_flags: List[str]¶
- property console_flags_post: List[str]¶
- property custom_console_path: Path | None¶
-
datastructure:
Optional
[BaseModelStructure
]¶
- property default_console_path: Path¶
- execute(timeout_in_seconds=600)¶
Execute a Model and wait for timeout seconds.
The model is modified in place if the calculation and parsing is successful.
- Parameters:
timeout_in_seconds (
int
) –- Return type:
- execute_remote(endpoint)¶
Execute a Model on a remote endpoint.
A new model instance is returned.
- Parameters:
endpoint (
HttpUrl
) –- Return type:
-
filename:
Optional
[Path
]¶
- get_error_context()¶
- Return type:
str
- get_meta_property(key)¶
Get a metadata property from the input file.
- Parameters:
key (
str
) –- Return type:
Optional
[str
]
- property input¶
Access internal dict-like datastructure of the input.
- property is_valid: bool¶
Checks validity and integrity of structure.
- property output¶
Access internal dict-like datastructure of the output.
Requires a successful execute.
- parse(filename)¶
Parse input or outputfile to Model, depending on extension.
- Parameters:
filename (
FilePath
) –- Return type:
- abstract property parser_provider_type: Type[BaseParserProvider]¶
Returns the parser provider type of the current concrete class.
- Raises:
NotImplementedError – If not implemented in the concrete class.
- Returns:
Type[BaseParserProvider] – Concrete parser provider.
- abstract serialize(filename)¶
Serialize model to input file.
- Parameters:
filename (
Union
[FilePath
,DirectoryPath
,None
]) –- Return type:
Union
[FilePath
,DirectoryPath
,None
]
- set_meta_property(key, value)¶
Set a metadata property from the input file.
- Parameters:
key (
str
) –value (
str
) –
- Return type:
None
- class geolib.models.base_model.BaseModelList(**data)¶
Hold multiple models that can be executed in parallel.
Note that all models need to have a unique filename otherwise they will overwrite eachother. This also helps with identifying them later.
- Parameters:
data (
Any
) –
-
errors:
List
[str
]¶
- execute(calculation_folder, timeout_in_seconds=600, nprocesses=4)¶
Execute all models in this class in parallel.
We split the list to separate folders and call a batch processes on each folder. Note that the order of models will change.
- Parameters:
calculation_folder (
DirectoryPath
) –timeout_in_seconds (
int
) –nprocesses (
Optional
[int
]) –
- Return type:
- execute_remote(endpoint)¶
Execute all models in this class in parallel on a remote endpoint.
Note that the order of models will change.
- Parameters:
endpoint (
HttpUrl
) –- Return type: