Sfoglia il codice sorgente

libpython: update to `raster_3d` (https://trac.osgeo.org/grass/ticket/2409)

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@63589 15284696-431f-4ddb-bdfa-cd5b030d7da7
Martin Landa 10 anni fa
parent
commit
1b765a369e

+ 2 - 2
lib/python/gunittest/case.py

@@ -672,7 +672,7 @@ class TestCase(unittest.TestCase):
                                           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 @@ class TestCase(unittest.TestCase):
             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

+ 1 - 1
lib/python/gunittest/testsuite/test_assertions_rast3d.py

@@ -29,7 +29,7 @@ class TestRaster3dMapAssertions(gunittest.TestCase):
     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):

+ 10 - 10
lib/python/pygrass/gis/__init__.py

@@ -15,11 +15,11 @@ libgis.G_gisinit('')
 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 @@ class Mapset(object):
     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

+ 3 - 3
lib/python/script/core.py

@@ -1088,7 +1088,7 @@ def list_strings(type, pattern=None, mapset=None, exclude=None, flag=''):
     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 @@ def list_pairs(type, pattern=None, mapset=None, exclude=None, flag=''):
     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 @@ def list_grouped(type, pattern=None, check_search_path=True, exclude=None,
     >>> 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

+ 1 - 1
lib/python/script/raster3d.py

@@ -33,7 +33,7 @@ def raster3d_info(map):
     >>> 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

+ 1 - 1
lib/python/temporal/abstract_map_dataset.py

@@ -46,7 +46,7 @@ class AbstractMapDataset(AbstractDataset):
     @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

+ 1 - 1
lib/python/temporal/extract.py

@@ -237,7 +237,7 @@ def extract_dataset(input, output, type, where, expression, base, nprocs=1,
                 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',

+ 2 - 2
lib/python/temporal/factory.py

@@ -26,7 +26,7 @@ from space_time_datasets import *
 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@mapset")
     """
@@ -38,7 +38,7 @@ def dataset_factory(type, id):
         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)

+ 2 - 2
lib/python/temporal/list_stds.py

@@ -33,8 +33,8 @@ def get_dataset_list(type, temporal_type, columns=None, where=None,
         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

+ 1 - 1
lib/python/temporal/mapcalc.py

@@ -331,7 +331,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
                 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()

+ 2 - 2
lib/python/temporal/open_stds.py

@@ -52,7 +52,7 @@ def open_old_stds(name, type, dbif=None):
 
     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 @@ def check_new_stds(name, type, dbif=None, overwrite=False):
 
     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)

+ 4 - 4
lib/python/temporal/register.py

@@ -35,7 +35,7 @@ def register_maps_in_space_time_dataset(
        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 @@ def register_maps_in_space_time_dataset(
         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 @@ def register_map_object_list(type,  map_list, output_stds,
     """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 @@ def register_map_object_list(type,  map_list, output_stds,
                 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()

+ 1 - 1
lib/python/temporal/space_time_datasets.py

@@ -418,7 +418,7 @@ class Raster3DDataset(AbstractMapDataset):
             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()
 

+ 2 - 2
lib/python/temporal/temporal_algebra.py

@@ -1063,7 +1063,7 @@ class TemporalAlgebraParser(object):
         """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 @@ class TemporalAlgebraParser(object):
                                 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':

+ 1 - 1
lib/python/temporal/temporal_raster3d_algebra.py

@@ -45,7 +45,7 @@ class TemporalRaster3DAlgebraParser(TemporalRasterBaseAlgebraParser):
         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

+ 1 - 1
lib/python/temporal/testsuite/unittests_temporal_raster3d_algebra.py

@@ -33,7 +33,7 @@ class TestTemporalRaster3dAlgebra(gunittest.TestCase):
         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):