Skip to content

[Bug] r.grow: failure in long-lat projects with small radius due to scientific notation #5521

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
neteler opened this issue Apr 9, 2025 · 0 comments
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working good first issue Good for newcomers
Milestone

Comments

@neteler
Copy link
Member

neteler commented Apr 9, 2025

Describe the bug

When using r.grow in a long-lat project (EPSG:4326) with a small radius it fails due to an internal switch to scientific notation.

Invalid map <4e>
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc with expression: one_buf =
       if(!isnull("one"),"one",if(r.grow.tmp.1081989.dist <
       4e-12,"r.grow.tmp.1081989.val",null()))

To reproduce

Store the following script as r_grow_bug.sh:

g.region res=1 n=90 s=-90 w=180 e=-180 -p
r.mapcalc expression="one = 1"
r.grow input=one output=one_buf radius=0.000002

Then run it:

grass --tmp-project EPSG:4326 --exec sh r_grow_bug.sh
WARNING: East (-180) is not larger than West (180)
projection: 3 (Latitude-Longitude)
zone:       0
datum:      wgs84
ellipsoid:  wgs84
north:      90N
south:      90S
west:       180W
east:       180E
nsres:      1
ewres:      1
rows:       180
cols:       360
cells:      64800
 100%
Reading raster map <one>...
 100%
Writing output raster maps...
 100%
Invalid map <4e>
Parse error
ERROR: parse error
ERROR: An error occurred while running r.mapcalc with expression: one_buf =
       if(!isnull("one"),"one",if(r.grow.tmp.1081989.dist <
       4e-12,"r.grow.tmp.1081989.val",null()))

Expected behavior

A code modification is needed to avoid this bug

System description

  • Linux Fedora 40
  • Affects all GRASS versions.
@neteler neteler added backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working labels Apr 9, 2025
@neteler neteler added this to the 8.5.0 milestone Apr 9, 2025
@petrasovaa petrasovaa added the good first issue Good for newcomers label Apr 10, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
backport to 8.4 PR needs to be backported to release branch 8.4 bug Something isn't working good first issue Good for newcomers
Projects
None yet
Development

No branches or pull requests

2 participants