diff --git a/qgreenland/config/datasets/gtn_permafrost.py b/qgreenland/config/datasets/gtn_permafrost.py new file mode 100644 index 00000000..f966b1b6 --- /dev/null +++ b/qgreenland/config/datasets/gtn_permafrost.py @@ -0,0 +1,39 @@ +from qgreenland.models.config.asset import HttpAsset +from qgreenland.models.config.dataset import Dataset + +gtn_permafrost = Dataset( + id="gtn_permafrost", + assets=[ + HttpAsset( + id="boreholes", + urls=[ + "http://flatey.arcticportal.org:8080/geoserver/page21/ows?service=WFS&version=1.0.0&request=GetFeature&typeName=page21:tsp&maxFeatures=3000&outputFormat=CSV", + ], + ), + HttpAsset( + id="calm_sites", + urls=[ + "https://gtnp.arcticportal.org/images/downloads/calm.csv", + ], + ), + ], + metadata={ + "title": "Global Terrestrial Network for Permafrost (GTN-P)", + "abstract": ( + """The Global Terrestrial Network for Permafrost (GTN-P) is the + primary international programme concerned with monitoring permafrost + parameters. GTN-P was developed by the International Permafrost + Association (IPA) under the Global Climate Observing System (GCOS) + and the Global Terrestrial Observing Network (GTOS) in 1999, with + the long term goal of obtaining a comprehensive view of the spatial + structure, trends, and variability of changes in the active layer + thickness and permafrost temperature.""" + ), + "citation": { + "text": ( + """Global Terrestrial Network for Permafrost. Date accessed: {{date_accessed}}.""" + ), + "url": "https://gtnp.arcticportal.org/", + }, + }, +) diff --git a/qgreenland/config/layers/Frozen ground/layers.py b/qgreenland/config/layers/Frozen ground/layers.py index 3980632b..0e6c0012 100644 --- a/qgreenland/config/layers/Frozen ground/layers.py +++ b/qgreenland/config/layers/Frozen ground/layers.py @@ -1,9 +1,11 @@ +from qgreenland.config.datasets.gtn_permafrost import gtn_permafrost from qgreenland.config.datasets.pangaea_ground_temperature import ( - pangaea_ground_temperature as dataset, + pangaea_ground_temperature as pangaea_dataset, ) from qgreenland.config.helpers.steps.compress_and_add_overviews import ( compress_and_add_overviews, ) +from qgreenland.config.helpers.steps.ogr2ogr import ogr2ogr from qgreenland.config.helpers.steps.warp_and_cut import warp_and_cut from qgreenland.config.project import project from qgreenland.models.config.layer import Layer, LayerInput @@ -36,7 +38,7 @@ } -layers = [ +pangaea_layers = [ Layer( id=layer_id, title=params["title"], @@ -44,8 +46,8 @@ tags=[], style=params["style"], input=LayerInput( - dataset=dataset, - asset=dataset.assets["10km"], + dataset=pangaea_dataset, + asset=pangaea_dataset.assets["10km"], ), steps=[ *warp_and_cut( @@ -85,3 +87,61 @@ ) for layer_id, params in _layer_params.items() ] + +gtn_permafrost_layers = [ + Layer( + id=layer_id, + title=params["title"], + description=params["description"], + tags=[], + style=params["style"], + input=LayerInput( + dataset=gtn_permafrost, + asset=gtn_permafrost.assets[params["asset"]], + ), + steps=[ + *ogr2ogr( + input_file="{input_dir}/*.csv", + output_file="{output_dir}/final.gpkg", + ogr2ogr_args=( + "-s_srs", + "EPSG:4326", + # The geometry is encoded as a WKT `Point` + "-oo", + "GEOM_POSSIBLE_NAMES=geom_ref", + "-oo", + "AUTODETECT_TYPE=YES", + *params["ogr2ogr_args"], + ), + ), + ], + ) + for layer_id, params in { + "boreholes": { + "title": "Thermal State of Permafrost (TSP) monitoring sites", + "description": ( + """The maps of boreholes display the location of all + Thermal State of Permafrost (TSP) monitoring sites contained in + the GTN-P database. + + """ + ), + "style": None, + "asset": "boreholes", + "ogr2ogr_args": (), + }, + "calm_sites": { + "title": "Active Layer Monitoring sites", + "description": "The maps of Circumpolar Active Layer Thickness Monitoring (CALM) sites display the location of all monitoring sites contained in the GTN-P database.", + "style": None, + "asset": "calm_sites", + "ogr2ogr_args": ( + # Layer creation option: Use "ID" as a FID column instead of + # the existing "FID", which is a string. `ogr2ogr` complains + # that this is an invalid type for the FID column otherwise. + "-lco", + "FID=ID", + ), + }, + }.items() +]