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

2014-03-06 Thread Vaclav Petras
On Wed, Mar 5, 2014 at 3:21 PM, Sören Gebbert
soerengebb...@googlemail.comwrote:

 print map_name, |, start, |, end


I'm affraid that this prints also spaces around | and so t.register will
fail because it expects only one separator, i.e. |.

That should be

print map_name + | + start + | + end

http://grass.osgeo.org/grass70/manuals/t.register.html
http://docs.python.org/2/reference/simple_stmts.html#print
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

2014-03-06 Thread Veronica Andreo
Hi Vaclav!

Yeah, I've noticed that and already changed it

Thanks!
Vero


2014-03-06 17:26 GMT+01:00 Vaclav Petras wenzesl...@gmail.com:


 That should be

 print map_name + | + start + | + end

 http://grass.osgeo.org/grass70/manuals/t.register.html
 http://docs.python.org/2/reference/simple_stmts.html#print

___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

2014-03-06 Thread Vaclav Petras
On Thu, Mar 6, 2014 at 12:58 PM, Veronica Andreo veroand...@gmail.comwrote:

 Hi Vaclav!

 Yeah, I've noticed that and already changed it

 Hi Veronica, so you are already learning Python, that's great!

Vaclav


 Thanks!
 Vero


 2014-03-06 17:26 GMT+01:00 Vaclav Petras wenzesl...@gmail.com:


 That should be

 print map_name + | + start + | + end

 http://grass.osgeo.org/grass70/manuals/t.register.html
 http://docs.python.org/2/reference/simple_stmts.html#print



___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

2014-03-06 Thread Veronica Andreo
Hi Vaclav!!!

lol!!! I'd wished!!!
Just fixed it with awk :)

Anyway, i tried what you suggested and didn't work in python 2.7. I googled
a bit, and this worked in python 3.3

print(map_name, '|', start, '|', end, sep=)

best,
Vero


2014-03-06 20:46 GMT+01:00 Vaclav Petras wenzesl...@gmail.com:

 Hi Veronica, so you are already learning Python, that's great!

 Vaclav


 Thanks!
 Vero


 2014-03-06 17:26 GMT+01:00 Vaclav Petras wenzesl...@gmail.com:


 That should be

 print map_name + | + start + | + end

 http://grass.osgeo.org/grass70/manuals/t.register.html
 http://docs.python.org/2/reference/simple_stmts.html#print




___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

2014-03-05 Thread Veronica Andreo
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.infosays

...
 + 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


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: A2003
*073*2003*080*.L3m_8D_CHL_chlor_a_4km_arg) into the corresponding dates

Thanks a lot in advance!

Best,
Vero
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user

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

2014-03-05 Thread Sören Gebbert
Hi Veronica,

2014-03-05 20:49 GMT+01:00 Veronica Andreo veroand...@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
}}}


 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? 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

}}}

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.

Best regards
Soeren


 Thanks a lot in advance!

 Best,
 Vero

 ___
 grass-user mailing list
 grass-user@lists.osgeo.org
 http://lists.osgeo.org/mailman/listinfo/grass-user
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user


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

2014-03-05 Thread Veronica Andreo
Hi Soren!

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

2014-03-05 21:21 GMT+01:00 Sören Gebbert soerengebb...@googlemail.com:

 Hi Veronica,

 2014-03-05 20:49 GMT+01:00 Veronica Andreo veroand...@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
___
grass-user mailing list
grass-user@lists.osgeo.org
http://lists.osgeo.org/mailman/listinfo/grass-user