Skip to content

Commit

Permalink
unify parameters for tree addons (#71)
Browse files Browse the repository at this point in the history
* unify parameters for tree addons

* black

* unify parameter names and defaults, unify v.trees.species

* generalize default values, add messages
  • Loading branch information
juleshaas authored Mar 25, 2024
1 parent a1f7d39 commit e79aea7
Show file tree
Hide file tree
Showing 9 changed files with 176 additions and 163 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,14 @@
# % description: Input natural tiles as vector map
# %end

# %option
# % key: new_mapset
# % type: string
# % required: yes
# % key_desc: name
# % description: Name for new mapset
# %end

# %option G_OPT_I_GROUP
# % key: group
# % multiple: no
Expand All @@ -56,14 +64,6 @@
# % description: Name of classified output raster map
# %end

# %option
# % key: new_mapset
# % type: string
# % required: yes
# % key_desc: name
# % description: Name for new mapset
# %end

import sys
import os

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
#
# MODULE: r.trees.mlapply
#
# AUTHOR(S): Julia Haas, Markus Metz, Lina Krisztian
# AUTHOR(S): Markus Metz, Lina Krisztian, Julia Haas
#
# PURPOSE: Applies the tree classification model in parallel to the
# current region
Expand Down Expand Up @@ -36,24 +36,28 @@
# %option G_OPT_V_INPUT
# % key: area
# % label: Name of vector defining area of interest
# % answer: study_area
# % guisection: Input
# %end

# %option G_OPT_I_GROUP
# % key: group
# % label: Name of input group
# % answer: ml_input
# % guisection: Input
# %end

# %option G_OPT_F_INPUT
# % key: model
# % label: Name of input model file
# % answer: ml_trees_randomforest.gz
# % guisection: Input
# %end

# %option G_OPT_R_OUTPUT
# % key: output
# % label: Name of classified output raster map
# % answer: tree_pixels
# % guisection: Output
# %end

Expand All @@ -67,8 +71,8 @@
# % key: tile_size
# % type: double
# % required: no
# % answer: 1000
# % label: Edge length of grid tiles in map units for parallel processing
# % answer: 1000
# % guisection: Parallel processing
# %end

Expand Down
51 changes: 25 additions & 26 deletions grass-gis-addons/m.analyse.trees/r.trees.mltrain/r.trees.mltrain.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,64 +27,64 @@

# %option G_OPT_R_INPUT
# % key: red_raster
# % required: yes
# % label: Name of the red band
# % label: Name of the red raster
# % answer: top_red_02
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: green_raster
# % required: yes
# % label: Name of the green band
# % label: Name of the green raster
# % answer: top_green_02
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: blue_raster
# % required: yes
# % label: Name of the blue band
# % label: Name of the blue raster
# % answer: top_blue_02
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: nir_raster
# % required: yes
# % label: Name of the NIR raster
# % answer: top_nir_02
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: ndvi_raster
# % required: yes
# % label: Name of the NDVI raster
# % answer: top_ndvi_02
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: ndsm
# % required: yes
# % label: Name of the nDSM raster
# % answer: ndsm
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: slope
# % required: yes
# % label: Name of the nDSM slope raster
# % answer: ndsm_slope
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: nearest
# % required: yes
# % label: Name of raster with nearest peak IDs
# % answer: nearest_tree
# % guisection: Input
# %end

# %option G_OPT_R_INPUT
# % key: peaks
# % required: yes
# % label: Name of raster with peaks and ridges
# % answer: tree_peaks
# % guisection: Input
# %end

Expand All @@ -102,67 +102,66 @@
# % guisection: Optional input
# %end


# %option
# % key: ndvi_threshold
# % type: double
# % required: no
# % label: Define NDVI threshold for potential trees
# % required: yes
# % label: NDVI threshold for potential trees
# % answer: 130
# % guisection: Parameters
# %end

# %option
# % key: nir_threshold
# % type: double
# % required: no
# % label: Define NIR threshold for potential trees
# % required: yes
# % label: NIR threshold for potential trees
# % answer: 130
# % guisection: Parameters
# %end

# %option
# % key: ndsm_threshold
# % type: double
# % required: no
# % label: Define nDSM threshold for potential trees
# % required: yes
# % label: nDSM threshold for potential trees
# % answer: 1
# % guisection: Parameters
# %end

# %option
# % key: slopep75_threshold
# % type: double
# % required: no
# % label: Define threshold for 75 percentile of slope for potential trees
# % required: yes
# % label: Threshold for 75 percentile of slope for potential trees
# % answer: 70
# % guisection: Parameters
# %end

# %option
# % key: area_threshold
# % type: double
# % required: no
# % label: Define area size threshold for potential trees
# % required: yes
# % label: Area size threshold for potential trees
# % answer: 5
# % guisection: Parameters
# %end

# %option
# % key: group
# % type: string
# % required: no
# % answer: ml_input
# % required: yes
# % gisprompt: new,group,group
# % label: Name of output imagery group
# % answer: ml_input
# % guisection: Output
# %end

# %option G_OPT_F_OUTPUT
# % key: save_model
# % label: Save model to file (for compression use e.g. '.gz' extension)
# % description: Name of file to store model results using python joblib
# % required: yes
# % answer: ml_trees_randomforest.gz
# % guisection: Output
# %end

Expand Down
29 changes: 13 additions & 16 deletions grass-gis-addons/m.analyse.trees/r.trees.peaks/r.trees.peaks.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,36 +25,33 @@
# % keyword: trees analysis
# %end

# %option G_OPT_V_INPUT
# % key: area
# % required: yes
# % label: Name of vector defining area of interest
# % answer: study_area
# % guisection: Optional input
# %end

# %option G_OPT_R_INPUT
# % key: ndsm
# % type: string
# % required: yes
# % multiple: no
# % label: Name of the nDSM raster
# % answer: ndsm
# % guisection: Input
# %end

# %option G_OPT_V_INPUT
# % key: area
# % answer: study_area
# % required: no
# % label: Name of vector defining area of interest
# % guisection: Optional input
# %end

# %option
# % key: forms_res
# % type: double
# % required: no
# % required: yes
# % label: Resolution to use for forms detection
# % answer: 0.8
# % guisection: Optional input
# %end


# %option G_OPT_R_OUTPUT
# % key: nearest
# % required: yes
# % multiple: no
# % label: Output raster map with ID of nearest tree
# % answer: nearest_tree
Expand All @@ -63,17 +60,17 @@

# %option G_OPT_R_OUTPUT
# % key: peaks
# % required: yes
# % multiple: no
# % label: Output raster map with peaks and ridges
# % answer: tree_peaks
# % guisection: Output
# %end

# %option G_OPT_R_OUTPUT
# % key: slope
# % required: yes
# % multiple: no
# % label: Output raster map with nDSM slope
# % answer: ndsm_slope
# % guisection: Output
# %end

Expand All @@ -91,8 +88,8 @@
# % key: tile_size
# % type: double
# % required: no
# % answer: 2000
# % label: Edge length of grid tiles in map units for parallel processing
# % answer: 2000
# % guisection: Parallel processing
# %end

Expand Down
Loading

0 comments on commit e79aea7

Please sign in to comment.