Soren,<div>What a great Friday afternoon brain stretch!  Thanks!</div><div><br></div><div>Doug</div><div><br></div><div><br><div class="gmail_quote">On Fri, Feb 22, 2013 at 4:13 PM, Sören Gebbert <span dir="ltr"><<a href="mailto:soerengebbert@googlemail.com" target="_blank">soerengebbert@googlemail.com</a>></span> wrote:<br>

<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><p>Hi,<br>
Am 22.02.2013 21:44 schrieb "Newcomb, Doug" <<a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a>>:</p><div class="im"><br>
><br>
> t.create--> t.register--> t.vect.observer.strds   in GRASS7 ?   Looks really nifty, could be useful with the Landsat Cube data sets <a href="http://landsat.usgs.gov/documents/Oct27_29_2009_huang_LST_boston.ppt" target="_blank">http://landsat.usgs.gov/documents/Oct27_29_2009_huang_LST_boston.ppt</a><br>


</div><p></p>
<p>Yes, thats the idea. I totally forgot, I made I short presentation and tutorial at the geostat in 2012:<br>
<a href="http://www.geostat-course.org/Topic_Gebbert" target="_blank">http://www.geostat-course.org/Topic_Gebbert</a><br></p>
<p>The presentation and the scripts are available there. The t.vect.observe.strds example is in part three of the presentation. The cool thing is that t.vect.observe.strds uses time stamped attribute tables to store the values.</p>



<p>Best regards<br>
Soeren</p><div><div class="h5"><br>
><br>
><br>
><br>
> Doug<br>
><br>
><br>
> On Fri, Feb 22, 2013 at 2:53 PM, Michael Barton <<a href="mailto:Michael.Barton@asu.edu" target="_blank">Michael.Barton@asu.edu</a>> wrote:<br>
>><br>
>> Thanks Doug,<br>
>><br>
>> I knew I could do it with a script and v.what.rast. <br>
>><br>
>> What I was hoping was that there is a shortcut already usable in GRASS modules. Looks like the new temporal GIS tools may be able to do it.<br>
>><br>
>> Michael<br>
>> ______________________________<br>
>> C. Michael Barton <br>
>> Director, Center for Social Dynamics & Complexity<br>
>> Professor of Anthropology, School of Human Evolution & Social Change<br>
>> Arizona State University<br>
>> Tempe, AZ  85287-2402<br>
>> USA<br>
>><br>
>> voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)<br>
>> fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)<br>
>> www:  <a href="http://csdc.asu.edu" target="_blank">http://csdc.asu.edu</a>, <a href="http://shesc.asu.edu" target="_blank">http://shesc.asu.edu</a><br>
>> <a href="http://www.public.asu.edu/~cmbarton" target="_blank">http://www.public.asu.edu/~cmbarton</a><br>
>><br>
>> On Feb 22, 2013, at 12:31 PM, "Newcomb, Doug" <<a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a>><br>
>>  wrote:<br>
>><br>
>>> Michael,<br>
>>> You could use v.what.rast  in a python script , iterating the raster layers with an sqlite database back end.  I think that would go up to 2000 columns for each point you have.<br>
>>><br>
>>> Alternatively, you could use a bit of python with gdal.  I was trying to do something similar in GRASS, to change the Z value of each point in a text LiDAR file, from absolute above sea level to relative the elevation of the ground.  For 25.5 billion text points and a Statewide 20 ft elevation grid (6.5 ? billion cells) , it was a bit slow using r.what.  So I converted the LiDAR data to (7)  3.3 billion point  LAS format files and exported the GRASS layer to an Erdas imagine format file and wrote the following ugly python script: <br>



>>><br>
>>> #!/usr/bin/python<br>
>>> import os,string,glob,re,gdal<br>
>>> from liblas import file<br>
>>> from liblas import header<br>
>>> from liblas import point<br>
>>> from gdalconst import *<br>
>>> h=header.Header()<br>
>>> #enter the LAS point file name<br>
>>> infile=raw_input("Enter the input lidar data points file: ")<br>
>>> #Hardcoded edras imagine file, you will have to use an array for the different data layer names<br>
>>> imgfile="/gisdata2/raster/allnc_20ft_el.img"<br>
>>> #print "suggest /gisdata2/raster for output dir\n"<br>
>>> inarr=infile.split('.')<br>
>>> #This sets the LAS output file, substitute your output text file instead<br>
>>> outfil=inarr[0]+"_norm.las"<br>
>>> #outfil=raw_input("Enter output text file name: ")<br>
>>> #This part reads the LAS file, if you <br>
>>> l=file.File(infile,mode='r')<br>
>>> #Outputs the LAS file<br>
>>> lout=file.File(outfil,mode='w',header=h)<br>
>>> # register all of the drivers, hopefully your gdal speaks GRASS<br>
>>> gdal.AllRegister()<br>
>>> #opening and closing the image layers might take some time if you are reading thousands of images<br>
>>> ds=gdal.Open(imgfile,GA_ReadOnly)<br>
>>> if ds is None:<br>
>>>     print 'Could not open image'<br>
>>>     sys.exit(1)<br>
>>> # get image size<br>
>>> rows = ds.RasterYSize<br>
>>> cols = ds.RasterXSize<br>
>>> bands = ds.RasterCount<br>
>>> # get georeference info, not sure how this would work for GRASS data layers<br>
>>> transform = ds.GetGeoTransform()<br>
>>> xOrigin = transform[0]<br>
>>> yOrigin = transformAsArray(xOffset, yOffset, 1, 1)<br>
>>> pixelWidth = transform[1]<br>
>>> pixelHeight = transform[5]<br>
>>> for p in l:<br>
>>>     x=float(p.x)<br>
>>>     y=float(p.y)<br>
>>>     z=float(p.z)<br>
>>>     # compute pixel offset<br>
>>>     xOffset = int((x - xOrigin) / pixelWidth)<br>
>>>     yOffset = int((y - yOrigin) / pixelHeight)<br>
>>>     band = ds.GetRasterBand(1) # 1-based index 0? 1?<br>
>>>     data = band.Readr(value) :continue<br>
>>>     value = data[0,0]<br>
>>>     #print value,"11","\n"<br>
>>>     if "nan" in st[3]<br>
>>>     znorm = z-value<br>
>>>     #print znorm,"\n"<br>
>>>     pt=point.Point()<br>
>>>     pt.x=p.x<br>
>>>     pt.y=p.y<br>
>>>     pt.z=znorm<br>
>>>     lout.write(pt)<br>
>>><br>
>>> l.close()<br>
>>> lout.close()<br>
>>> #25561312019 points in allreturns<br>
>>><br>
>>> This managed to process everything over a weekend( in 7 parallel threads), which was fast enough for me at the time.  Approaching your problem , if your data layers are all n GRASS and your version of gdal can read GRASS data layers,  I would grab the list of GRASS layers via glob and iterate the layers , writing the name of the raster layer and the value of the raster layer at the point coordinates out to a text file as you state below.  <br>



>>><br>
>>> Hope this helps,<br>
>>> Doug<br>
>>>  <br>
>>><br>
>>> On Fri, Feb 22, 2013 at 1:23 PM, Michael Barton <<a href="mailto:Michael.Barton@asu.edu" target="_blank">Michael.Barton@asu.edu</a>> wrote:<br>
>>>><br>
>>>> But I want to do it with a time series of hundreds or thousands of maps.<br>
>>>><br>
>>>> Michael<br>
>>>> ______________________________<br>
>>>> C. Michael Barton<br>
>>>> Director, Center for Social Dynamics & Complexity<br>
>>>> Professor of Anthropology, School of Human Evolution & Social Change<br>
>>>> Arizona State University<br>
>>>> Tempe, AZ  85287-2402<br>
>>>> USA<br>
>>>><br>
>>>> voice:  480-965-6262 (SHESC), 480-727-9746 (CSDC)<br>
>>>> fax:          480-965-7671(SHESC), 480-727-0709 (CSDC)<br>
>>>> www:    <a href="http://csdc.asu.edu" target="_blank">http://csdc.asu.edu</a>, <a href="http://shesc.asu.edu" target="_blank">http://shesc.asu.edu</a><br>
>>>>                 <a href="http://www.public.asu.edu/~cmbarton" target="_blank">http://www.public.asu.edu/~cmbarton</a><br>
>>>><br>
>>>> On Feb 22, 2013, at 10:53 AM, Markus Neteler <<a href="mailto:neteler@osgeo.org" target="_blank">neteler@osgeo.org</a>><br>
>>>>  wrote:<br>
>>>><br>
>>>> > On Fri, Feb 22, 2013 at 6:41 PM, Michael Barton <<a href="mailto:Michael.Barton@asu.edu" target="_blank">Michael.Barton@asu.edu</a>> wrote:<br>
>>>> >> Is there tool somewhere, including in the new temporal GIS modules, to<br>
>>>> >> sample the value of a raster series at one cell location? I'd like to get<br>
>>>> >> text something like this for a cell that I specify with xy coordinates or a<br>
>>>> >> cat:<br>
>>>> >><br>
>>>> >> map1, value 1<br>
>>>> >> map2, value 2<br>
>>>> >> map3, value 3<br>
>>>> >> map4, value 4<br>
>>>> >> map5, value 5<br>
>>>> >> …<br>
>>>> >><br>
>>>> ><br>
>>>> > I do such queries with r.what which accepts multiple input:<br>
>>>> ><br>
>>>> > <a href="http://grass.osgeo.org/grass64/manuals/r.what.html" target="_blank">http://grass.osgeo.org/grass64/manuals/r.what.html</a><br>
>>>> ><br>
>>>> > Markus<br>
>>>><br>
>>>> _______________________________________________<br>
>>>> grass-dev mailing list<br>
>>>> <a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
>>>> <a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
>>><br>
>>><br>
>>><br>
>>><br>
>>> -- <br>
>>> Doug Newcomb<br>
>>> USFWS<br>
>>> Raleigh, NC<br>
>>> 919-856-4520 ext. 14 <a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a><br>
>>> ---------------------------------------------------------------------------------------------------------<br>
>>> The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior.   Life is too short for undocumented, proprietary data formats.<br>



>><br>
>><br>
><br>
><br>
><br>
> -- <br>
> Doug Newcomb<br>
> USFWS<br>
> Raleigh, NC<br>
> 919-856-4520 ext. 14 <a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a><br>
> ---------------------------------------------------------------------------------------------------------<br>
> The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior.   Life is too short for undocumented, proprietary data formats.<br>
><br>
> _______________________________________________<br>
> grass-dev mailing list<br>
> <a href="mailto:grass-dev@lists.osgeo.org" target="_blank">grass-dev@lists.osgeo.org</a><br>
> <a href="http://lists.osgeo.org/mailman/listinfo/grass-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/grass-dev</a><br>
</div></div><p></p>
</blockquote></div><br><br clear="all"><div><br></div>-- <br><div>Doug Newcomb</div><div>USFWS</div><div>Raleigh, NC</div><div>919-856-4520 ext. 14 <a href="mailto:doug_newcomb@fws.gov" target="_blank">doug_newcomb@fws.gov</a></div>

<div>---------------------------------------------------------------------------------------------------------</div><div>The opinions I express are my own and are not representative of the official policy of the U.S.Fish and Wildlife Service or Dept. of the Interior.   Life is too short for undocumented, proprietary data formats.</div>


</div>