[GRASS-dev] t.rast.aggregate: problem with sampling methods

Veronica Andreo veroandreo at gmail.com
Tue Apr 24 12:29:54 PDT 2018


Hello devs,

I have a raster time series derived from MODIS VI products which
granularity is 16-days. When I use either t.rast.aggregate or
t.rast.aggregate.ds with default sampling method (i.e., contains) to create
a monthly time series, I get 2 maps less than I should (106 instead of 108
which would correspond to 12 months * 9 years). I found out that the
problem appears with maps from november in leap years. Here an extract of
t.rast.list from the 16-days time series:

t.rast.list -u EVI_16day_lwr_filt where="start_time >= '2012-10-01
00:00:00'"

EVI_lwr_filt_088|ghana|2012-10-15 00:00:00|2012-10-31 00:00:00
EVI_lwr_filt_089|ghana|2012-10-31 00:00:00|2012-11-16 00:00:00
EVI_lwr_filt_090|ghana|2012-11-16 00:00:00|2012-12-02 00:00:00 <<-- here
EVI_lwr_filt_091|ghana|2012-12-02 00:00:00|2012-12-18 00:00:00
EVI_lwr_filt_092|ghana|2012-12-18 00:00:00|2013-01-01 00:00:00
...
EVI_lwr_filt_180|ghana|2016-10-15 00:00:00|2016-10-31 00:00:00
EVI_lwr_filt_181|ghana|2016-10-31 00:00:00|2016-11-16 00:00:00
EVI_lwr_filt_182|ghana|2016-11-16 00:00:00|2016-12-02 00:00:00 <<-- here
EVI_lwr_filt_183|ghana|2016-12-02 00:00:00|2016-12-18 00:00:00
EVI_lwr_filt_184|ghana|2016-12-18 00:00:00|2017-01-01 00:00:00

Using the following command (by default sampling=contains):

t.rast.aggregate input=EVI_16day_lwr_filt output=bla \
  method=average granularity="1 months" basename=bla suffix=gran

I get no aggregated maps for november in 2012 and 2016 (leap years):

bla_2012_09|ghana|2012-09-01 00:00:00|2012-10-01 00:00:00
bla_2012_10|ghana|2012-10-01 00:00:00|2012-11-01 00:00:00
bla_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00
bla_2013_01|ghana|2013-01-01 00:00:00|2013-02-01 00:00:00
...
bla_2016_09|ghana|2016-09-01 00:00:00|2016-10-01 00:00:00
bla_2016_10|ghana|2016-10-01 00:00:00|2016-11-01 00:00:00
bla_2016_12|ghana|2016-12-01 00:00:00|2017-01-01 00:00:00
bla_2017_01|ghana|2017-01-01 00:00:00|2017-02-01 00:00:00

I thought it had to do with the sampling method, so I tried systematically
with all of them. No one creates maps for nov2012 or nov2016. I thought
sampling=starts or started would do, but no...

Is this a bug or no topological relation can actually handle this case??
What are the possible solutions? Manually aggregate per year and month :-(
? Manually change the time stamp of the problematic map ?

Thanks much in advance!

Vero

ps: I use grass trunk, r72636. I attach my tests in a text file. I can
share the time series if needed.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20180424/025ba8db/attachment.html>
-------------- next part --------------
SAMPLING_MET=(equal overlaps overlapped starts started finishes finished during contains)

# test with all sampling methods in t.rast.aggregate
for SAMPLING in ${SAMPLING_MET[*]} ; do 
 
 echo "SAMPLING METHOD: ${SAMPLING}"
 
 t.rast.aggregate input=EVI_16day_lwr_filt output=bla_${SAMPLING} \
  method=average granularity="1 months" basename=bla_${SAMPLING} \
  suffix=gran sampling=${SAMPLING} --o
 
 eval `t.info -g bla_${SAMPLING}` ; echo $number_of_maps
 
 t.rast.list bla_${SAMPLING} where="start_time >= '2012-11-01 00:00:00' AND start_time <= '2012-12-01 00:00:00'"
done 

#### RESULTS #####
SAMPLING METHOD: equal
ERROR: Dataset <bla_equal at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_equal> not found

SAMPLING METHOD: overlaps
92
name|mapset|start_time|end_time
bla_overlaps_2012_11|ghana|2012-11-01 00:00:00|2012-12-01 00:00:00

SAMPLING METHOD: overlapped
92
name|mapset|start_time|end_time
bla_overlapped_2012_11|ghana|2012-11-01 00:00:00|2012-12-01 00:00:00
bla_overlapped_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00

SAMPLING METHOD: starts
ERROR: Dataset <bla_starts at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_starts> not found

SAMPLING METHOD: started
16

SAMPLING METHOD: finishes
ERROR: Dataset <bla_finishes at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_finishes> not found

SAMPLING METHOD: finished
16
name|mapset|start_time|end_time
bla_finished_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00

SAMPLING METHOD: during
ERROR: Dataset <bla_during at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_during> not found

SAMPLING METHOD: contains
106
name|mapset|start_time|end_time
bla_contains_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00

#######################################################
# test with all sampling methods in t.rast.aggregate.ds 
# Note: sample strds is correctly aggregated into 108 maps (12*9), 
# it comes from a 8day gran strds

for SAMPLING in ${SAMPLING_MET[*]} ; do 
 
 echo "SAMPLING METHOD: ${SAMPLING}"
 
 t.rast.aggregate.ds input=EVI_16day_lwr_filt \
  sample=LST.Night_lwr_filt_monthly_average output=bla_${SAMPLING} \
  method=average basename=bla_${SAMPLING} \
  suffix=gran sampling=${SAMPLING} --o
 
 eval `t.info -g bla_${SAMPLING}` ; echo $number_of_maps
 
 t.rast.list bla_${SAMPLING} \
  where="start_time >= '2012-11-01 00:00:00' AND start_time <= '2012-12-01 00:00:00'"

done 

#### RESULTS #####
SAMPLING METHOD: equal
ERROR: Dataset <bla_equal at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_equal> not found

SAMPLING METHOD: overlaps
92
name|mapset|start_time|end_time
bla_overlaps_2012_11|ghana|2012-11-01 00:00:00|2012-12-01 00:00:00

SAMPLING METHOD: overlapped
92
name|mapset|start_time|end_time
bla_overlapped_2012_11|ghana|2012-11-01 00:00:00|2012-12-01 00:00:00
bla_overlapped_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00

SAMPLING METHOD: starts
ERROR: Dataset <bla_starts at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_starts> not found

SAMPLING METHOD: started
16

SAMPLING METHOD: finishes
ERROR: Dataset <bla_finishes at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_finishes> not found

SAMPLING METHOD: finished
16
name|mapset|start_time|end_time
bla_finished_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00

SAMPLING METHOD: during
ERROR: Dataset <bla_during at ghana> not found in temporal database
ERROR: Space time raster dataset <bla_during> not found

SAMPLING METHOD: contains
106
name|mapset|start_time|end_time
bla_contains_2012_12|ghana|2012-12-01 00:00:00|2013-01-01 00:00:00




More information about the grass-dev mailing list