Opened 7 years ago
Closed 6 years ago
#3509 closed defect (fixed)
g.region grow with negative number limited because of top and bottom
Reported by: | wenzeslaus | Owned by: | |
---|---|---|---|
Priority: | minor | Milestone: | 7.6.0 |
Component: | Raster | Version: | svn-trunk |
Keywords: | grow, shrink, g.region, expand computational region, extent, 3D | Cc: | |
CPU: | Unspecified | Platform: | Unspecified |
Description
Here is what happens if you want to shrink region (grow < 0):
g.region -p raster=elevation g.region -p grow=-1 # ERROR: Top must be larger than Bottom g.region -p grow=2 g.region -p grow=-1 g.region -p grow=-1 g.region -p grow=-1 # ERROR: Top must be larger than Bottom
When you have small depth (1 by default) you can't do grow=-1
.
Please, add milestone 7.6.
Attachments (1)
Change History (6)
comment:1 by , 7 years ago
Milestone: | 7.4.1 → 7.6.0 |
---|
by , 7 years ago
Attachment: | gregion.diff added |
---|
comment:2 by , 7 years ago
I create this "workaround", I don't think a true fix could exist. It is something like if a user decide to set the Top smaller then Bottom.
The same problem could append with extent
g.region -p raster=elevation g.region nsres=13480 ewres=14980 rows=1 cols=1 -p g.region -p grow=-1 ERROR: North must be larger than South
Should we also try to fix something like the error above? Or we should just improve the output message? I think this is not a bug but a user error or misunderstanding.
What do you think about the attached patch?
follow-up: 4 comment:3 by , 7 years ago
What about just ignoring the request for decrease when the minimal range is reached? Not sure if that makes sense for X and Y, but it seems OK for Z.
comment:4 by , 7 years ago
Replying to wenzeslaus:
What about just ignoring the request for decrease when the minimal range is reached? Not sure if that makes sense for X and Y, but it seems OK for Z.
+1
Introducing yet another flag is IMHO not a good idea, and it is against the idea that the grow
option should apply to all dimensions. I would rather add a test for each dimension that the change results in a valid region: top must be > bottom, east must be > west, north must be > south. For latlon, north must be <= 90 degrees + 0.5 * ns_res, south must be >= -90 degrees - 0.5 * ns_res. A warning could be printed if growing in a specific dimension would result in an invalid region.
proposed patch