Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add column selection parameter to coda processing algorithms #282

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -19,16 +19,28 @@ def __init__(self) -> None:
self._short_help_string = "Perform an additive logratio transformation on the data."

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "column", "keep_denominator_column", "output_vector"]
self.alg_parameters = [
"input_vector", "columns", "denominator_column", "keep_denominator_column", "output_vector"
]

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector with compositional data.")
self.addParameter(input_vector_param)

denominator_column_param = QgsProcessingParameterField(
columns_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True,
)
columns_param.setHelp("Columns to be transformed.")
self.addParameter(columns_param)

denominator_column_param = QgsProcessingParameterField(
name=self.alg_parameters[2],
description="Denominator column",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
Expand All @@ -37,7 +49,7 @@ def initAlgorithm(self, config=None):
self.addParameter(denominator_column_param)

keep_denominator_column_param = QgsProcessingParameterBoolean(
name=self.alg_parameters[2],
name=self.alg_parameters[3],
description="Keep denominator column",
defaultValue=False
)
Expand All @@ -47,7 +59,7 @@ def initAlgorithm(self, config=None):
self.addParameter(keep_denominator_column_param)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[3],
name=self.alg_parameters[4],
description="Output vector",
)
output_vector_param.setHelp("Output vector with the ALR transformed data.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qgis.core import (
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterVectorDestination,
)

Expand All @@ -17,16 +18,26 @@ def __init__(self) -> None:
self._short_help_string = "Perform a centered logratio transformation on the data."

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "output_vector"]
self.alg_parameters = ["input_vector", "columns", "output_vector"]

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector with compositional data.")
self.addParameter(input_vector_param)

output_vector_param = QgsProcessingParameterVectorDestination(
columns_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True
)
columns_param.setHelp("The names of the columns to be transformed.")
self.addParameter(columns_param)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[2],
description="Output vector",
)
output_vector_param.setHelp("Output vector with the CLR transformed data.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
from qgis.core import (
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
QgsProcessingParameterString,
QgsProcessingParameterVectorDestination,
)

Expand All @@ -19,23 +19,34 @@ def __init__(self) -> None:
self._short_help_string = "Perform the inverse transformation for a set of ALR transformed data."

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "denominator_column", "scale", "output_vector"]
self.alg_parameters = ["input_vector", "denominator_column", "columns", "scale", "output_vector"]

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector with ALR transformed compositional data.")
self.addParameter(input_vector_param)

denominator_column_name_param = QgsProcessingParameterString(
denominator_column_name_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Denominator column name",
description="Denominator column",
parentLayerParameterName=self.alg_parameters[0],
)
denominator_column_name_param.setHelp("The name of the denominator column.")
self.addParameter(denominator_column_name_param)

scale_param = QgsProcessingParameterNumber(
columns_param = QgsProcessingParameterField(
name=self.alg_parameters[2],
description="Columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True,
)
columns_param.setHelp("The names of the columns to be transformed.")
self.addParameter(columns_param)

scale_param = QgsProcessingParameterNumber(
name=self.alg_parameters[3],
description="Scale",
defaultValue=1.0,
type=QgsProcessingParameterNumber.Double
Expand All @@ -47,7 +58,7 @@ def initAlgorithm(self, config=None):
self.addParameter(scale_param)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[3],
name=self.alg_parameters[4],
description="Output vector",
)
output_vector_param.setHelp("Output vector with inverse transformed data.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qgis.core import (
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterNumber,
QgsProcessingParameterVectorDestination,
)
Expand All @@ -18,16 +19,26 @@ def __init__(self) -> None:
self._short_help_string = "Perform the inverse transformation for a set of CLR transformed data."

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "scale", "output_vector"] # NOTE: Colnames param omitted
self.alg_parameters = ["input_vector", "columns", "scale", "output_vector"] # NOTE: Colnames param omitted

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector with CLR transformed compositional data.")
self.addParameter(input_vector_param)

scale_param = QgsProcessingParameterNumber(
columns_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True,
)
columns_param.setHelp("The names of the columns to be transformed.")
self.addParameter(columns_param)

scale_param = QgsProcessingParameterNumber(
name=self.alg_parameters[2],
description="Scale",
defaultValue=1.0,
type=QgsProcessingParameterNumber.Double
Expand All @@ -39,7 +50,7 @@ def initAlgorithm(self, config=None):
self.addParameter(scale_param)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[2],
name=self.alg_parameters[3],
description="Output vector",
)
output_vector_param.setHelp("Output vector with inverse transformed data.")
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
from qgis.core import (
QgsProcessingParameterFeatureSource,
QgsProcessingParameterField,
QgsProcessingParameterVectorDestination,
)

Expand All @@ -15,18 +16,28 @@ def __init__(self) -> None:
self._group = "Transformations — CoDA"
self._group_id = "transformations_coda"
self._short_help_string = """
Perform a pivot logratio transformation on the dataframe, returning the full set of transforms.
Perform a pivot logratio transformation on the selected columns.
"""

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "output_vector"]
self.alg_parameters = ["input_vector", "columns", "output_vector"]

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
)
input_vector_param.setHelp("Input vector with compositional data.")
self.addParameter(input_vector_param)

columns_param = QgsProcessingParameterField(
name=self.alg_parameters[1],
description="Columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True,
)
columns_param.setHelp("The names of the columns to be transformed.")
self.addParameter(columns_param)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[1],
description="Output vector",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ def __init__(self) -> None:
"""

def initAlgorithm(self, config=None):
self.alg_parameters = ["input_vector", "column", "output_vector"]
self.alg_parameters = ["input_vector", "numerator", "denominator", "output_vector"]

input_vector_param = QgsProcessingParameterFeatureSource(
name=self.alg_parameters[0], description="Input vector"
Expand All @@ -41,8 +41,18 @@ def initAlgorithm(self, config=None):
numerator_column.setHelp("The name of the numerator column to use for the transformation.")
self.addParameter(numerator_column)

output_vector_param = QgsProcessingParameterVectorDestination(
denominator_columns = QgsProcessingParameterField(
name=self.alg_parameters[2],
description="Denominator columns",
parentLayerParameterName=self.alg_parameters[0],
optional=True,
allowMultiple=True,
)
denominator_columns.setHelp("The name(s) of the denominator column(s) to use for transformation.")
self.addParameter(denominator_columns)

output_vector_param = QgsProcessingParameterVectorDestination(
name=self.alg_parameters[3],
description="Output vector",
)
output_vector_param.setHelp("Output vector with the transformed data.")
Expand Down
Loading