Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-12 Thread Moritz Lennert

On 10/05/17 23:49, Pierre Roudier wrote:

Thanks Luca, that would be a good idea indeed!

Any pointers to implement this? I'm unfamiliar with parallel processing
in Pygrass.


You can look at i.pansharpen for a simple example:

https://trac.osgeo.org/grass/browser/grass/branches/releasebranch_7_2/scripts/i.pansharpen/i.pansharpen.py#L151

or for a bit more sophisticated handling using PyGRASS:

https://grass.osgeo.org/grass72/manuals/libpython/pygrass.modules.interface.html#pygrass.modules.interface.module.ParallelModuleQueue

Other examples exist (cf i.segment.uspo for example)

Moritz

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-10 Thread Pierre Roudier
Hi Paulo,

fl is used to store flags passed to the command.

There was a typo in my code, and Moritz was kind enough to commit a
corrected version of the add-on (thanks Moritz!),

Would be more than happy to merge both addons, they do look similar enough
to be merged.

Cheers,

P

On 9 May 2017 at 19:30, Paulo van Breugel  wrote:

> Hi Pierre,
>
> I have one question about the code. In lines 126-130 you create an object
> 'fl', which you subsequently do not seem to use. Perhaps in line 150 it
> should be flags=fl ?
>
> Something else, last year I wrote an addon r.what.rastlabel (
> https://github.com/ecodiv/GRASS-scripts/tree/master/v.what.rastlabel)
> which can be used to (multiple) raster values and labels. Optionally, it
> can also upload raster values only, like your addon (that part uses the
> same approach you use). I have not yet added it to the grass addon
> repository. I might do that later, at which point we can also see if it
> makes sense to merge the two.
>
> Cheers,
>
> Paulo
>
>
> On 5/9/17 8:36 AM, Luca Delucchi wrote:
>
>> On 8 May 2017 at 07:16, Pierre Roudier  wrote:
>>
>>> Hi all,
>>>
>>> Hi,
>>
>> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
>>> [0].
>>>
>>> It is a super simple Python wrapper around v.what.rast, and allows to
>>> query
>>> a suite of rasters in one go:
>>>
>>> thanks, it is useful
>> to improve a little bit, you add multiprocessing to the module, for
>> example a process for each raster
>>
> Interesting, could help to speed up with large point data layers.
>
>>
>> Cheers,
>>>
>>> Pierre
>>>
>>>
>>
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-10 Thread Pierre Roudier
Thanks Luca, that would be a good idea indeed!

Any pointers to implement this? I'm unfamiliar with parallel processing in
Pygrass.

Cheers,

P

On 9 May 2017 at 18:36, Luca Delucchi  wrote:

> On 8 May 2017 at 07:16, Pierre Roudier  wrote:
> > Hi all,
> >
>
> Hi,
>
> > FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
> [0].
> >
> > It is a super simple Python wrapper around v.what.rast, and allows to
> query
> > a suite of rasters in one go:
> >
>
> thanks, it is useful
> to improve a little bit, you add multiprocessing to the module, for
> example a process for each raster
>
> >
> > Cheers,
> >
> > Pierre
> >
>
>
> --
> ciao
> Luca
>
> www.lucadelu.org
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Veronica Andreo
Now it works! Thanks a lot for such a quick fix :)

best,
Vero

2017-05-09 15:25 GMT+02:00 Moritz Lennert :

> On 09/05/17 15:13, Moritz Lennert wrote:
>
>> On 09/05/17 15:03, Moritz Lennert wrote:
>>
>>> On 09/05/17 14:37, Veronica Andreo wrote:
>>>
 Hello Pierre,

 Thanks for this new add-on! Comes on time for me :)

 I'm testing it and I have observed something odd.
 I'm querying integer maps but v.what.rast.multi gives me float values. I
 run v.what.rast and I get the proper integer values. Does it have
 anything to do with what Paulo just pointed out?

>>>
>>>
>>> The module just loops over a series of v.what.rast calls, so results
>>> should not be different. If any, Paulo's point reinforces this as the
>>> '-i' flag (i.e.interpolate nearest points) is never used...
>>>
>>
>> Sorry, I take that back: the -i flag is always set as what is passed on
>> to v.what.rast is 'flags' and without the '-i' flag set still is
>> non-null (it contains "{'i': False}") and so
>>
>> 'if (interp_flag->answer)'
>>
>> in v.what.rast/main.c returns true.
>>
>> So, yes the issue is linked to Paulo's remark.
>>
>
> Fixed in r71072.
>
> But
>
> v.what.rast.multi map=test raster=elev_srtm_30m,elev_ned_30m,srtm,ned
> columns=srtm_float_nofl,ned_float_nofl,srtm_int_nofl,ned_int_nofl
>
> v.what.rast.multi -i map=test raster=elev_srtm_30m,elev_ned_30m,srtm,ned
> columns=srtm_float_fl,ned_float_fl,srtm_int_fl,ned_int_fl
>
> cat|srtm_float_nofl|ned_float_nofl|srtm_int_nofl|ned_int_nof
> l|srtm_float_fl|ned_float_fl|srtm_int_fl|ned_int_fl
> 1|88.40672|84.94218|88|84|88.74082|85.08109|88|84
> 2|109.1437|98.23732|109|98|108.8838|98.40421|108|98
> 3|121.3047|117.567|121|117|121.5324|117.8318|121|117
> 4|142.1468|131.73|142|131|142.0981|131.7365|141|131
> 5|121.9686|122.3212|121|122|122.9578|123.2583|122|122
> 6|80.502|82.1487|80|82|81.29526|82.14999|80|81
>
> So, integer remains integer...
>
> Moritz
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Moritz Lennert

On 09/05/17 15:13, Moritz Lennert wrote:

On 09/05/17 15:03, Moritz Lennert wrote:

On 09/05/17 14:37, Veronica Andreo wrote:

Hello Pierre,

Thanks for this new add-on! Comes on time for me :)

I'm testing it and I have observed something odd.
I'm querying integer maps but v.what.rast.multi gives me float values. I
run v.what.rast and I get the proper integer values. Does it have
anything to do with what Paulo just pointed out?



The module just loops over a series of v.what.rast calls, so results
should not be different. If any, Paulo's point reinforces this as the
'-i' flag (i.e.interpolate nearest points) is never used...


Sorry, I take that back: the -i flag is always set as what is passed on
to v.what.rast is 'flags' and without the '-i' flag set still is
non-null (it contains "{'i': False}") and so

'if (interp_flag->answer)'

in v.what.rast/main.c returns true.

So, yes the issue is linked to Paulo's remark.


Fixed in r71072.

But

v.what.rast.multi map=test raster=elev_srtm_30m,elev_ned_30m,srtm,ned 
columns=srtm_float_nofl,ned_float_nofl,srtm_int_nofl,ned_int_nofl


v.what.rast.multi -i map=test raster=elev_srtm_30m,elev_ned_30m,srtm,ned 
columns=srtm_float_fl,ned_float_fl,srtm_int_fl,ned_int_fl


cat|srtm_float_nofl|ned_float_nofl|srtm_int_nofl|ned_int_nofl|srtm_float_fl|ned_float_fl|srtm_int_fl|ned_int_fl
1|88.40672|84.94218|88|84|88.74082|85.08109|88|84
2|109.1437|98.23732|109|98|108.8838|98.40421|108|98
3|121.3047|117.567|121|117|121.5324|117.8318|121|117
4|142.1468|131.73|142|131|142.0981|131.7365|141|131
5|121.9686|122.3212|121|122|122.9578|123.2583|122|122
6|80.502|82.1487|80|82|81.29526|82.14999|80|81

So, integer remains integer...

Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Moritz Lennert

On 09/05/17 15:03, Moritz Lennert wrote:

On 09/05/17 14:37, Veronica Andreo wrote:

Hello Pierre,

Thanks for this new add-on! Comes on time for me :)

I'm testing it and I have observed something odd.
I'm querying integer maps but v.what.rast.multi gives me float values. I
run v.what.rast and I get the proper integer values. Does it have
anything to do with what Paulo just pointed out?



The module just loops over a series of v.what.rast calls, so results
should not be different. If any, Paulo's point reinforces this as the
'-i' flag (i.e.interpolate nearest points) is never used...


Sorry, I take that back: the -i flag is always set as what is passed on 
to v.what.rast is 'flags' and without the '-i' flag set still is 
non-null (it contains "{'i': False}") and so


'if (interp_flag->answer)'

in v.what.rast/main.c returns true.

So, yes the issue is linked to Paulo's remark.

Moritz

___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Moritz Lennert

On 09/05/17 14:37, Veronica Andreo wrote:

Hello Pierre,

Thanks for this new add-on! Comes on time for me :)

I'm testing it and I have observed something odd.
I'm querying integer maps but v.what.rast.multi gives me float values. I
run v.what.rast and I get the proper integer values. Does it have
anything to do with what Paulo just pointed out?



The module just loops over a series of v.what.rast calls, so results 
should not be different. If any, Paulo's point reinforces this as the 
'-i' flag (i.e.interpolate nearest points) is never used...


And I cannot confirm:

g.region rast=elev_ned_30m
v.random test npoints=500
r.mapcalc "srtm = int(elev_srtm_30m)"
r.mapcalc "ned = int(elev_ned_30m)"
v.what.rast.multi map=test raster=elev_srtm_30m,elev_ned_30m,srtm,ned 
columns=srtm_float,ned_float,srtm_int,ned_int

v.db.select test col=srtm_float,ned_float,srtm_int,ned_int
[...]
105.1695|103.4447|104|102
124.6583|122.6958|124|122
104.6636|93.28199|104|93
81.77528|79.49014|81|78
90.53698|86.29738|89|85
80.44241|76.85014|79|76
127.8045|125.4002|127|124
106.0921|104.8796|105|104
151.5683|148.3245|150|148
121.2332|116.3521|120|116
123.2887|115.1104|123|114

Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Veronica Andreo
Hello Pierre,

Thanks for this new add-on! Comes on time for me :)

I'm testing it and I have observed something odd.
I'm querying integer maps but v.what.rast.multi gives me float values. I
run v.what.rast and I get the proper integer values. Does it have anything
to do with what Paulo just pointed out?

Thanks much!
Vero

2017-05-09 9:30 GMT+02:00 Paulo van Breugel :

> Hi Pierre,
>
> I have one question about the code. In lines 126-130 you create an object
> 'fl', which you subsequently do not seem to use. Perhaps in line 150 it
> should be flags=fl ?
>
> Something else, last year I wrote an addon r.what.rastlabel (
> https://github.com/ecodiv/GRASS-scripts/tree/master/v.what.rastlabel)
> which can be used to (multiple) raster values and labels. Optionally, it
> can also upload raster values only, like your addon (that part uses the
> same approach you use). I have not yet added it to the grass addon
> repository. I might do that later, at which point we can also see if it
> makes sense to merge the two.
>
> Cheers,
>
> Paulo
>
>
> On 5/9/17 8:36 AM, Luca Delucchi wrote:
>
>> On 8 May 2017 at 07:16, Pierre Roudier  wrote:
>>
>>> Hi all,
>>>
>>> Hi,
>>
>> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
>>> [0].
>>>
>>> It is a super simple Python wrapper around v.what.rast, and allows to
>>> query
>>> a suite of rasters in one go:
>>>
>>> thanks, it is useful
>> to improve a little bit, you add multiprocessing to the module, for
>> example a process for each raster
>>
> Interesting, could help to speed up with large point data layers.
>
>>
>> Cheers,
>>>
>>> Pierre
>>>
>>>
>>
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-09 Thread Paulo van Breugel

Hi Pierre,

I have one question about the code. In lines 126-130 you create an 
object 'fl', which you subsequently do not seem to use. Perhaps in line 
150 it should be flags=fl ?


Something else, last year I wrote an addon r.what.rastlabel 
(https://github.com/ecodiv/GRASS-scripts/tree/master/v.what.rastlabel) 
which can be used to (multiple) raster values and labels. Optionally, it 
can also upload raster values only, like your addon (that part uses the 
same approach you use). I have not yet added it to the grass addon 
repository. I might do that later, at which point we can also see if it 
makes sense to merge the two.


Cheers,

Paulo


On 5/9/17 8:36 AM, Luca Delucchi wrote:

On 8 May 2017 at 07:16, Pierre Roudier  wrote:

Hi all,


Hi,


FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi [0].

It is a super simple Python wrapper around v.what.rast, and allows to query
a suite of rasters in one go:


thanks, it is useful
to improve a little bit, you add multiprocessing to the module, for
example a process for each raster

Interesting, could help to speed up with large point data layers.



Cheers,

Pierre





___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-08 Thread Moritz Lennert

On 09/05/17 07:26, pablo zader wrote:

Very Nice!!

I have one question: Because it is called v.what.rast.multi and not
r.what.rast.multi?


It is a frontend to v.what.rast which loads information from a raster 
map into the attribute table of a point vector map. As it is the vector 
map which is modified, it is considered a vector module.


Moritz


___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-08 Thread Luca Delucchi
On 8 May 2017 at 07:16, Pierre Roudier  wrote:
> Hi all,
>

Hi,

> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi [0].
>
> It is a super simple Python wrapper around v.what.rast, and allows to query
> a suite of rasters in one go:
>

thanks, it is useful
to improve a little bit, you add multiprocessing to the module, for
example a process for each raster

>
> Cheers,
>
> Pierre
>


-- 
ciao
Luca

www.lucadelu.org
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-08 Thread pablo zader
Very Nice!!

I have one question: Because it is called v.what.rast.multi and not
r.what.rast.multi?

Best



2017-05-08 18:25 GMT-03:00 Pierre Roudier :

> Done -- thanks for the heads-up Moritz!
>
> On 8 May 2017 at 23:05, Moritz Lennert 
> wrote:
>
>> On 08/05/17 07:16, Pierre Roudier wrote:
>>
>>> Hi all,
>>>
>>> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
>>> [0].
>>>
>>> It is a super simple Python wrapper around v.what.rast, and allows to
>>> query a suite of rasters in one go:
>>>
>>> v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect
>>> columns=elevation,slope,aspect
>>>
>>
>> Very useful, thanks !
>>
>> Don't forget to add the addon to the Makefile in the
>> grass-addons/grass7/vector directory.
>>
>> Moritz
>>
>
>
> ___
> grass-dev mailing list
> grass-dev@lists.osgeo.org
> https://lists.osgeo.org/mailman/listinfo/grass-dev
>



-- 
*Pablo J. Zader*
*Universidad Nacional de Córdoba*

*GIS and remote sensing developer--*
*Lic. en Cs. de la Computación*
*Mgtr. en Aplicaciones  Espaciales de Alerta y Respuesta Temprana a
Emergencias*
*--*
*pablo.za...@gmail.com *





*"Los Grandes Hombres hablan sobre ideas... Los Hombres Promedio hablan
sobre cosas... Los Hombres Pequeños hablan.. de otros Hombres.*
*del libro Matemática estas ahi? A. Paenza "*
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-08 Thread Pierre Roudier
Done -- thanks for the heads-up Moritz!

On 8 May 2017 at 23:05, Moritz Lennert  wrote:

> On 08/05/17 07:16, Pierre Roudier wrote:
>
>> Hi all,
>>
>> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
>> [0].
>>
>> It is a super simple Python wrapper around v.what.rast, and allows to
>> query a suite of rasters in one go:
>>
>> v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect
>> columns=elevation,slope,aspect
>>
>
> Very useful, thanks !
>
> Don't forget to add the addon to the Makefile in the
> grass-addons/grass7/vector directory.
>
> Moritz
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-08 Thread Moritz Lennert

On 08/05/17 07:16, Pierre Roudier wrote:

Hi all,

FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi [0].

It is a super simple Python wrapper around v.what.rast, and allows to
query a suite of rasters in one go:

v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect
columns=elevation,slope,aspect


Very useful, thanks !

Don't forget to add the addon to the Makefile in the 
grass-addons/grass7/vector directory.


Moritz
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

Re: [GRASS-dev] new addon: v.what.rast.multi

2017-05-07 Thread Pierre Roudier
I guess I probably should have added the URL:
https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.what.rast.multi

Apologies!

On 8 May 2017 at 17:16, Pierre Roudier  wrote:

> Hi all,
>
> FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi
> [0].
>
> It is a super simple Python wrapper around v.what.rast, and allows to
> query a suite of rasters in one go:
>
> v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect
> columns=elevation,slope,aspect
>
> Cheers,
>
> Pierre
>
> [0]: https://trac.osgeo.org/grass/browser/grass-addons/grass7/
> vector/v.what.rast.multi
>
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev

[GRASS-dev] new addon: v.what.rast.multi

2017-05-07 Thread Pierre Roudier
Hi all,

FYI I just submitted my (first!) GRASS add-on, called v.what.rast.multi [0].

It is a super simple Python wrapper around v.what.rast, and allows to query
a suite of rasters in one go:

v.what.rast.multi map=mygeodetic_pts raster=elev_state_500m,slope,aspect
columns=elevation,slope,aspect

Cheers,

Pierre

[0]:
https://trac.osgeo.org/grass/browser/grass-addons/grass7/vector/v.what.rast.multi
___
grass-dev mailing list
grass-dev@lists.osgeo.org
https://lists.osgeo.org/mailman/listinfo/grass-dev