[GRASS-dev] ERROR grass addon v/r.surf.nnbathy using a lat/lon location

Roberto Marzocchi roberto.marzocchi at gmail.com
Mon Mar 26 03:14:11 PDT 2018


I have tested my solution and it works.
Can I do the push on SVN? My question is for Martin Landa who is mentor for
the authors of the command and did the last commit of nnbathy.py command?


I found also two more problem in the v.surf.nnbathy command.

1) The command crash. It is probaby due to the v.out.ascii -r command (the
-r option do not works correctly, at least on GRASS 7.4). It is possible to
remove the -r flag in this command and the v.in.nnbathy works correctly,
even if the output is different. Perhaps is a better output, because it use
also the points outside the computational region for the interpolation.

2) An other problem is due to the command to write output ascii file for
interpolation -->  fout.write(parts[0]+' '+parts[1]+' '+parts[3]) is valid
only for 2D geometry while for 3D geometry the correct command is
fout.write(parts[0]+' '+parts[1]+' '+parts[4])

I think we need an if condition to check if the geometry is 2 or 3D. I have
no idea of a possible python command.. I will do some search.. Have you any
suggestion?

R


2018-03-23 18:05 GMT+01:00 Roberto Marzocchi <roberto.marzocchi a gmail.com>:

> Dear all,
>
> I am using r.surf.nnbathy (on GRASS 7.4)
>
> Using a projected location (meters) I obtain a result
>
> Using lat/lon location I see the following error:
>
>
>> Traceback (most recent call last):
>>   File
>> "/home/roberto/.grass7/addons/scripts/r.surf.nnbathy", line
>> 80, in <module>
>>     main()
>>   File
>> "/home/roberto/.grass7/addons/scripts/r.surf.nnbathy", line
>> 74, in main
>>     obj = Nnbathy_raster(options)
>>   File "/home/roberto/.grass7/addons/etc/v.surf.nnbathy/nnba
>> thy.py", line 107, in __init__
>>     Nnbathy.__init__(self, options)
>>   File "/home/roberto/.grass7/addons/etc/v.surf.nnbathy/nnba
>> thy.py", line 13, in __init__
>>     self.region()
>>   File "/home/roberto/.grass7/addons/etc/v.surf.nnbathy/nnba
>> thy.py", line 20, in region
>>     reg_N = float(kv['north'])
>> ValueError: invalid literal for float(): 47:00:29.111155N
>
>
>
>
> I think the error is due to the https://trac.osgeo.org/
> grass/browser/grass-addons/grass7/vector/v.surf.nnbathy/nnbathy.py file
> and in particular to the region() function
>
>
>
> reg = grass.read_command("g.region", flags='p')
>  kv = grass.parse_key_val(reg, sep=':')
> reg_N = float(kv['north'])
> reg_W = float(kv['west'])
> reg_S = float(kv['south'])
> reg_E = float(kv['east'])
> nsres = float(kv['nsres'])
>  ewres = float(kv['ewres'])
>
>
> perhaps this can be a solution:
>
> in_region = gscript.region()
> reg_E=float(in_region['e'])
> reg_W=float(in_region['w'])
> reg_N=float(in_region['s'])
> reg_S=float(in_region['s'])
> nsres = float(in_region['nsres'])
> ewres = float(in_region['ewres'])
>
>
> If you agree I will do some test and I can update the add-on
>
> Any suggestions?
>
> Thanks in advanced for your help
> R
>
-------------- parte successiva --------------
Un allegato HTML รจ stato rimosso...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180326/58cd2568/attachment.html>


More information about the grass-dev mailing list