Models

pydantic model qgreenland.models.base_model.QgrBaseModel[source]

Bases: pydantic.main.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.

validator clean_all_string_fields  »  all fields[source]

Clean up all string fields with cleandoc.

This adjusts indentation and removes leading and trailing newlines, enabling cleaner use of triple-quoted strings, just like docstrings.

validator validate_id_fields  »  all fields[source]

Ensure id fields have appropriate content.

Only lowercase alphanumeric characters or underscores are permitted.

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: qgreenland.models.base_model.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
  • clean_all_string_fields

  • validate_id_fields

field layer_tree: anytree.node.node.Node [Required][source]

A tree of all layers and groups.

Structured as they would be in the QGIS Layers Panel.

Validated by
  • clean_all_string_fields

  • validate_id_fields

field layers: dict[str, qgreenland.models.config.layer.Layer] [Required][source]

A lookup of all layers included in the project.

Validated by
  • clean_all_string_fields

  • validate_id_fields

field project: qgreenland.models.config.project.Project [Required][source]

General project-wide configuration, such as CRS.

Validated by
  • clean_all_string_fields

  • validate_id_fields

Project

pydantic model qgreenland.models.config.project.BoundariesInfo[source]

Bases: qgreenland.models.base_model.QgrBaseModel

field bbox: qgreenland.models.config.project.BoundingBox [Required][source]

Bounding box, automatically populated from the file.

Validated by
field filepath: qgreenland.util.runtime_vars.EvalFilePath [Required][source]

Path to GeoJSON boundary file.

Validated by
validator calculate_bbox  »  all fields[source]
Return type

dict[str, Any]

validator ensure_relative_to_assets  »  filepath[source]
pydantic model qgreenland.models.config.project.BoundingBox[source]

Bases: qgreenland.models.base_model.QgrBaseModel

field max_x: float [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

field max_y: float [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

field min_x: float [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

field min_y: float [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

pydantic model qgreenland.models.config.project.Project[source]

Bases: qgreenland.models.base_model.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
  • clean_all_string_fields

  • validate_id_fields

field crs: str [Required][source]

The Coordinate Reference System of the project.

Validated by
  • clean_all_string_fields

  • validate_id_fields

Layer Groups

pydantic model qgreenland.models.config.layer_group.LayerGroupSettings[source]

Bases: qgreenland.models.config.layer_group.RootGroupSettings

field expand: bool = False[source]

Whether the group is expanded or collapsed in the QGIS Layers Panel.

Validated by
  • validate_id_fields

  • clean_all_string_fields

field show: bool = False[source]

Whether the group is shown or hidden in the QGIS Layers Panel.

Validated by
  • validate_id_fields

  • clean_all_string_fields

pydantic model qgreenland.models.config.layer_group.RootGroupSettings[source]

Bases: qgreenland.models.base_model.QgrBaseModel

Settings specific to the root group.

field order: Optional[list[str]] [Required][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
  • validate_id_fields

  • clean_all_string_fields

Layers

pydantic model qgreenland.models.config.layer.Layer[source]

Bases: qgreenland.models.base_model.QgrBaseModel

field description: str [Required][source]

Descriptive text shown as hover-text in the QGIS Layer Panel.

Constraints
  • minLength = 1

Validated by
  • validate_id_fields

  • validate_paragraph_text

  • clean_all_string_fields

field id: str [Required][source]

Unique identifier.

Validated by
  • validate_id_fields

  • clean_all_string_fields

field in_package: bool = True[source]

Is this layer in the final QGreenland zip file?

Validated by
  • validate_id_fields

  • clean_all_string_fields

field input: qgreenland.models.config.layer.LayerInput [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

field show: bool = False[source]

Is this layer initially “checked” or visible in QGIS?

Validated by
  • validate_id_fields

  • clean_all_string_fields

field steps: Optional[list[qgreenland.models.config.step.CommandStep]] [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

field style: Optional[str] = None[source]

Which style (.qml) file to use for this layer?

Omit the file extension.

Constraints
  • minLength = 1

Validated by
field tags: list[str] = [][source]

Additional categories that describe this data.

Validated by
  • validate_id_fields

  • clean_all_string_fields

field title: str [Required][source]

The layer name in QGIS Layers Panel.

Validated by
  • validate_id_fields

  • clean_all_string_fields

validator style_file_exists  »  style[source]

Ensure the QML style file exists in the configuration.

property style_filepath: Optional[pathlib.Path][source]

Full filepath to the QML style file.

pydantic model qgreenland.models.config.layer.LayerInput[source]

Bases: qgreenland.models.base_model.QgrBaseModel

The input(s) to a layer’s processing pipeline.

field asset: 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]

The actual input asset (file or files).

Validated by
  • validate_id_fields

  • clean_all_string_fields

field dataset: qgreenland.models.config.dataset.Dataset [Required][source]

The dataset providing the layer’s input. Important for metadata.

Validated by
  • validate_id_fields

  • clean_all_string_fields

Steps

qgreenland.models.config.step.AnyStep[source]

alias of qgreenland.models.config.step.CommandStep

pydantic model qgreenland.models.config.step.CommandStep[source]

Bases: qgreenland.models.base_model.QgrBaseModel, qgreenland.models.config.step.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: Optional[str] [Required][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
validator set_default_id  »  all fields[source]

Generate an identifier from args if one is not provided.

property provenance: str[source]

Represent what was done in this step.

class qgreenland.models.config.step.LayerStep[source]

Bases: abc.ABC

id: Optional[str][source]

An identifier for the step. Does not need to be unique.

abstract property provenance: str[source]

Represent what was done in this step.

type: str[source]

The type of the step. Should not be set by the user.

Datasets

pydantic model qgreenland.models.config.dataset.Dataset[source]

Bases: qgreenland.models.base_model.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.

Validated by
field id: str [Required][source]

Dataset unique identifier.

Constraints
  • minLength = 1

Validated by
  • validate_id_fields

  • clean_all_string_fields

field metadata: qgreenland.models.config.dataset.DatasetMetadata [Required][source]
Validated by
  • validate_id_fields

  • clean_all_string_fields

validator index_assets_by_id  »  assets[source]

Reindex assets from a list to a dictionary keyed by id.

pydantic model qgreenland.models.config.dataset.DatasetCitation[source]

Bases: qgreenland.models.base_model.QgrBaseModel

Citation for a dataset.

field text: str [Required][source]

The citation text.

Validated by
field url: str [Required][source]

The citation URL. This is usually a doi.org URL.

Validated by
  • validate_id_fields

  • clean_all_string_fields

validator strip_enclosing_newlines  »  text[source]

Clean up the citation text.

pydantic model qgreenland.models.config.dataset.DatasetMetadata[source]

Bases: qgreenland.models.base_model.QgrBaseModel

Metadata for the dataset.

field abstract: str [Required][source]

The dataset abstract.

Validated by
  • clean_all_string_fields

  • validate_paragraph_text

  • validate_id_fields

field citation: qgreenland.models.config.dataset.DatasetCitation [Required][source]
Validated by
  • clean_all_string_fields

  • validate_id_fields

field title: str [Required][source]

The dataset’s title. Please use sentence case, not title case.

Validated by
  • clean_all_string_fields

  • validate_id_fields

Assets

pydantic model qgreenland.models.config.asset.CmrAsset[source]

Bases: qgreenland.models.config.asset.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
  • validate_id_fields

  • clean_all_string_fields

field granule_ur: str [Required][source]

The CMR unique granule UR identifier.

Constraints
  • minLength = 1

Validated by
  • validate_id_fields

  • clean_all_string_fields

property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.CommandAsset[source]

Bases: qgreenland.models.config.asset.DatasetAsset

Data that are fetched via an arbitrary command.

Data is written to ‘{output_dir}’, which _must_ be specified in the command.

field args: list[qgreenland.util.runtime_vars.EvalStr] [Required][source]

Command arguments.

E.g.: [‘echo’, ‘foo’, ‘>’, ‘{output_dir}/foo.txt’].

Validated by
  • validate_id_fields

  • clean_all_string_fields

property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.DatasetAsset[source]

Bases: qgreenland.models.base_model.QgrBaseModel, abc.ABC

Actual data associated with the dataset.

Assets determine how this data is accessed.

field id: str [Required][source]

Asset unique identifier. Must be unique within the dataset.

Constraints
  • minLength = 1

Validated by
  • clean_all_string_fields

  • validate_id_fields

abstract property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.HttpAsset[source]

Bases: qgreenland.models.config.asset.DatasetAsset

An asset fetched over HyperText Transfer Protocol.

field urls: list[pydantic.networks.AnyUrl] [Required][source]

List of URLs to fetch.

Validated by
  • clean_all_string_fields

  • validate_id_fields

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
  • clean_all_string_fields

  • validate_id_fields

property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.ManualAsset[source]

Bases: qgreenland.models.config.asset.DatasetAsset

Data that must be manually accessed by a human.

For example, data which require an interactive login.

field access_instructions: str [Required][source]

Instructions for accessing the asset.

Constraints
  • minLength = 1

Validated by
  • clean_all_string_fields

  • validate_id_fields

property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.OnlineAsset[source]

Bases: qgreenland.models.config.asset.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
  • clean_all_string_fields

  • validate_id_fields

field url: Union[pydantic.networks.AnyUrl, str] [Required][source]

The URL to use when setting up this layer in QGIS.

Validated by
  • clean_all_string_fields

  • validate_id_fields

property provenance: str[source]

How the asset was acquired.

pydantic model qgreenland.models.config.asset.RepositoryAsset[source]

Bases: qgreenland.models.config.asset.DatasetAsset

Data stored in this repository in ASSETS_DIR.

field filepath: qgreenland.util.runtime_vars.EvalFilePath [Required][source]

The location of the asset, e.g. {assets_dir}/foo.txt.

Validated by
validator ensure_relative_to_assets  »  filepath[source]

Ensure the asset path is as expected.

property provenance: str[source]

How the asset was acquired.