[GRASS-SVN] r48390 - in grass/trunk: lib/python lib/temporal
temporal/t.time.rel
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 20 18:33:57 EDT 2011
Author: huhabla
Date: 2011-09-20 15:33:57 -0700 (Tue, 20 Sep 2011)
New Revision: 48390
Modified:
grass/trunk/lib/python/tgis_abstract_datasets.py
grass/trunk/lib/python/tgis_space_time_datasets.py
grass/trunk/lib/python/tgis_temporal_extent.py
grass/trunk/lib/temporal/map_tables_template.sql
grass/trunk/lib/temporal/raster3d_metadata_table.sql
grass/trunk/lib/temporal/raster_metadata_table.sql
grass/trunk/lib/temporal/stds_map_register_table_template.sql
grass/trunk/lib/temporal/stds_tables_template.sql
grass/trunk/lib/temporal/str3ds_metadata_table.sql
grass/trunk/lib/temporal/strds_metadata_table.sql
grass/trunk/lib/temporal/stvds_metadata_table.sql
grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql
grass/trunk/lib/temporal/vector_metadata_table.sql
grass/trunk/temporal/t.time.rel/t.time.rel.py
grass/trunk/temporal/t.time.rel/test.t.time.rel.sh
Log:
Implemented the use of start and end time in absolute and relative time representation.
Modified: grass/trunk/lib/python/tgis_abstract_datasets.py
===================================================================
--- grass/trunk/lib/python/tgis_abstract_datasets.py 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/python/tgis_abstract_datasets.py 2011-09-20 22:33:57 UTC (rev 48390)
@@ -54,9 +54,13 @@
return (start, end, tz)
def get_relative_time(self):
- """Returns the relative time interval or None if not present"""
- return self.relative_time.get_interval()
+ """Returns the relative time interval (start_time, end_time) or None if not present"""
+ start = self.relative_time.get_start_time()
+ end = self.relative_time.get_end_time()
+
+ return (start, end)
+
def get_temporal_type(self):
"""Return the temporal type of this dataset"""
return self.base.get_ttype()
@@ -197,7 +201,7 @@
if self.is_time_absolute() and map.is_time_absolute():
return self.absolute_time.temporal_relation(map.absolute_time)
if self.is_time_relative() and map.is_time_relative():
- return self.relative_time.temporal_relation(map.absolute_time)
+ return self.relative_time.temporal_relation(map.relative_time)
return None
###############################################################################
@@ -227,12 +231,25 @@
@timezone Thee timezone of the map
"""
+ if start_time != None and not isinstance(start_time, datetime) :
+ core.fatal(_("Start time must be of type datetime"))
+
+ if end_time != None and not isinstance(end_time, datetime) :
+ core.fatal(_("End time must be of type datetime"))
+
+ if start_time != None and end_time != None:
+ if start_time >= end_time:
+ core.error(_("End time must be later than start time"))
+ return False
+
self.base.set_ttype("absolute")
self.absolute_time.set_start_time(start_time)
self.absolute_time.set_end_time(end_time)
self.absolute_time.set_timezone(timezone)
+ return True
+
def update_absolute_time(self, start_time, end_time=None, timezone=None, dbif = None):
"""Update the absolute time
@@ -254,17 +271,29 @@
if connect == True:
dbif.close()
- def set_relative_time(self, interval):
+ def set_relative_time(self, start_time, end_time=None):
"""Set the relative time interval
- @interval A double value in days
-
+ @start_time A double value in days
+ @end_time A double value in days
+
"""
+ if start_time != None and end_time != None:
+ if abs(float(start_time)) >= abs(float(end_time)):
+ core.error(_("End time must be greater than start time"))
+ return False
+
self.base.set_ttype("relative")
- self.relative_time.set_interval(interval)
+ self.relative_time.set_start_time(float(start_time))
+ if end_time != None:
+ self.relative_time.set_end_time(float(end_time))
+ else:
+ self.relative_time.set_end_time(None)
- def update_relative_time(self, interval, dbif = None):
+ return True
+
+ def update_relative_time(self, start_time, end_time=None, dbif = None):
"""Set the relative time interval
@interval A double value in days
@@ -277,7 +306,7 @@
dbif.connect()
connect = True
- self.set_relative_time(interval)
+ self.set_relative_time(start_time, end_time)
self.relative_time.update(dbif)
self.base.update(dbif)
Modified: grass/trunk/lib/python/tgis_space_time_datasets.py
===================================================================
--- grass/trunk/lib/python/tgis_space_time_datasets.py 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/python/tgis_space_time_datasets.py 2011-09-20 22:33:57 UTC (rev 48390)
@@ -406,6 +406,8 @@
if type == "vector":
sp = space_time_vector_dataset(id)
+ connect = False
+
if dbif == None:
dbif = sql_database_interface()
dbif.connect()
@@ -554,7 +556,7 @@
@type The type of the maps raster, raster3d or vector
@maps A comma separated list of map names
@start The start date and time of the first raster map (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
- @start The end date and time of the first raster map (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
+ @end The end date and time of the first raster map (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
@increment Time increment between maps for time stamp creation (format absolute: NNN seconds, minutes, hours, days, weeks, months, years; format relative: 1.0)
"""
@@ -633,7 +635,8 @@
@ttype The temporal type which should be assigned and which the time format is of
@map A map dataset object derived from abstract_map_dataset
- @start The start date and time of the first raster map, in case the map has no date (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
+ @start The start date and time of the first raster map (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
+ @end The end date and time of the first raster map (format absolute: "yyyy-mm-dd HH:MM:SS" or "yyyy-mm-dd", format relative 5.0)
@increment Time increment between maps for time stamp creation (format absolute: NNN seconds, minutes, hours, days, weeks, months, years; format relative: 1.0)
@multi A multiplier for the increment
"""
@@ -663,15 +666,22 @@
start_time = increment_datetime_by_string(start_time, increment, mult)
end_time = increment_datetime_by_string(start_time, increment, 1)
- core.verbose("Set absolute valid time for map <" + map.get_id() + "> to " + str(start_time) + " - " + str(end_time))
+ core.verbose(_("Set absolute valid time for map <%s> to %s - %s") % (map.get_id(), str(start_time), str(end_time)))
map.update_absolute_time(start_time, end_time, None, dbif)
else:
- if increment:
- interval = float(start) + mult * float(increment)
+ start_time = float(start)
+
+ if end:
+ end_time = float(end)
else:
- interval = float(start)
- core.verbose("Set relative valid time for map <" + map.get_id() + "> to " + str(interval))
- map.update_relative_time(interval, dbif)
+ end_time = None
+ if increment:
+ start_time = start_time + mult * float(increment)
+ end_time = start_time + float(increment)
+
+ core.verbose(_("Set relative valid time for map <%s> to %f - %s") % (map.get_id(), start_time, str(end_time)))
+ map.update_relative_time(start_time, end_time, dbif)
+
if connect == True:
dbif.close()
Modified: grass/trunk/lib/python/tgis_temporal_extent.py
===================================================================
--- grass/trunk/lib/python/tgis_temporal_extent.py 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/python/tgis_temporal_extent.py 2011-09-20 22:33:57 UTC (rev 48390)
@@ -24,16 +24,15 @@
###############################################################################
-class absolute_temporal_extent(sql_database_interface):
- """This is the absolute time base class for all maps and spacetime datasets"""
- def __init__(self, table=None, ident=None, start_time=None, end_time=None, timezone=None):
+class abstract_temporal_extent(sql_database_interface):
+ """This is the abstract time base class for relative and absolute time objects"""
+ def __init__(self, table=None, ident=None, start_time=None, end_time=None):
sql_database_interface.__init__(self, table, ident)
self.set_id(ident)
self.set_start_time(start_time)
self.set_end_time(end_time)
- self.set_timezone(timezone)
def starts(self, map):
"""Return True if this absolute time object starts at the start of the provided absolute time object and finishes within it
@@ -219,17 +218,13 @@
self.D["id"] = ident
def set_start_time(self, start_time):
- """Set the valid start time of the map, this should be of type datetime"""
+ """Set the valid start time of the map"""
self.D["start_time"] = start_time
def set_end_time(self, end_time):
- """Set the valid end time of the map, this should be of type datetime"""
+ """Set the valid end time of the map"""
self.D["end_time"] = end_time
- def set_timezone(self, timezone):
- """Set the timezone of the map, integer from 1 - 24"""
- self.D["timezone"] = timezone
-
def get_id(self):
"""Convenient method to get the unique identifier (primary key)
@return None if not found
@@ -255,6 +250,34 @@
else:
return None
+ def print_info(self):
+ """Print information about this class in human readable style"""
+ # 0123456789012345678901234567890
+ print " | Start time:................. " + str(self.get_start_time())
+ print " | End time:................... " + str(self.get_end_time())
+
+ def print_shell_info(self):
+ """Print information about this class in shell style"""
+ print "start_time=" + str(self.get_start_time())
+ print "end_time=" + str(self.get_end_time())
+
+###############################################################################
+
+class absolute_temporal_extent(abstract_temporal_extent):
+ """This is the absolute time class for all maps and spacetime datasets
+
+ start_time and end_time must be of type datetime
+ """
+ def __init__(self, table=None, ident=None, start_time=None, end_time=None, timezone=None):
+
+ abstract_temporal_extent.__init__(self, table, ident, start_time, end_time)
+
+ self.set_timezone(timezone)
+
+ def set_timezone(self, timezone):
+ """Set the timezone of the map, integer from 1 - 24"""
+ self.D["timezone"] = timezone
+
def get_timezone(self):
"""Get the timezone of the map
@return None if not found"""
@@ -267,14 +290,12 @@
"""Print information about this class in human readable style"""
# 0123456789012345678901234567890
print " +-------------------- Absolute time -----------------------------------------+"
- print " | Start time:................. " + str(self.get_start_time())
- print " | End time:................... " + str(self.get_end_time())
+ abstract_temporal_extent.print_info(self)
print " | Timezone:................... " + str(self.get_timezone())
def print_shell_info(self):
"""Print information about this class in shell style"""
- print "start_time=" + str(self.get_start_time())
- print "end_time=" + str(self.get_end_time())
+ abstract_temporal_extent.print_shell_info(self)
print "timezone=" + str(self.get_timezone())
###############################################################################
@@ -338,113 +359,43 @@
###############################################################################
-class relative_temporal_extent(sql_database_interface):
- """This is the relative time base class for all maps and spacetime datasets"""
- def __init__(self, table=None, ident=None, interval=None):
- sql_database_interface.__init__(self, table, ident)
+class relative_temporal_extent(abstract_temporal_extent):
+ """This is the relative time class for all maps and spacetime datasets
- self.set_id(ident)
- self.set_interval(interval)
+ start_time and end_time must be of type datetime
+ """
+ def __init__(self, table=None, ident=None, start_time=None, end_time=None):
- def after(self, map):
- """Return True if this relative time object is temporal located after the provided relative time object
- A |
- B |
- """
- if self.D["interval"] > map.D["interval"]:
- return True
- else:
- return False
+ abstract_temporal_extent.__init__(self, table, ident, start_time, end_time)
- def before(self, map):
- """Return True if this relative time object is temporal located bevor the provided relative time object
- A |
- B |
- """
- if self.D["interval"] < map.D["interval"]:
- return True
- else:
- return False
-
- def equivalent(self, map):
- """Return True if this relative time object is equivalent to the provided relative time object
- A |
- B |
- """
- if self.D["interval"] == map.D["interval"]:
- return True
- else:
- return False
-
- def temporal_relation(self, map):
- """Returns the temporal relation between relative time temporal objects
- """
- if self.equivalent(map):
- return "equivalent"
- if self.after(map):
- return "after"
- if self.before(map):
- return "before"
- return None
-
- def set_id(self, ident):
- """Convenient method to set the unique identifier (primary key)"""
- self.ident = ident
- self.D["id"] = ident
-
- def set_interval(self, interval):
- """Set the valid interval time of the map, this should be of type datetime"""
- self.D["interval"] = interval
-
- def get_id(self):
- """Convenient method to get the unique identifier (primary key)
- @return None if not found
- """
- if self.D.has_key("id"):
- return self.D["id"]
- else:
- return None
-
- def get_interval(self):
- """Get the valid interval time of the map
- @return None if not found"""
- if self.D.has_key("interval"):
- return self.D["interval"]
- else:
- return None
-
def print_info(self):
"""Print information about this class in human readable style"""
# 0123456789012345678901234567890
- print " +-------------------- Relative time -----------------------------------------+"
- print " | Interval:................... " + str(self.get_interval())
+ print " +-------------------- Reltive time ------------------------------------------+"
+ abstract_temporal_extent.print_info(self)
- def print_shell_info(self):
- """Print information about this class in shell style"""
- print "interval=" + str(self.get_interval())
-
###############################################################################
class raster_relative_time(relative_temporal_extent):
- def __init__(self, ident=None, interval=None):
- relative_temporal_extent.__init__(self, "raster_relative_time", ident, interval)
+ def __init__(self, ident=None, start_time=None, end_time=None):
+ relative_temporal_extent.__init__(self, "raster_relative_time", ident, start_time, end_time)
class raster3d_relative_time(relative_temporal_extent):
- def __init__(self, ident=None, interval=None):
- relative_temporal_extent.__init__(self, "raster3d_relative_time", ident, interval)
+ def __init__(self, ident=None, start_time=None, end_time=None):
+ relative_temporal_extent.__init__(self, "raster3d_relative_time", ident, start_time, end_time)
class vector_relative_time(relative_temporal_extent):
- def __init__(self, ident=None, interval=None):
- relative_temporal_extent.__init__(self, "vector_relative_time", ident, interval)
+ def __init__(self, ident=None, start_time=None, end_time=None):
+ relative_temporal_extent.__init__(self, "vector_relative_time", ident, start_time, end_time)
###############################################################################
class stds_relative_time(relative_temporal_extent):
- def __init__(self, table=None, ident=None, interval=None, granularity=None):
- relative_temporal_extent.__init__(self, table, ident, interval)
+ def __init__(self, table=None, ident=None, start_time=None, end_time=None, granularity=None):
+ relative_temporal_extent.__init__(self, table, ident, start_time, end_time)
self.set_granularity(granularity)
@@ -474,14 +425,14 @@
###############################################################################
class strds_relative_time(stds_relative_time):
- def __init__(self, ident=None, interval=None, granularity=None):
- stds_relative_time.__init__(self, "strds_relative_time", ident, interval, granularity)
+ def __init__(self, ident=None, start_time=None, end_time=None, granularity=None):
+ stds_relative_time.__init__(self, "strds_relative_time", ident, start_time, end_time, granularity)
class str3ds_relative_time(stds_relative_time):
- def __init__(self, ident=None, interval=None, granularity=None):
- stds_relative_time.__init__(self, "str3ds_relative_time", ident, interval, granularity)
+ def __init__(self, ident=None, start_time=None, end_time=None, granularity=None):
+ stds_relative_time.__init__(self, "str3ds_relative_time", ident, start_time, end_time, granularity)
class stvds_relative_time(stds_relative_time):
- def __init__(self, ident=None, interval=None, granularity=None):
- stds_relative_time.__init__(self, "stvds_relative_time", ident, interval, granularity)
+ def __init__(self, ident=None, start_time=None, end_time=None, granularity=None):
+ stds_relative_time.__init__(self, "stvds_relative_time", ident, start_time, end_time, granularity)
Modified: grass/trunk/lib/temporal/map_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/map_tables_template.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/map_tables_template.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -26,18 +26,20 @@
PRIMARY KEY (id)
);
+-- Relative valid time interval with start and end time
CREATE TABLE GRASS_MAP_relative_time (
- id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
- interval DOUBLE PRECISION, -- The relative time interval in [days], this interval starts always from 0 or the event befor this event
+ id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
+ start_time DOUBLE PRECISION, -- The relative valid start time in [days]
+ end_time DOUBLE PRECISION, -- The relative valid end time in [days]
PRIMARY KEY (id),
FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
);
CREATE TABLE GRASS_MAP_absolute_time (
- id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
- start_time TIMESTAMP, -- Start of the valid time, can be NULL if no time information is available
- end_time TIMESTAMP, -- End of the valid time, can be NULL if no time information is available or valid time is a single point in time
- timezone SMALLINT, -- The timezone of the valid time
+ id VARCHAR NOT NULL, -- The id (PFK) is the unique identifier for all tables, it is based on name and mapset (name at mapset) and is used as primary foreign key
+ start_time TIMESTAMP, -- Start of the valid time, can be NULL if no time information is available
+ end_time TIMESTAMP, -- End of the valid time, can be NULL if no time information is available or valid time is a single point in time
+ timezone SMALLINT, -- The timezone of the valid time
PRIMARY KEY (id),
FOREIGN KEY (id) REFERENCES GRASS_MAP_base (id) ON DELETE CASCADE
);
Modified: grass/trunk/lib/temporal/raster3d_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/raster3d_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/raster3d_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -33,8 +33,8 @@
A1.id, A1.mapset,
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
- A1.revision, A1.creator,
- A2.start_time, A2.end_time,
+ A1.revision, A1.creator,
+ A2.start_time, A2.end_time, A2.timezone,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.datatype, A4.cols, A4.rows, A4.depths,
A4.nsres, A4.ewres, A4.tbres,
@@ -49,8 +49,8 @@
A1.id, A1.mapset,
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
- A1.revision, A1.creator,
- A2.interval,
+ A1.revision, A1.creator,
+ A2.start_time, A2.end_time,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.datatype, A4.cols, A4.rows, A4.depths,
A4.nsres, A4.ewres, A4.tbres,
Modified: grass/trunk/lib/temporal/raster_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/raster_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/raster_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -32,7 +32,7 @@
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
A1.revision, A1.creator,
- A2.start_time, A2.end_time,
+ A2.start_time, A2.end_time, A2.timezone,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.datatype, A4.cols, A4.rows,
A4.nsres, A4.ewres, A4.min, A4.max,
@@ -46,8 +46,8 @@
A1.id, A1.mapset,
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
- A1.revision, A1.creator,
- A2.interval,
+ A1.revision, A1.creator,
+ A2.start_time, A2.end_time,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.datatype, A4.cols, A4.rows,
A4.nsres, A4.ewres, A4.min, A4.max,
Modified: grass/trunk/lib/temporal/stds_map_register_table_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_map_register_table_template.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/stds_map_register_table_template.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -40,10 +40,14 @@
-- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-- ) WHERE id = "SPACETIME_ID";
--- UPDATE STDS_relative_time SET interval =
--- (SELECT max(interval) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
--- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
+-- UPDATE STDS_relative_time SET start_time =
+-- (SELECT min(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
+-- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
-- ) WHERE id = "SPACETIME_ID";
+-- UPDATE STDS_relative_time SET end_time =
+-- (SELECT max(end_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
+-- (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
+-- ) WHERE id = "SPACETIME_ID";
-- -- Update the spatial extent
-- UPDATE STDS_spatial_extent SET north =
-- (SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
Modified: grass/trunk/lib/temporal/stds_tables_template.sql
===================================================================
--- grass/trunk/lib/temporal/stds_tables_template.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/stds_tables_template.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -24,7 +24,8 @@
CREATE TABLE STDS_relative_time (
id VARCHAR NOT NULL, -- Id of the space-time dataset, this is the primary foreign key
- interval DOUBLE, -- The relative time interval in [days], this interval starts always at 0 days
+ start_time DOUBLE PRECISION, -- The relative valid start time in [days]
+ end_time DOUBLE PRECISION, -- The relative valid end time in [days]
granularity DOUBLE, -- The granularity in [days]
PRIMARY KEY (id),
FOREIGN KEY (id) REFERENCES STDS_base (id) ON DELETE CASCADE
Modified: grass/trunk/lib/temporal/str3ds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/str3ds_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/str3ds_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -32,8 +32,8 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision, A2.start_time,
- A2.end_time, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.timezone, A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.raster3d_register,
A4.number_of_maps,
@@ -51,8 +51,8 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision,
- A2.interval, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.raster3d_register,
A4.number_of_maps,
Modified: grass/trunk/lib/temporal/strds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/strds_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/strds_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -30,8 +30,8 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision, A2.start_time,
- A2.end_time, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.timezone, A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.raster_register,
A4.number_of_maps,
@@ -48,8 +48,8 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision,
- A2.interval, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.raster_register,
A4.number_of_maps,
Modified: grass/trunk/lib/temporal/stvds_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/stvds_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/stvds_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -22,8 +22,9 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision, A2.start_time,
- A2.end_time, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.timezone,
+ A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.vector_register,
A4.number_of_maps,
@@ -36,8 +37,8 @@
A1.id, A1.name, A1.mapset, A1.temporal_type,
A1.creator, A1.semantic_type,
A1.creation_time, A1.modification_time,
- A1.revision,
- A2.interval, A2.granularity,
+ A1.revision,
+ A2.start_time, A2.end_time, A2.granularity,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.vector_register,
A4.number_of_maps,
Modified: grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql
===================================================================
--- grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/update_stds_spatial_temporal_extent_template.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -27,10 +27,14 @@
(SELECT max(end_time) FROM GRASS_MAP_absolute_time WHERE GRASS_MAP_absolute_time.id IN
(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
) WHERE id = "SPACETIME_ID";
-UPDATE STDS_relative_time SET interval =
- (SELECT max(interval) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
+UPDATE STDS_relative_time SET start_time =
+ (SELECT min(start_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
(SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
) WHERE id = "SPACETIME_ID";
+UPDATE STDS_relative_time SET end_time =
+ (SELECT max(end_time) FROM GRASS_MAP_relative_time WHERE GRASS_MAP_relative_time.id IN
+ (SELECT id FROM SPACETIME_NAME_GRASS_MAP_register)
+ ) WHERE id = "SPACETIME_ID";
-- Update the spatial extent
UPDATE STDS_spatial_extent SET north =
(SELECT max(north) FROM GRASS_MAP_spatial_extent WHERE GRASS_MAP_spatial_extent.id IN
Modified: grass/trunk/lib/temporal/vector_metadata_table.sql
===================================================================
--- grass/trunk/lib/temporal/vector_metadata_table.sql 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/lib/temporal/vector_metadata_table.sql 2011-09-20 22:33:57 UTC (rev 48390)
@@ -22,8 +22,8 @@
A1.id, A1.mapset,
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
- A1.revision, A1.creator,
- A2.start_time, A2.end_time,
+ A1.revision, A1.creator,
+ A2.start_time, A2.end_time, A2.timezone,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.stvds_register
FROM vector_base A1, vector_absolute_time A2,
@@ -34,8 +34,8 @@
A1.id, A1.mapset,
A1.name, A1.temporal_type,
A1.creation_time, A1.modification_time,
- A1.revision, A1.creator,
- A2.interval,
+ A1.revision, A1.creator,
+ A2.start_time, A2.end_time,
A3.north, A3.south, A3.east, A3.west, A3.proj,
A4.stvds_register
FROM vector_base A1, vector_relative_time A2,
Modified: grass/trunk/temporal/t.time.rel/t.time.rel.py
===================================================================
--- grass/trunk/temporal/t.time.rel/t.time.rel.py 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/temporal/t.time.rel/t.time.rel.py 2011-09-20 22:33:57 UTC (rev 48390)
@@ -34,7 +34,15 @@
#%option
#% key: start
#% type: double
-#% description: The valid time value in [days]
+#% description: The valid start time value in [days]
+#% required: yes
+#% multiple: no
+#%end
+
+#%option
+#% key: end
+#% type: double
+#% description: The valid end time value in [days]
#% required: no
#% multiple: no
#%end
@@ -56,13 +64,14 @@
# Get the options
maps = options["maps"]
start = options["start"]
+ end = options["end"]
increment = options["increment"]
# Make sure the temporal database exists
grass.create_temporal_database()
# Set valid relative time to maps
grass.assign_valid_time_to_maps(type="raster", maps=maps, ttype="relative", \
- start=start, end=None, increment=increment, dbif=None)
+ start=start, end=end, increment=increment, dbif=None)
if __name__ == "__main__":
options, flags = grass.core.parser()
Modified: grass/trunk/temporal/t.time.rel/test.t.time.rel.sh
===================================================================
--- grass/trunk/temporal/t.time.rel/test.t.time.rel.sh 2011-09-20 21:58:22 UTC (rev 48389)
+++ grass/trunk/temporal/t.time.rel/test.t.time.rel.sh 2011-09-20 22:33:57 UTC (rev 48390)
@@ -29,7 +29,7 @@
t.time.rel --v maps=prec_1,prec_2,prec_3 start=0 increment=1000
t.info type=strds dataset=precip_rel1
-t.time.rel --v maps=prec_4,prec_5 start=5000
+t.time.rel --v maps=prec_4,prec_5 start=5000 end=6000
t.info type=raster dataset=prec_4
t.info type=raster dataset=prec_5
t.time.rel --v maps=prec_6 start=6000
More information about the grass-commit
mailing list