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

#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.0.6
Component: Python | Version: unspecified
Keywords: r.plane | CPU: Unspecified
Platform: Unspecified |
-------------------------+-------------------------
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.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225&gt;
GRASS GIS <https://grass.osgeo.org>

#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: unspecified
Resolution: | Keywords: r.plane
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------
Changes (by martinl):

* milestone: 7.0.7 => 7.6.2

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225#comment:2&gt;
GRASS GIS <https://grass.osgeo.org>

#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: unspecified
Resolution: | Keywords: r.plane
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by neteler):

I guess a Python equivalent of G_scan_easting() and G_scan_northing() is
needed here.

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225#comment:3&gt;
GRASS GIS <https://grass.osgeo.org>

#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: unspecified
Resolution: | Keywords: r.plane
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by mmetz):

Replying to [comment:3 neteler]:
> I guess a Python equivalent of G_scan_easting() and G_scan_northing() is
needed here.

It's here:
https://trac.osgeo.org/grass/browser/grass/trunk/lib/python/script/utils.py#L33

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225#comment:4&gt;
GRASS GIS <https://grass.osgeo.org>

#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: unspecified
Resolution: | Keywords: r.plane
       CPU: Unspecified | Platform: Unspecified
--------------------------+-------------------------

Comment (by lucadelu):

Please look and try r74438

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225#comment:5&gt;
GRASS GIS <https://grass.osgeo.org>

#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&gt;
GRASS GIS <https://grass.osgeo.org>

#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
--------------------------+-------------------------

Comment (by lucadelu):

In [changeset:"74485" 74485]:
{{{
#!CommitTicketReference repository="" revision="74485"
libpython: float_or_dms accept E,W,N,S. see #3225
}}}

--
Ticket URL: <https://trac.osgeo.org/grass/ticket/3225#comment:7&gt;
GRASS GIS <https://grass.osgeo.org>