Browse Source

r.geomorphon: combine profile parser rules to allow usage as pygrass module (#2154)

* combine profile parser rules

* let coords require profilesettings

* relax parser rules even more

* remove defaults and add back parser rules

* adjust manual

* reactivate r.geomorphon test

Co-authored by: Denis Ovsienko <denis@ovsienko.info>
Stefan Blumentrath 3 years ago
parent
commit
1991d89276
3 changed files with 4 additions and 6 deletions
  1. 0 1
      .gunittest.cfg
  2. 2 2
      raster/r.geomorphon/main.c
  3. 2 3
      raster/r.geomorphon/r.geomorphon.html

+ 0 - 1
.gunittest.cfg

@@ -17,7 +17,6 @@ exclude =
     python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py
     python/grass/temporal/testsuite/unittests_temporal_raster_algebra_equal_ts.py
     python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py
     python/grass/temporal/testsuite/unittests_temporal_raster_conditionals_complement_else.py
     raster/r.contour/testsuite/testrc.py
     raster/r.contour/testsuite/testrc.py
-    raster/r.geomorphon/testsuite/test_r_geom.py
     raster/r.in.gdal/testsuite/test_r_in_gdal.py
     raster/r.in.gdal/testsuite/test_r_in_gdal.py
     raster/r.in.lidar/testsuite/test_base_resolution.sh
     raster/r.in.lidar/testsuite/test_base_resolution.sh
     raster/r.in.lidar/testsuite/test_base_resolution.sh
     raster/r.in.lidar/testsuite/test_base_resolution.sh

+ 2 - 2
raster/r.geomorphon/main.c

@@ -178,22 +178,22 @@ int main(int argc, char **argv)
 
 
         par_profiledata = G_define_standard_option(G_OPT_F_OUTPUT);
         par_profiledata = G_define_standard_option(G_OPT_F_OUTPUT);
         par_profiledata->key = "profiledata";
         par_profiledata->key = "profiledata";
-        par_profiledata->answer = "-";
         par_profiledata->required = NO;
         par_profiledata->required = NO;
         par_profiledata->description =
         par_profiledata->description =
             _("Profile output file name (\"-\" for stdout)");
             _("Profile output file name (\"-\" for stdout)");
         par_profiledata->guisection = _("Profile");
         par_profiledata->guisection = _("Profile");
         G_option_requires(par_profiledata, par_coords, NULL);
         G_option_requires(par_profiledata, par_coords, NULL);
+        G_option_requires(par_coords, par_profiledata, NULL);
 
 
         par_profileformat = G_define_option();
         par_profileformat = G_define_option();
         par_profileformat->key = "profileformat";
         par_profileformat->key = "profileformat";
         par_profileformat->type = TYPE_STRING;
         par_profileformat->type = TYPE_STRING;
         par_profileformat->options = "json,yaml,xml";
         par_profileformat->options = "json,yaml,xml";
-        par_profileformat->answer = "json";
         par_profileformat->required = NO;
         par_profileformat->required = NO;
         par_profileformat->description = _("Profile output format");
         par_profileformat->description = _("Profile output format");
         par_profileformat->guisection = _("Profile");
         par_profileformat->guisection = _("Profile");
         G_option_requires(par_profileformat, par_coords, NULL);
         G_option_requires(par_profileformat, par_coords, NULL);
+        G_option_requires(par_coords, par_profileformat, NULL);
 
 
         if (G_parser(argc, argv))
         if (G_parser(argc, argv))
             exit(EXIT_FAILURE);
             exit(EXIT_FAILURE);

+ 2 - 3
raster/r.geomorphon/r.geomorphon.html

@@ -101,10 +101,9 @@ write to the standard output. The data is in a machine-readable format
 and it includes assorted values describing the computation context and
 and it includes assorted values describing the computation context and
 parameters, as well as its intermediate and final results.</DD>
 parameters, as well as its intermediate and final results.</DD>
 <DT><b>profileformat</b></DT>
 <DT><b>profileformat</b></DT>
-<DD>Format of the profile data: "json" (the default),
-"yaml" or "xml".</DD>
+<DD>Format of the profile data: "json", "yaml" or "xml".</DD>
 </DL>
 </DL>
-<P><em>NOTE: parameters below are very experimental. The usefulness of these parameters are currently under investigation.</em></P>
+<P><em>NOTE: parameters below are experimental. The usefulness of these parameters are currently under investigation.</em></P>
 <DL>
 <DL>
 <DT><b>intensity</b></DT>
 <DT><b>intensity</b></DT>
 <DD>returns avarage difference between central cell of geomorphon and eight cells in visibility neighbourhood. This parameter shows local (as is visible) exposition/abasement of the form in the terrain.</DD>
 <DD>returns avarage difference between central cell of geomorphon and eight cells in visibility neighbourhood. This parameter shows local (as is visible) exposition/abasement of the form in the terrain.</DD>