[GRASS-dev] [GRASS GIS] #3225: r.plane: ValueError: invalid literal for float(): 0:04:14.5E

GRASS GIS trac at osgeo.org
Mon Apr 29 22:49:04 PDT 2019


#3225: r.plane: ValueError: invalid literal for float(): 0:04:14.5E
--------------------------+-------------------------
  Reporter:  neteler      |      Owner:  grass-dev@…
      Type:  defect       |     Status:  new
  Priority:  normal       |  Milestone:  7.6.2
 Component:  Python       |    Version:  svn-trunk
Resolution:               |   Keywords:  r.plane
       CPU:  Unspecified  |   Platform:  Unspecified
--------------------------+-------------------------
Changes (by neteler):

 * version:  unspecified => svn-trunk


Old description:

> At time (besides the weird fact that the angle convention of azimuth does
> not match the standard GRASS convention) the easting and northing input
> does not accept sexagesimal input in lat-long location:
>
> {{{
> GRASS 7.2.0svn (latlong):~ >
> r.plane output=plane dip=45 azimuth=-9 \
>   easting=0:04:14.5E northing=48:52:14.5N elev=1000 type=CELL
> Traceback (most recent call last):
>   File "/home/neteler/software/grass72/dist.x86_64-pc-linux-
> gnu/scripts/r.plane", line 128, in <module>
>     main()
>   File "/home/neteler/software/grass72/dist.x86_64-pc-linux-
> gnu/scripts/r.plane", line 78, in main
>     ea = float(options['easting'])
> ValueError: invalid literal for float(): 0:04:14.5E
> }}}
>
> AFAIK G_OPT_M_COORDS would support that but here the values have to be
> specified separately.

New description:

 At time (besides the weird fact that the angle convention of azimuth does
 not match the standard GRASS convention) the easting and northing input
 does not accept sexagesimal input in lat-long location:

 {{{
 GRASS 7.2.0svn (latlong):~ >
 r.plane output=plane dip=45 azimuth=9 \
   easting=0:04:14.5E northing=48:52:14.5N elev=1000 type=CELL
 Traceback (most recent call last):
   File "/home/neteler/software/grass72/dist.x86_64-pc-linux-
 gnu/scripts/r.plane", line 128, in <module>
     main()
   File "/home/neteler/software/grass72/dist.x86_64-pc-linux-
 gnu/scripts/r.plane", line 78, in main
     ea = float(options['easting'])
 ValueError: invalid literal for float(): 0:04:14.5E
 }}}

 AFAIK G_OPT_M_COORDS would support that but here the values have to be
 specified separately.

--

Comment:

 Replying to [comment:5 lucadelu]:
 > Please look and try r74438

 Thanks, but now I get

 {{{
 r.plane output=plane dip=45 azimuth=9 easting=0:04:14.5E
 northing=48:52:14.5N elev=1000 type=CELL
 ERROR: Input coordinates seems to be invalid
 }}}

 With debug output added locally, I see that "E" and "N" are the problem
 (which are accepted in g.region, see
 https://grass.osgeo.org/grass76/manuals/g.region.html#changing-extent-and-
 raster-resolution-using-values):

 {{{
 r.plane output=plane dip=45 azimuth=9 easting="00:04:14.5E"
 northing="48:52:14.5N" elev=1000 type=CELL
 Traceback (most recent call last):
   File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-
 gnu/scripts/r.plane", line 134, in <module>
     main()
   File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-
 gnu/scripts/r.plane", line 84, in main
     print(gscript.utils.float_or_dms(options['easting']))
   File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-
 gnu/etc/python/grass/script/utils.py", line 45, in float_or_dms
     return sum(float(x) / 60 ** n for (n, x) in enumerate(s.split(':')))
   File "/home/mneteler/software/grass77/dist.x86_64-pc-linux-
 gnu/etc/python/grass/script/utils.py", line 45, in <genexpr>
     return sum(float(x) / 60 ** n for (n, x) in enumerate(s.split(':')))
 ValueError: invalid literal for float(): 14.5E

 # trying without "E":
 r.plane output=plane dip=45 azimuth=9 easting="00:04:14.5"
 northing="48:52:14.5N" elev=1000 type=CELL
 0.0706944444444
 ERROR: Input coordinates seems to be invalid

 # trying without E and N:
 r.plane output=plane dip=45 azimuth=9 easting=00:04:14.5
 northing=48:52:14.5 elev=1000 type=CELL
   36%
 ...
 }}}

 IMHO float_or_dms() needs an update to accept E and N.

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



More information about the grass-dev mailing list