[GRASS-dev] odd behavior from t.register when loading from file and no "end date" is specified

Dylan Beaudette dylan.beaudette at gmail.com
Tue Oct 13 14:10:52 PDT 2015


Hi,

I recently notices something when working with t.register and a large
collection of daily files. My typical work-flow is something like
this:

# make some data
r.mapcalc expression="prec_1 = 100"
r.mapcalc expression="prec_2 = 200"
r.mapcalc expression="prec_3 = 300"
r.mapcalc expression="prec_4 = 400"
r.mapcalc expression="prec_5 = 500"
r.mapcalc expression="prec_6 = 600"

# create a new space-time data set
t.create --o type=strds temporaltype=absolute \
    output=precip_abs title="Example" \
    descr="Example"

# generate a file describing the raster names and start dates
echo "prec_1|1981-01-01|
prec_2|1981-01-02|
prec_3|1981-01-03|
prec_4|1981-01-04|
prec_5|1981-01-05|
prec_6|1981-01-06|" > precip_abs.files


... In many cases the list of raster and dates is generated by parsing
raster names, like this:

g.list type=rast pattern="file_*" | \
awk -F '_' '{print
$1"_"$2"|"substr($2,1,4)"-"substr($2,5,2)"-"substr($2,7,2)}' >
somefile

... this is really handy when you have a lot of files (>10k), but
cannot generate both "start" and "stop" dates for the t.register input
file.

OK, well (unless I am mistaken) t.register should be able to figure
this out when invoked with the "-i" flag:

# register maps from file, filling-in stop dates
t.register --o -i input=precip_abs file=precip_abs.files type=raster
increment="1 day"

... however, this results in the following:

# double-check start | stop dates:
t.rast.list precip_abs

name|mapset|start_time|end_time
prec_1|PERMANENT|1981-01-02 00:00:00|1981-01-03 00:00:00
prec_2|PERMANENT|1981-01-03 00:00:00|1981-01-04 00:00:00
prec_3|PERMANENT|1981-01-04 00:00:00|1981-01-05 00:00:00
prec_4|PERMANENT|1981-01-05 00:00:00|1981-01-06 00:00:00
prec_5|PERMANENT|1981-01-06 00:00:00|1981-01-07 00:00:00
prec_6|PERMANENT|1981-01-07 00:00:00|1981-01-08 00:00:00

... these maps are offset by 1 day into the future.

Is this the intended result?

I am able to get my expected result if I fully specify the start and
stop dates in the t.register input file. This get a little tricky, but
(insert your favorite scripting language) can make the process of
adding 1 day to each line simple.


This is with grass_trunk as of:

Last Changed Rev: 66487
Last Changed Date: 2015-10-13 02:54:55 -0700 (Tue, 13 Oct 2015)


Am I abusing t.register or otherwise misinterpreting the manual pages?

Thanks,
Dylan


More information about the grass-dev mailing list