[GRASS-SVN] r63589 - in grass/trunk/lib/python: gunittest gunittest/testsuite pygrass/gis script temporal temporal/testsuite

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Dec 18 07:43:47 PST 2014


Author: martinl
Date: 2014-12-18 07:43:47 -0800 (Thu, 18 Dec 2014)
New Revision: 63589

Modified:
   grass/trunk/lib/python/gunittest/case.py
   grass/trunk/lib/python/gunittest/testsuite/test_assertions_rast3d.py
   grass/trunk/lib/python/pygrass/gis/__init__.py
   grass/trunk/lib/python/script/core.py
   grass/trunk/lib/python/script/raster3d.py
   grass/trunk/lib/python/temporal/abstract_map_dataset.py
   grass/trunk/lib/python/temporal/extract.py
   grass/trunk/lib/python/temporal/factory.py
   grass/trunk/lib/python/temporal/list_stds.py
   grass/trunk/lib/python/temporal/mapcalc.py
   grass/trunk/lib/python/temporal/open_stds.py
   grass/trunk/lib/python/temporal/register.py
   grass/trunk/lib/python/temporal/space_time_datasets.py
   grass/trunk/lib/python/temporal/temporal_algebra.py
   grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py
   grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py
Log:
libpython: update to `raster_3d` (#2409)


Modified: grass/trunk/lib/python/gunittest/case.py
===================================================================
--- grass/trunk/lib/python/gunittest/case.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/gunittest/case.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -672,7 +672,7 @@
                                           sep='=', precision=precision,
                                           reference=statistics, msg=msg)
             finally:
-                call_module('g.remove', flags='f', type='3draster', name=diff)
+                call_module('g.remove', flags='f', type='raster_3d', name=diff)
         else:
             # general case
             # TODO: we are using r.info min max and r.univar min max interchangably
@@ -698,7 +698,7 @@
             self.assertRaster3dFitsUnivar(raster=diff, reference=statistics,
                                           precision=precision, msg=msg)
         finally:
-            call_module('g.remove', flags='f', type='3draster', name=diff)
+            call_module('g.remove', flags='f', type='raster_3d', name=diff)
 
     # TODO: this works only in 2D
     # TODO: write tests

Modified: grass/trunk/lib/python/gunittest/testsuite/test_assertions_rast3d.py
===================================================================
--- grass/trunk/lib/python/gunittest/testsuite/test_assertions_rast3d.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/gunittest/testsuite/test_assertions_rast3d.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -29,7 +29,7 @@
     def tearDownClass(cls):
         cls.del_temp_region()
         # TODO: input as list does not work, why?
-        cls.runModule('g.remove', flags='f', type='3draster',
+        cls.runModule('g.remove', flags='f', type='raster_3d',
                       name=','.join([cls.constant_map, cls.rcd_increasing_map]))
 
     def test_assertRaster3dFitsUnivar(self):

Modified: grass/trunk/lib/python/pygrass/gis/__init__.py
===================================================================
--- grass/trunk/lib/python/pygrass/gis/__init__.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/pygrass/gis/__init__.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -15,11 +15,11 @@
 from grass.pygrass.errors import GrassError
 
 
-ETYPE = {'rast': libgis.G_ELEMENT_RASTER,
-         '3draster': libgis.G_ELEMENT_RASTER3D,
-         'vect': libgis.G_ELEMENT_VECTOR,
-         'oldvect': libgis.G_ELEMENT_OLDVECTOR,
-         'asciivect': libgis.G_ELEMENT_ASCIIVECTOR,
+ETYPE = {'raster': libgis.G_ELEMENT_RASTER,
+         'raster_3d': libgis.G_ELEMENT_RASTER3D,
+         'vector': libgis.G_ELEMENT_VECTOR,
+         'oldvector': libgis.G_ELEMENT_OLDVECTOR,
+         'asciivector': libgis.G_ELEMENT_ASCIIVECTOR,
          'icon': libgis.G_ELEMENT_ICON,
          'labels': libgis.G_ELEMENT_LABEL,
          'sites': libgis.G_ELEMENT_SITE,
@@ -309,17 +309,17 @@
     def glist(self, type, pattern=None):
         """Return a list of grass types like:
 
-            * 'asciivect',
+            * 'asciivector',
             * 'group',
             * 'icon',
             * 'labels',
-            * 'oldvect',
-            * 'rast',
-            * '3draster',
+            * 'oldvector',
+            * 'raster',
+            * 'raster_3d',
             * 'region',
             * 'region3d',
             * 'sites',
-            * 'vect',
+            * 'vector',
             * 'view3d'
 
         :param type: the type of element to query

Modified: grass/trunk/lib/python/script/core.py
===================================================================
--- grass/trunk/lib/python/script/core.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/script/core.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -1088,7 +1088,7 @@
     Returns the output from running g.list, as a list of qualified
     names.
 
-    :param str type: element type (rast, vect, 3draster, region, ...)
+    :param str type: element type (raster, vector, raster_3d, region, ...)
     :param str pattern: pattern string
     :param str mapset: mapset name (if not given use search path)
     :param str exclude: pattern string to exclude maps from the research
@@ -1119,7 +1119,7 @@
     Returns the output from running g.list, as a list of
     (name, mapset) pairs
 
-    :param str type: element type (rast, vect, 3draster, region, ...)
+    :param str type: element type (raster, vector, raster_3d, region, ...)
     :param str pattern: pattern string
     :param str mapset: mapset name (if not given use search path)
     :param str exclude: pattern string to exclude maps from the research
@@ -1144,7 +1144,7 @@
     >>> list_grouped('vect', pattern='*roads*')['PERMANENT']
     ['railroads', 'roadsmajor']
 
-    :param str type: element type (rast, vect, 3draster, region, ...) or list of elements
+    :param str type: element type (raster, vector, raster_3d, region, ...) or list of elements
     :param str pattern: pattern string
     :param str check_search_path: True to add mapsets for the search path
                                   with no found elements

Modified: grass/trunk/lib/python/script/raster3d.py
===================================================================
--- grass/trunk/lib/python/script/raster3d.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/script/raster3d.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -33,7 +33,7 @@
     >>> mapcalc3d('volume = row() + col() + depth()')
     >>> raster3d_info('volume') # doctest: +ELLIPSIS
     {'vertical_units': '"units"', 'tbres': 1.0, ... 'south': 185000.0}
-    >>> run_command('g.remove', flags='f', type='3draster', name='volume')
+    >>> run_command('g.remove', flags='f', type='raster_3d', name='volume')
     0
 
     :param str map: map name

Modified: grass/trunk/lib/python/temporal/abstract_map_dataset.py
===================================================================
--- grass/trunk/lib/python/temporal/abstract_map_dataset.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/abstract_map_dataset.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -46,7 +46,7 @@
     @abstractmethod
     def get_new_stds_instance(self, ident):
         """Return a new space time dataset instance that store maps with the
-           type of this map object (rast, 3draster or vect)
+           type of this map object (raster, raster_3d or vector)
 
            :param ident The identifier of the space time dataset
            :return: The new space time dataset instance

Modified: grass/trunk/lib/python/temporal/extract.py
===================================================================
--- grass/trunk/lib/python/temporal/extract.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/extract.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -237,7 +237,7 @@
                 gscript.run_command("g.remove", flags='f', type='raster',
                                     name=names, quiet=True)
             elif type == "raster3d":
-                gscript.run_command("g.remove", flags='f', type='3draster',
+                gscript.run_command("g.remove", flags='f', type='raster_3d',
                                     name=names, quiet=True)
             elif type == "vector":
                 gscript.run_command("g.remove", flags='f', type='vector',

Modified: grass/trunk/lib/python/temporal/factory.py
===================================================================
--- grass/trunk/lib/python/temporal/factory.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/factory.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -26,7 +26,7 @@
 def dataset_factory(type, id):
     """A factory functions to create space time or map datasets
 
-       :param type: the dataset type: rast or raster; rast3d, raster3d or 3draster;
+       :param type: the dataset type: rast or raster; rast3d, raster3d or raster_3d;
                     vect or vector; strds; str3ds; stvds
        :param id: The id of the dataset ("name at mapset")
     """
@@ -38,7 +38,7 @@
         sp = SpaceTimeVectorDataset(id)
     elif type == "rast" or type == "raster":
         sp = RasterDataset(id)
-    elif type == "3draster" or type == "rast3d" or type == "raster3d":
+    elif type == "raster_3d" or type == "rast3d" or type == "raster3d":
         sp = Raster3DDataset(id)
     elif type == "vect" or type == "vector":
         sp = VectorDataset(id)

Modified: grass/trunk/lib/python/temporal/list_stds.py
===================================================================
--- grass/trunk/lib/python/temporal/list_stds.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/list_stds.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -33,8 +33,8 @@
         This method returns a dictionary, the keys are the available mapsets,
         the values are the rows from the SQL database query.
 
-        :param type: The type of the datasets (strds, str3ds, stvds, rast,
-                     3draster, vect)
+        :param type: The type of the datasets (strds, str3ds, stvds, raster,
+                     raster_3d, vector)
         :param temporal_type: The temporal type of the datasets (absolute,
                               relative)
         :param columns: A comma separated list of columns that will be selected

Modified: grass/trunk/lib/python/temporal/mapcalc.py
===================================================================
--- grass/trunk/lib/python/temporal/mapcalc.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/mapcalc.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -331,7 +331,7 @@
                 gscript.run_command("g.remove", flags='f', type='raster',
                                     name=names, quiet=True)
             elif type == "raster3d":
-                gscript.run_command("g.remove", flags='f', type='3draster',
+                gscript.run_command("g.remove", flags='f', type='raster_3d',
                                     name=names, quiet=True)
 
     dbif.close()

Modified: grass/trunk/lib/python/temporal/open_stds.py
===================================================================
--- grass/trunk/lib/python/temporal/open_stds.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/open_stds.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -52,7 +52,7 @@
 
     if type == "strds" or type == "rast" or type == "raster":
         sp = dataset_factory("strds", id)
-    elif type == "str3ds" or type == "raster3d" or type == "rast3d" or type == "3draster":
+    elif type == "str3ds" or type == "raster3d" or type == "rast3d" or type == "raster_3d":
         sp = dataset_factory("str3ds", id)
     elif type == "stvds" or type == "vect" or type == "vector":
         sp = dataset_factory("stvds", id)
@@ -108,7 +108,7 @@
 
     if type == "strds" or type == "rast" or type == "raster":
         sp = dataset_factory("strds", id)
-    elif type == "str3ds" or type == "raster3d" or type == "rast3d "or type == "3draster":
+    elif type == "str3ds" or type == "raster3d" or type == "rast3d "or type == "raster_3d":
         sp = dataset_factory("str3ds", id)
     elif type == "stvds" or type == "vect" or type == "vector":
         sp = dataset_factory("stvds", id)

Modified: grass/trunk/lib/python/temporal/register.py
===================================================================
--- grass/trunk/lib/python/temporal/register.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/register.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -35,7 +35,7 @@
        It takes care of the correct update of the space time datasets from all
        registered maps.
 
-       :param type: The type of the maps raster, 3draster or vector
+       :param type: The type of the maps raster, raster_3d or vector
        :param name: The name of the space time dataset. Maps will be
                     registered in the temporal database if the name was set
                     to None
@@ -327,7 +327,7 @@
         for dataset in datatsets_to_modify:
             if type == "rast" or type == "raster":
                 ds = dataset_factory("strds", dataset)
-            elif type == "3draster" or type == "rast3d" or type == "raster3d":
+            elif type == "raster_3d" or type == "rast3d" or type == "raster3d":
                 ds = dataset_factory("str3ds", dataset)
             elif type == "vect" or type == "vector":
                 ds = dataset_factory("stvds", dataset)
@@ -434,7 +434,7 @@
     """Register a list of AbstractMapDataset objects in the temporal database
        and optional in a space time dataset.
 
-       :param type: The type of the map layer (raster, 3draster, vector)
+       :param type: The type of the map layer (raster, raster_3d, vector)
        :param map_list: List of AbstractMapDataset objects
        :param output_stds: The output stds
        :param delete_empty: Set True to delete empty map layer found in the map_list
@@ -491,7 +491,7 @@
                 if map.get_type() == "raster":
                     mod(type='raster', name=map.get_name())
                 if map.get_type() == "raster3d":
-                    mod(type='3draster', name=map.get_name())
+                    mod(type='raster_3d', name=map.get_name())
                 if map.get_type() == "vector":
                     mod(type='vector', name=map.get_name())
                 mod.run()

Modified: grass/trunk/lib/python/temporal/space_time_datasets.py
===================================================================
--- grass/trunk/lib/python/temporal/space_time_datasets.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/space_time_datasets.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -418,7 +418,7 @@
             True
             >>> r3map.is_time_relative()
             False
-            >>> grass.run_command("g.remove", flags="f", type="3draster", name=name, quiet=True)
+            >>> grass.run_command("g.remove", flags="f", type="raster_3d", name=name, quiet=True)
             0
             >>> grass.del_temp_region()
 

Modified: grass/trunk/lib/python/temporal/temporal_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_algebra.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/temporal_algebra.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -1063,7 +1063,7 @@
         """Remove maps of specific type
         
             :param namelist: List of map names to be removed
-            :param map_type: The type of the maps  (rast, 3draster or vect)
+            :param map_type: The type of the maps  (raster, raster_3d or vector)
         """
         max = 100
         chunklist = [namelist[i:i + max] for i in range(0, len(namelist), max)]
@@ -2065,7 +2065,7 @@
                                 process_queue.put(m)
                             elif map_i.get_type() == 'raster3d':
                                 m = copy.deepcopy(self.m_copy)
-                                m.inputs["3draster"].value = map_i.get_id(),  newident
+                                m.inputs["raster_3d"].value = map_i.get_id(),  newident
                                 m.flags["overwrite"].value = self.overwrite
                                 process_queue.put(m)
                             elif map_i.get_type() == 'vector':

Modified: grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/temporal_raster3d_algebra.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -45,7 +45,7 @@
         self.overwrite = overwrite
         self.count = 0
         self.stdstype = "str3ds"
-        self.maptype = "3draster"
+        self.maptype = "raster_3d"
         self.mapclass = Raster3DDataset
         self.basename = basename
         self.expression = expression

Modified: grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py
===================================================================
--- grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py	2014-12-18 15:35:41 UTC (rev 63588)
+++ grass/trunk/lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py	2014-12-18 15:43:47 UTC (rev 63589)
@@ -33,7 +33,7 @@
         tgis.open_new_stds(name="A", type="str3ds", temporaltype="absolute",
                                          title="A", descr="A", semantic="field", overwrite=True)
 
-        tgis.register_maps_in_space_time_dataset(type="3draster", name="A", maps="a1,a2,a3,a4",
+        tgis.register_maps_in_space_time_dataset(type="raster_3d", name="A", maps="a1,a2,a3,a4",
                                                  start="2001-01-01", increment="1 day", interval=True)
 
     def tearDown(self):



More information about the grass-commit mailing list