gws.base.model.util¶
Model utilities.
Source code: gws.base.model.util
Module Contents¶
- gws.base.model.util.copy_context(mc: gws.ModelContext, **kwargs) gws.ModelContext¶
Copy a model context.
- Parameters:
mc – The model context.
**kwargs – Properties to set in the copy.
- Returns:
A new model context.
- gws.base.model.util.describe_from_record(fd: gws.FeatureRecord) gws.DataSetDescription¶
Create a dataset description from a feature record.
Column types are derived from the python types of the attribute values. If the record has a shape, a
geometrycolumn is added.- Parameters:
fd – The feature record.
- Returns:
The dataset description.
- gws.base.model.util.iter_features(features: list[gws.Feature], mc: gws.ModelContext) Iterable[gws.Feature]¶
Iterate over features and their related features.
Related features are features stored in attributes, directly or in lists. They are visited depth-first, as long as the relation depth of the context is below its maximum.
- Parameters:
features – The features.
mc – The model context.
- Yields:
Each feature, followed by its related features.
- gws.base.model.util.secondary_context(mc: gws.ModelContext, **kwargs) gws.ModelContext¶
Copy a model context for related features, with the relation depth increased by one.
- Parameters:
mc – The model context.
**kwargs – Properties to set in the copy.
- Returns:
A new model context.