Models
- pydantic model qgreenland.models.base_model.QgrBaseModel[source]
Bases:
BaseModel
Implements ‘faux’ immutability and allows usage of functools.cached_property.
Immutability is not ‘strict’ (e.g., dicts can be mutated) - a determined dev can still mutate model instances.
Configuration
The configuration determines the final output of the processing pipelines, including the final QGIS project, zip package, and layers that are created.
- pydantic model qgreenland.models.config.__init__.Config[source]
Bases:
QgrBaseModel
The configuration determines the pipeline outputs.
All fields are populated programmatically. There is no need to specify a Config object anywhere: this is part of the framework.
- field datasets: dict[str, qgreenland.models.config.dataset.Dataset] [Required][source]
A lookup of all datasets included in the project.
- Validated by:
- field layer_tree: Node [Required][source]
A tree of all layers and groups.
Structured as they would be in the QGIS Layers Panel.
- Validated by:
- field layers: dict[str, qgreenland.models.config.layer.Layer] [Required][source]
A lookup of all layers included in the project.
- Validated by:
Project
- pydantic model qgreenland.models.config.project.BoundariesInfo[source]
Bases:
QgrBaseModel
- field bbox: BoundingBox [Required][source]
Bounding box, automatically populated from the file.
- Validated by:
- pydantic model qgreenland.models.config.project.BoundingBox[source]
Bases:
QgrBaseModel
- pydantic model qgreenland.models.config.project.Project[source]
Bases:
QgrBaseModel
General project-wide configuration.
- field boundaries: dict[str, qgreenland.models.config.project.BoundariesInfo] [Required][source]
The boundaries available for use (e.g. clipping) during layer steps.
- Validated by:
Layer Groups
- class qgreenland.models.config.layer_group.LayerGroupIdentifier(seq)[source]
Bases:
LayerIdentifierBase
A string corresponding with a single layer group/directory name.
This is not expected to be globally unique, only locally within their parent group. For example, there may be two group _paths_:
Foo/January
Bar/January
Foo, Bar, January are all LayerGroupIdentifiers, but January is not globally unique, only locally (i.e. there can’t be two January`s in `Foo).
TODO: Update other models to replace string layer group identifiers with lists of this class?
- pydantic model qgreenland.models.config.layer_group.LayerGroupSettings[source]
Bases:
RootGroupSettings
- field expand: bool = False[source]
Whether the group is expanded or collapsed in the QGIS Layers Panel.
- Validated by:
- class qgreenland.models.config.layer_group.LayerIdentifier(seq)[source]
Bases:
LayerIdentifierBase
A string uniquely identifying a layer.
TODO: Update other models to replace string layer identifiers with this class?
- class qgreenland.models.config.layer_group.LayerIdentifierBase(seq)[source]
Bases:
UserString
A base class for special strings meant to be distinguished by type.
Based on docs: https://docs.pydantic.dev/1.10/usage/types/#classes-with-__get_validators__
TODO: The doc above specifies a __modify_schema__ method which we’re not using. Should we be?
- pydantic model qgreenland.models.config.layer_group.RootGroupSettings[source]
Bases:
QgrBaseModel
Settings specific to the root group.
- field order: list[qgreenland.models.config.layer_group.LayerIdentifier | qgreenland.models.config.layer_group.LayerGroupIdentifier] | None = None[source]
The order in which this group’s contents will be shown.
Subgroups are referenced by name, e.g. ‘Basemaps’, and layers are referenced by a colon followed by the layer ID, e.g. :background. If ‘order’ is omitted, a default sorting algorithm is applied.
- Validated by:
Layers
- pydantic model qgreenland.models.config.layer.Layer[source]
Bases:
QgrBaseModel
- field description: str [Required][source]
Descriptive text shown as hover-text in the QGIS Layer Panel.
- Constraints:
minLength = 1
- Validated by:
- field in_package: bool = True[source]
Is this layer in the final QGreenland zip file?
- Validated by:
- field input: LayerInput [Required][source]
- Validated by:
- field show: bool = False[source]
Is this layer initially “checked” or visible in QGIS?
- Validated by:
- field steps: list[qgreenland.models.config.step.CommandStep] | None = None[source]
- Validated by:
- field style: str | None = None[source]
Which style (.qml) file to use for this layer?
Omit the file extension.
- Constraints:
minLength = 1
- Validated by:
validate_style_file_continuous_legend
validate_style_file_exists
validate_style_file_only_contains_allowed_fonts
- pydantic model qgreenland.models.config.layer.LayerInput[source]
Bases:
QgrBaseModel
The input(s) to a layer’s processing pipeline.
- field asset: CmrAsset | CommandAsset | HttpAsset | ManualAsset | OnlineAsset | RepositoryAsset [Required][source]
The actual input asset (file or files).
- Validated by:
Steps
- qgreenland.models.config.step.AnyStep[source]
alias of
CommandStep
- pydantic model qgreenland.models.config.step.CommandStep[source]
Bases:
QgrBaseModel
,LayerStep
A step run as a shell command.
- field args: list[qgreenland.util.runtime_vars.EvalStr] [Required][source]
The command arguments, e.g. [‘cat’, ‘{input_dir}/foo.txt’].
- Validated by:
- field id: str | None = None[source]
An identifier for the step. Does not need to be unique.
- Validated by:
- field type: Literal['command'] = 'command'[source]
The type of the step. Should not be set by the user.
- Validated by:
Datasets
- pydantic model qgreenland.models.config.dataset.Dataset[source]
Bases:
QgrBaseModel
Configuration for a dataset.
- field assets: dict[str, Union[qgreenland.models.config.asset.CmrAsset, qgreenland.models.config.asset.CommandAsset, qgreenland.models.config.asset.HttpAsset, qgreenland.models.config.asset.ManualAsset, qgreenland.models.config.asset.OnlineAsset, qgreenland.models.config.asset.RepositoryAsset]] [Required][source]
Actual data associated with the dataset.
- field id: str [Required][source]
Dataset unique identifier.
- Constraints:
minLength = 1
- Validated by:
- field metadata: DatasetMetadata [Required][source]
- Validated by:
- pydantic model qgreenland.models.config.dataset.DatasetCitation[source]
Bases:
QgrBaseModel
Citation for a dataset.
- pydantic model qgreenland.models.config.dataset.DatasetMetadata[source]
Bases:
QgrBaseModel
Metadata for the dataset.
- field citation: DatasetCitation [Required][source]
- Validated by:
Assets
- pydantic model qgreenland.models.config.asset.CmrAsset[source]
Bases:
DatasetAsset
Data fetched based on the location provided by CMR.
- field collection_concept_id: str [Required][source]
The CMR unique collection concept identifier.
- Constraints:
minLength = 1
- Validated by:
- pydantic model qgreenland.models.config.asset.CommandAsset[source]
Bases:
DatasetAsset
Data that are fetched via an arbitrary command.
Data is written to ‘{output_dir}’, which _must_ be specified in the command.
- pydantic model qgreenland.models.config.asset.DatasetAsset[source]
Bases:
QgrBaseModel
,ABC
Actual data associated with the dataset.
Assets determine how this data is accessed.
- pydantic model qgreenland.models.config.asset.HttpAsset[source]
Bases:
DatasetAsset
An asset fetched over HyperText Transfer Protocol.
- field verify_tls: bool = True[source]
Verify the server’s TLS certificate?
https://2.python-requests.org/en/master/api/#requests.Session.request
- Validated by:
- pydantic model qgreenland.models.config.asset.ManualAsset[source]
Bases:
DatasetAsset
Data that must be manually accessed by a human.
For example, data which require an interactive login.
- pydantic model qgreenland.models.config.asset.OnlineAsset[source]
Bases:
DatasetAsset
A QGIS online layer that is not fetched, but is accessed by QGIS.
- field provider: Literal['gdal', 'ogr', 'wms', 'wfs', 'wcs'] [Required][source]
The Layer Provider to use when setting up this layer in QGIS.
- Validated by:
- pydantic model qgreenland.models.config.asset.RepositoryAsset[source]
Bases:
DatasetAsset
Data stored in this repository in ASSETS_DIR.