Opened 9 years ago
Last modified 5 years ago
#2919 new defect
Use SFD above this threshold - infinity doesn't work in r.stream.extract
Reported by: | PitStop | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 7.8.3 |
Component: | Raster | Version: | git-releasebranch78 |
Keywords: | r.stream.extract | Cc: | |
CPU: | x86-64 | Platform: | MSWindows 8 |
Description
Hi There,
I'm trying to delineate a watershed and also extract the streams within using here for reproduction the NC data set.
r.watershed elevation=elev_srtm_30m@PERMANENT threshold=1000 accumulation=accu drainage=drain basin=basin
and then
r.stream.extract elevation=elev_srtm_30m@PERMANENT accumulation=accu@user1 threshold=1000 stream_raster=stream_r stream_vector=stream_v
leads to
ERROR: Missing value for parameter <d8cut>
while the accumulation map is specified in the command and therefor d8cut shouldn't be used.
The same error was report http://osgeo-org.1560.x6.nabble.com/r-stream-extract-grass7-addon-td5018389.html#a5018528
g.version -g
version=7.0.3 date=2016 revision=67691 build_date=2016-01-28 build_platform=x86_64-w64-mingw32
Change History (17)
follow-up: 2 comment:1 by , 9 years ago
Milestone: | → 7.0.4 |
---|
comment:2 by , 9 years ago
Replying to neteler:
I just tried on Linux, no such issue:
g.region raster=elev_srtm_30m r.watershed elevation=elev_srtm_30m@PERMANENT threshold=1000 accumulation=accu drainage=drain basin=basin r.stream.extract elevation=elev_srtm_30m@PERMANENT accumulation=accu@user1 \ threshold=1000 stream_raster=stream_r stream_vector=stream_vNo errors occured.
g.version -g version=7.0.4svn date=2016 revision=67880M build_date=2016-01-20 build_platform=x86_64-pc-linux-gnuYou marked it as "addon" while it is part of core GRASS 7. Is it possible that you are using a leftover Addon version of r.stream.extract?
Confirmed here in winGRASS. the default value of d8cut seems not to be recognized by parser in winGRASS again. see the mentioned ML entry.
follow-ups: 6 10 comment:3 by , 9 years ago
I see: the change r53993 (remove default: infinity) was not applied to relbranch7, see
Seems that "infinity" is not understood by the parser?
comment:4 by , 9 years ago
Milestone: | 7.0.4 → 7.0.5 |
---|
comment:5 by , 8 years ago
Milestone: | 7.0.5 → 7.0.6 |
---|
comment:6 by , 8 years ago
comment:7 by , 7 years ago
Milestone: | 7.0.6 → 7.2.3 |
---|---|
Summary: | r.stream.extract error → Use SFD above this threshold - infinity doesn't work in r.stream.extract |
Version: | 7.0.3 → svn-releasebranch72 |
changing title.
see also #3432
comment:8 by , 7 years ago
taken from #3432
still an issue in relbranch 7
System Info GRASS version: 7.3.svn GRASS SVN revision: r71600 Build date: 2017-10-27 Build platform: x86_64-w64-mingw32 GDAL: 2.2.1 PROJ.4: 4.9.3 GEOS: 3.5.0 SQLite: 3.17.0 Python: 2.7.5 wxPython: 2.8.12.1 Platform: Windows-8-6.2.9200 (OSGeo4W)
and trunk
System Info GRASS version: 7.2.2 GRASS SVN revision: r71496 Build date: 2017-09-20 Build platform: x86_64-w64-mingw32 GDAL: 2.2.1 PROJ.4: 4.9.3 GEOS: 3.5.0 SQLite: 3.17.0 Python: 2.7.5 wxPython: 2.8.12.1 Platform: Windows-8-6.2.9200 (OSGeo4W)
comment:9 by , 7 years ago
Component: | Addons → Raster |
---|---|
Platform: | MSWindows 7 → MSWindows 8 |
follow-up: 11 comment:10 by , 7 years ago
follow-up: 12 comment:11 by , 7 years ago
Replying to hellik:
Seems that "infinity" is not understood by the parser?
yes, it seems to be a parser issue. but why it works then in linux?
My guess - input.d8cut->answer contains extra chars (CR/LF issue?) and thus changing line to read:
if (strncmp(input.d8cut->answer, "infinity", 8) == 0) {
would solve the issue. Still, if it is so, then it is worth to digg deeper to see why it is failing as strcmp is used in many modules.
comment:12 by , 7 years ago
Replying to marisn:
Replying to hellik:
Seems that "infinity" is not understood by the parser?
yes, it seems to be a parser issue. but why it works then in linux?
My guess - input.d8cut->answer contains extra chars (CR/LF issue?)
there can't be CR/LF, answers are terminated by '\0'
and thus changing line to read:
if (strncmp(input.d8cut->answer, "infinity", 8) == 0) {would solve the issue.
The d8cut option is not required, therefore I removed the problematic default answer "infinity" and changed
- if (strcmp(input.d8cut->answer, "infinity") == 0) { + if (!input.d8cut->answer) {
in trunk and relbr72 with r71607,8.
Still, if it is so, then it is worth to digg deeper to see why it is failing as strcmp is used in many modules.
I guess that the MS Windows version of sscanf does not recognize infinity as a floating point number, while the Linux version does.
comment:14 by , 7 years ago
Milestone: | → 7.2.4 |
---|
comment:15 by , 5 years ago
Milestone: | 7.2.4 → 7.8.3 |
---|---|
Version: | svn-releasebranch72 → git-releasebranch78 |
The code is now here:
Not sure what to look for?
comment:16 by , 5 years ago
isn't it some kind of a parser issue?
as it pops up also in other modules/addons, e.g.
https://lists.osgeo.org/pipermail/grass-user/2020-June/081577.html
worth to open a GH issue?
comment:17 by , 5 years ago
some background information:
https://sourceforge.net/p/mingw/bugs/2358/
[...] You are using Microsoft's implementation of scanf(), (because that is all that MinGW has ever used for this function, and its siblings), so the behaviour is as Microsoft have specified it, (and there appears to be nothing in their documentation to suggest how infinities and nans might be converted, [...] You may consider Microsoft's implementation to be broken -- and you may well be right -- but good luck with trying to get them to acknowledge that, much less fix it.
AFAIR there was also some discussion some times ago how winGRASS (not) handling NaN in raster data. (can't find ticket or thread at the moment).
I just tried on Linux, no such issue:
No errors occured.
You marked it as "addon" while it is part of core GRASS 7. Is it possible that you are using a leftover Addon version of r.stream.extract?