<div dir="ltr"><div><div><div>Hi Pietro,<br><br></div>for 3 maps, I am collecting one pixel at a time for thousands of maps, create a temporal signature for all 3, then use python-pywt on it, then return the single pixel to each map. To do that I need to open files and close them before reaching the max file opened OS limit...<br>
<br></div>Very slow indeed, but python-pywt has a large library of wavelet coefficients, and libgsl has none of that choice and is not made for fused recomposition from different sources (I asked the maintainer of libgsl, and he is not the author, and does not understand why we (RS/GIS guys) want to recompose from different sources....<br>
<br></div>Thanks,<br>Yann<br><div><div><br><br></div></div></div><div class="gmail_extra"><br><br><div class="gmail_quote">On 16 September 2013 16:05, Pietro <span dir="ltr"><<a href="mailto:peter.zamb@gmail.com" target="_blank">peter.zamb@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">Hi all!<br>
<div class="im"><br>
On Mon, Sep 16, 2013 at 10:43 AM, Sören Gebbert<br>
<<a href="mailto:soerengebbert@googlemail.com">soerengebbert@googlemail.com</a>> wrote:<br>
> Hi Yann,<br>
> you can use the raster info-oject to access the raster specific region<br>
> information's:<br>
><br>
> ras = raster.RasterRow("Bla")<br>
> ras.info.rows<br>
><br>
> You don't need to open the map to gather the info.<br>
<br>
</div>just some example to be more clear...<br>
<br>
I'm on North Carolina dataset, my region is:<br>
<br>
{{{<br>
projection: 99 (Lambert Conformal Conic)<br>
zone:       0<br>
datum:      nad83<br>
ellipsoid:  a=6378137 es=0.006694380022900787<br>
north:      220750<br>
south:      220000<br>
west:       638300<br>
east:       639000<br>
nsres:      0.2<br>
ewres:      0.2<br>
rows:       3750<br>
cols:       3500<br>
cells:      13125000<br>
}}}<br>
<br>
now with python:<br>
<br>
{{{<br>
>>> from grass.pygrass.raster import RasterRow<br>
>>> elev = RasterRow('elevation')<br>
>>> <a href="http://elev.info" target="_blank">elev.info</a><br>
elevation@PERMANENT<br>
rows: 1350<br>
cols: 1500<br>
north: 228500.0 south: 215000.0 nsres:10.0<br>
east:  645000.0 west: 630000.0 ewres:10.0<br>
range: 56, 156<br>
proj: 99<br>
>>> elev.info.rows<br>
1350<br>
}}}<br>
<br>
So the info return just the main data of the raster.<br>
<br>
If you open the raster map:<br>
<br>
{{{<br>
>>> elev.open('r')<br>
>>> elev.info.rows<br>
1350<br>
>>> elev.info.cols<br>
1500<br>
>>> elev._rows<br>
3750<br>
>>> elev._cols<br>
3500<br>
>>> len(elev)<br>
3750<br>
>>> len(elev[0])<br>
3500<br>
}}}<br>
<br>
I put the underscore in front of the rows and cols attribute because<br>
the number of rows and columns depend from the active region that you<br>
are using...<br>
<br>
and to discourage the user to work/use these data...<br>
<br>
Why do you need the number of rows and columns? If you want to do a<br>
cycle you can do something like:<br>
<br>
{{{<br>
>>> for row in elev:<br>
...     dosomething(row)<br>
...<br>
}}}<br>
<br>
if you need the row number you can just use enumerate<br>
<br>
{{{<br>
>>> for irow, row in enumerate(elev):<br>
...     dosomething(irow, row)<br>
...<br>
}}}<br>
<br>
of course you can nest two cycle, something like<br>
<br>
{{{<br>
>>> for irow, row in enumerate(elev):<br>
...     for icol, col in enumerate(row):<br>
...         dosomething(irow, icol, row, col)<br>
...<br>
}}}<br>
<br>
But I discourage to cycle over the column of a row, because it is too<br>
slow, the row is a numpy array and you should use the numpy API to<br>
work with the row...<br>
<br>
Any way If you think that rows and cols are useful attributes I can<br>
rename them from _rows, _cols => row, cols :-)<br>
<br>
Best regards<br>
<span class="HOEnZb"><font color="#888888"><br>
Pietro<br>
</font></span></blockquote></div><br><br clear="all"><br>-- <br>----
</div>