[GRASS-dev] what if: Anything series?

Ivan Shmakov ivan at theory.asu.ru
Sun Jan 13 11:18:44 EST 2008


>>>>> Markus Neteler <neteler at osgeo.org> writes:

 > Hi Ivan, thanks for you impressive suggestions!

	Thank you for reading it.  I hope I'd have the time to
	demonstrate these ideas in a working application.

 > I have right now added a tiny contribution from Soeren Gebbert with a
 > few bugfixes from me into GRASS Addons-SVN:

 > r.rast4d + tg.* - raster time series SQL support

	... May I suggest s/directoy/directory/ on QuickStart.txt?

	Take a look at the minor change for lib/insert_raster.sh as well
	(attached.)

 > This is a scripted approach to register time series of raster maps
 > into a SQLite database.  Comes in handy when dealing with thousands
 > of MODIS maps for example.

	While I have nothing against implementing time series this
	particular way, I doubt this approach will scale well to cover
	the other areas I had mentioned.

	In particular, I believe that the generic arrays storage
	facility is needed in GRASS for a long time.  At the very least,
	the ability to access arbitrary arrays in `r.mapcalc'
	expressions sounds quite appealing to me.

	Implementing this facility would effectively split the raster
	data set implementation into the generic ``raster'' (or
	``array'') part and the specific ``geospatial'', ``color
	mapping'', and ``who knows what'' ones.

-------------- next part --------------
--- lib/insert_raster.sh	2008-01-13 02:06:37.000000000 +0600
+++ lib/insert_raster.sh	2008-01-13 21:57:52.000000000 +0600
@@ -9,28 +9,19 @@
 #pasre the grass date format and convert it into sqlite date format
 parse_timestamp() #arguments are DAY MONTH YEAR TIME
 {
-DAY=$1
-MONTH=$2
-YEAR=$3
-TIME=$4
-
-# change the month to MM!!!! :/
-MONTH=`echo $MONTH | sed s/Jan/01/`
-MONTH=`echo $MONTH | sed s/Feb/02/`
-MONTH=`echo $MONTH | sed s/Mar/03/`
-MONTH=`echo $MONTH | sed s/Apr/04/`
-MONTH=`echo $MONTH | sed s/May/05/`
-MONTH=`echo $MONTH | sed s/Jun/06/`
-MONTH=`echo $MONTH | sed s/Jul/07/`
-MONTH=`echo $MONTH | sed s/Aug/08/`
-MONTH=`echo $MONTH | sed s/Sep/09/`
-MONTH=`echo $MONTH | sed s/Oct/10/`
-MONTH=`echo $MONTH | sed s/Nov/11/`
-MONTH=`echo $MONTH | sed s/Dec/12/`
-#change the day to DD
-if [ `expr $DAY \< 10` -eq 1 ] ; then
-DAY="0$DAY"
-fi
+    local DAY=$1 MONTH=$2 YEAR=$3 TIME=$4
+
+    # change the month to MM!!!! :/
+    MONTH=$(echo "$MONTH" \
+                | sed -e s/Jan/01/ -e s/Feb/02/ -e s/Mar/03/ \
+                      -e s/Apr/04/ -e s/May/05/ -e s/Jun/06/ \
+                      -e s/Jul/07/ -e s/Aug/08/ -e s/Sep/09/ \
+                      -e s/Oct/10/ -e s/Nov/11/ -e s/Dec/12/)
+
+    # change the day to DD
+    if [ $DAY -lt 10 ] ; then
+        DAY="0$DAY"
+    fi
 
 GLOBAL_DATE_VAR="$YEAR-$MONTH-$DAY $TIME"
 }


More information about the grass-dev mailing list