Opened 13 years ago
Closed 13 years ago
#1597 closed defect (fixed)
r.topidx ERROR current region resolution
Reported by: | madi | Owned by: | |
---|---|---|---|
Priority: | normal | Milestone: | 6.5.0 |
Component: | Raster | Version: | svn-develbranch6 |
Keywords: | r.topidx | Cc: | |
CPU: | x86-64 | Platform: | Linux |
Description
I get the following weird message: ERROR: Current region resolution [20.00x20.00] lower than input map resolution [20.00x20.00]
Attachments (1)
Change History (14)
by , 13 years ago
Attachment: | Screenshot.png added |
---|
comment:1 by , 13 years ago
comment:2 by , 13 years ago
... or perhaps that 'g.region -a res=20' needs to be run in the mapset, and the error message should use G_format_resolution() instead of %.2f (which is unuseful for lat/lon)
what does "r.info -g input_map" and "g.region -p" say?
Hamish
comment:3 by , 13 years ago
:~> r.info -g dem north=4559778 south=4403628 east=669447 west=525987
:~ > g.region -p projection: 1 (UTM) zone: 33 datum: wgs84 ellipsoid: wgs84 north: 4559780 south: 4403620 west: 525980 east: 669460 nsres: 20 ewres: 20 rows: 7808 cols: 7174 cells: 56014592
follow-up: 8 comment:5 by , 13 years ago
ok so the two grids don't match (your dem map is not on multiples of 20m, its grid is offset), and it is being resampled. what does the full r.info say? (everything between the Type of map: and Range of data: lines)
was it a self-made DEM or did you import it from some 3rd party source? (ie can you remake it on a cleaner grid without loss?)
also try "g.region -p rast=dem" before r.topidx so that the region and the map perfectly align the map's (offset) grid.
Hamish
follow-up: 9 comment:6 by , 13 years ago
G_fatal_error(_("Current region resolution [%.2fx%.2f] lower than
input map resolution [%.2fx%.2f]! Needs to be at least identical or
the current region resolution lower than the input map resolution"),
shouldn't that read "Needs to be at least identical or the current region resolution higher than ..." ?
Hamish
comment:7 by , 13 years ago
I've now updated the error message in all branches to be clearer and show the region resolution at correct precision.
Hamish
comment:8 by , 13 years ago
Replying to hamish:
ok so the two grids don't match (your dem map is not on multiples of 20m, its grid is offset), and it is being resampled. what does the full r.info say? (everything between the Type of map: and Range of data: lines)
was it a self-made DEM or did you import it from some 3rd party source? (ie can you remake it on a cleaner grid without loss?)
also try "g.region -p rast=dem" before r.topidx so that the region and the map perfectly align the map's (offset) grid.
Hamish
OK figured out:
g.region -p rast=dem projection: 1 (UTM) zone: 33 datum: wgs84 ellipsoid: wgs84 north: 4559778 south: 4403628 west: 525987 east: 669447 nsres: 20.0012809 ewres: 20 rows: 7807 cols: 7173 cells: 55999611
Now it works. Thanks.
madi
comment:9 by , 13 years ago
Replying to hamish:
G_fatal_error(_("Current region resolution [%.2fx%.2f] lower than
input map resolution [%.2fx%.2f]! Needs to be at least identical or
the current region resolution lower than the input map resolution"),
shouldn't that read "Needs to be at least identical or the current region resolution higher than ..." ?
Hamish
Now it works, and current region (20) is lower than dem resolution (20.0012809).
Thanks, madi
comment:10 by , 13 years ago
Replying to madi: ...
g.region -p rast=dem projection: 1 (UTM)
...
nsres: 20.0012809
Sidenote: This is a rather unfortunate resolution which indicates a problem in the data preparation.
follow-up: 12 comment:11 by , 13 years ago
I think the old message could be confusing, the new one is
G_fatal_error(_("The current region resolution [%s x %s] is finer " "than the input map's resolution [%s x %s]. " "The current region resolution must be identical " "to, or coarser than, the input map's resolution."),
with ew x ns resolution shown with G_format_resolution() instead of %.2f which always rounds away the extra digits. Can you test and see if the new version gives a more useful error when 'g.region res=20 -a' ?
thanks, Hamish
comment:12 by , 13 years ago
Replying to hamish:
I think the old message could be confusing, the new one is
G_fatal_error(_("The current region resolution [%s x %s] is finer " "than the input map's resolution [%s x %s]. " "The current region resolution must be identical " "to, or coarser than, the input map's resolution."),with ew x ns resolution shown with G_format_resolution() instead of %.2f which always rounds away the extra digits. Can you test and see if the new version gives a more useful error when 'g.region res=20 -a' ?
thanks, Hamish
ERROR: The current region resolution [20 x 20] is finer than the input map's resolution [20 x 20.0012809]. The current region resolution must be identical to, or coarser than, the input map's resolution.
This looks way better to me. Thanks a lot. madi
comment:13 by , 13 years ago
Resolution: | → fixed |
---|---|
Status: | new → closed |
The code in question is in file_io.c:
I suspect that GRASS_EPSILON should be used here.