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

Veronica Andreo veroandreo at gmail.com
Wed Oct 14 05:10:18 PDT 2015


Hi Dylan,

I guess -i flag "might" (not sure) be incompatible with a file with
start_time... so, if you have a list with mapname|start_time, you would
only pass that and no need to set an increment really, because it would be
implicit in the start_time (of course if your maps have different
granularities, then you need to specify start and end time)... this is what
I get with your example:

GRASS 7.1.svn (latlong_wgs84):~ > t.register --o input=precip_abs
file=precip_abs.files type=raster
...

GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list precip_abs
name|mapset|start_time|end_time
prec_1|pruebas|1981-01-01 00:00:00|None
prec_2|pruebas|1981-01-02 00:00:00|None
prec_3|pruebas|1981-01-03 00:00:00|None
prec_4|pruebas|1981-01-04 00:00:00|None
prec_5|pruebas|1981-01-05 00:00:00|None
prec_6|pruebas|1981-01-06 00:00:00|None

If I use the list of mapnames only (without start_time) and so, I set -i
flag, increment="1 days" and start="1981-01-01", then I get:

GRASS 7.1.svn (latlong_wgs84):~ > t.register --o -i input=precip_abs
file=somefile type=raster increment="1 days" start="1981-01-01"
...
GRASS 7.1.svn (latlong_wgs84):~ > t.rast.list precip_abs
name|mapset|start_time|end_time
prec_1|pruebas|1981-01-01 00:00:00|1981-01-02 00:00:00
prec_2|pruebas|1981-01-02 00:00:00|1981-01-03 00:00:00
prec_3|pruebas|1981-01-03 00:00:00|1981-01-04 00:00:00
prec_4|pruebas|1981-01-04 00:00:00|1981-01-05 00:00:00
prec_5|pruebas|1981-01-05 00:00:00|1981-01-06 00:00:00
prec_6|pruebas|1981-01-06 00:00:00|1981-01-07 00:00:00

I'm using r66429

HTH,
Vero

2015-10-13 18:10 GMT-03:00 Dylan Beaudette <dylan.beaudette at gmail.com>:

> 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
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20151014/345651a2/attachment-0001.html>


More information about the grass-dev mailing list