[R-sig-Geo] write.tgrass (spacetime) does not create init.txt

Sören Gebbert soerengebbert at googlemail.com
Sat Jul 19 16:55:23 CEST 2014


Hi Edzer,
sorry for the delay.


2014-07-13 18:11 GMT+02:00 Edzer Pebesma <edzer.pebesma at uni-muenster.de>:
> spacetime::write.tgrass (as it is on github) now writes init.txt,
> hopefully correct. I took examples from
> https://www-pool.math.tu-berlin.de/~soeren/grass/ , and used file
> precipitation_1950_2013_yearly_mm.tar.gz.
>
> In this file, init.txt has quite different content from that you
> describe below:

Oh, yes, sorry, i explained only the most basic file format. The
keywords "stds_type" and "format" are by default "strds" and "GTiff"
and can therefor be omitted in your case. But they have to be set in
case of stvds and other data formats than geotiff. For raster data
only GTiff, AAIGrid and the native tar-gzipped GRASS data formats are
supported.

>
> stds_type=strds
> format=GTiff
> temporal_type=absolute
> semantic_type=mean
> number_of_maps=63
> north=75.5
> south=25.25
> east=75.5
> west=-40.5
>
> Does tgrass depend on knowing "relative_time_unit"?

TGRASS depends on relative time unit in case of relative time. Hence
if you write time like 1,2,3,4, ... , 100 then you have to specify the
unit of them. The relative time unit is not needed in case of calendar
time, since only Gregorian time is supported.

>
> I could write a function that write "years" when the number of days
> between time stamps is 356 or 366, and act similarly for "months" (28,
> 29, 30 or 31), but this is somewhat messy of course, and things get
> worse in case of daylight saving time and monthly data... Suggestions
> welcome!

How does R implements the concept of relative time, hence time without
an absolute reference?

Best regards
Soeren

>
> On 07/07/2014 06:57 PM, Sören Gebbert wrote:
>> Hi,
>> init.txt has the following content:
>>
>> temporal_type=absolute
>> semantic_type=mean
>> relative_time_unit=years
>> number_of_maps=61
>> north=75.5
>> south=25.25
>> east=75.5
>> west=-40.5
>>
>> The spatial extent is ignored while importing, but the temporal type,
>> semantic type (still a dummy in TGRASS) and the number of maps must be
>> provided. The relative time unit is mandatory if the dataset has
>> relative time, otherwise it can be left out.
>>
>> I noticed that the reader expects always absolute time, is it possible
>> to support relative time as well?
>>
>>
>> Best regards
>> Soeren
>>
>> 2014-07-07 18:46 GMT+02:00 Edzer Pebesma <edzer.pebesma at uni-muenster.de>:
>>> Thanks for the clear report, Veronica.
>>>
>>> Soeren (Cc:), do you know where we can find a description of the
>>> requirements, or examples, of the init.txt file?
>>>
>>> On 07/07/2014 06:31 PM, Veronica Andreo wrote:
>>>> Hi list
>>>>
>>>> I'm using R to run some processing over a spatio-temporal raster dataset
>>>> coming from GRASS. The workflow is as follows:
>>>>
>>>> 1. Export all my images from GRASS with t.rast.export
>>>> 2. Import them as a raster stack in R with read.tgrass
>>>> 3. do the processing... which implies converting the rasterstack into a
>>>> matrix, transposing and running dineof
>>>> 4. create the rasterstack again, add the time with setZ
>>>> 5. export with write.tgrass (which only seems to work for RasterStack and
>>>> not for STFDF, i tried both ways)
>>>> 6. and import to grass again...
>>>>
>>>> here is where I get the error since an init.txt file with the following
>>>> information is needed but it's not created by write.tgrass...
>>>>
>>>> stds_type=strds
>>>> format=GTiff
>>>> temporal_type=absolute
>>>> semantic_type=mean
>>>> number_of_maps=
>>>> north=
>>>> south=
>>>> east=
>>>> west=
>>>>
>>>> There are of course some workarounds but it would be nice -and much more
>>>> straightforward- that the function which is intended to provide interface
>>>> between R and T-GRASS, already does the job itself :)
>>>>
>>>> Thanks much!
>>>>
>>>> Best,
>>>> Vero
>>>>
>>>>       [[alternative HTML version deleted]]
>>>>
>>>> _______________________________________________
>>>> R-sig-Geo mailing list
>>>> R-sig-Geo at r-project.org
>>>> https://stat.ethz.ch/mailman/listinfo/r-sig-geo
>>>>
>>>
>>> --
>>> Edzer Pebesma
>>> Institute for Geoinformatics (ifgi), University of Münster
>>> Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
>>> 83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795
>>>
>
> --
> Edzer Pebesma
> Institute for Geoinformatics (ifgi), University of Münster
> Heisenbergstraße 2, 48149 Münster, Germany. Phone: +49 251
> 83 33081 http://ifgi.uni-muenster.de GPG key ID 0xAC227795
>



More information about the R-sig-Geo mailing list