Skip to content

Commit

Permalink
Merge pull request #275 from Samweli/admin_default_data_management
Browse files Browse the repository at this point in the history
Admin default data management
  • Loading branch information
Samweli authored Nov 6, 2023
2 parents 3adb070 + 21e9984 commit 15dc72b
Show file tree
Hide file tree
Showing 10 changed files with 637 additions and 630 deletions.
27 changes: 25 additions & 2 deletions src/cplus_plugin/conf.py
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,24 @@ def get_value(self, name: str, default=None, setting_type=None):
)
return self.settings.value(f"{self.BASE_GROUP_NAME}/{name}", default)

def find_settings(self, name):
"""Returns the plugin setting keys from the
plugin root group that matches the passed name
:param name: Setting name to search for
:type name: str
:returns result: List of the matching settings names
:rtype result: list
"""

result = []
with qgis_settings(f"{self.BASE_GROUP_NAME}") as settings:
for settings_name in settings.childKeys():
if name in settings_name:
result.append(settings_name)
return result

def remove(self, name):
"""Remove the setting with the specified name.
Expand Down Expand Up @@ -366,12 +384,16 @@ def get_priority_layer(self, identifier) -> typing.Dict:
:returns: Priority layers dict
:rtype: dict
"""
priority_layer = None

settings_key = self._get_priority_layers_settings_base(identifier)
with qgis_settings(settings_key) as settings:
groups_key = f"{settings_key}/groups"
groups = []

if len(settings.childKeys()) <= 0:
return priority_layer

with qgis_settings(groups_key) as groups_settings:
for name in groups_settings.childGroups():
group_settings_key = f"{groups_key}/{name}"
Expand Down Expand Up @@ -440,6 +462,7 @@ def find_layer_by_name(self, name) -> typing.Dict:
:returns: Priority layers dict
:rtype: dict
"""
found_id = None
with qgis_settings(
f"{self.BASE_GROUP_NAME}/" f"{self.PRIORITY_LAYERS_GROUP_NAME}"
) as settings:
Expand All @@ -451,7 +474,7 @@ def find_layer_by_name(self, name) -> typing.Dict:
found_id = uuid.UUID(layer_id)
break

return self.get_priority_layer(found_id)
return self.get_priority_layer(found_id) if found_id is not None else None

def find_layers_by_group(self, group) -> typing.List:
"""Finds priority layers inside the plugin QgsSettings
Expand Down Expand Up @@ -529,7 +552,7 @@ def set_current_priority_layer(self, identifier):
)

def delete_priority_layers(self):
"""Deletes all the plugin priority settings."""
"""Deletes all the plugin priority weighting layers settings."""
with qgis_settings(
f"{self.BASE_GROUP_NAME}/" f"{self.PRIORITY_LAYERS_GROUP_NAME}"
) as settings:
Expand Down
330 changes: 330 additions & 0 deletions src/cplus_plugin/data/default/implementation_models.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,330 @@
{
"models": [
{
"uuid": "a0b8fd2d-1259-4141-9ad6-d4369cf0dfd4",
"name": "Agroforestry",
"description": " Agroforestry is an integrated land use system that combines the cultivation of trees with agricultural crops and/or livestock. It promotes sustainable land management, biodiversity conservation, soil health improvement, and diversified income sources for farmers.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#d80007",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "Reds"}
}
},
{
"uuid": "1c8db48b-717b-451b-a644-3af1bee984ea",
"name": "Alien Plant Removal",
"description": "This model involves the removal of invasive alien plant species that negatively impact native ecosystems. By eradicating these plants, natural habitats can be restored, allowing native flora and fauna to thrive.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"3c155210-ccd8-404b-bbe8-b1433d6158a2",
"9f6c8b8f-0648-44ca-b943-58fab043f559",
"9291a5d9-d1cd-44c2-8fc3-2b3b20f80572"
],
"style": {
"scenario_layer": {
"color": "#6f6f6f",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "Greys"}
}
},
{
"uuid": "de9597b2-f082-4299-9620-1da3bad8ab62",
"name": "Applied Nucleation",
"description": " Applied nucleation is a technique that jump-starts the restoration process by creating focal points of vegetation growth within degraded areas. These 'nuclei' serve as centers for biodiversity recovery, attracting seeds, dispersers, and other ecological processes, ultimately leading to the regeneration of the surrounding landscape.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#81c4ff",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "PuBu"}
}
},
{
"uuid": "40f04ea6-1f91-4695-830a-7d46f821f5db",
"name": "Assisted Natural Regeneration",
"description": " This model focuses on facilitating the natural regeneration of forests and degraded lands by removing barriers (such as alien plants or hard crusted soils) and providing support for native plant species to regrow. It involves activities such as removing competing vegetation, protecting young seedlings, and restoring ecosystem functions.",
"pwls_ids": [
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"85cd441e-fa3d-46e4-add9-973ba58f8bd4",
"5e41f4fa-3d7f-41aa-bee7-b9e9d08b56db",
"86c3dfc5-58d7-4ebd-a851-3b65a6bf5edd",
"620d5d7d-c452-498f-b848-b206a76891cd"
],
"style": {
"scenario_layer": {
"color": "#e8ec18",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "YlOrRd"}
}
},
{
"uuid": "43f96ed8-cd2f-4b91-b6c8-330d3b93bcc1",
"name": "Avoided Deforestation and Degradation",
"description": " This model focuses on preventing the conversion of forested areas into other land uses and minimizing degradation of existing forests. It involves implementing measures to protect and sustainably manage forests, preserving their biodiversity, carbon sequestration potential, and ecosystem services.",
"pwls_ids": [
"f5687ced-af18-4cfc-9bc3-8006e40420b6",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#ff4c84",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "RdPu"}
}
},
{
"uuid": "c3c5a381-2b9f-4ddc-8a77-708239314fb6",
"name": "Avoided Wetland Conversion/Restoration",
"description": " This model aims to prevent the conversion of wetland ecosystems into other land uses and, where possible, restore degraded wetlands. It involves implementing conservation measures, such as land-use planning, regulatory frameworks, and restoration efforts, to safeguard the ecological functions and biodiversity of wetland habitats",
"pwls_ids": [
"f5687ced-af18-4cfc-9bc3-8006e40420b6",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#1f31d3",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "Blues"}
}
},
{
"uuid": "3defbd0e-2b12-4ab2-a7d4-a035152396a7",
"name": "Bioproducts",
"description": " The bioproducts model focuses on utilizing natural resources sustainably to create value-added products. It involves the development and production of renewable and biodegradable materials, such as biofuels, bio-based chemicals, and bio-based materials, to reduce reliance on fossil fuels and promote a more sustainable economy.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"fef3c7e4-0cdf-477f-823b-a99da42f931e",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"fb92cac1-7744-4b11-8238-4e1da97650e0",
"9e5cff3f-73e7-4734-b76a-2a9f0536fa27",
"c5b1b81e-e1ae-41ec-adeb-7388f7597156",
"3872be6d-f791-41f7-b031-b85173e41d5e"
],
"style": {
"scenario_layer": {
"color": "#67593f",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "BrBG"}
}
},
{
"uuid": "22f9e555-0356-4b18-b292-c2d516dcdba5",
"name": "Bush Thinning",
"description": "Bush thinning refers to the controlled removal of excess woody vegetation in certain ecosystems and using that biomass to brush pack bare soil areas to promote regrowth of grass. This practice helps restore natural balance, prevent overgrowth, and enhance biodiversity.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"fef3c7e4-0cdf-477f-823b-a99da42f931e",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"e1a801c5-7f77-4746-be34-0138b62ff25c",
"478b0729-a507-4729-b1e4-b2bea7e161fd",
"5f329f53-31ff-4039-b0ec-a8d174a50866",
"5bcebbe2-7035-4d81-9817-0b4db8aa63e2"
],
"style": {
"scenario_layer": {
"color": "#30ff01",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "BuGn"}
}
},
{
"uuid": "177f1f27-cace-4f3e-9c3c-ef2cf54fc283",
"name": "Direct Tree Seeding",
"description": " This model involves planting tree seeds directly into the ground, allowing them to grow and establish without the need for nursery cultivation. It is a cost-effective and environmentally friendly approach to reforestation and afforestation efforts, promoting forest restoration and carbon sequestration.",
"pwls_ids": [
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#bd6b70",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "PuRd"}
}
},
{
"uuid": "d9d00a77-3db1-4390-944e-09b27bcbb981",
"name": "Livestock Rangeland Management",
"description": "This model focuses on sustainable management practices for livestock grazing on rangelands. It includes rotational grazing, monitoring of vegetation health, and implementing grazing strategies that promote biodiversity, soil health, and sustainable land use.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"fee0b421-805b-4bd9-a629-06586a760405",
"38a33633-9198-4b55-a424-135a4d522973",
"88dc8ff3-e61f-4a48-8f9b-5791efb6603f",
"a1bfff8e-fb87-4bca-97fa-a984d9bde712"
],
"style": {
"scenario_layer": {
"color": "#ffa500",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "YlOrBr"}
}
},
{
"uuid": "4fbfcb1c-bfd7-4305-b216-7a1077a2ccf7",
"name": "Livestock Market Access",
"description": " This model aims to improve market access for livestock producers practicing sustainable and regenerative farming methods. It involves creating networks, certifications, and partnerships that support the sale of sustainably produced livestock products, promoting economic viability and incentivizing environmentally friendly practices.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#6c0009",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "PRGn"}
}
},
{
"uuid": "20491092-e665-4ee7-b92f-b0ed864c7312",
"name": "Natural Woodland Livestock Management",
"description": " This model emphasizes the sustainable management of livestock within natural woodland environments. It involves implementing practices that balance livestock grazing with the protection and regeneration of native woodlands, ensuring ecological integrity while meeting livestock production goals.",
"pwls_ids": [
"c931282f-db2d-4644-9786-6720b3ab206a",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#007018",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "Greens"}
}
},
{
"uuid": "1334cc3b-cb7b-46a3-923a-45d9b18d9d56",
"name": "Protected Area Expansion",
"description": "This model involves expanding existing protected areas to protect more grassland, savanna, and forest from converting to an anthropogenic land cover class.",
"pwls_ids": [
"f5687ced-af18-4cfc-9bc3-8006e40420b6",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"style": {
"scenario_layer": {
"color": "#c27ba0",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "PiYG"}
}
},
{
"uuid": "1334cc3b-cb7b-46a3-923a-45d9b18d9d56",
"name": "Protected Area Expansion",
"description": "This model involves expanding existing protected areas to protect more grassland, savanna, and forest from converting to an anthropogenic land cover class.",
"pwls_ids": [
"f5687ced-af18-4cfc-9bc3-8006e40420b6",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"88c1c7dd-c5d1-420c-a71c-a5c595c1c5be",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20"
],
"fill_style": {
"color": "#c27ba0",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
}
},
{
"uuid": "92054916-e8ea-45a0-992c-b6273d1b75a7",
"name": "Sustainable Crop Farming & Aquaponics",
"description": " This model combines sustainable crop farming practices such as agroecology, Permaculture and aquaponics, a system that integrates aquaculture (fish farming) with hydroponics (soil-less crop cultivation). It enables the production of crops with sustainable practices in a mutually beneficial and resource-efficient manner, reducing water usage and chemical inputs while maximizing productivity.",
"pwls_ids": [
"f5687ced-af18-4cfc-9bc3-8006e40420b6",
"fce41934-5196-45d5-80bd-96423ff0e74e",
"9ab8c67a-5642-4a09-a777-bd94acfae9d1",
"2f76304a-bb73-442c-9c02-ff9945389a20",
"6f7c1494-f73e-4e5e-8411-59676f9fa6e1",
"151668e7-8ffb-4766-9534-09949ab0356b",
"ed1ee71b-e7db-4599-97a9-a97c941a615f",
"307df1f4-206b-4f70-8db4-6505948e2a4e"
],
"style": {
"scenario_layer": {
"color": "#781a8b",
"style": "solid",
"outline_width": "0",
"outline_color": "35,35,35,0"
},
"model_layer": {"color_ramp": "Purples"}
}
}
]
}
Loading

0 comments on commit 15dc72b

Please sign in to comment.