[GRASS-SVN] r48291 - grass/trunk/temporal/t.info
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Sep 13 21:16:45 EDT 2011
Author: huhabla
Date: 2011-09-13 18:16:45 -0700 (Tue, 13 Sep 2011)
New Revision: 48291
Modified:
grass/trunk/temporal/t.info/t.info.py
Log:
Print info about all datasets in the temporal database
Modified: grass/trunk/temporal/t.info/t.info.py
===================================================================
--- grass/trunk/temporal/t.info/t.info.py 2011-09-14 01:12:42 UTC (rev 48290)
+++ grass/trunk/temporal/t.info/t.info.py 2011-09-14 01:16:45 UTC (rev 48291)
@@ -15,29 +15,33 @@
#############################################################################
#%module
-#% description: Remove a space-time dataset
+#% description: List informtion about space time and map datasets
#% keywords: spacetime dataset
#% keywords: remove
#%end
#%option
-#% key: name
+#% key: dataset
#% type: string
-#% description: Name of the new space-time dataset
+#% description: Name of an existing space time or map dataset
#% required: yes
#% multiple: no
#%end
+
#%option
#% key: type
#% type: string
-#% description: Type of the space time dataset, default is strds
+#% description: Type of the dataset, default is strds (space time raster dataset)
#% required: no
-#% options: strds
+#% options: strds, str3ds, stvds, raster, raster3d, vector
#% answer: strds
#%end
-import sys
-import os
+#%flag
+#% key: g
+#% description: Print information in shell style
+#%end
+
import grass.script as grass
############################################################################
@@ -45,9 +49,45 @@
def main():
# Get the options
- name = options["name"]
+ name = options["dataset"]
type = options["type"]
+ shellstyle = flags['g']
+ # Make sure the temporal database exists
+ grass.create_temporal_database()
+
+ #Get the current mapset to create the id of the space time dataset
+
+ if name.find("@") >= 0:
+ id = name
+ else:
+ mapset = grass.gisenv()["MAPSET"]
+ id = name + "@" + mapset
+
+ if type == "strds":
+ sp = grass.space_time_raster_dataset(id)
+ if type == "str3ds":
+ sp = grass.space_time_raster3d_dataset(id)
+ if type == "stvds":
+ sp = grass.space_time_vector_dataset(id)
+ if type == "raster":
+ sp = grass.raster_dataset(id)
+ if type == "raster3d":
+ sp = grass.raster3d_dataset(id)
+ if type == "vector":
+ sp = grass.vector_dataset(id)
+
+ if sp.is_in_db() == False:
+ grass.fatal("Dataset <" + name + "> not found in temporal database")
+
+ # Insert content from db
+ sp.select()
+
+ if shellstyle == True:
+ sp.print_shell_info()
+ else:
+ sp.print_info()
+
if __name__ == "__main__":
options, flags = grass.core.parser()
main()
More information about the grass-commit
mailing list