[GRASS-SVN] r31792 - in grass-addons/raster/r.rast4d: . bin lib
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jun 21 19:12:30 EDT 2008
Author: neteler
Date: 2008-06-21 19:12:30 -0400 (Sat, 21 Jun 2008)
New Revision: 31792
Modified:
grass-addons/raster/r.rast4d/QuickStart.txt
grass-addons/raster/r.rast4d/bin/tg.update
grass-addons/raster/r.rast4d/lib/insert_raster.sh
Log:
new end_time parameter; calculate vtime_duration
Modified: grass-addons/raster/r.rast4d/QuickStart.txt
===================================================================
--- grass-addons/raster/r.rast4d/QuickStart.txt 2008-06-21 21:15:45 UTC (rev 31791)
+++ grass-addons/raster/r.rast4d/QuickStart.txt 2008-06-21 23:12:30 UTC (rev 31792)
@@ -18,7 +18,8 @@
the ./db/ directory and run r.rast4d.init again
* tg.update
-Use tg.update to register/update your raster maps in the sqlite table
+Use tg.update to register/update your raster maps in the sqlite table.
+You can run it again to update already registered maps.
* tg.list
Use tg.list to show the registered maps, performe sql where statements on the view
@@ -54,7 +55,7 @@
Beispiel mit 4 registrierten Maps:
-GRASS 6.3.cvs > bin/tg.list rast select=name,vtime_start
+GRASS 6.3.cvs > tg.list rast select=name,vtime_start
select name,vtime_start from raster_view where ctime > DATETIME('1950-01-01 10:00:00') order by name
test.1.1|1999-06-08 13:10:20
test.1.2|1999-06-09 13:10:20
Modified: grass-addons/raster/r.rast4d/bin/tg.update
===================================================================
--- grass-addons/raster/r.rast4d/bin/tg.update 2008-06-21 21:15:45 UTC (rev 31791)
+++ grass-addons/raster/r.rast4d/bin/tg.update 2008-06-21 23:12:30 UTC (rev 31792)
@@ -22,6 +22,14 @@
#% required : yes
#% multiple: no
#%END
+#%option
+#% key: end_time
+#% type: string
+#% description: end time of raster map (start time is taken from raster map timestamp)
+#% answer: +10 years
+#% required : no
+#% multiple: no
+#%END
#Only run if started in GRASS
@@ -53,7 +61,7 @@
echo "processing map $i"
insert_raster_map $i
insert_raster_map_metadata $i
- insert_raster_map_time $i
+ insert_raster_map_time $i "$GIS_OPT_END_TIME"
done
exit 0
Modified: grass-addons/raster/r.rast4d/lib/insert_raster.sh
===================================================================
--- grass-addons/raster/r.rast4d/lib/insert_raster.sh 2008-06-21 21:15:45 UTC (rev 31791)
+++ grass-addons/raster/r.rast4d/lib/insert_raster.sh 2008-06-21 23:12:30 UTC (rev 31792)
@@ -153,6 +153,7 @@
insert_raster_map_time ()
{
MAPNAME=$1
+MY_VTIME_END="$2"
YEAR=`r.info $MAPNAME | grep Date: | awk '{print $9}'`
MONTH=`r.info $MAPNAME | grep Date: | awk '{print $6}'`
DAY=`r.info $MAPNAME | grep Date: | awk '{print $7}'`
@@ -171,7 +172,7 @@
# the sqlite3 time format is YYYY-MM-DD HH:MM:SS
parse_timestamp $DAY $MONTH $YEAR $TIME
VTIME_START=$GLOBAL_DATE_VAR
-VTIME_END="DATETIME('$VTIME_START', '+10 years')"
+VTIME_END="DATETIME('$VTIME_START', '$MY_VTIME_END')"
#echo $CTIME
#echo $MTIME
@@ -194,6 +195,8 @@
$GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET mtime=$MTIME WHERE name='$MAPNAME'"
$GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_start='$VTIME_START' WHERE name='$MAPNAME'"
$GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_end=$VTIME_END WHERE name='$MAPNAME'"
+ # difference in days
+ $GRAST4D_DBM $GRAST4D_DATABASE "UPDATE $GRASTER_TIME_TABLE_NAME SET vtime_duration=(strftime('%s',vtime_end) - (SELECT strftime('%s',vtime_start)))/86400.0"
fi
exit
}
More information about the grass-commit
mailing list