[GRASS-user] resample STRDS to finer temporal resolution

Ken Mankoff mankoff at gmail.com
Thu Sep 12 11:55:21 PDT 2019


Hello,

I'd like to take an STRDS with several overlapping time span rasters and extract a time stamp (or a shorter time-span) that is some operation of the overlapping rasters.

For example:

% t.rast.list input=SEC | head
name|mapset|start_time|end_time
SEC_19920101_19970101|CCI_SEC|1992-01-01 00:00:00|1997-01-01 00:00:00
SEC_19930101_19980101|CCI_SEC|1993-01-01 00:00:00|1998-01-01 00:00:00
SEC_19940101_19990101|CCI_SEC|1994-01-01 00:00:00|1999-01-01 00:00:00
SEC_19950101_20000101|CCI_SEC|1995-01-01 00:00:00|2000-01-01 00:00:00
SEC_19960101_20010101|CCI_SEC|1996-01-01 00:00:00|2001-01-01 00:00:00

And I'd like to get a raster that represents some subset, for example a time stamp of 1994-07-01 or time span covering that day, or a time span covering one month.

The operation could be simple - say the average of all rasters that include or contain the timestamp, or I'd be happy if I could have more complex operations, like a weighted running mean.

I've looked at t.rast.aggregate - this appears to only work for sampling to larger time spans. For example, I can aggregate by decade:

% t.rast.aggregate -n input=SEC output=SEC_y basename=base granularity="10 years" method=average
% t.rast.list input=SEC_y
name|mapset|start_time|end_time
base_1992|CCI_SEC|1992-01-01 00:00:00|2002-01-01 00:00:00
base_2002|CCI_SEC|2002-01-01 00:00:00|2012-01-01 00:00:00
base_2012|CCI_SEC|2012-01-01 00:00:00|2022-01-01 00:00:00

But not by day:

% t.rast.aggregate -n input=SEC output=SEC_d basename=base granularity="10 days" method=average
% t.rast.list input=SEC_d
ERROR: Space time raster dataset <SEC_d> not found



If I want this (copied from above):

% t.rast.list input=SEC | head
name|mapset|start_time|end_time
SEC_19920101_19970101|CCI_SEC|1992-01-01 00:00:00|1997-01-01 00:00:00
SEC_19930101_19980101|CCI_SEC|1993-01-01 00:00:00|1998-01-01 00:00:00
SEC_19940101_19990101|CCI_SEC|1994-01-01 00:00:00|1999-01-01 00:00:00
SEC_19950101_20000101|CCI_SEC|1995-01-01 00:00:00|2000-01-01 00:00:00
SEC_19960101_20010101|CCI_SEC|1996-01-01 00:00:00|2001-01-01 00:00:00

resampled monthly for a decade, do I need to do it all manually? For example, loop over 120 months, and for each one 1) t.rast.extract or t.rast.mapcalc to get STRDS rasters that contain that month, 2) r.mapcalc to generate a new raster where I use t.rast.list as the input to the expression, and then 3) add the new raster to a new monthly STRDS?

Thanks,

  -k.


More information about the grass-user mailing list