From 6ee76fb1950896a892b88ab7e1c5d7f2cc897264 Mon Sep 17 00:00:00 2001 From: Trey Stafford Date: Thu, 24 Aug 2023 11:46:30 -0600 Subject: [PATCH] Reorganize hydrology layers --- qgreenland/config/cfg-lock.json | 586 +++++++++--------- .../__settings__.py | 11 + .../streams_outlets_basins.py | 0 .../config/layers/Hydrology/__settings__.py | 9 +- 4 files changed, 316 insertions(+), 290 deletions(-) create mode 100644 qgreenland/config/layers/Hydrology/Streams, outlets, and basins/__settings__.py rename qgreenland/config/layers/Hydrology/{ => Streams, outlets, and basins}/streams_outlets_basins.py (100%) diff --git a/qgreenland/config/cfg-lock.json b/qgreenland/config/cfg-lock.json index 018dc469b..14b1ade1b 100644 --- a/qgreenland/config/cfg-lock.json +++ b/qgreenland/config/cfg-lock.json @@ -19263,308 +19263,327 @@ "name": "marginal_lakes" }, { - "layer_cfg": { - "description": "Calculated locations for subglacial hydrologic basin ice-margin-terminating outlets.", - "id": "ice_outlets", - "in_package": true, - "input": { - "asset": { - "id": "ice_outlets" - }, - "dataset": { - "id": "streams_outlets_basins" - } - }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/ice_outlets.gpkg", - "{input_dir}/outlets.gpkg" + "children": [ + { + "layer_cfg": { + "description": "Calculated locations for subglacial hydrologic basin ice-margin-terminating outlets.", + "id": "ice_outlets", + "in_package": true, + "input": { + "asset": { + "id": "ice_outlets" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/ice_outlets.gpkg", + "{input_dir}/outlets.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "ice_outlets", - "tags": [], - "title": "Ice outlets" - }, - "name": "ice_outlets" - }, - { - "layer_cfg": { - "description": "Calculated locations for terrestrial hydrologic basin coast-terminating outlets.", - "id": "land_outlets", - "in_package": true, - "input": { - "asset": { - "id": "land_outlets" + "style": "ice_outlets", + "tags": [], + "title": "Ice outlets" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "ice_outlets" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/land_outlets.gpkg", - "{input_dir}/outlets.gpkg" + { + "layer_cfg": { + "description": "Calculated locations for terrestrial hydrologic basin coast-terminating outlets.", + "id": "land_outlets", + "in_package": true, + "input": { + "asset": { + "id": "land_outlets" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/land_outlets.gpkg", + "{input_dir}/outlets.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "land_outlets", - "tags": [], - "title": "Land outlets" - }, - "name": "land_outlets" - }, - { - "layer_cfg": { - "description": "Calculated subglacial hydrologic stream paths.", - "id": "ice_streams", - "in_package": true, - "input": { - "asset": { - "id": "ice_streams" + "style": "land_outlets", + "tags": [], + "title": "Land outlets" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "land_outlets" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "-dialect", - "sqlite", - "-sql", - "\"SELECT * from streams\n WHERE GeometryType(geom) = 'LINESTRING' AND ST_NPoints(geom) > 1\"", - "{output_dir}/ice_streams.gpkg", - "{input_dir}/streams.gpkg" + { + "layer_cfg": { + "description": "Calculated subglacial hydrologic stream paths.", + "id": "ice_streams", + "in_package": true, + "input": { + "asset": { + "id": "ice_streams" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "-dialect", + "sqlite", + "-sql", + "\"SELECT * from streams\n WHERE GeometryType(geom) = 'LINESTRING' AND ST_NPoints(geom) > 1\"", + "{output_dir}/ice_streams.gpkg", + "{input_dir}/streams.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "ice_streams", - "tags": [], - "title": "Ice streams" - }, - "name": "ice_streams" - }, - { - "layer_cfg": { - "description": "Calculated ice sheet hydrologic basins using regional climate model spatial coverage.", - "id": "ice_basins", - "in_package": true, - "input": { - "asset": { - "id": "ice_basins" + "style": "ice_streams", + "tags": [], + "title": "Ice streams" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "ice_streams" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/ice_basins.gpkg", - "{input_dir}/basins.gpkg" + { + "layer_cfg": { + "description": "Calculated ice sheet hydrologic basins using regional climate model spatial coverage.", + "id": "ice_basins", + "in_package": true, + "input": { + "asset": { + "id": "ice_basins" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/ice_basins.gpkg", + "{input_dir}/basins.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "ice_basins", - "tags": [], - "title": "Ice basins" - }, - "name": "ice_basins" - }, - { - "layer_cfg": { - "description": "Calculated ice sheet hydrologic basins including areas classified as land/ocean by regional climate models (filled).", - "id": "ice_basins_filled", - "in_package": true, - "input": { - "asset": { - "id": "ice_basins_filled" + "style": "ice_basins", + "tags": [], + "title": "Ice basins" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "ice_basins" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/ice_basins_filled.gpkg", - "{input_dir}/basins_filled.gpkg" + { + "layer_cfg": { + "description": "Calculated ice sheet hydrologic basins including areas classified as land/ocean by regional climate models (filled).", + "id": "ice_basins_filled", + "in_package": true, + "input": { + "asset": { + "id": "ice_basins_filled" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/ice_basins_filled.gpkg", + "{input_dir}/basins_filled.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "ice_basins", - "tags": [], - "title": "Ice basins filled" - }, - "name": "ice_basins_filled" - }, - { - "layer_cfg": { - "description": "Calculated terrestrial hydrologic stream paths.", - "id": "land_streams", - "in_package": true, - "input": { - "asset": { - "id": "land_streams" + "style": "ice_basins", + "tags": [], + "title": "Ice basins filled" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "ice_basins_filled" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "-dialect", - "sqlite", - "-sql", - "\"SELECT * from streams\n WHERE GeometryType(geom) = 'LINESTRING' AND ST_NPoints(geom) > 1\"", - "{output_dir}/land_streams.gpkg", - "{input_dir}/streams.gpkg" + { + "layer_cfg": { + "description": "Calculated terrestrial hydrologic stream paths.", + "id": "land_streams", + "in_package": true, + "input": { + "asset": { + "id": "land_streams" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "-dialect", + "sqlite", + "-sql", + "\"SELECT * from streams\n WHERE GeometryType(geom) = 'LINESTRING' AND ST_NPoints(geom) > 1\"", + "{output_dir}/land_streams.gpkg", + "{input_dir}/streams.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "land_streams", - "tags": [], - "title": "Land streams" - }, - "name": "land_streams" - }, - { - "layer_cfg": { - "description": "Calculated terrestrial hydrologic basins using regional climate model spatial coverage.", - "id": "land_basins", - "in_package": true, - "input": { - "asset": { - "id": "land_basins" + "style": "land_streams", + "tags": [], + "title": "Land streams" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "land_streams" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/land_basins.gpkg", - "{input_dir}/basins.gpkg" + { + "layer_cfg": { + "description": "Calculated terrestrial hydrologic basins using regional climate model spatial coverage.", + "id": "land_basins", + "in_package": true, + "input": { + "asset": { + "id": "land_basins" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/land_basins.gpkg", + "{input_dir}/basins.gpkg" + ], + "type": "command" + } ], - "type": "command" - } - ], - "style": "land_basins", - "tags": [], - "title": "Land basins" - }, - "name": "land_basins" - }, - { - "layer_cfg": { - "description": "Calculated terrestrial hydrologic basins including areas classified as ice/ocean by regional climate models (filled).", - "id": "land_basins_filled", - "in_package": true, - "input": { - "asset": { - "id": "land_basins_filled" + "style": "land_basins", + "tags": [], + "title": "Land basins" }, - "dataset": { - "id": "streams_outlets_basins" - } + "name": "land_basins" }, - "show": false, - "steps": [ - { - "args": [ - "ogr2ogr", - "-lco", - "ENCODING=UTF-8", - "-t_srs", - "EPSG:3413", - "-clipdst", - "{assets_dir}/latitude_shape_40_degrees.geojson", - "-makevalid", - "{output_dir}/land_basins_filled.gpkg", - "{input_dir}/basins_filled.gpkg" + { + "layer_cfg": { + "description": "Calculated terrestrial hydrologic basins including areas classified as ice/ocean by regional climate models (filled).", + "id": "land_basins_filled", + "in_package": true, + "input": { + "asset": { + "id": "land_basins_filled" + }, + "dataset": { + "id": "streams_outlets_basins" + } + }, + "show": false, + "steps": [ + { + "args": [ + "ogr2ogr", + "-lco", + "ENCODING=UTF-8", + "-t_srs", + "EPSG:3413", + "-clipdst", + "{assets_dir}/latitude_shape_40_degrees.geojson", + "-makevalid", + "{output_dir}/land_basins_filled.gpkg", + "{input_dir}/basins_filled.gpkg" + ], + "type": "command" + } ], - "type": "command" - } + "style": "land_basins", + "tags": [], + "title": "Land basins filled" + }, + "name": "land_basins_filled" + } + ], + "name": "Streams, outlets, and basins", + "settings": { + "expand": false, + "order": [ + ":ice_outlets", + ":land_outlets", + ":ice_streams", + ":ice_basins", + ":ice_basins_filled", + ":land_streams", + ":land_basins", + ":land_basins_filled" ], - "style": "land_basins", - "tags": [], - "title": "Land basins filled" - }, - "name": "land_basins_filled" + "show": false + } } ], "name": "Hydrology", @@ -19572,14 +19591,7 @@ "expand": false, "order": [ ":marginal_lakes", - ":ice_outlets", - ":land_outlets", - ":ice_streams", - ":ice_basins", - ":ice_basins_filled", - ":land_streams", - ":land_basins", - ":land_basins_filled" + "Streams, outlets, and basins" ], "show": false } diff --git a/qgreenland/config/layers/Hydrology/Streams, outlets, and basins/__settings__.py b/qgreenland/config/layers/Hydrology/Streams, outlets, and basins/__settings__.py new file mode 100644 index 000000000..9a7cd5cb7 --- /dev/null +++ b/qgreenland/config/layers/Hydrology/Streams, outlets, and basins/__settings__.py @@ -0,0 +1,11 @@ +from qgreenland.config.helpers.layers.streams_outlets_basins import ORDERED_LAYER_IDS +from qgreenland.models.config.layer_group import ( + LayerGroupSettings, + LayerIdentifier, +) + +settings = LayerGroupSettings( + order=[ + *[LayerIdentifier(layer_id) for layer_id in ORDERED_LAYER_IDS], + ], +) diff --git a/qgreenland/config/layers/Hydrology/streams_outlets_basins.py b/qgreenland/config/layers/Hydrology/Streams, outlets, and basins/streams_outlets_basins.py similarity index 100% rename from qgreenland/config/layers/Hydrology/streams_outlets_basins.py rename to qgreenland/config/layers/Hydrology/Streams, outlets, and basins/streams_outlets_basins.py diff --git a/qgreenland/config/layers/Hydrology/__settings__.py b/qgreenland/config/layers/Hydrology/__settings__.py index 5f77b3faa..a7b32c439 100644 --- a/qgreenland/config/layers/Hydrology/__settings__.py +++ b/qgreenland/config/layers/Hydrology/__settings__.py @@ -1,9 +1,12 @@ -from qgreenland.config.helpers.layers.streams_outlets_basins import ORDERED_LAYER_IDS -from qgreenland.models.config.layer_group import LayerGroupSettings, LayerIdentifier +from qgreenland.models.config.layer_group import ( + LayerGroupIdentifier, + LayerGroupSettings, + LayerIdentifier, +) settings = LayerGroupSettings( order=[ LayerIdentifier("marginal_lakes"), - *[LayerIdentifier(layer_id) for layer_id in ORDERED_LAYER_IDS], + LayerGroupIdentifier("Streams, outlets, and basins"), ], )