# !/usr/bin/env python3
# =========================================================================
# Program: iota2
#
# Copyright (c) CESBIO. All rights reserved.
#
# See LICENSE for details.
#
# This software is distributed WITHOUT ANY WARRANTY; without even
# the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR
# PURPOSE. See the above copyright notices for more information.
#
# =========================================================================
"""Module that groups all the definitions of the simplification parameters"""
from typing import ClassVar
from pydantic import Field
from iota2.configuration_files.sections.cfg_utils import (
FileParameter,
Iota2ParamSection,
)
[docs]class SimplificationSection(Iota2ParamSection):
"""Parameters of the section 'simplification'."""
section_name: ClassVar[str] = "simplification"
umc1: int = Field(
None,
doc_type="int",
short_desc="MMU for the first regularization.",
long_desc=(
"""
It is an interface of parameter '-st' of gdal_sieve.py function.
If None, classification is not regularized."
"""
),
available_on_builders=["I2Obia"],
)
umc2: int = Field(
None,
doc_type="int",
short_desc="MMU for the second regularization.",
long_desc=(
"""
OSO-like vectorization process requires 2 successive regularizations, if you need
a single regularization, let this parameter to None.
"""
),
available_on_builders=["I2Obia"],
)
inland: FileParameter = Field(
None,
doc_type="str",
short_desc="Inland water limit shapefile.",
long_desc=(
"To vectorize only inland waters, and not unnecessary sea water areas."
),
available_on_builders=["I2Obia"],
)
rssize: int = Field(
20,
doc_type="int",
short_desc="Resampling size of input classification raster (projection unit)",
long_desc=(
"""
OSO-like vectorization requires a resampling step in order to regularize and decrease
raster polygons number. If None, classification is not resampled.
"""
),
available_on_builders=["I2Obia"],
)
gridsize: int = Field(
None,
doc_type="int",
short_desc="Number of lines and columns of the serialization process.",
long_desc=(
"""
This parameter is useful only for large areas for which vectorization process can not
be executed (memory limitation).
By 'serialization', we mean parallel vectorization processes.
If not None, regularized classification raster is split in gridsize x gridsize rasters.
"""
),
available_on_builders=["I2Obia"],
)
nomenclature: FileParameter = Field(
None,
doc_type="Configuration file which describes nomenclature.",
short_desc="Configuration file which describes nomenclature.",
long_desc=(
"""
The following configuration file includes code, color, description
and vector field alias of each class:
.. code-block:: bash
Classes:
{
Level1:
{
"Urbain":
{
code:100
alias:"Urbain"
color:"#b106b1"
}
...
}
Level2:
{
"Urbain dense":
{
code:1
alias:"UrbainDens"
color:"#ff00ff"
parent:100
}
...
}
}
"""
),
available_on_builders=["I2Obia"],
)