1#!/bin/sh 2# This is a test to register and unregister raster maps in 3# space time raster input. 4# The raster maps will be registered in different space time raster 5# inputs 6 7# We need to set a specific region in the 8# @preprocess step of this test. We generate 9# raster with r.mapcalc and create two space time raster inputs 10# with absolute time 11# The region setting should work for UTM and LL test locations 12g.region s=0 n=80 w=0 e=120 b=0 t=50 res=10 res3=10 -p3 13 14# Generate data 15r.mapcalc --o expr="prec_1 = rand(0, 550)" -s 16r.mapcalc --o expr="prec_2 = rand(0, 450)" -s 17r.mapcalc --o expr="prec_3 = rand(0, 320)" -s 18r.mapcalc --o expr="prec_4 = rand(0, 510)" -s 19r.mapcalc --o expr="prec_5 = rand(0, 300)" -s 20r.mapcalc --o expr="prec_6 = rand(0, 650)" -s 21 22n1=`g.tempfile pid=1 -d` # Only map names 23n2=`g.tempfile pid=2 -d` # Map names and start time 24n3=`g.tempfile pid=3 -d` # Map names start time and increment 25 26cat > "${n1}" << EOF 27prec_1 28prec_2 29prec_3 30prec_4 31prec_5 32prec_6 33EOF 34cat "${n1}" 35 36cat > "${n2}" << EOF 37prec_1|2001-01-01 38prec_2|2001-02-01 39prec_3|2001-03-01 40prec_4|2001-04-01 41prec_5|2001-05-01 42prec_6|2001-06-01 43EOF 44cat "${n2}" 45 46cat > "${n3}" << EOF 47prec_1|2001-01-01|2001-04-01 48prec_2|2001-04-01|2001-07-01 49prec_3|2001-07-01|2001-10-01 50prec_4|2001-10-01|2002-01-01 51prec_5|2002-01-01|2002-04-01 52prec_6|2002-04-01|2002-07-01 53EOF 54cat "${n3}" 55 56# The first @test 57# We create the space time raster inputs and register the raster maps with absolute time interval 58t.create --o type=strds temporaltype=absolute output=precip_abs8 title="A test with input files" descr="A test with input files" 59 60# Test with input files 61# File 1 62t.register --o -i input=precip_abs8 file="${n1}" start="2001-01-01" increment="1 months" 63t.info type=strds input=precip_abs8 64t.rast.list input=precip_abs8 65# File 1 66t.register --o input=precip_abs8 file="${n1}" start="2001-01-01" 67t.info type=strds input=precip_abs8 68t.rast.list input=precip_abs8 69# File 2 70t.register --o input=precip_abs8 file="${n2}" 71t.info type=strds input=precip_abs8 72t.rast.list input=precip_abs8 73# File 2 74t.register --o input=precip_abs8 file="${n2}" increment="1 months" 75t.info type=strds input=precip_abs8 76t.rast.list input=precip_abs8 77# File 3 78t.register --o -i input=precip_abs8 file="${n3}" 79t.info type=strds input=precip_abs8 80t.rast.list input=precip_abs8 81 82t.remove --v type=strds input=precip_abs8 83t.unregister --v type=raster file="${n1}" 84