[GRASS-user] DOY support in t.register?

Veronica Andreo veroandreo at gmail.com
Wed Mar 5 13:35:22 PST 2014


Hi Soren!

Thanks much for answering so quickly!! And so clearly!

2014-03-05 21:21 GMT+01:00 Sören Gebbert <soerengebbert at googlemail.com>:

> Hi Veronica,
>
> 2014-03-05 20:49 GMT+01:00 Veronica Andreo <veroandreo at gmail.com>:
> > Dear list
> >
> > I'm working with ocean color data set from MODIS and starting to use t.*
> > modules... I'm trying now to register the strds and as i'm working with
> > 8-day products i specified start date as 2003-01-01 and interval as 8
> days
> > for a list of 506 maps. The time series should end by 2013-12-31 and
> t.info
> > says
> >
> > ...
> >  +-------------------- Absolute time
> > -----------------------------------------+
> >  | Start time:................. 2003-01-01 00:00:00
> >  | End time:................... 2014-01-31 00:00:00
> >  | Granularity:................ 8 days
> >  | Temporal type of maps:...... interval
> > ....
>
> Using Python shows that in case of an 8 day's interval, the end date
> is computed correctly:
>
> {{{
> import datetime
> print datetime.datetime(2003,1,1) + datetime.timedelta(506*8)
> 2014-01-31 00:00:00
> }}}
>

Actually, it is the same as with grass... it is mathematically correct, but
it is not correct for this case... end date of my time series is
*2013-12-31* and not 2014-01-31... as i mentioned earlier the problem
arises in the last image of each year that covers a 5 or 6 days period
(dependending on leap years) and not 8 days as the rest of images in each
year...


> > The problem arise because all products at the end of the year don't
> really
> > cover an 8-days period... So, i understand i should add starting and
> ending
> > date to each file in the list i use as input for t.register... Question
> is:
> > Is it possible to use DOY instead of dates?? or what would be a
> (reasonably)
> > easy way of transforming DOY in map names (for example:
> > A20030732003080.L3m_8D_CHL_chlor_a_4km_arg) into the corresponding
> dates????
>
> So your time series has unequal time intervals?


Sort of... most of it is every 8 day, excep for the last image of the
year...


> I would suggest to use
> a single input file that lists all maps with time stamps as input for
> a single t.register call.
> DOY is not supported by t.register. I would suggest that you use the
> following Python code to extract the exact start and end time from the
> map names:
>
> {{{
> import datetime
>
> #           012345678901234567890123456789012345678901
> map_name = "A20030732003080.L3m_8D_CHL_chlor_a_4km_arg"
> start_year = int(map_name[1:5])
> start_day  = int(map_name[5:8])
> end_year   = int(map_name[8:12])
> end_day    = int(map_name[12:15])
>
> start = datetime.datetime(start_year, 1, 1) + datetime.timedelta(start_day
> - 1)
> end = datetime.datetime(int(end_year), 1, 1) + datetime.timedelta(end_day
> - 1)
>
> print map_name, "|", start, "|", end
>
> }}}
>
> Great!! I really need to learn python :)


> Write each map name with start and end time into one file (a single
> map name with start and end time each line) and register all maps at
> once with "t.register input=my_strds file=my_maps.txt".
>
> Thanks again!
Vero
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-user/attachments/20140305/ce4b9318/attachment.html>


More information about the grass-user mailing list