[GRASS-dev] [GRASS GIS] #3860: GRASS GIS producing different slope than GDAL

GRASS GIS trac at osgeo.org
Mon Jun 10 13:30:23 PDT 2019


#3860: GRASS GIS producing different slope than GDAL
------------------------+-------------------------
  Reporter:  mazingaro  |      Owner:  grass-dev@…
      Type:  defect     |     Status:  reopened
  Priority:  normal     |  Milestone:  7.6.2
 Component:  Raster     |    Version:  unspecified
Resolution:             |   Keywords:  slope
       CPU:  x86-64     |   Platform:  Linux
------------------------+-------------------------

Comment (by mmetz):

 Replying to [comment:9 mankoff]:
 > I think the issue is related to the region.
 >
 > The `r.slope.aspect` documentation in the NOTES section implies that the
 region is adjusted to the raster. I do not find that to be the case.
 Specifically in the NC test data, I've created the following slope
 rasters, and then looked at their univariate statistics:
 >
 > {{{
 > g.region raster=elevation
 > r.slope.aspect elevation=elevation slope=slope_0
 > r.slope.aspect -a elevation=elevation slope=slope_1
 > g.region res=30 -pa
 > r.slope.aspect elevation=elevation slope=slope_2
 > r.slope.aspect -a elevation=elevation slope=slope_3
 >
 > for i in $(seq 0 3); do
 >   (echo -n "slope_${i} "; r.univar slope_${i} | grep range) | tr '\n' '
 '
 > done
 > }}}

 Please also check the extents and resolution of slope_0, slope_1, slope_2,
 slope_3. You need to set the region to the raster map before running
 r.univar because r.univar uses the current region. Therefore these results
 are not what you intend to get because they are all obtained with the same
 region settings:
 >
 > Results are:
 >
 > {{{
 > slope_0 range: 36.3347
 > slope_1 range: 36.3347
 > slope_2 range: 13.7754
 > slope_3 range: 25.3968
 > }}}

 Alternatively, try `r.info -s` which ignores the current region and
 reports simple raster stats stored in metadata.

 Replying to [comment:12 neteler]:
 > Replying to [comment:9 mankoff]:
 > > I think the issue is related to the region.
 > >
 > > The `r.slope.aspect` documentation in the NOTES section implies that
 the region is adjusted to the raster. I do not find that to be the case.
 >
 > Reopening for manual to be corrected (if that's the solution to the
 reported differences).

 I think the manual is correct.

-- 
Ticket URL: <https://trac.osgeo.org/grass/ticket/3860#comment:13>
GRASS GIS <https://grass.osgeo.org>



More information about the grass-dev mailing list