فهرست منبع

temporal framework: Changed the temporal framework code documentation from doxygen style to sphinx style

git-svn-id: https://svn.osgeo.org/grass/grass/trunk@62121 15284696-431f-4ddb-bdfa-cd5b030d7da7
Soeren Gebbert 10 سال پیش
والد
کامیت
7c5afd96a9
37فایلهای تغییر یافته به همراه5736 افزوده شده و 5863 حذف شده
  1. 1 1
      lib/python/docs/src/index.rst
  2. 110 67
      lib/python/docs/src/temporal_framework.rst
  3. 153 147
      lib/python/temporal/abstract_dataset.py
  4. 263 268
      lib/python/temporal/abstract_map_dataset.py
  5. 419 432
      lib/python/temporal/abstract_space_time_dataset.py
  6. 36 42
      lib/python/temporal/aggregation.py
  7. 255 264
      lib/python/temporal/base.py
  8. 113 117
      lib/python/temporal/c_libraries_interface.py
  9. 58 57
      lib/python/temporal/core.py
  10. 283 289
      lib/python/temporal/datetime_math.py
  11. 14 17
      lib/python/temporal/extract.py
  12. 10 14
      lib/python/temporal/factory.py
  13. 15 17
      lib/python/temporal/gui_support.py
  14. 52 51
      lib/python/temporal/list_stds.py
  15. 48 48
      lib/python/temporal/mapcalc.py
  16. 630 644
      lib/python/temporal/metadata.py
  17. 43 48
      lib/python/temporal/open_stds.py
  18. 34 39
      lib/python/temporal/register.py
  19. 17 22
      lib/python/temporal/sampling.py
  20. 402 406
      lib/python/temporal/space_time_datasets.py
  21. 589 613
      lib/python/temporal/spatial_extent.py
  22. 91 94
      lib/python/temporal/spatial_topology_dataset_connector.py
  23. 476 482
      lib/python/temporal/spatio_temporal_relationships.py
  24. 31 30
      lib/python/temporal/stds_export.py
  25. 32 35
      lib/python/temporal/stds_import.py
  26. 428 434
      lib/python/temporal/temporal_algebra.py
  27. 622 638
      lib/python/temporal/temporal_extent.py
  28. 212 218
      lib/python/temporal/temporal_granularity.py
  29. 3 4
      lib/python/temporal/temporal_raster3d_algebra.py
  30. 3 5
      lib/python/temporal/temporal_raster_algebra.py
  31. 52 54
      lib/python/temporal/temporal_raster_base_algebra.py
  32. 5 6
      lib/python/temporal/temporal_raster_operator.py
  33. 133 137
      lib/python/temporal/temporal_topology_dataset_connector.py
  34. 68 71
      lib/python/temporal/temporal_vector_algebra.py
  35. 7 8
      lib/python/temporal/temporal_vector_operator.py
  36. 3 15
      lib/python/temporal/unit_tests.py
  37. 25 29
      lib/python/temporal/univar_statistics.py

+ 1 - 1
lib/python/docs/src/index.rst

@@ -8,7 +8,7 @@ Contents:
 
    script
    pygrass_index
-   temporal
+   temporal_framework
    exceptions
    imaging
    gunittest_testing

+ 110 - 67
lib/python/docs/src/temporal_framework.rst

@@ -28,183 +28,217 @@ The temporal framework API consists of several dedicated modules. Each module co
 as well as function definition. The API can be roughly divided in a low level and high level part. However, several
 functions from the low level module are used in module implementation as well.
 
-
 Low level API
-*************
+^^^^^^^^^^^^^
+
+The low level API implements the core functionality of the temporal framework. Core functionality is
+for example the database interface, the temporal database creation and initialization,
+the SQL object serialization, all classes that represent table entries, datetime mathematics and many more.
 
-The low level API implements the core functionality on which the high level API is based on.
 
-**python::temporal::core**
+:mod:`~temporal.core`
+"""""""""""""""""""""
 
     The core functionality of the temporal framework:
 
-    - Initialization function :func:`init()`
+    - Initialization function :func:`~temporal.core.init()`
     - Definition of global variables
     - Several global functions to access TGIS specific variables
     - Interfaces to the TGIS C-library and PyGRASS messenger objects
-    - Database interface connection class :class:`~temporal.core.SQLDatabaseInterfaceConnection` to sqlite3 and postgresql
-      database backends
+    - Database interface connection class :class:`~temporal.core.SQLDatabaseInterfaceConnection` 
+      to sqlite3 and postgresql database backends
     - Functions to create the temporal database
 
-**python::temporal::base**
+:mod:`~temporal.base`
+"""""""""""""""""""""
 
     Implements of basic dataset informations and SQL conversion of such information:
 
-    - Definition of the SQL serialize class :class:`~temporal.base.DictSQLSerializer` that converts the content of temporal
+    - Definition of the SQL serialize class :class:`~temporal.base.DictSQLSerializer` 
+      that converts the content of temporal
       classes into SQL SELECT, INSERT or UPDATE statements
-    - Definition of :class:`~temporal.base.SQLDatabaseInterface` that is the base class for all temporal datatype subclasses
+    - Definition of :class:`~temporal.base.SQLDatabaseInterface` 
+      that is the base class for all temporal datatype subclasses
     - Contains classes for all datasets [#allds]_ that contain
       basic informations (id, name, mapset, creator, ...)
 
-**python::temporal::spatial_extent**
+:mod:`~temporal.spatial_extent`
+"""""""""""""""""""""""""""""""
 
     Implements of 2d and 3d spatial extents of all datasets:
 
-    - Implements class :class:`~temporal.spatial_extent.SpatialExtent` that is the base class for all dataset specific spatial extent classes
+    - Implements class :class:`~temporal.spatial_extent.SpatialExtent` 
+      that is the base class for all dataset specific spatial extent classes
       It provides spatial topological logic and operations for 2D and 3D extents
     - Implements spatial extent classes for all datasets [#allds]_
 
-**python::temporal::temporal_extent**
+:mod:`~temporal.temporal_extent`
+""""""""""""""""""""""""""""""""
 
     Implements of the temporal extent of all datasets for relative and absolute time:
 
-    - Implements class :class:`~temporal.temporal_extent.TemporalExtent` that is the base class for all dataset specific temporal extent classes
+    - Implements class :class:`~temporal.temporal_extent.TemporalExtent` 
+      that is the base class for all dataset specific temporal extent classes
       It provides temporal topological logic and operations
     - Implements temporal extent classes for relative time and absolute time for
       all datasets [#allds]_
 
-**python::temporal::metadata**
+:mod:`~temporal.metadata`
+"""""""""""""""""""""""""
 
     Implements the metadata base classes and datatype specific derivatives fpr all datasets [#allds]_.
 
-**python::temporal::spatial_topology_dataset_connector**
+:mod:`~temporal.spatial_topology_dataset_connector`
+"""""""""""""""""""""""""""""""""""""""""""""""""""
 
     Implements the interface to link datasets by spatial topological relations
 
-**python::temporal::temporal_topology_dataset_connector**
+:mod:`~temporal.temporal_topology_dataset_connector`
+""""""""""""""""""""""""""""""""""""""""""""""""""""
 
     Implements the interface to link datasets by temporal topological relations
 
-**python::temporal::c_libraries_interface**
+:mod:`~temporal.c_libraries_interface`
+""""""""""""""""""""""""""""""""""""""
 
     The RPC C-library interface for exit safe and fast access to raster, vector and 3D raster informations.
 
-**python::temporal::temporal_granularity**
+:mod:`~temporal.temporal_granularity`
+"""""""""""""""""""""""""""""""""""""
 
     The computation of the temporal granularity for a list
-    of :class:`~temporal.abstract_dataset.AbstractDataset` objects for absolute and relative is implemented here.
+    of :class:`~temporal.abstract_dataset.AbstractDataset` 
+    objects for absolute and relative is implemented here.
 
-**python::temporal::datetime_math**
+:mod:`~temporal.datetime_math`
+""""""""""""""""""""""""""""""
 
     This module contains function to parse, convert and process datetime objects
     in the temporal framework.
 
 Spatio-temporal algebra classes for space time raster and vector datasets are defined in:
 
-- **python::temporal::temporal_algebra**
-- **python::temporal::temporal_vector_algebra**
-- **python::temporal::temporal_vector_operator**
+- :mod:`~temporal.temporal_algebra`
+- :mod:`~temporal.temporal_vector_algebra`
+- :mod:`~temporal.temporal_vector_operator`
 
 High level API
-**************
+^^^^^^^^^^^^^^
 
-The high level API utilizes the low level API
+The high level API utilizes the low level API. Its classes and functions are usually used to implement
+temporal processing algorithms and temporal GRASS modules.
 
-**python::temporal::abstract_dataset**
+:mod:`~temporal.abstract_dataset`
+"""""""""""""""""""""""""""""""""
 
     - Implements the base class for all datasets [#allds]_ :class:`~temporal.abstract_dataset.AbstractDataset`.
     - Implements the the select, insert and update functionality as well as
       convenient functions to access the base, extent and metadata informations
 
-**python::temporal::abstract_map_dataset**
+:mod:`~temporal.abstract_map_dataset`
+"""""""""""""""""""""""""""""""""""""
 
-    - Implements the base class :class:`~temporal.abstract_map_dataset.AbstractMapDataset` for all map layer specific classes
+    - Implements the base class :class:`~temporal.abstract_map_dataset.AbstractMapDataset` 
+      for all map layer specific classes
     - Provides the interface to all map layer specific informations in the temporal database
 
-**python::temporal::abstract_space_time_dataset**
+:mod:`~temporal.abstract_space_time_dataset`
+""""""""""""""""""""""""""""""""""""""""""""
 
-    - Implements the base class :class:`~temporal.abstract_space_time_dataset.AbstractSpaceTimeDataset` for all Space Time Datasets classes
+    - Implements the base class :class:`~temporal.abstract_space_time_dataset.AbstractSpaceTimeDataset` 
+      for all Space Time Datasets classes
     - Contains the creation and deletion functionality, the map registration and un-registration,
       access methods to map layer objects and so on
     - Provides the interface to all Space Time Dataset specific informations in the temporal database
 
-**python::temporal::space_time_datasets**
-
-    This module contains all classes that represent specific datasets [#allds]_. A module developer uses these
-    map layer and Space Time Dataset object representations to perform spatio-temporal tasks.
+:mod:`~temporal.space_time_datasets`
+""""""""""""""""""""""""""""""""""""
 
+    This module contains all classes that represent specific datasets [#allds]_. 
+    A module developer uses these map layer and Space Time Dataset object 
+    representations to perform spatio-temporal tasks.
 
-**python::temporal::spatio_temporal_relationships**
+:mod:`~temporal.spatio_temporal_relationships`
+""""""""""""""""""""""""""""""""""""""""""""""
 
     The logic to compute spatio-temporal topology for a single list or two lists of :class:`~temporal.abstract_dataset.AbstractDataset` objects
     is implemented in this module.
-    The class :class:`~temporal.spatio_temporal_relationships.SpatioTemporalTopologyBuilder` provides a convenient
-    interface for topology computation.
+    The class :class:`~temporal.spatio_temporal_relationships.SpatioTemporalTopologyBuilder` 
+    provides a convenient interface for topology computation.
 
-**python::temporal::gui_support**
+:mod:`~temporal.gui_support`
+""""""""""""""""""""""""""""
 
     Helper functions to support the listing of space time datasets in the automatically generated GUI.
 
-Temporal Framework Testsuite
-****************************
-
-All temporal framework specific unittests and doctests are located here:
-
-- **python::temporal::testsuite**
-
 
 Shared Module functionality
-***************************
+^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 Functionality that is shared between different temporal GRASS modules, such as
-map listing, space time dataset creation, map registration and unregistration, 
+map listing, space time dataset creation, map registration and un-registration, 
 aggregation, extraction, map calculation, statistics as well as import and export of 
-space time datasets are defined here:
+space time datasets.
 
-**python::temporal::aggregation**
+:mod:`~temporal.aggregation`
+""""""""""""""""""""""""""""
 
     Aggregation of Space Time Raster Datasets based on topological relations. 
     Used in *t.rast.aggregate* and *t.rast.aggregate.ds*
 
-**python::temporal::extract**
+:mod:`~temporal.extract`
+""""""""""""""""""""""""
 
-    Extraction of subsets from Space Time Datasets including map algebra and vector selection statements. 
+    Extraction of subsets from Space Time Datasets including 
+    map algebra and vector selection statements. 
     Used in *t.rast.extract*, *t.rast3d.extract* and *t.vect.extract*.
 
-**python::temporal::factory**
+:mod:`~temporal.factory`
+""""""""""""""""""""""""
 
     Factory functions to create datasets of all types [#allds]_.
 
-**python::temporal::open_stds**
+:mod:`~temporal.open_stds`
+""""""""""""""""""""""""""
 
-    Convenient functions to open existing Space Time Datasets or to create new ones. Used in almost all temporal modules.
+    Convenient functions to open existing Space Time Datasets or 
+    to create new ones. Used in almost all temporal modules.
 
-**python::temporal::list_stds**
+:mod:`~temporal.list_stds`
+""""""""""""""""""""""""""
 
-    Convenient functions to list datasets of all types [#allds]_ registered in the temporal database.
+    Convenient functions to list datasets of all types [#allds]_ 
+    registered in the temporal database.
 
-**python::temporal::mapcalc**
+:mod:`~temporal.mapcalc`
+""""""""""""""""""""""""
 
-    Simple temporal algebra for Scpae Time Raster and 3d Raster datasets. Used in *t.rast.mapcalc* and *t.rast3d.mapcalc*
+    Simple temporal algebra for Space Time Raster and 3d Raster 
+    datasets. Used in *t.rast.mapcalc* and *t.rast3d.mapcalc*
 
-**python::temporal::register**
+:mod:`~temporal.register`
+"""""""""""""""""""""""""
 
     Convenient functions to register a single or multiple map layer in the temporal database and
     SpaceTime Datasets. Used in several modules, most important *t.register*.
 
-**python::temporal::sampling**
+:mod:`~temporal.sampling`
+"""""""""""""""""""""""""
 
     Sampling functions used in several modules.
 
-**python::temporal::stds_export**
+:mod:`~temporal.stds_export`
+""""""""""""""""""""""""""""
 
     Functions to export of Space Time Datasets, used in *t.rast.export*, *t.rast3d.export* and *t.vect.export*.
 
-**python::temporal::stds_import**
+:mod:`~temporal.stds_import`
+""""""""""""""""""""""""""""
 
     Functions to import Space Time Datasets, used in *t.rast.import*, *t.rast3d.import* and *t.vect.import*.
 
-**python::temporal::univar_statistics**
+:mod:`~temporal.univar_statistics`
+""""""""""""""""""""""""""""""""""
 
     Simple statistical analysis functions for Space Time Datasets, used in *t.rast.univar*, *t.rast3d.univar*
     and *t.vect.univar*.
@@ -213,11 +247,20 @@ space time datasets are defined here:
 .. [#allds] : Raster Map Layer, 3d Raster Map Layer, Vector Map Layer, Space time Raster Datasets (STRDS),
               Space Time 3d Raster Datasets (STR3DS) and Space Time Vector Datasets (STVDS)
 
+
+Here the full list of all temporal modules:
+
+.. toctree::
+   :maxdepth: 2
+
+   temporal
+
+
 Examples
 --------
 
 Howto start example
-*******************
+^^^^^^^^^^^^^^^^^^^
 
 This simple example shows how to open a space time raster dataset
 to access its registered maps.
@@ -274,7 +317,7 @@ to access its registered maps.
 
 
 Creation of a space time dataset
-********************************
+^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
 
 This example shows howto create a space time dataset. The code is generic and works
 for different space time datasets (raster, 3D raster and vector): 
@@ -335,7 +378,7 @@ for different space time datasets (raster, 3D raster and vector):
 
 
 Temporal shifting
-*****************
+^^^^^^^^^^^^^^^^^
 
 .. code-block:: python
 

+ 153 - 147
lib/python/temporal/abstract_dataset.py

@@ -1,17 +1,14 @@
 # -*- coding: utf-8 -*-
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in temporal GIS Python library package.
-
+"""
+The abstract_dataset module provides the AbstractDataset class
+that is the base class for all map layer and Space Time Datasets.
 
 (C) 2011-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 import uuid
 import copy
@@ -27,7 +24,7 @@ from grass.exceptions import ImplementationError
 ###############################################################################
 
 class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetConnector):
-    """!This is the base class for all datasets
+    """This is the base class for all datasets
        (raster, vector, raster3d, strds, stvds, str3ds)"""
 
     __metaclass__ = ABCMeta
@@ -38,42 +35,47 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         self.msgr = get_tgis_message_interface()
 
     def reset_topology(self):
-        """!Reset any information about temporal topology"""
+        """
+        Reset any information about temporal topology"""
+        
         self.reset_spatial_topology()
         self.reset_temporal_topology()
 
     def get_number_of_relations(self):
-        """! Return a dictionary in which the keys are the relation names and the value
+        """ 
+        Return a dictionary in which the keys are the relation names and the value
         are the number of relations.
 
         The following relations are available:
 
-        Spatial relations
-        - equivalent
-        - overlap
-        - in
-        - contain
-        - meet
-        - cover
-        - covered
-
-        Temporal relations
-        - equal
-        - follows
-        - precedes
-        - overlaps
-        - overlapped
-        - during (including starts, finishes)
-        - contains (including started, finished)
-        - starts
-        - started
-        - finishes
-        - finished
+        Spatial relations:
+        
+            - equivalent
+            - overlap
+            - in
+            - contain
+            - meet
+            - cover
+            - covered
+
+        Temporal relations:
+        
+            - equal
+            - follows
+            - precedes
+            - overlaps
+            - overlapped
+            - during (including starts, finishes)
+            - contains (including started, finished)
+            - starts
+            - started
+            - finishes
+            - finished
 
         To access topological information the spatial, temporal or booth topologies must be build first
         using the SpatioTemporalTopologyBuilder.
 
-        @return the dictionary with relations as keys and number as values or None in case the topology  wasn't build
+        :return: The dictionary with relations as keys and number as values or None in case the topology  wasn't build
         """
         if self.is_temporal_topology_build() and not self.is_spatial_topology_build():
             return self.get_number_of_temporal_relations()
@@ -86,20 +88,20 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return None
 
     def set_topology_build_true(self):
-        """!Use this method when the spatio-temporal topology was build"""
+        """Use this method when the spatio-temporal topology was build"""
         self.set_spatial_topology_build_true()
         self.set_temporal_topology_build_true()
 
 
     def set_topology_build_false(self):
-        """!Use this method when the spatio-temporal topology was not build"""
+        """Use this method when the spatio-temporal topology was not build"""
         self.set_spatial_topology_build_false()
         self.set_temporal_topology_build_false()
 
     def is_topology_build(self):
-        """!Check if the spatial and temporal topology was build
+        """Check if the spatial and temporal topology was build
 
-           @return A dictionary with "spatial" and "temporal" as keys that have boolen values
+           :return: A dictionary with "spatial" and "temporal" as keys that have boolen values
         """
         d = {}
         d["spatial"] = self.is_spatial_topology_build()
@@ -122,103 +124,105 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
 
     @abstractmethod
     def reset(self, ident):
-        """!Reset the internal structure and set the identifier
+        """Reset the internal structure and set the identifier
 
             This method creates the dataset specific internal objects
             that store the base information, the spatial and temporal extent
             and the metadata. It must be implemented in the dataset
             specific subclasses. This is the code for the
             vector dataset:
+            
+            .. code-block:: python
 
-            self.base = VectorBase(ident=ident)
-            self.absolute_time = VectorAbsoluteTime(ident=ident)
-            self.relative_time = VectorRelativeTime(ident=ident)
-            self.spatial_extent = VectorSpatialExtent(ident=ident)
-            self.metadata = VectorMetadata(ident=ident)
+                self.base = VectorBase(ident=ident)
+                self.absolute_time = VectorAbsoluteTime(ident=ident)
+                self.relative_time = VectorRelativeTime(ident=ident)
+                self.spatial_extent = VectorSpatialExtent(ident=ident)
+                self.metadata = VectorMetadata(ident=ident)
 
-           @param ident The identifier of the dataset that  "name@mapset" or in case of vector maps "name:layer@mapset"
+           :param ident: The identifier of the dataset that  "name@mapset" or in case of vector maps "name:layer@mapset"
         """
 
     @abstractmethod
     def is_stds(self):
-        """!Return True if this class is a space time dataset
+        """Return True if this class is a space time dataset
 
-           @return True if this class is a space time dataset, False otherwise
+           :return: True if this class is a space time dataset, False otherwise
         """
 
     @abstractmethod
     def get_type(self):
-        """!Return the type of this class as string
+        """Return the type of this class as string
 
            The type can be "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
 
-           @return "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
+           :return: "vect", "rast", "rast3d", "stvds", "strds" or "str3ds"
         """
 
     @abstractmethod
     def get_new_instance(self, ident):
-        """!Return a new instance with the type of this class
+        """Return a new instance with the type of this class
 
-           @param ident The identifier of the new dataset instance
-           @return A new instance with the type of this object
+           :param ident: The identifier of the new dataset instance
+           :return: A new instance with the type of this object
         """
 
     @abstractmethod
     def spatial_overlapping(self, dataset):
-        """!Return True if the spatial extents overlap
+        """Return True if the spatial extents overlap
 
-           @param dataset The abstract dataset to check spatial overlapping
-           @return True if self and the provided dataset spatial overlap
+           :param dataset: The abstract dataset to check spatial overlapping
+           :return: True if self and the provided dataset spatial overlap
         """
 
     @abstractmethod
     def spatial_intersection(self, dataset):
-        """!Return the spatial intersection as spatial_extent
+        """Return the spatial intersection as spatial_extent
            object or None in case no intersection was found.
 
-           @param dataset The abstract dataset to intersect with
-           @return The intersection spatial extent
+           :param dataset: The abstract dataset to intersect with
+           :return: The intersection spatial extent
         """
 
     @abstractmethod
     def spatial_union(self, dataset):
-        """!Return the spatial union as spatial_extent
+        """Return the spatial union as spatial_extent
            object or None in case the extents does not overlap or meet.
 
-           @param dataset The abstract dataset to create a union with
-           @return The union spatial extent
+           :param dataset: The abstract dataset to create a union with
+           :return: The union spatial extent
         """
 
     @abstractmethod
     def spatial_disjoint_union(self, dataset):
-        """!Return the spatial union as spatial_extent object.
+        """Return the spatial union as spatial_extent object.
 
-           @param dataset The abstract dataset to create a union with
-           @return The union spatial extent
+           :param dataset: The abstract dataset to create a union with
+           :return: The union spatial extent
         """
 
     @abstractmethod
     def spatial_relation(self, dataset):
-        """!Return the spatial relationship between self and dataset
+        """Return the spatial relationship between self and dataset
 
-           @param dataset The abstract dataset to compute the spatial relation with self
-           @return The spatial relationship as string
+           :param dataset: The abstract dataset to compute the spatial relation with self
+           :return: The spatial relationship as string
         """
 
     @abstractmethod
     def print_info(self):
-        """!Print information about this class in human readable style"""
+        """Print information about this class in human readable style"""
 
     @abstractmethod
     def print_shell_info(self):
-        """!Print information about this class in shell style"""
+        """Print information about this class in shell style"""
 
     @abstractmethod
     def print_self(self):
-        """!Print the content of the internal structure to stdout"""
+        """Print the content of the internal structure to stdout"""
 
     def set_id(self, ident):
-        """!Set the identifier of the dataset"""
+        """Set the identifier of the dataset"""
         self.base.set_id(ident)
         self.temporal_extent.set_id(ident)
         self.spatial_extent.set_id(ident)
@@ -227,37 +231,37 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
             self.stds_register.set_id(ident)
 
     def get_id(self):
-        """!Return the unique identifier of the dataset
-           @return The id of the dataset "name(:layer)@mapset" as string
+        """Return the unique identifier of the dataset
+           :return: The id of the dataset "name(:layer)@mapset" as string
         """
         return self.base.get_id()
 
     def get_name(self):
-        """!Return the name
-           @return The name of the dataset as string
+        """Return the name
+           :return: The name of the dataset as string
         """
         return self.base.get_name()
 
     def get_mapset(self):
-        """!Return the mapset
-           @return The mapset in which the dataset was created as string
+        """Return the mapset
+           :return: The mapset in which the dataset was created as string
         """
         return self.base.get_mapset()
 
     def get_temporal_extent_as_tuple(self):
-        """!Returns a tuple of the valid start and end time
+        """Returns a tuple of the valid start and end time
 
            Start and end time can be either of type datetime or of type integer,
            depending on the temporal type.
 
-           @return A tuple of (start_time, end_time)
+           :return: A tuple of (start_time, end_time)
         """
         start = self.temporal_extent.get_start_time()
         end = self.temporal_extent.get_end_time()
         return (start, end)
 
     def get_absolute_time(self):
-        """!Returns the start time, the end
+        """Returns the start time, the end
            time of the map as tuple
 
            The start time is of type datetime.
@@ -265,7 +269,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
            The end time is of type datetime in case of interval time,
            or None on case of a time instance.
 
-           @return A tuple of (start_time, end_time)
+           :return: A tuple of (start_time, end_time)
         """
 
         start = self.absolute_time.get_start_time()
@@ -274,7 +278,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return (start, end)
 
     def get_relative_time(self):
-        """!Returns the start time, the end
+        """Returns the start time, the end
            time and the temporal unit of the dataset as tuple
 
            The start time is of type integer.
@@ -282,7 +286,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
            The end time is of type integer in case of interval time,
            or None on case of a time instance.
 
-           @return A tuple of (start_time, end_time, unit)
+           :return: A tuple of (start_time, end_time, unit)
         """
 
         start = self.relative_time.get_start_time()
@@ -292,17 +296,17 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return (start, end, unit)
 
     def get_relative_time_unit(self):
-        """!Returns the relative time unit
-           @return The relative time unit as string, None if not present
+        """Returns the relative time unit
+           :return: The relative time unit as string, None if not present
         """
         return self.relative_time.get_unit()
 
     def check_relative_time_unit(self, unit):
-        """!Check if unit is of type  year(s), month(s), day(s), hour(s),
+        """Check if unit is of type  year(s), month(s), day(s), hour(s),
            minute(s) or second(s)
 
-           @param unit The unit string
-           @return True if success, False otherwise
+           :param unit: The unit string
+           :return: True if success, False otherwise
         """
         # Check unit
         units = ["year", "years", "month", "months", "day", "days", "hour",
@@ -312,37 +316,37 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return True
 
     def get_temporal_type(self):
-        """!Return the temporal type of this dataset
+        """Return the temporal type of this dataset
 
            The temporal type can be absolute or relative
 
-           @return The temporal type of the dataset as string
+           :return: The temporal type of the dataset as string
         """
         return self.base.get_ttype()
 
     def get_spatial_extent_as_tuple(self):
-        """!Return the spatial extent as tuple
+        """Return the spatial extent as tuple
 
            Top and bottom are set to 0 in case of a two dimensional spatial extent.
 
-           @return A the spatial extent as tuple (north, south, east, west, top, bottom)
+           :return: A the spatial extent as tuple (north, south, east, west, top, bottom)
         """
         return self.spatial_extent.get_spatial_extent_as_tuple()
 
     def get_spatial_extent(self):
-        """!Return the spatial extent
+        """Return the spatial extent
         """
         return self.spatial_extent
 
     def select(self, dbif=None):
-        """!Select temporal dataset entry from database and fill
+        """Select temporal dataset entry from database and fill
            the internal structure
 
            The content of every dataset is stored in the temporal database.
            This method must be used to fill this object with the content
            from the temporal database.
 
-           @param dbif The database interface to be used
+           :param dbif: The database interface to be used
         """
 
         dbif, connected = init_dbif(dbif)
@@ -358,25 +362,25 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
             dbif.close()
 
     def is_in_db(self, dbif=None):
-        """!Check if the dataset is registered in the database
+        """Check if the dataset is registered in the database
 
-           @param dbif The database interface to be used
-           @return True if the dataset is registered in the database
+           :param dbif: The database interface to be used
+           :return: True if the dataset is registered in the database
         """
         return self.base.is_in_db(dbif)
 
     @abstractmethod
     def delete(self):
-        """!Delete dataset from database if it exists"""
+        """Delete dataset from database if it exists"""
 
     def insert(self, dbif=None, execute=True):
-        """!Insert dataset into database
+        """Insert dataset into database
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned
-                           and must be executed by the caller.
-            @return The SQL insert statement in case execute=False, or an empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      If False the prepared SQL statements are returned
+                                     and must be executed by the caller.
+            :return: The SQL insert statement in case execute=False, or an empty string otherwise
         """
 
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
@@ -405,15 +409,15 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return statement
 
     def update(self, dbif=None, execute=True, ident=None):
-        """!Update the dataset entry in the database from the internal structure
+        """Update the dataset entry in the database from the internal structure
            excluding None variables
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned
-                           and must be executed by the caller.
-           @param ident The identifier to be updated, useful for renaming
-           @return The SQL update statement in case execute=False, or an empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      If False the prepared SQL statements are returned
+                                      and must be executed by the caller.
+           :param ident: The identifier to be updated, useful for renaming
+           :return: The SQL update statement in case execute=False, or an empty string otherwise
         """
 
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
@@ -446,15 +450,15 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return statement
 
     def update_all(self, dbif=None, execute=True, ident=None):
-        """!Update the dataset entry in the database from the internal structure
+        """Update the dataset entry in the database from the internal structure
            and include None variables.
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                           If False the prepared SQL statements are returned
-                           and must be executed by the caller.
-           @param ident The identifier to be updated, useful for renaming
-           @return The SQL update statement in case execute=False, or an empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      f False the prepared SQL statements are returned
+                                     and must be executed by the caller.
+           :param ident: The identifier to be updated, useful for renaming
+           :return: The SQL update statement in case execute=False, or an empty string otherwise
         """
 
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
@@ -486,9 +490,9 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
         return statement
 
     def is_time_absolute(self):
-        """!Return True in case the temporal type is absolute
+        """Return True in case the temporal type is absolute
 
-            @return True if temporal type is absolute, False otherwise
+            :return: True if temporal type is absolute, False otherwise
         """
         if "temporal_type" in self.base.D:
             return self.base.get_ttype() == "absolute"
@@ -496,9 +500,9 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
             return None
 
     def is_time_relative(self):
-        """!Return True in case the temporal type is relative
+        """Return True in case the temporal type is relative
 
-            @return True if temporal type is relative, False otherwise
+            :return: True if temporal type is relative, False otherwise
         """
         if "temporal_type" in self.base.D:
             return self.base.get_ttype() == "relative"
@@ -506,7 +510,7 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
             return None
 
     def get_temporal_extent(self):
-        """!Return the temporal extent of the correct internal type
+        """Return the temporal extent of the correct internal type
         """
         if self.is_time_absolute():
             return self.absolute_time
@@ -517,55 +521,56 @@ class AbstractDataset(SpatialTopologyDatasetConnector, TemporalTopologyDatasetCo
     temporal_extent = property(fget=get_temporal_extent)
 
     def temporal_relation(self, dataset):
-        """!Return the temporal relation of self and the provided dataset
+        """Return the temporal relation of self and the provided dataset
 
-            @return The temporal relation as string
+            :return: The temporal relation as string
         """
         return self.temporal_extent.temporal_relation(dataset.temporal_extent)
 
     def temporal_intersection(self, dataset):
-        """!Intersect self with the provided dataset and
+        """Intersect self with the provided dataset and
            return a new temporal extent with the new start and end time
 
-           @param dataset The abstract dataset to temporal intersect with
-           @return The new temporal extent with start and end time,
-                   or None in case of no intersection
+           :param dataset: The abstract dataset to temporal intersect with
+           :return: The new temporal extent with start and end time,
+                        or None in case of no intersection
         """
         return self.temporal_extent.intersect(dataset.temporal_extent)
 
     def temporal_union(self, dataset):
-        """!Creates a union with the provided dataset and
+        """Creates a union with the provided dataset and
            return a new temporal extent with the new start and end time.
 
-           @param dataset The abstract dataset to create temporal union with
-           @return The new temporal extent with start and end time,
-                   or None in case of no intersection
+           :param dataset: The abstract dataset to create temporal union with
+           :return: The new temporal extent with start and end time,
+                        or None in case of no intersection
         """
         return self.temporal_extent.union(dataset.temporal_extent)
 
     def temporal_disjoint_union(self, dataset):
-        """!Creates a union with the provided dataset and
+        """Creates a union with the provided dataset and
            return a new temporal extent with the new start and end time.
 
-           @param dataset The abstract dataset to create temporal union with
-           @return The new temporal extent with start and end time
+           :param dataset: The abstract dataset to create temporal union with
+           :return: The new temporal extent with start and end time
         """
         return self.temporal_extent.disjoint_union(dataset.temporal_extent)
 
 ###############################################################################
 
 class AbstractDatasetComparisonKeyStartTime(object):
-    """!This comparison key can be used to sort lists of abstract datasets
+    """This comparison key can be used to sort lists of abstract datasets
        by start time
 
         Example:
 
-        # Return all maps in a space time raster dataset as map objects
-        map_list = strds.get_registered_maps_as_objects()
+        .. code-block:: python
+        
+            # Return all maps in a space time raster dataset as map objects
+            map_list = strds.get_registered_maps_as_objects()
 
-        # Sort the maps in the list by start time
-        sorted_map_list = sorted(
-            map_list, key=AbstractDatasetComparisonKeyStartTime)
+            # Sort the maps in the list by start time
+            sorted_map_list = sorted(map_list, key=AbstractDatasetComparisonKeyStartTime)
     """
     def __init__(self, obj, *args):
         self.obj = obj
@@ -603,17 +608,18 @@ class AbstractDatasetComparisonKeyStartTime(object):
 ###############################################################################
 
 class AbstractDatasetComparisonKeyEndTime(object):
-    """!This comparison key can be used to sort lists of abstract datasets
+    """This comparison key can be used to sort lists of abstract datasets
        by end time
 
         Example:
 
-        # Return all maps in a space time raster dataset as map objects
-        map_list = strds.get_registered_maps_as_objects()
+        .. code-block:: python
+        
+            # Return all maps in a space time raster dataset as map objects
+            map_list = strds.get_registered_maps_as_objects()
 
-        # Sort the maps in the list by end time
-        sorted_map_list = sorted(
-            map_list, key=AbstractDatasetComparisonKeyEndTime)
+            # Sort the maps in the list by end time
+            sorted_map_list = sorted(map_list, key=AbstractDatasetComparisonKeyEndTime)
     """
     def __init__(self, obj, *args):
         self.obj = obj

+ 263 - 268
lib/python/temporal/abstract_map_dataset.py

@@ -1,22 +1,20 @@
 # -*- coding: utf-8 -*-
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in temporal GIS Python library package.
+"""
+The abstract_map_dataset module provides the AbstractMapDataset class
+that is the base class for all map layer.
 
 (C) 2011-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 from abstract_dataset import *
 from datetime_math import *
 
 class AbstractMapDataset(AbstractDataset):
-    """!This is the base class for all maps (raster, vector, raster3d).
+    """This is the base class for all maps (raster, vector, raster3d).
 
         The temporal extent, the spatial extent and the metadata of maps
         are stored in the temporal database. Maps can be registered in the
@@ -24,12 +22,13 @@ class AbstractMapDataset(AbstractDataset):
 
         This class provides all functionalities that are needed to manage maps
         in the temporal database. That are:
+        
         - insert() to register the map and therefore its spatio-temporal extent
-                   and metadata in the temporal database
+          and metadata in the temporal database
         - update() to update the map spatio-temporal extent and metadata in the
-                   temporal database
+          temporal database
         - unregister() to unregister the map from each space time dataset in
-                       which this map is registered
+          which this map is registered
         - delete() to remove the map from the temporal database
         - Methods to set relative and absolute time stamps
         - Abstract methods that must be implemented in the map specific
@@ -44,15 +43,15 @@ class AbstractMapDataset(AbstractDataset):
 
     @abstractmethod
     def get_new_stds_instance(self, ident):
-        """!Return a new space time dataset instance that store maps with the
+        """Return a new space time dataset instance that store maps with the
            type of this map object (rast, rast3d or vect)
 
-           @param ident The identifier of the space time dataset
-           @return The new space time dataset instance
+           :param ident The identifier of the space time dataset
+           :return: The new space time dataset instance
         """
 
     def check_resolution_with_current_region(self):
-        """!Check if the raster or voxel resolution is
+        """Check if the raster or voxel resolution is
            finer than the current resolution
 
            - Return "finer" in case the raster/voxel resolution is finer
@@ -63,7 +62,7 @@ class AbstractMapDataset(AbstractDataset):
            Vector maps have no resolution, since they store the coordinates
            directly.
 
-           @return "finer" or "coarser"
+           :return: "finer" or "coarser"
         """
         raise ImplementationError(
             "This method must be implemented in the subclasses")
@@ -71,20 +70,20 @@ class AbstractMapDataset(AbstractDataset):
 
     @abstractmethod
     def has_grass_timestamp(self):
-        """!Check if a grass file based time stamp exists for this map.
-            @return True is the grass file based time stamped exists for this
+        """Check if a grass file based time stamp exists for this map.
+            :return: True is the grass file based time stamped exists for this
                     map
         """
 
     @abstractmethod
     def write_timestamp_to_grass(self):
-        """!Write the timestamp of this map into the map metadata
+        """Write the timestamp of this map into the map metadata
            in the grass file system based spatial database.
         """
 
     @abstractmethod
     def read_timestamp_from_grass(self):
-        """!Read the timestamp of this map from the map metadata
+        """Read the timestamp of this map from the map metadata
            in the grass file system based spatial database and
            set the internal time stamp that should be insert/updated
            in the temporal database.
@@ -92,29 +91,29 @@ class AbstractMapDataset(AbstractDataset):
 
     @abstractmethod
     def remove_timestamp_from_grass(self):
-        """!Remove the timestamp from the grass file
+        """Remove the timestamp from the grass file
            system based spatial database
         """
 
     @abstractmethod
     def map_exists(self):
-        """!Return True in case the map exists in the grass spatial database
+        """Return True in case the map exists in the grass spatial database
 
-           @return True if map exists, False otherwise
+           :return: True if map exists, False otherwise
         """
 
     @abstractmethod
     def load(self):
-        """!Load the content of this object from the grass
+        """Load the content of this object from the grass
            file system based database"""
 
     def _convert_timestamp(self):
-        """!Convert the valid time into a grass datetime library
+        """Convert the valid time into a grass datetime library
            compatible timestamp string
 
             This methods works for relative and absolute time
 
-            @return the grass timestamp string
+            :return: the grass timestamp string
         """
         start = ""
 
@@ -134,7 +133,7 @@ class AbstractMapDataset(AbstractDataset):
         return start
 
     def get_map_id(self):
-        """!Return the map id. The map id is the unique identifier
+        """Return the map id. The map id is the unique identifier
            in grass and must not be equal to the
            primary key identifier (id) of the map in the database.
            Since vector maps may have layer information,
@@ -144,24 +143,23 @@ class AbstractMapDataset(AbstractDataset):
            in the file system but not to identify
            map information in the temporal database.
 
-           @return The map id "name@mapset"
+           :return: The map id "name@mapset"
         """
         return self.base.get_map_id()
 
     @staticmethod
     def build_id(name, mapset, layer=None):
-        """!Convenient method to build the unique identifier
+        """Convenient method to build the unique identifier
 
             Existing layer and mapset definitions in the name
             string will be reused
 
-           @param name The name of the map
-           @param mapset The mapset in which the map is located
-           @param layer The layer of the vector map, use None in case no
-                        layer exists
+           :param name: The name of the map
+           :param mapset: The mapset in which the map is located
+           :param layer: The layer of the vector map, use None in case no
+                                 layer exists
 
-           @return the id of the map as "name(:layer)@mapset"
-                   while layer is optional
+           :return: the id of the map as "name(:layer)@mapset" while layer is optional
         """
 
         # Check if the name includes any mapset
@@ -178,14 +176,15 @@ class AbstractMapDataset(AbstractDataset):
             return "%s@%s" % (name, mapset)
 
     def get_layer(self):
-        """!Return the layer of the map
-            @return the layer of the map or None in case no layer is defined
+        """Return the layer of the map
+
+            :return: the layer of the map or None in case no layer is defined
         """
         return self.base.get_layer()
 
 
     def print_self(self):
-        """!Print the content of the internal structure to stdout"""
+        """Print the content of the internal structure to stdout"""
         self.base.print_self()
         self.temporal_extent.print_self()
         self.spatial_extent.print_self()
@@ -193,7 +192,7 @@ class AbstractMapDataset(AbstractDataset):
         self.stds_register.print_self()
 
     def print_info(self):
-        """!Print information about this object in human readable style"""
+        """Print information about this object in human readable style"""
 
         if self.get_type() == "raster":
             #                1         2         3         4         5         6         7
@@ -231,7 +230,7 @@ class AbstractMapDataset(AbstractDataset):
         print " +----------------------------------------------------------------------------+"
 
     def print_shell_info(self):
-        """!Print information about this object in shell style"""
+        """Print information about this object in shell style"""
         self.base.print_shell_info()
         self.temporal_extent.print_shell_info()
         self.spatial_extent.print_shell_info()
@@ -252,7 +251,7 @@ class AbstractMapDataset(AbstractDataset):
             self.print_topology_shell_info()
 
     def insert(self, dbif=None, execute=True):
-        """!Insert the map content into the database from the internal
+        """Insert the map content into the database from the internal
            structure
 
            This functions assures that the timestamp is written to the
@@ -261,65 +260,65 @@ class AbstractMapDataset(AbstractDataset):
            Hence maps can only be registered in a space time dataset, when
            they were inserted in the temporal database beforehand.
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
-           @return The SQL insert statement in case execute=False, or an
-                   empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
+           :return: The SQL insert statement in case execute=False, or an
+                        empty string otherwise
         """
         if get_enable_timestamp_write():
             self.write_timestamp_to_grass()
         return AbstractDataset.insert(self, dbif=dbif, execute=execute)
 
     def update(self, dbif=None, execute=True):
-        """!Update the map content in the database from the internal structure
+        """Update the map content in the database from the internal structure
            excluding None variables
 
            This functions assures that the timestamp is written to the
            grass file system based database in addition to the temporal
            database entry.
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
-           @return The SQL insert statement in case execute=False, or an
-                   empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
+           :return: The SQL insert statement in case execute=False, or an
+                        empty string otherwise
         """
         if get_enable_timestamp_write():
             self.write_timestamp_to_grass()
         return AbstractDataset.update(self, dbif, execute)
 
     def update_all(self, dbif=None, execute=True):
-        """!Update the map content in the database from the internal structure
+        """Update the map content in the database from the internal structure
            including None variables
 
            This functions assures that the timestamp is written to the
            grass file system based database in addition to the temporal
            database entry.
 
-           @param dbif The database interface to be used
-           @param execute If True the SQL statements will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
-            @return The SQL insert statement in case execute=False, or an
-                    empty string otherwise
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL statements will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
+            :return: The SQL insert statement in case execute=False, or an
+                         empty string otherwise
         """
         if get_enable_timestamp_write():
             self.write_timestamp_to_grass()
         return AbstractDataset.update_all(self, dbif, execute)
 
     def set_time_to_absolute(self):
-        """!Set the temporal type to absolute"""
+        """Set the temporal type to absolute"""
         self.base.set_ttype("absolute")
 
     def set_time_to_relative(self):
-        """!Set the temporal type to relative"""
+        """Set the temporal type to relative"""
         self.base.set_ttype("relative")
 
     def set_absolute_time(self, start_time, end_time=None):
-        """!Set the absolute time with start time and end time
+        """Set the absolute time with start time and end time
 
             The end time is optional and must be set to None in case of time
             instance.
@@ -327,12 +326,10 @@ class AbstractMapDataset(AbstractDataset):
             This method only modifies this object and does not commit
             the modifications to the temporal database.
 
-           @param start_time a datetime object specifying the start time of the
-                             map
-           @param end_time a datetime object specifying the end time of the
-                           map, None in case or time instance
+           :param start_time: A datetime object specifying the start time of the map
+           :param end_time: A datetime object specifying the end time of the map, None in case or time instance
 
-           @return True for success and False otherwise
+           :return: True for success and False otherwise
         """
         if start_time and not isinstance(start_time, datetime):
             if self.get_layer() is not None:
@@ -388,7 +385,7 @@ class AbstractMapDataset(AbstractDataset):
         return True
 
     def update_absolute_time(self, start_time, end_time=None, dbif=None):
-        """!Update the absolute time
+        """Update the absolute time
 
            The end time is optional and must be set to None in case of time
            instance.
@@ -397,11 +394,11 @@ class AbstractMapDataset(AbstractDataset):
            grass file system based database in addition to the temporal
            database entry.
 
-           @param start_time a datetime object specifying the start time of
-                  the map
-           @param end_time a datetime object specifying the end time of the
-                  map, None in case or time instance
-           @param dbif The database interface to be used
+           :param start_time: A datetime object specifying the start time of
+                                         the map
+           :param end_time: A datetime object specifying the end time of the
+                                        map, None in case or time instance
+           :param dbif: The database interface to be used
            """
 
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
@@ -422,7 +419,7 @@ class AbstractMapDataset(AbstractDataset):
                 self.write_timestamp_to_grass()
 
     def set_relative_time(self, start_time, end_time, unit):
-        """!Set the relative time interval
+        """Set the relative time interval
 
             The end time is optional and must be set to None in case of time
             instance.
@@ -430,12 +427,12 @@ class AbstractMapDataset(AbstractDataset):
             This method only modifies this object and does not commit
             the modifications to the temporal database.
 
-           @param start_time An integer value
-           @param end_time An integer value, None in case or time instance
-           @param unit The unit of the relative time. Supported units:
-                       year(s), month(s), day(s), hour(s), minute(s), second(s)
+           :param start_time: An integer value
+           :param end_time: An integer value, None in case or time instance
+           :param unit: The unit of the relative time. Supported units:
+                                year(s), month(s), day(s), hour(s), minute(s), second(s)
 
-           @return True for success and False otherwise
+           :return: True for success and False otherwise
 
         """
         if not self.check_relative_time_unit(unit):
@@ -481,7 +478,7 @@ class AbstractMapDataset(AbstractDataset):
         return True
 
     def update_relative_time(self, start_time, end_time, unit, dbif=None):
-        """!Update the relative time interval
+        """Update the relative time interval
 
            The end time is optional and must be set to None in case of time
            instance.
@@ -490,10 +487,10 @@ class AbstractMapDataset(AbstractDataset):
            grass file system based database in addition to the temporal
            database entry.
 
-           @param start_time An integer value
-           @param end_time An integer value, None in case or time instance
-           @param unit The relative time unit
-           @param dbif The database interface to be used
+           :param start_time: An integer value
+           :param end_time: An integer value, None in case or time instance
+           :param unit: The relative time unit
+           :param dbif: The database interface to be used
         """
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
             self.msgr.fatal(_("Unable to update dataset <%(ds)s> of type %(type)s in the temporal database."
@@ -512,38 +509,38 @@ class AbstractMapDataset(AbstractDataset):
                 self.write_timestamp_to_grass()
 
     def set_temporal_extent(self, extent):
-        """!Convenient method to set the temporal extent from a temporal extent object
-
-           @param temporal_extent The temporal extent that should be set for this object
-
-           @code
-           >>> import datetime
-           >>> import grass.temporal as tgis
-           >>> map      = tgis.RasterDataset(None)
-           >>> temp_ext = tgis.RasterRelativeTime(start_time=1, end_time=2, unit="years")
-           >>> map.set_temporal_extent(temp_ext)
-           >>> print map.get_temporal_extent_as_tuple()
-           (1, 2)
-           >>> map      = tgis.VectorDataset(None)
-           >>> temp_ext = tgis.VectorAbsoluteTime(start_time=datetime.datetime(2000, 1, 1),
-           ...                                        end_time=datetime.datetime(2001, 1, 1))
-           >>> map.set_temporal_extent(temp_ext)
-           >>> print map.get_temporal_extent_as_tuple()
-           (datetime.datetime(2000, 1, 1, 0, 0), datetime.datetime(2001, 1, 1, 0, 0))
-
-           >>> map1 = tgis.VectorDataset("A@P")
-           >>> check = map1.set_absolute_time(datetime.datetime(2000,5,5), datetime.datetime(2005,6,6))
-           >>> print map1.get_temporal_extent_as_tuple()
-           (datetime.datetime(2000, 5, 5, 0, 0), datetime.datetime(2005, 6, 6, 0, 0))
-           >>> map2 = tgis.RasterDataset("B@P")
-           >>> check = map2.set_absolute_time(datetime.datetime(1990,1,1), datetime.datetime(1999,8,1))
-           >>> print map2.get_temporal_extent_as_tuple()
-           (datetime.datetime(1990, 1, 1, 0, 0), datetime.datetime(1999, 8, 1, 0, 0))
-           >>> map2.set_temporal_extent(map1.get_temporal_extent())
-           >>> print map2.get_temporal_extent_as_tuple()
-           (datetime.datetime(2000, 5, 5, 0, 0), datetime.datetime(2005, 6, 6, 0, 0))
-
-           @endcode
+        """Convenient method to set the temporal extent from a temporal extent object
+
+           :param temporal_extent: The temporal extent that should be set for this object
+
+           .. code-block: : python
+           
+               >>> import datetime
+               >>> import grass.temporal as tgis
+               >>> map      = tgis.RasterDataset(None)
+               >>> temp_ext = tgis.RasterRelativeTime(start_time=1, end_time=2, unit="years")
+               >>> map.set_temporal_extent(temp_ext)
+               >>> print map.get_temporal_extent_as_tuple()
+               (1, 2)
+               >>> map      = tgis.VectorDataset(None)
+               >>> temp_ext = tgis.VectorAbsoluteTime(start_time=datetime.datetime(2000, 1, 1),
+               ...                                        end_time=datetime.datetime(2001, 1, 1))
+               >>> map.set_temporal_extent(temp_ext)
+               >>> print map.get_temporal_extent_as_tuple()
+               (datetime.datetime(2000, 1, 1, 0, 0), datetime.datetime(2001, 1, 1, 0, 0))
+
+               >>> map1 = tgis.VectorDataset("A@P")
+               >>> check = map1.set_absolute_time(datetime.datetime(2000,5,5), datetime.datetime(2005,6,6))
+               >>> print map1.get_temporal_extent_as_tuple()
+               (datetime.datetime(2000, 5, 5, 0, 0), datetime.datetime(2005, 6, 6, 0, 0))
+               >>> map2 = tgis.RasterDataset("B@P")
+               >>> check = map2.set_absolute_time(datetime.datetime(1990,1,1), datetime.datetime(1999,8,1))
+               >>> print map2.get_temporal_extent_as_tuple()
+               (datetime.datetime(1990, 1, 1, 0, 0), datetime.datetime(1999, 8, 1, 0, 0))
+               >>> map2.set_temporal_extent(map1.get_temporal_extent())
+               >>> print map2.get_temporal_extent_as_tuple()
+               (datetime.datetime(2000, 5, 5, 0, 0), datetime.datetime(2005, 6, 6, 0, 0))
+
         """
         if issubclass(type(extent), RelativeTemporalExtent):
             start = extent.get_start_time()
@@ -559,80 +556,79 @@ class AbstractMapDataset(AbstractDataset):
             self.set_absolute_time(start, end)
 
     def temporal_buffer(self, increment, update=False, dbif=None):
-        """!Create a temporal buffer based on an increment
+        """Create a temporal buffer based on an increment
 
            For absolute time the increment must be a string of type "integer
            unit"
            Unit can be year, years, month, months, day, days, hour, hours,
            minute, minutes, day or days.
 
-           @param increment This is the increment, a string in case of absolute
-                            time or an integer in case of relative time
-           @param update Perform an immediate database update to store the
-                         modified temporal extent, otherwise only this object
-                         will be modified
+           :param increment: This is the increment, a string in case of absolute
+                                         time or an integer in case of relative time
+           :param update: Perform an immediate database update to store the
+                                    modified temporal extent, otherwise only this object
+                                    will be modified
 
            Usage:
 
-           @code
-
-           >>> import grass.temporal as tgis
-           >>> maps = []
-           >>> for i in range(5):
-           ...   map = tgis.RasterDataset(None)
-           ...   if i%2 == 0:
-           ...       check = map.set_relative_time(i, i + 1, 'years')
-           ...   else:
-           ...       check = map.set_relative_time(i, None, 'years')
-           ...   map.temporal_buffer(3)
-           ...   maps.append(map)
-           >>> for map in maps:
-           ...   map.temporal_extent.print_info()
-            +-------------------- Relative time -----------------------------------------+
-            | Start time:................. -3
-            | End time:................... 4
-            | Relative time unit:......... years
-            +-------------------- Relative time -----------------------------------------+
-            | Start time:................. -2
-            | End time:................... 4
-            | Relative time unit:......... years
-            +-------------------- Relative time -----------------------------------------+
-            | Start time:................. -1
-            | End time:................... 6
-            | Relative time unit:......... years
-            +-------------------- Relative time -----------------------------------------+
-            | Start time:................. 0
-            | End time:................... 6
-            | Relative time unit:......... years
-            +-------------------- Relative time -----------------------------------------+
-            | Start time:................. 1
-            | End time:................... 8
-            | Relative time unit:......... years
-           >>> maps = []
-           >>> for i in range(1,5):
-           ...   map = tgis.RasterDataset(None)
-           ...   if i%2 == 0:
-           ...       check = map.set_absolute_time(datetime(2001,i,1), datetime(2001, i + 1, 1))
-           ...   else:
-           ...       check = map.set_absolute_time(datetime(2001,i,1),  None)
-           ...   map.temporal_buffer("7 days")
-           ...   maps.append(map)
-           >>> for map in maps:
-           ...   map.temporal_extent.print_info()
-            +-------------------- Absolute time -----------------------------------------+
-            | Start time:................. 2000-12-25 00:00:00
-            | End time:................... 2001-01-08 00:00:00
-            +-------------------- Absolute time -----------------------------------------+
-            | Start time:................. 2001-01-25 00:00:00
-            | End time:................... 2001-03-08 00:00:00
-            +-------------------- Absolute time -----------------------------------------+
-            | Start time:................. 2001-02-22 00:00:00
-            | End time:................... 2001-03-08 00:00:00
-            +-------------------- Absolute time -----------------------------------------+
-            | Start time:................. 2001-03-25 00:00:00
-            | End time:................... 2001-05-08 00:00:00
-
-           @endcode
+           .. code-block: : python
+
+               >>> import grass.temporal as tgis
+               >>> maps = []
+               >>> for i in range(5):
+               ...   map = tgis.RasterDataset(None)
+               ...   if i%2 == 0:
+               ...       check = map.set_relative_time(i, i + 1, 'years')
+               ...   else:
+               ...       check = map.set_relative_time(i, None, 'years')
+               ...   map.temporal_buffer(3)
+               ...   maps.append(map)
+               >>> for map in maps:
+               ...   map.temporal_extent.print_info()
+                +-------------------- Relative time -----------------------------------------+
+                | Start time:................. -3
+                | End time:................... 4
+                | Relative time unit:......... years
+                +-------------------- Relative time -----------------------------------------+
+                | Start time:................. -2
+                | End time:................... 4
+                | Relative time unit:......... years
+                +-------------------- Relative time -----------------------------------------+
+                | Start time:................. -1
+                | End time:................... 6
+                | Relative time unit:......... years
+                +-------------------- Relative time -----------------------------------------+
+                | Start time:................. 0
+                | End time:................... 6
+                | Relative time unit:......... years
+                +-------------------- Relative time -----------------------------------------+
+                | Start time:................. 1
+                | End time:................... 8
+                | Relative time unit:......... years
+               >>> maps = []
+               >>> for i in range(1,5):
+               ...   map = tgis.RasterDataset(None)
+               ...   if i%2 == 0:
+               ...       check = map.set_absolute_time(datetime(2001,i,1), datetime(2001, i + 1, 1))
+               ...   else:
+               ...       check = map.set_absolute_time(datetime(2001,i,1),  None)
+               ...   map.temporal_buffer("7 days")
+               ...   maps.append(map)
+               >>> for map in maps:
+               ...   map.temporal_extent.print_info()
+                +-------------------- Absolute time -----------------------------------------+
+                | Start time:................. 2000-12-25 00:00:00
+                | End time:................... 2001-01-08 00:00:00
+                +-------------------- Absolute time -----------------------------------------+
+                | Start time:................. 2001-01-25 00:00:00
+                | End time:................... 2001-03-08 00:00:00
+                +-------------------- Absolute time -----------------------------------------+
+                | Start time:................. 2001-02-22 00:00:00
+                | End time:................... 2001-03-08 00:00:00
+                +-------------------- Absolute time -----------------------------------------+
+                | Start time:................. 2001-03-25 00:00:00
+                | End time:................... 2001-05-08 00:00:00
+
         """
 
         if self.is_time_absolute():
@@ -662,59 +658,58 @@ class AbstractMapDataset(AbstractDataset):
                 self.set_relative_time(new_start, new_end, unit)
 
     def set_spatial_extent_from_values(self, north, south, east, west, top=0, bottom=0):
-        """!Set the spatial extent of the map from values
+        """Set the spatial extent of the map from values
 
             This method only modifies this object and does not commit
             the modifications to the temporal database.
 
-           @param north The northern edge
-           @param south The southern edge
-           @param east The eastern edge
-           @param west The western edge
-           @param top The top edge
-           @param bottom The bottom edge
+           :param north: The northern edge
+           :param south: The southern edge
+           :param east: The eastern edge
+           :param west: The western edge
+           :param top: The top edge
+           :param bottom: The bottom edge
         """
         self.spatial_extent.set_spatial_extent_from_values(
             north, south, east, west, top, bottom)
 
     def set_spatial_extent(self, spatial_extent):
-        """!Set the spatial extent of the map
+        """Set the spatial extent of the map
 
             This method only modifies this object and does not commit
             the modifications to the temporal database.
 
-            @param spatial_extent An object of type SpatialExtent or its subclasses
+            :param spatial_extent: An object of type SpatialExtent or its subclasses
+
+           .. code-block: : python
 
-           @code
-           >>> import datetime
-           >>> import grass.temporal as tgis
-           >>> map      = tgis.RasterDataset(None)
-           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
-           >>> map.set_spatial_extent(spat_ext)
-           >>> print map.get_spatial_extent_as_tuple()
-           (10.0, -10.0, 20.0, -20.0, 5.0, -5.0)
+               >>> import datetime
+               >>> import grass.temporal as tgis
+               >>> map      = tgis.RasterDataset(None)
+               >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+               >>> map.set_spatial_extent(spat_ext)
+               >>> print map.get_spatial_extent_as_tuple()
+               (10.0, -10.0, 20.0, -20.0, 5.0, -5.0)
 
-           @endcode
         """
         self.spatial_extent.set_spatial_extent(spatial_extent)
 
     def spatial_buffer(self, size, update=False, dbif=None):
-        """!Buffer the spatial extent by a given size in all
+        """Buffer the spatial extent by a given size in all
            spatial directions.
 
-           @param size The buffer size, using the unit of the grass region
+           :param size: The buffer size, using the unit of the grass region
 
-           @code
+           .. code-block: : python
 
-           >>> import grass.temporal as tgis
-           >>> map = tgis.RasterDataset(None)
-           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
-           >>> map.set_spatial_extent(spat_ext)
-           >>> map.spatial_buffer(10)
-           >>> print map.get_spatial_extent_as_tuple()
-           (20.0, -20.0, 30.0, -30.0, 15.0, -15.0)
+               >>> import grass.temporal as tgis
+               >>> map = tgis.RasterDataset(None)
+               >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+               >>> map.set_spatial_extent(spat_ext)
+               >>> map.spatial_buffer(10)
+               >>> print map.get_spatial_extent_as_tuple()
+               (20.0, -20.0, 30.0, -30.0, 15.0, -15.0)
 
-           @endcode
         """
         self.spatial_extent.north   += size
         self.spatial_extent.south   -= size
@@ -727,22 +722,21 @@ class AbstractMapDataset(AbstractDataset):
             self.spatial_extent.update(dbif)
 
     def spatial_buffer_2d(self, size, update=False, dbif=None):
-        """!Buffer the spatial extent by a given size in 2d
+        """Buffer the spatial extent by a given size in 2d
            spatial directions.
 
-           @param size The buffer size, using the unit of the grass region
+           :param size: The buffer size, using the unit of the grass region
 
-           @code
+           .. code-block: : python
 
-           >>> import grass.temporal as tgis
-           >>> map = tgis.RasterDataset(None)
-           >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
-           >>> map.set_spatial_extent(spat_ext)
-           >>> map.spatial_buffer_2d(10)
-           >>> print map.get_spatial_extent_as_tuple()
-           (20.0, -20.0, 30.0, -30.0, 5.0, -5.0)
+               >>> import grass.temporal as tgis
+               >>> map = tgis.RasterDataset(None)
+               >>> spat_ext = tgis.SpatialExtent(north=10, south=-10, east=20, west=-20, top=5, bottom=-5)
+               >>> map.set_spatial_extent(spat_ext)
+               >>> map.spatial_buffer_2d(10)
+               >>> print map.get_spatial_extent_as_tuple()
+               (20.0, -20.0, 30.0, -30.0, 5.0, -5.0)
 
-           @endcode
         """
         self.spatial_extent.north   += size
         self.spatial_extent.south   -= size
@@ -753,7 +747,7 @@ class AbstractMapDataset(AbstractDataset):
             self.spatial_extent.update(dbif)
 
     def check_for_correct_time(self):
-        """!Check for correct time"""
+        """Check for correct time"""
         if self.is_time_absolute():
             start, end= self.get_absolute_time()
         else:
@@ -781,24 +775,25 @@ class AbstractMapDataset(AbstractDataset):
         return True
 
     def delete(self, dbif=None, update=True, execute=True):
-        """!Delete a map entry from database if it exists
+        """Delete a map entry from database if it exists
 
             Remove dependent entries:
-            * Remove the map entry in each space time dataset in which this map
+            
+            - Remove the map entry in each space time dataset in which this map
               is registered
-            * Remove the space time dataset register table
-
-           @param dbif The database interface to be used
-           @param update Call for each unregister statement the update from
-                          registered maps of the space time dataset.
-                          This can slow down the un-registration process
-                          significantly.
-           @param execute If True the SQL DELETE and DROP table statements will
-                           be executed.
-                           If False the prepared SQL statements are
-                           returned and must be executed by the caller.
-
-           @return The SQL statements if execute=False, else an empty string,
+            - Remove the space time dataset register table
+
+           :param dbif: The database interface to be used
+           :param update: Call for each unregister statement the update from
+                                    registered maps of the space time dataset.
+                                    This can slow down the un-registration process
+                                    significantly.
+           :param execute: If True the SQL DELETE and DROP table statements will
+                                      be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
+
+           :return: The SQL statements if execute=False, else an empty string,
                    None in case of a failure
         """
         if get_enable_mapset_check() is True and self.get_mapset() != get_current_mapset():
@@ -840,19 +835,19 @@ class AbstractMapDataset(AbstractDataset):
         return statement
 
     def unregister(self, dbif=None, update=True, execute=True):
-        """! Remove the map entry in each space time dataset in which this map
+        """ Remove the map entry in each space time dataset in which this map
            is registered
 
-           @param dbif The database interface to be used
-           @param update Call for each unregister statement the update from
-                         registered maps of the space time dataset. This can
-                         slow down the un-registration process significantly.
-           @param execute If True the SQL DELETE and DROP table statements
-                          will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
+           :param dbif: The database interface to be used
+           :param update: Call for each unregister statement the update from
+                                     registered maps of the space time dataset. This can
+                                     slow down the un-registration process significantly.
+           :param execute: If True the SQL DELETE and DROP table statements
+                                      will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
 
-           @return The SQL statements if execute=False, else an empty string
+           :return: The SQL statements if execute=False, else an empty string
         """
 
 
@@ -900,13 +895,13 @@ class AbstractMapDataset(AbstractDataset):
         return statement
 
     def get_registered_stds(self, dbif=None):
-        """!Return all space time dataset ids in which this map is registered
+        """Return all space time dataset ids in which this map is registered
            as as a list of strings, or None if this map is not
            registered in any space time dataset.
 
-           @param dbif The database interface to be used
-           @return A list of ids of all space time datasets in
-                   which this map is registered
+           :param dbif: The database interface to be used
+           :return: A list of ids of all space time datasets in
+                        which this map is registered
         """
         dbif, connected = init_dbif(dbif)
 
@@ -924,16 +919,16 @@ class AbstractMapDataset(AbstractDataset):
         return datasets
 
     def add_stds_to_register(self, stds_id, dbif=None, execute=True):
-        """!Add a new space time dataset to the register
+        """Add a new space time dataset to the register
 
-           @param stds_id The id of the space time dataset to be registered
-           @param dbif The database interface to be used
-           @param execute If True the SQL INSERT table statements
-                          will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
+           :param stds_id: The id of the space time dataset to be registered
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL INSERT table statements
+                                      will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
 
-           @return The SQL statements if execute=False, else an empty string
+           :return: The SQL statements if execute=False, else an empty string
         """
         dbif, connected = init_dbif(dbif=dbif)
 
@@ -970,16 +965,16 @@ class AbstractMapDataset(AbstractDataset):
 
 
     def remove_stds_from_register(self, stds_id, dbif=None, execute=True):
-        """!Remove a space time dataset from the register
+        """Remove a space time dataset from the register
 
-           @param stds_id The id of the space time dataset to removed from the registered
-           @param dbif The database interface to be used
-           @param execute If True the SQL INSERT table statements
-                          will be executed.
-                          If False the prepared SQL statements are
-                          returned and must be executed by the caller.
+           :param stds_id: The id of the space time dataset to removed from the registered
+           :param dbif: The database interface to be used
+           :param execute: If True the SQL INSERT table statements
+                                      will be executed.
+                                      If False the prepared SQL statements are
+                                      returned and must be executed by the caller.
 
-           @return The SQL statements if execute=False, else an empty string
+           :return: The SQL statements if execute=False, else an empty string
         """
         dbif, connected = init_dbif(dbif)
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 419 - 432
lib/python/temporal/abstract_space_time_dataset.py


+ 36 - 42
lib/python/temporal/aggregation.py

@@ -1,26 +1,20 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Aggregation methods for space time raster datasets
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
 
-tgis.aggregate_raster_maps(dataset, mapset, inputs, base, start, end,
-    count, method, register_null, dbif)
+    import grass.temporal as tgis
 
-...
-@endcode
+    tgis.aggregate_raster_maps(dataset, mapset, inputs, base, start, end, count, method, register_null, dbif)
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:author: Soeren Gebbert
 """
 
 from space_time_datasets import *
@@ -30,15 +24,15 @@ import grass.script as gscript
 
 
 def collect_map_names(sp, dbif, start, end, sampling):
-    """!Gather all maps from dataset using a specific sample method
+    """Gather all maps from dataset using a specific sample method
 
-       @param sp The space time raster dataset to select aps from
-       @param dbif The temporal database interface to use
-       @param start The start time of the sample interval, may be relative or
+       :param sp: The space time raster dataset to select aps from
+       :param dbif: The temporal database interface to use
+       :param start: The start time of the sample interval, may be relative or
               absolute
-       @param end The end time of the sample interval, may be relative or
+       :param end: The end time of the sample interval, may be relative or
               absolute
-       @param sampling The sampling methods to use
+       :param sampling: The sampling methods to use
     """
 
     use_start = False
@@ -104,21 +98,21 @@ def collect_map_names(sp, dbif, start, end, sampling):
 
 def aggregate_raster_maps(inputs, base, start, end, count, method,
                           register_null, dbif,  offset=0):
-    """!Aggregate a list of raster input maps with r.series
+    """Aggregate a list of raster input maps with r.series
 
-       @param inputs The names of the raster maps to be aggregated
-       @param base The basename of the new created raster maps
-       @param start The start time of the sample interval, may be relative or
+       :param inputs: The names of the raster maps to be aggregated
+       :param base: The basename of the new created raster maps
+       :param start: The start time of the sample interval, may be relative or
                     absolute
-       @param end The end time of the sample interval, may be relative or
+       :param end: The end time of the sample interval, may be relative or
                   absolute
-       @param count The number to be attached to the basename of the new
+       :param count: The number to be attached to the basename of the new
                     created raster map
-       @param method The aggreation method to be used by r.series
-       @param register_null If true null maps will be registered in the space
+       :param method: The aggreation method to be used by r.series
+       :param register_null: If true null maps will be registered in the space
                             time raster dataset, if false not
-       @param dbif The temporal database interface to use
-       @param offset Offset to be added to the map counter to create the map ids
+       :param dbif: The temporal database interface to use
+       :param offset: Offset to be added to the map counter to create the map ids
     """
 
     msgr = get_tgis_message_interface()
@@ -184,28 +178,28 @@ def aggregate_raster_maps(inputs, base, start, end, count, method,
 def aggregate_by_topology(granularity_list,  granularity,  map_list,  topo_list,  basename,  time_suffix,
                           offset=0,  method="average",  nprocs=1,  spatial=None,  dbif=None, 
                           overwrite=False):
-    """!Aggregate a list of raster input maps with r.series
+    """Aggregate a list of raster input maps with r.series
 
-       @param granularity_list A list of AbstractMapDataset objects. 
+       :param granularity_list: A list of AbstractMapDataset objects. 
                                The temporal extents of the objects are used
                                to build the spatio-temporal topology with the map list objects
-       @param granularity The granularity of the granularity list
-       @param map_list A list of RasterDataset objects that contain the raster 
+       :param granularity: The granularity of the granularity list
+       :param map_list: A list of RasterDataset objects that contain the raster 
                        maps that should be aggregated
-       @param topo_list A list of strings of topological relations that are 
+       :param topo_list: A list of strings of topological relations that are 
                         used to select the raster maps for aggregation
-       @param basename The basename of the new generated raster maps
-       @param time_suffix Use the granularity truncated start time of the 
+       :param basename: The basename of the new generated raster maps
+       :param time_suffix: Use the granularity truncated start time of the 
                           actual granule to create the suffix for the basename
-       @param offset Use a numerical offset for suffix generation (overwritten by time_suffix)
-       @param method The aggregation method of r.series (average,min,max, ...)
-       @param nprocs The number of processes used for parallel computation
-       @param spatial This indicates if the spatial topology is created as well:
+       :param offset: Use a numerical offset for suffix generation (overwritten by time_suffix)
+       :param method: The aggregation method of r.series (average,min,max, ...)
+       :param nprocs: The number of processes used for parallel computation
+       :param spatial: This indicates if the spatial topology is created as well:
                       spatial can be None (no spatial topology), "2D" using west, east,
                       south, north or "3D" using west, east, south, north, bottom, top
-       @param dbif The database interface to be used
-       @param overwrite Overwrite existing raster maps
-       @return A list of RasterDataset objects that contain the new map names and
+       :param dbif: The database interface to be used
+       :param overwrite: Overwrite existing raster maps
+       :return: A list of RasterDataset objects that contain the new map names and
                the temporal extent for map registration
     """
     import grass.pygrass.modules as pymod

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 255 - 264
lib/python/temporal/base.py


+ 113 - 117
lib/python/temporal/c_libraries_interface.py

@@ -1,18 +1,14 @@
 # -*- coding: utf-8 -*-
-"""@package grass.pygrass.massages
-
-@brief Temporal Framework GRASS C-library interface
-
+"""
 Fast and exit-safe interface to GRASS C-library functions
 using ctypes and multiprocessing
 
-
 (C) 2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 import sys
@@ -761,118 +757,118 @@ class CLibrariesInterface(object):
 
        Usage:
 
-       @code
-       >>> import grass.script as gscript
-       >>> import grass.temporal as tgis
-       >>> gscript.use_temp_region()
-       >>> gscript.run_command("g.region", n=80.0, s=0.0, e=120.0, w=0.0,
-       ... t=1.0, b=0.0, res=10.0, res3=10.0)
-       0
-       >>> tgis.init()
-       >>> gscript.run_command("r.mapcalc", expression="test = 1", overwrite=True, quiet=True)
-       0
-       >>> gscript.run_command("r3.mapcalc", expression="test = 1", overwrite=True, quiet=True)
-       0
-       >>> gscript.run_command("v.random", output="test", n=10, overwrite=True, quiet=True)
-       0
-       >>> gscript.run_command("r.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
-       0
-       >>> gscript.run_command("r3.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
-       0
-       >>> gscript.run_command("v.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
-       0
-
-       # Check mapsets
-       >>> ciface = tgis.CLibrariesInterface()
-       >>> mapsets = ciface.available_mapsets()
-       >>> mapsets[0] == tgis.get_current_mapset()
-       True
-       
-       # Raster map
-       >>> ciface = tgis.CLibrariesInterface()
-       >>> check = ciface.raster_map_exists("test", tgis.get_current_mapset())
-       >>> print check
-       True
-       >>> ciface.read_raster_info("test", tgis.get_current_mapset())
-       {'rows': 12, 'north': 80.0, 'min': 1, 'datatype': 'CELL', 'max': 1, 'ewres': 10.0, 'cols': 8, 'west': 0.0, 'east': 120.0, 'nsres': 10.0, 'south': 0.0}
-       >>> check = ciface.has_raster_timestamp("test", tgis.get_current_mapset())
-       >>> print check
-       True
-       >>> if check:
-       ...     res = ciface.read_raster_timestamp("test", tgis.get_current_mapset())
-       ...     if res[0]:
-       ...         print str(res[1][0]), str(res[1][0])
-       ...         ciface.remove_raster_timestamp("test", tgis.get_current_mapset())
-       1995-03-12 10:34:40 1995-03-12 10:34:40
-       1
-       >>> ciface.has_raster_timestamp("test", tgis.get_current_mapset())
-       False
-       >>> ciface.write_raster_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
-       1
-       >>> ciface.has_raster_timestamp("test", tgis.get_current_mapset())
-       True
-
-
-       # 3D raster map
-       >>> check = ciface.raster3d_map_exists("test", tgis.get_current_mapset())
-       >>> print check
-       True
-       >>> ciface.read_raster3d_info("test", tgis.get_current_mapset())
-       {'tbres': 1.0, 'rows': 12, 'north': 80.0, 'bottom': 0.0, 'datatype': 'DCELL', 'max': 1.0, 'top': 1.0, 'min': 1.0, 'cols': 8, 'depths': 1, 'west': 0.0, 'ewres': 10.0, 'east': 120.0, 'nsres': 10.0, 'south': 0.0}
-       >>> check = ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
-       >>> print check
-       True
-       >>> if check:
-       ...     res = ciface.read_raster3d_timestamp("test", tgis.get_current_mapset())
-       ...     if res[0]:
-       ...         print str(res[1][0]), str(res[1][0])
-       ...         ciface.remove_raster3d_timestamp("test", tgis.get_current_mapset())
-       1995-03-12 10:34:40 1995-03-12 10:34:40
-       1
-       >>> ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
-       False
-       >>> ciface.write_raster3d_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
-       1
-       >>> ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
-       True
-
-
-       # Vector map
-       >>> check = ciface.vector_map_exists("test", tgis.get_current_mapset())
-       >>> print check
-       True
-       >>> kvp = ciface.read_vector_info("test", tgis.get_current_mapset())
-       >>> print kvp['points']
-       10
-       >>> check = ciface.has_vector_timestamp("test", tgis.get_current_mapset(), None)
-       >>> print check
-       True
-       >>> if check:
-       ...     res = ciface.read_vector_timestamp("test", tgis.get_current_mapset())
-       ...     if res[0]:
-       ...         print str(res[1][0]), str(res[1][0])
-       ...         ciface.remove_vector_timestamp("test", tgis.get_current_mapset())
-       1995-03-12 10:34:40 1995-03-12 10:34:40
-       1
-       >>> ciface.has_vector_timestamp("test", tgis.get_current_mapset())
-       False
-       >>> ciface.write_vector_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
-       1
-       >>> ciface.has_vector_timestamp("test", tgis.get_current_mapset())
-       True
-       
-       >>> ciface.get_driver_name()
-       'sqlite'
-       >>> ciface.get_database_name().split("/")[-1]
-       'sqlite.db'
-       
-       >>> mapset = ciface.get_mapset()
-       >>> location = ciface.get_location()
-       >>> gisdbase = ciface.get_gisdbase()
+       .. code-block:: python
+           
+           >>> import grass.script as gscript
+           >>> import grass.temporal as tgis
+           >>> gscript.use_temp_region()
+           >>> gscript.run_command("g.region", n=80.0, s=0.0, e=120.0, w=0.0,
+           ... t=1.0, b=0.0, res=10.0, res3=10.0)
+           0
+           >>> tgis.init()
+           >>> gscript.run_command("r.mapcalc", expression="test = 1", overwrite=True, quiet=True)
+           0
+           >>> gscript.run_command("r3.mapcalc", expression="test = 1", overwrite=True, quiet=True)
+           0
+           >>> gscript.run_command("v.random", output="test", n=10, overwrite=True, quiet=True)
+           0
+           >>> gscript.run_command("r.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
+           0
+           >>> gscript.run_command("r3.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
+           0
+           >>> gscript.run_command("v.timestamp", map="test", date='12 Mar 1995 10:34:40', overwrite=True, quiet=True)
+           0
+
+           # Check mapsets
+           >>> ciface = tgis.CLibrariesInterface()
+           >>> mapsets = ciface.available_mapsets()
+           >>> mapsets[0] == tgis.get_current_mapset()
+           True
+           
+           # Raster map
+           >>> ciface = tgis.CLibrariesInterface()
+           >>> check = ciface.raster_map_exists("test", tgis.get_current_mapset())
+           >>> print check
+           True
+           >>> ciface.read_raster_info("test", tgis.get_current_mapset())
+           {'rows': 12, 'north': 80.0, 'min': 1, 'datatype': 'CELL', 'max': 1, 'ewres': 10.0, 'cols': 8, 'west': 0.0, 'east': 120.0, 'nsres': 10.0, 'south': 0.0}
+           >>> check = ciface.has_raster_timestamp("test", tgis.get_current_mapset())
+           >>> print check
+           True
+           >>> if check:
+           ...     res = ciface.read_raster_timestamp("test", tgis.get_current_mapset())
+           ...     if res[0]:
+           ...         print str(res[1][0]), str(res[1][0])
+           ...         ciface.remove_raster_timestamp("test", tgis.get_current_mapset())
+           1995-03-12 10:34:40 1995-03-12 10:34:40
+           1
+           >>> ciface.has_raster_timestamp("test", tgis.get_current_mapset())
+           False
+           >>> ciface.write_raster_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
+           1
+           >>> ciface.has_raster_timestamp("test", tgis.get_current_mapset())
+           True
+
+
+           # 3D raster map
+           >>> check = ciface.raster3d_map_exists("test", tgis.get_current_mapset())
+           >>> print check
+           True
+           >>> ciface.read_raster3d_info("test", tgis.get_current_mapset())
+           {'tbres': 1.0, 'rows': 12, 'north': 80.0, 'bottom': 0.0, 'datatype': 'DCELL', 'max': 1.0, 'top': 1.0, 'min': 1.0, 'cols': 8, 'depths': 1, 'west': 0.0, 'ewres': 10.0, 'east': 120.0, 'nsres': 10.0, 'south': 0.0}
+           >>> check = ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
+           >>> print check
+           True
+           >>> if check:
+           ...     res = ciface.read_raster3d_timestamp("test", tgis.get_current_mapset())
+           ...     if res[0]:
+           ...         print str(res[1][0]), str(res[1][0])
+           ...         ciface.remove_raster3d_timestamp("test", tgis.get_current_mapset())
+           1995-03-12 10:34:40 1995-03-12 10:34:40
+           1
+           >>> ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
+           False
+           >>> ciface.write_raster3d_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
+           1
+           >>> ciface.has_raster3d_timestamp("test", tgis.get_current_mapset())
+           True
+
+
+           # Vector map
+           >>> check = ciface.vector_map_exists("test", tgis.get_current_mapset())
+           >>> print check
+           True
+           >>> kvp = ciface.read_vector_info("test", tgis.get_current_mapset())
+           >>> print kvp['points']
+           10
+           >>> check = ciface.has_vector_timestamp("test", tgis.get_current_mapset(), None)
+           >>> print check
+           True
+           >>> if check:
+           ...     res = ciface.read_vector_timestamp("test", tgis.get_current_mapset())
+           ...     if res[0]:
+           ...         print str(res[1][0]), str(res[1][0])
+           ...         ciface.remove_vector_timestamp("test", tgis.get_current_mapset())
+           1995-03-12 10:34:40 1995-03-12 10:34:40
+           1
+           >>> ciface.has_vector_timestamp("test", tgis.get_current_mapset())
+           False
+           >>> ciface.write_vector_timestamp("test", tgis.get_current_mapset(), "13 Jan 1999 14:30:05")
+           1
+           >>> ciface.has_vector_timestamp("test", tgis.get_current_mapset())
+           True
+           
+           >>> ciface.get_driver_name()
+           'sqlite'
+           >>> ciface.get_database_name().split("/")[-1]
+           'sqlite.db'
+           
+           >>> mapset = ciface.get_mapset()
+           >>> location = ciface.get_location()
+           >>> gisdbase = ciface.get_gisdbase()
 
-       >>> gscript.del_temp_region()
+           >>> gscript.del_temp_region()
 
-       @endcode
     """
     def __init__(self):
         self.client_conn = None
@@ -1131,7 +1127,7 @@ class CLibrariesInterface(object):
 
            :param name: The name of the map
            :param mapset: The mapset of the map
-           :param layer The layer of the vector map
+           :param layer: The layer of the vector map
            :returns: The return value of G_remove_vector_timestamp
        """
         self._check_restart_server()

+ 58 - 57
lib/python/temporal/core.py

@@ -1,28 +1,24 @@
-"""package grass.temporal
-
-GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS core functions to be used in library modules and scripts.
-
+"""
 This module provides the functionality to create the temporal
 SQL database and to establish a connection to the database.
 
 Usage:
 
+.. code-block:: python
 
->>> import grass.temporal as tgis
->>> # Create the temporal database
->>> tgis.init()
->>> # Establish a database connection
->>> dbif, connected = tgis.init_dbif(None)
->>> dbif.connect()
->>> # Execute a SQL statement
->>> dbif.execute_transaction("SELECT datetime(0, 'unixepoch', 'localtime');")
->>> # Mogrify an SQL statement
->>> dbif.mogrify_sql_statement(["SELECT name from raster_base where name = ?",
-... ("precipitation",)])
-"SELECT name from raster_base where name = 'precipitation'"
->>> dbif.close()
+    >>> import grass.temporal as tgis
+    >>> # Create the temporal database
+    >>> tgis.init()
+    >>> # Establish a database connection
+    >>> dbif, connected = tgis.init_dbif(None)
+    >>> dbif.connect()
+    >>> # Execute a SQL statement
+    >>> dbif.execute_transaction("SELECT datetime(0, 'unixepoch', 'localtime');")
+    >>> # Mogrify an SQL statement
+    >>> dbif.mogrify_sql_statement(["SELECT name from raster_base where name = ?",
+    ... ("precipitation",)])
+    "SELECT name from raster_base where name = 'precipitation'"
+    >>> dbif.close()
 
 
 (C) 2011-2014 by the GRASS Development Team
@@ -273,27 +269,27 @@ def set_raise_on_error(raise_exp=True):
     :param raise_exp: True to raise a FatalError exception instead of calling
                       sys.exit(1) when using the tgis messenger interface
 
-
-    >>> import grass.temporal as tgis
-    >>> tgis.init()
-    >>> ignore = tgis.set_raise_on_error(False)
-    >>> msgr = tgis.get_tgis_message_interface()
-    >>> tgis.get_raise_on_error()
-    False
-    >>> msgr.fatal("Ohh no no no!")
-    Traceback (most recent call last):
-      File "__init__.py", line 239, in fatal
-        sys.exit(1)
-    SystemExit: 1
-
-    >>> tgis.set_raise_on_error(True)
-    False
-    >>> msgr.fatal("Ohh no no no!")
-    Traceback (most recent call last):
-      File "__init__.py", line 241, in fatal
-        raise FatalError(message)
-    FatalError: Ohh no no no!
-
+    .. code-block:: python
+    
+        >>> import grass.temporal as tgis
+        >>> tgis.init()
+        >>> ignore = tgis.set_raise_on_error(False)
+        >>> msgr = tgis.get_tgis_message_interface()
+        >>> tgis.get_raise_on_error()
+        False
+        >>> msgr.fatal("Ohh no no no!")
+        Traceback (most recent call last):
+          File "__init__.py", line 239, in fatal
+            sys.exit(1)
+        SystemExit: 1
+
+        >>> tgis.set_raise_on_error(True)
+        False
+        >>> msgr.fatal("Ohh no no no!")
+        Traceback (most recent call last):
+          File "__init__.py", line 241, in fatal
+            raise FatalError(message)
+        FatalError: Ohh no no no!
 
     :returns: current status
     """
@@ -434,6 +430,7 @@ def init(raise_fatal_error=False):
        subprocesses are spawned.
 
        Re-run this function in case the following GRASS variables change while the process runs:
+       
        - MAPSET
        - LOCATION_NAME
        - GISDBASE
@@ -441,10 +438,12 @@ def init(raise_fatal_error=False):
        - TGIS_DISABLE_TIMESTAMP_WRITE
 
        Re-run this function if the following t.connect variables change while the process runs:
+       
        - temporal GIS driver (set by t.connect driver=)
        - temporal GIS database (set by t.connect database=)
 
        The following environmental variables are checked:
+       
         - GRASS_TGIS_PROFILE (True, False, 1, 0)
         - GRASS_TGIS_RAISE_ON_ERROR (True, False, 1, 0)
 
@@ -453,7 +452,6 @@ def init(raise_fatal_error=False):
 
         :param raise_fatal_error: Set this True to assure that the init() function
                                  does not kill a persistent process like the GUI.
-
                                  If set True a grass.pygrass.messages.FatalError
                                  exception will be raised in case a fatal error occurs
                                  in the init process, otherwise sys.exit(1) will be called.
@@ -757,9 +755,9 @@ def _create_tgis_metadata_table(content, dbif=None):
     """!Create the temporal gis metadata table which stores all metadata
        information about the temporal database.
 
-       @param content The dictionary that stores the key:value metadata
+       :param content: The dictionary that stores the key:value metadata
                       that should be stored in the metadata table
-       @param dbif The database interface to be used
+       :param dbif: The database interface to be used
     """
     dbif, connected = init_dbif(dbif)
     statement = "CREATE TABLE tgis_metadata (key VARCHAR NOT NULL, value VARCHAR);\n";
@@ -937,6 +935,7 @@ class DBConnection(object):
        and provides access to the chisen backend modules.
 
        The following DBMS are supported:
+       
          - sqlite via the sqlite3 standard library
          - postgresql via psycopg2
 
@@ -1014,7 +1013,6 @@ class DBConnection(object):
            There may be several temporal databases in a location, hence 
            close all temporal databases that have been opened. Use a dictionary
            to manage different connections.
-           
         """
         self.connection.commit()
         self.cursor.close()
@@ -1036,12 +1034,14 @@ class DBConnection(object):
 
            Usage:
 
-
-           >>> init()
-           >>> dbif = SQLDatabaseInterfaceConnection()
-           >>> dbif.mogrify_sql_statement(["SELECT ctime FROM raster_base WHERE id = ?",
-           ... ["soil@PERMANENT",]])
-           "SELECT ctime FROM raster_base WHERE id = 'soil@PERMANENT'"
+           .. code-block:: python
+           
+               >>> init()
+               >>> dbif = SQLDatabaseInterfaceConnection()
+               >>> dbif.mogrify_sql_statement(["SELECT ctime FROM raster_base WHERE id = ?",
+               ... ["soil@PERMANENT",]])
+               "SELECT ctime FROM raster_base WHERE id = 'soil@PERMANENT'"
+           
         """
         sql = content[0]
         args = content[1]
@@ -1216,15 +1216,16 @@ def init_dbif(dbif):
 
         Usage code sample:
   
+        .. code-block:: python
+        
+            dbif, connect = tgis.init_dbif(None)
 
-        dbif, connect = tgis.init_dbif(None)
-
-        sql = dbif.mogrify_sql_statement(["SELECT * FROM raster_base WHERE ? = ?"],
-                                               ["id", "soil@PERMANENT"])
-        dbif.execute_transaction(sql)
+            sql = dbif.mogrify_sql_statement(["SELECT * FROM raster_base WHERE ? = ?"],
+                                                   ["id", "soil@PERMANENT"])
+            dbif.execute_transaction(sql)
 
-        if connect:
-            dbif.close()
+            if connect:
+                dbif.close()
 
     """
     if dbif is None:

+ 283 - 289
lib/python/temporal/datetime_math.py

@@ -1,15 +1,12 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS datetime math functions to be used in library functions and modules.
+"""
+Functions for mathematical datetime operations
 
 (C) 2011-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 from datetime import datetime, date, time, timedelta
 from core import *
@@ -27,7 +24,7 @@ SECOND_AS_DAY = 1.1574074074074073e-05
 ###############################################################################
 
 def relative_time_to_time_delta(value):
-    """!Convert the double value representing days
+    """Convert the double value representing days
        into a timedelta object.
     """
 
@@ -41,7 +38,7 @@ def relative_time_to_time_delta(value):
 
 
 def time_delta_to_relative_time(delta):
-    """!Convert the time delta into a
+    """Convert the time delta into a
        double value, representing days.
     """
 
@@ -51,7 +48,7 @@ def time_delta_to_relative_time(delta):
 
 
 def relative_time_to_time_delta_seconds(value):
-    """!Convert the double value representing seconds
+    """Convert the double value representing seconds
        into a timedelta object.
     """
 
@@ -64,7 +61,7 @@ def relative_time_to_time_delta_seconds(value):
 
 
 def time_delta_to_relative_time_seconds(delta):
-    """!Convert the time delta into a
+    """Convert the time delta into a
        double value, representing seconds.
     """
 
@@ -74,159 +71,157 @@ def time_delta_to_relative_time_seconds(delta):
 
 def decrement_datetime_by_string(mydate, increment, mult=1):
 
-    """!Return a new datetime object decremented with the provided
+    """Return a new datetime object decremented with the provided
        relative dates specified as string.
        Additional a multiplier can be specified to multiply the increment
        before adding to the provided datetime object.
 
        Usage:
 
-       @code
+       .. code-block:: python
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "31 days"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2000, 12, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "31 days"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2000, 12, 1, 0, 0)
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "1 month"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2000, 12, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "1 month"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2000, 12, 1, 0, 0)
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "2 month"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2000, 11, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "2 month"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2000, 11, 1, 0, 0)
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "24 months"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(1999, 1, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "24 months"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(1999, 1, 1, 0, 0)
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "48 months"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(1997, 1, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "48 months"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(1997, 1, 1, 0, 0)
 
-        >>> dt = datetime(2001, 6, 1, 0, 0, 0)
-        >>> string = "5 months"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2001, 1, 1, 0, 0)
+            >>> dt = datetime(2001, 6, 1, 0, 0, 0)
+            >>> string = "5 months"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2001, 1, 1, 0, 0)
 
-        >>> dt = datetime(2001, 6, 1, 0, 0, 0)
-        >>> string = "7 months"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2000, 11, 1, 0, 0)
+            >>> dt = datetime(2001, 6, 1, 0, 0, 0)
+            >>> string = "7 months"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2000, 11, 1, 0, 0)
 
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "1 year"
-        >>> decrement_datetime_by_string(dt, string)
-        datetime.datetime(2000, 1, 1, 0, 0)
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "1 year"
+            >>> decrement_datetime_by_string(dt, string)
+            datetime.datetime(2000, 1, 1, 0, 0)
 
-        @endcode
 
-       @param mydate A datetime object to incremented
-       @param increment A string providing increment information:
+       :param mydate: A datetime object to incremented
+       :param increment: A string providing increment information:
                   The string may include comma separated values of type seconds,
                   minutes, hours, days, weeks, months and years
                   Example: Increment the datetime 2001-01-01 00:00:00
                   with "60 seconds, 4 minutes, 12 hours, 10 days, 1 weeks, 5 months, 1 years"
                   will result in the datetime 2003-02-18 12:05:00
-       @param mult A multiplier, default is 1
-       @return The new datetime object or none in case of an error
+       :param mult: A multiplier, default is 1
+       :return: The new datetime object or none in case of an error
     """
     return modify_datetime_by_string(mydate, increment, mult, sign=int(-1))
 
 ###############################################################################
 
 def increment_datetime_by_string(mydate, increment, mult=1):
-    """!Return a new datetime object incremented with the provided
+    """Return a new datetime object incremented with the provided
        relative dates specified as string.
        Additional a multiplier can be specified to multiply the increment
        before adding to the provided datetime object.
 
        Usage:
 
-       @code
-
-        >>> dt = datetime(2001, 9, 1, 0, 0, 0)
-        >>> string = "60 seconds, 4 minutes, 12 hours, 10 days, 1 weeks, 5 months, 1 years"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2003, 2, 18, 12, 5)
-
-        >>> dt = datetime(2001, 11, 1, 0, 0, 0)
-        >>> string = "1 months"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2001, 12, 1, 0, 0)
-
-        >>> dt = datetime(2001, 11, 1, 0, 0, 0)
-        >>> string = "13 months"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2002, 12, 1, 0, 0)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "72 months"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2007, 1, 1, 0, 0)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "72 months"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2007, 1, 1, 0, 0)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "5 minutes"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2001, 1, 1, 0, 5)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "49 hours"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2001, 1, 3, 1, 0)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "3600 seconds"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2001, 1, 1, 1, 0)
-
-        >>> dt = datetime(2001, 1, 1, 0, 0, 0)
-        >>> string = "30 days"
-        >>> increment_datetime_by_string(dt, string)
-        datetime.datetime(2001, 1, 31, 0, 0)
-
-        @endcode
-
-       @param mydate A datetime object to incremented
-       @param increment A string providing increment information:
+       .. code-block:: python
+
+            >>> dt = datetime(2001, 9, 1, 0, 0, 0)
+            >>> string = "60 seconds, 4 minutes, 12 hours, 10 days, 1 weeks, 5 months, 1 years"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2003, 2, 18, 12, 5)
+
+            >>> dt = datetime(2001, 11, 1, 0, 0, 0)
+            >>> string = "1 months"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2001, 12, 1, 0, 0)
+
+            >>> dt = datetime(2001, 11, 1, 0, 0, 0)
+            >>> string = "13 months"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2002, 12, 1, 0, 0)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "72 months"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2007, 1, 1, 0, 0)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "72 months"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2007, 1, 1, 0, 0)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "5 minutes"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2001, 1, 1, 0, 5)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "49 hours"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2001, 1, 3, 1, 0)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "3600 seconds"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2001, 1, 1, 1, 0)
+
+            >>> dt = datetime(2001, 1, 1, 0, 0, 0)
+            >>> string = "30 days"
+            >>> increment_datetime_by_string(dt, string)
+            datetime.datetime(2001, 1, 31, 0, 0)
+
+
+       :param mydate: A datetime object to incremented
+       :param increment: A string providing increment information:
                   The string may include comma separated values of type seconds,
                   minutes, hours, days, weeks, months and years
                   Example: Increment the datetime 2001-01-01 00:00:00
                   with "60 seconds, 4 minutes, 12 hours, 10 days, 1 weeks, 5 months, 1 years"
                   will result in the datetime 2003-02-18 12:05:00
-       @param mult A multiplier, default is 1
-       @return The new datetime object or none in case of an error
+       :param mult: A multiplier, default is 1
+       :return: The new datetime object or none in case of an error
     """
     return modify_datetime_by_string(mydate, increment, mult, sign=int(1))
 
 ###############################################################################
 
 def modify_datetime_by_string(mydate, increment, mult=1, sign=1):
-    """!Return a new datetime object incremented with the provided
+    """Return a new datetime object incremented with the provided
        relative dates specified as string.
        Additional a multiplier can be specified to multiply the increment
        before adding to the provided datetime object.
 
-       @param mydate A datetime object to incremented
-       @param increment A string providing increment information:
+       :param mydate: A datetime object to incremented
+       :param increment: A string providing increment information:
                   The string may include comma separated values of type seconds,
                   minutes, hours, days, weeks, months and years
                   Example: Increment the datetime 2001-01-01 00:00:00
                   with "60 seconds, 4 minutes, 12 hours, 10 days, 1 weeks, 5 months, 1 years"
                   will result in the datetime 2003-02-18 12:05:00
-       @param mult A multiplier, default is 1
-       @param sign Choose 1 for positive sign (incrementing) or -1 for negative
+       :param mult: A multiplier, default is 1
+       :param sign: Choose 1 for positive sign (incrementing) or -1 for negative
                    sign (decrementing).
-       @return The new datetime object or none in case of an error
+       :return: The new datetime object or none in case of an error
     """
     sign  = int(sign)
     if sign != 1 and sign != -1:
@@ -279,7 +274,7 @@ def modify_datetime_by_string(mydate, increment, mult=1, sign=1):
 
 def modify_datetime(mydate, years=0, months=0, weeks=0, days=0, hours=0,
                        minutes=0, seconds=0):
-    """!Return a new datetime object incremented with the provided
+    """Return a new datetime object incremented with the provided
        relative dates and times"""
 
     tdelta_seconds = timedelta(seconds=seconds)
@@ -354,7 +349,7 @@ def modify_datetime(mydate, years=0, months=0, weeks=0, days=0, hours=0,
 
 
 def adjust_datetime_to_granularity(mydate, granularity):
-    """!Modify the datetime object to fit the given granularity
+    """Modify the datetime object to fit the given granularity
 
         - Years will start at the first of Januar
         - Months will start at the first day of the month
@@ -364,43 +359,42 @@ def adjust_datetime_to_granularity(mydate, granularity):
 
         Usage:
 
-        @code
+        .. code-block:: python
 
-        >>> dt = datetime(2001, 8, 8, 12,30,30)
-        >>> adjust_datetime_to_granularity(dt, "5 seconds")
-        datetime.datetime(2001, 8, 8, 12, 30, 30)
+            >>> dt = datetime(2001, 8, 8, 12,30,30)
+            >>> adjust_datetime_to_granularity(dt, "5 seconds")
+            datetime.datetime(2001, 8, 8, 12, 30, 30)
 
-        >>> adjust_datetime_to_granularity(dt, "20 minutes")
-        datetime.datetime(2001, 8, 8, 12, 30)
+            >>> adjust_datetime_to_granularity(dt, "20 minutes")
+            datetime.datetime(2001, 8, 8, 12, 30)
 
-        >>> adjust_datetime_to_granularity(dt, "20 minutes")
-        datetime.datetime(2001, 8, 8, 12, 30)
+            >>> adjust_datetime_to_granularity(dt, "20 minutes")
+            datetime.datetime(2001, 8, 8, 12, 30)
 
-        >>> adjust_datetime_to_granularity(dt, "3 hours")
-        datetime.datetime(2001, 8, 8, 12, 0)
+            >>> adjust_datetime_to_granularity(dt, "3 hours")
+            datetime.datetime(2001, 8, 8, 12, 0)
 
-        >>> adjust_datetime_to_granularity(dt, "5 days")
-        datetime.datetime(2001, 8, 8, 0, 0)
+            >>> adjust_datetime_to_granularity(dt, "5 days")
+            datetime.datetime(2001, 8, 8, 0, 0)
 
-        >>> adjust_datetime_to_granularity(dt, "2 weeks")
-        datetime.datetime(2001, 8, 6, 0, 0)
+            >>> adjust_datetime_to_granularity(dt, "2 weeks")
+            datetime.datetime(2001, 8, 6, 0, 0)
 
-        >>> adjust_datetime_to_granularity(dt, "6 months")
-        datetime.datetime(2001, 8, 1, 0, 0)
+            >>> adjust_datetime_to_granularity(dt, "6 months")
+            datetime.datetime(2001, 8, 1, 0, 0)
 
-        >>> adjust_datetime_to_granularity(dt, "2 years")
-        datetime.datetime(2001, 1, 1, 0, 0)
+            >>> adjust_datetime_to_granularity(dt, "2 years")
+            datetime.datetime(2001, 1, 1, 0, 0)
 
-        >>> adjust_datetime_to_granularity(dt, "2 years, 3 months, 5 days, 3 hours, 3 minutes, 2 seconds")
-        datetime.datetime(2001, 8, 8, 12, 30, 30)
+            >>> adjust_datetime_to_granularity(dt, "2 years, 3 months, 5 days, 3 hours, 3 minutes, 2 seconds")
+            datetime.datetime(2001, 8, 8, 12, 30, 30)
 
-        >>> adjust_datetime_to_granularity(dt, "3 months, 5 days, 3 minutes")
-        datetime.datetime(2001, 8, 8, 12, 30)
+            >>> adjust_datetime_to_granularity(dt, "3 months, 5 days, 3 minutes")
+            datetime.datetime(2001, 8, 8, 12, 30)
 
-        >>> adjust_datetime_to_granularity(dt, "3 weeks, 5 days")
-        datetime.datetime(2001, 8, 8, 0, 0)
+            >>> adjust_datetime_to_granularity(dt, "3 weeks, 5 days")
+            datetime.datetime(2001, 8, 8, 0, 0)
 
-        @endcode
     """
 
     if granularity:
@@ -486,136 +480,135 @@ def adjust_datetime_to_granularity(mydate, granularity):
 
 
 def compute_datetime_delta(start, end):
-    """!Return a dictionary with the accumulated delta in year, month, day,
+    """Return a dictionary with the accumulated delta in year, month, day,
        hour, minute and second
 
         Usage:
 
-        @code
-
-        >>> start = datetime(2001, 1, 1, 00,00,00)
-        >>> end = datetime(2001, 1, 1, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 0, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2001, 1, 1, 00,00,14)
-        >>> end = datetime(2001, 1, 1, 00,00,44)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 0, 'second': 30, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2001, 1, 1, 00,00,44)
-        >>> end = datetime(2001, 1, 1, 00,01,14)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 0, 'second': 30, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 1}
-
-        >>> start = datetime(2001, 1, 1, 00,00,30)
-        >>> end = datetime(2001, 1, 1, 00,05,30)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 0, 'second': 300, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 5}
-
-        >>> start = datetime(2001, 1, 1, 00,00,00)
-        >>> end = datetime(2001, 1, 1, 00,01,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 0, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 1}
-
-        >>> start = datetime(2011,10,31, 00,45,00)
-        >>> end = datetime(2011,10,31, 01,45,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 60}
-
-        >>> start = datetime(2011,10,31, 00,45,00)
-        >>> end = datetime(2011,10,31, 01,15,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 30}
-
-        >>> start = datetime(2011,10,31, 00,45,00)
-        >>> end = datetime(2011,10,31, 12,15,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 12, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 690}
-
-        >>> start = datetime(2011,10,31, 00,00,00)
-        >>> end = datetime(2011,10,31, 01,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,10,31, 00,00,00)
-        >>> end = datetime(2011,11,01, 01,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 25, 'second': 0, 'max_days': 1, 'year': 0, 'day': 1, 'minute': 0}
-
-        >>> start = datetime(2011,10,31, 12,00,00)
-        >>> end = datetime(2011,11,01, 06,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 18, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,11,01, 00,00,00)
-        >>> end = datetime(2011,12,01, 01,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 721, 'month': 1, 'second': 0, 'max_days': 30, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,11,01, 00,00,00)
-        >>> end = datetime(2011,11,05, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'second': 0, 'max_days': 4, 'year': 0, 'day': 4, 'minute': 0}
-
-        >>> start = datetime(2011,10,06, 00,00,00)
-        >>> end = datetime(2011,11,05, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'second': 0, 'max_days': 30, 'year': 0, 'day': 30, 'minute': 0}
-
-        >>> start = datetime(2011,12,02, 00,00,00)
-        >>> end = datetime(2012,01,01, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'second': 0, 'max_days': 30, 'year': 1, 'day': 30, 'minute': 0}
-
-        >>> start = datetime(2011,01,01, 00,00,00)
-        >>> end = datetime(2011,02,01, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 1, 'second': 0, 'max_days': 31, 'year': 0, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,12,01, 00,00,00)
-        >>> end = datetime(2012,01,01, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 1, 'second': 0, 'max_days': 31, 'year': 1, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,12,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 6, 'second': 0, 'max_days': 183, 'year': 1, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2021,06,01, 00,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 120, 'second': 0, 'max_days': 3653, 'year': 10, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 12,00,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 8796, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 12,30,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 8796, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 527790}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 12,00,05)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 8796, 'month': 12, 'second': 31665605, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 00,30,00)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 527070}
-
-        >>> start = datetime(2011,06,01, 00,00,00)
-        >>> end = datetime(2012,06,01, 00,00,05)
-        >>> compute_datetime_delta(start, end)
-        {'hour': 0, 'month': 12, 'second': 31622405, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
-
-        @endcode
-
-       @return A dictionary with year, month, day, hour, minute and second as keys()
+        .. code-block:: python
+
+            >>> start = datetime(2001, 1, 1, 00,00,00)
+            >>> end = datetime(2001, 1, 1, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 0, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2001, 1, 1, 00,00,14)
+            >>> end = datetime(2001, 1, 1, 00,00,44)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 0, 'second': 30, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2001, 1, 1, 00,00,44)
+            >>> end = datetime(2001, 1, 1, 00,01,14)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 0, 'second': 30, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 1}
+
+            >>> start = datetime(2001, 1, 1, 00,00,30)
+            >>> end = datetime(2001, 1, 1, 00,05,30)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 0, 'second': 300, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 5}
+
+            >>> start = datetime(2001, 1, 1, 00,00,00)
+            >>> end = datetime(2001, 1, 1, 00,01,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 0, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 1}
+
+            >>> start = datetime(2011,10,31, 00,45,00)
+            >>> end = datetime(2011,10,31, 01,45,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 60}
+
+            >>> start = datetime(2011,10,31, 00,45,00)
+            >>> end = datetime(2011,10,31, 01,15,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 30}
+
+            >>> start = datetime(2011,10,31, 00,45,00)
+            >>> end = datetime(2011,10,31, 12,15,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 12, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 690}
+
+            >>> start = datetime(2011,10,31, 00,00,00)
+            >>> end = datetime(2011,10,31, 01,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 1, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,10,31, 00,00,00)
+            >>> end = datetime(2011,11,01, 01,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 25, 'second': 0, 'max_days': 1, 'year': 0, 'day': 1, 'minute': 0}
+
+            >>> start = datetime(2011,10,31, 12,00,00)
+            >>> end = datetime(2011,11,01, 06,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 18, 'second': 0, 'max_days': 0, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,11,01, 00,00,00)
+            >>> end = datetime(2011,12,01, 01,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 721, 'month': 1, 'second': 0, 'max_days': 30, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,11,01, 00,00,00)
+            >>> end = datetime(2011,11,05, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'second': 0, 'max_days': 4, 'year': 0, 'day': 4, 'minute': 0}
+
+            >>> start = datetime(2011,10,06, 00,00,00)
+            >>> end = datetime(2011,11,05, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'second': 0, 'max_days': 30, 'year': 0, 'day': 30, 'minute': 0}
+
+            >>> start = datetime(2011,12,02, 00,00,00)
+            >>> end = datetime(2012,01,01, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'second': 0, 'max_days': 30, 'year': 1, 'day': 30, 'minute': 0}
+
+            >>> start = datetime(2011,01,01, 00,00,00)
+            >>> end = datetime(2011,02,01, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 1, 'second': 0, 'max_days': 31, 'year': 0, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,12,01, 00,00,00)
+            >>> end = datetime(2012,01,01, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 1, 'second': 0, 'max_days': 31, 'year': 1, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,12,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 6, 'second': 0, 'max_days': 183, 'year': 1, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2021,06,01, 00,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 120, 'second': 0, 'max_days': 3653, 'year': 10, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 12,00,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 8796, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 12,30,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 8796, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 527790}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 12,00,05)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 8796, 'month': 12, 'second': 31665605, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 00,30,00)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 12, 'second': 0, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 527070}
+
+            >>> start = datetime(2011,06,01, 00,00,00)
+            >>> end = datetime(2012,06,01, 00,00,05)
+            >>> compute_datetime_delta(start, end)
+            {'hour': 0, 'month': 12, 'second': 31622405, 'max_days': 366, 'year': 1, 'day': 0, 'minute': 0}
+
+
+       :return: A dictionary with year, month, day, hour, minute and second as keys()
     """
     comp = {}
 
@@ -702,16 +695,17 @@ def compute_datetime_delta(start, end):
 
 
 def check_datetime_string(time_string):
-    """!Check if  a string can be converted into a datetime object
+    """Check if  a string can be converted into a datetime object
 
         Supported ISO string formats are:
+        
         - YYYY-mm-dd
         - YYYY-mm-dd HH:MM:SS
 
         Time zones are not supported
 
-        @param time_string The time string to be checked for conversion
-        @return datetime object or an error message string in case of an error
+        :param time_string: The time string to be checked for conversion
+        :return: datetime: object or an error message string in case of an error
     """
 
     global has_dateutil
@@ -754,9 +748,10 @@ def check_datetime_string(time_string):
 
 
 def string_to_datetime(time_string):
-    """!Convert a string into a datetime object
+    """Convert a string into a datetime object
 
         In case datutil is not installed the supported ISO string formats are:
+        
         - YYYY-mm-dd
         - YYYY-mm-dd HH:MM:SS
         - Time zones are not supported
@@ -764,8 +759,8 @@ def string_to_datetime(time_string):
         If dateutil is installed, all string formats of the dateutil module
         are supported, as well as time zones
 
-        @param time_string The time string to convert
-        @return datetime object or None in case the string 
+        :param time_string: The time string to convert
+        :return: datetime: object or None in case the string 
                          could not be converted
     """
 
@@ -784,26 +779,25 @@ def string_to_datetime(time_string):
 
 
 def datetime_to_grass_datetime_string(dt):
-    """!Convert a python datetime object into a GRASS datetime string
+    """Convert a python datetime object into a GRASS datetime string
     
-    @code
+    .. code-block:: python
     
-    >>> import grass.temporal as tgis
-    >>> import dateutil.parser as parser
-    >>> dt = parser.parse("2011-01-01 10:00:00 +01:30")
-    >>> tgis.datetime_to_grass_datetime_string(dt)
-    '01 jan 2011 10:00:00 +0090'
-    >>> dt = parser.parse("2011-01-01 10:00:00 +02:30")
-    >>> tgis.datetime_to_grass_datetime_string(dt)
-    '01 jan 2011 10:00:00 +0150'
-    >>> dt = parser.parse("2011-01-01 10:00:00 +12:00")
-    >>> tgis.datetime_to_grass_datetime_string(dt)
-    '01 jan 2011 10:00:00 +0720'
-    >>> dt = parser.parse("2011-01-01 10:00:00 -01:30")
-    >>> tgis.datetime_to_grass_datetime_string(dt)
-    '01 jan 2011 10:00:00 -0090'
+        >>> import grass.temporal as tgis
+        >>> import dateutil.parser as parser
+        >>> dt = parser.parse("2011-01-01 10:00:00 +01:30")
+        >>> tgis.datetime_to_grass_datetime_string(dt)
+        '01 jan 2011 10:00:00 +0090'
+        >>> dt = parser.parse("2011-01-01 10:00:00 +02:30")
+        >>> tgis.datetime_to_grass_datetime_string(dt)
+        '01 jan 2011 10:00:00 +0150'
+        >>> dt = parser.parse("2011-01-01 10:00:00 +12:00")
+        >>> tgis.datetime_to_grass_datetime_string(dt)
+        '01 jan 2011 10:00:00 +0720'
+        >>> dt = parser.parse("2011-01-01 10:00:00 -01:30")
+        >>> tgis.datetime_to_grass_datetime_string(dt)
+        '01 jan 2011 10:00:00 -0090'
     
-    @endcode
     """
     # GRASS datetime month names
     month_names = ["", "jan", "feb", "mar", "apr", "may", "jun",
@@ -843,14 +837,14 @@ suffix_units = {"years" : "%Y",
 
 
 def create_suffix_from_datetime(start_time,  granularity):
-    """!Create a datetime string based on a datetime object and a provided
+    """Create a datetime string based on a datetime object and a provided
        granularity that can be used as suffix for map names.
        
        dateteime=2001-01-01 00:00:00, granularity="1 month" returns "2001_01"
        
-       @param start_time The datetime object
-       @param granularity The granularity for example "1 month" or "100 seconds"
-       @return A string
+       :param start_time: The datetime object
+       :param granularity: The granularity for example "1 month" or "100 seconds"
+       :return: A string
     """
     global suffix_units
     return start_time.strftime(suffix_units[granularity.split(' ')[1]]) 

+ 14 - 17
lib/python/temporal/extract.py

@@ -1,15 +1,12 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Extract functions for space time raster, 3d raster and vector datasets
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from grass.script.utils import get_num_suffix
@@ -24,28 +21,28 @@ import grass.script as gscript
 def extract_dataset(input, output, type, where, expression, base, nprocs=1,
                     register_null=False, layer=1,
                     vtype="point,line,boundary,centroid,area,face"):
-    """!Extract a subset of a space time raster, raster3d or vector dataset
+    """Extract a subset of a space time raster, raster3d or vector dataset
 
        A mapcalc expression can be provided to process the temporal extracted
        maps.
        Mapcalc expressions are supported for raster and raster3d maps.
 
-       @param input The name of the input space time raster/raster3d dataset
-       @param output The name of the extracted new space time raster/raster3d
+       :param input: The name of the input space time raster/raster3d dataset
+       :param output: The name of the extracted new space time raster/raster3d
                      dataset
-       @param type The type of the dataset: "raster", "raster3d" or vector
-       @param where The temporal SQL WHERE statement for subset extraction
-       @param expression The r(3).mapcalc expression or the v.extract where
+       :param type: The type of the dataset: "raster", "raster3d" or vector
+       :param where: The temporal SQL WHERE statement for subset extraction
+       :param expression: The r(3).mapcalc expression or the v.extract where
                          statement
-       @param base The base name of the new created maps in case a mapclac
+       :param base: The base name of the new created maps in case a mapclac
                    expression is provided
-       @param nprocs The number of parallel processes to be used for mapcalc
+       :param nprocs: The number of parallel processes to be used for mapcalc
                      processing
-       @param register_null Set this number True to register empty maps
+       :param register_null: Set this number True to register empty maps
                             (only raster and raster3d maps)
-       @param layer The vector layer number to be used when no timestamped
+       :param layer: The vector layer number to be used when no timestamped
               layer is present, default is 1
-       @param vtype The feature type to be extracted for vector maps, default
+       :param vtype: The feature type to be extracted for vector maps, default
               is point,line,boundary,centroid,area and face
     """
 

+ 10 - 14
lib/python/temporal/factory.py

@@ -1,25 +1,21 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Object factory
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
+
+    import grass.temporal as tgis
 
-tgis.register_maps_in_space_time_dataset(type, name, maps)
+    tgis.register_maps_in_space_time_dataset(type, name, maps)
 
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from space_time_datasets import *
@@ -28,11 +24,11 @@ from space_time_datasets import *
 
 
 def dataset_factory(type, id):
-    """!A factory functions to create space time or map datasets
+    """A factory functions to create space time or map datasets
 
-       @param type the dataset type: rast or raster, rast3d,
+       :param type: the dataset type: rast or raster, rast3d,
                     vect or vector, strds, str3ds, stvds
-       @param id The id of the dataset ("name@mapset")
+       :param id: The id of the dataset ("name@mapset")
     """
     if type == "strds":
         sp = SpaceTimeRasterDataset(id)

+ 15 - 17
lib/python/temporal/gui_support.py

@@ -1,8 +1,5 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+GUI support functions
 
 
 (C) 2008-2011 by the GRASS Development Team
@@ -10,7 +7,7 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from space_time_datasets import *
@@ -20,21 +17,22 @@ import grass.script as gscript
 ###############################################################################
 
 def tlist_grouped(type, group_type = False, dbif=None):
-    """!List of temporal elements grouped by mapsets.
+    """List of temporal elements grouped by mapsets.
 
     Returns a dictionary where the keys are mapset 
     names and the values are lists of space time datasets in that
     mapset. Example:
 
-    @code
-    >>> tgis.tlist_grouped('strds')['PERMANENT']
-    ['precipitation', 'temperature']
-    @endcode
+    .. code-block:: python
+    
+        >>> tgis.tlist_grouped('strds')['PERMANENT']
+        ['precipitation', 'temperature']
+
     
-    @param type element type (strds, str3ds, stvds)
-    @param group_type TBD
+    :param type: element type (strds, str3ds, stvds)
+    :param group_type: TBD
 
-    @return directory of mapsets/elements
+    :return: directory of mapsets/elements
     """
     result = {}
     dbif, connected = init_dbif(dbif)
@@ -80,11 +78,11 @@ def tlist_grouped(type, group_type = False, dbif=None):
 ###############################################################################
 
 def tlist(type, dbif=None):
-    """!Return a list of space time datasets of absolute and relative time
+    """Return a list of space time datasets of absolute and relative time
      
-    @param type element type (strds, str3ds, stvds)
+    :param type: element type (strds, str3ds, stvds)
 
-    @return a list of space time dataset ids
+    :return: a list of space time dataset ids
     """
     id = None
     sp = dataset_factory(type, id)

+ 52 - 51
lib/python/temporal/list_stds.py

@@ -1,25 +1,21 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Functions to create space time dataset lists
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
+
+    import grass.temporal as tgis
 
-tgis.register_maps_in_space_time_dataset(type, name, maps)
+    tgis.register_maps_in_space_time_dataset(type, name, maps)
 
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from space_time_datasets import *
@@ -29,40 +25,43 @@ from open_stds import *
 ###############################################################################
 
 def get_dataset_list(type,  temporal_type,  columns=None,  where=None,  order=None):
-    """! Return a list of time stamped maps or space time datasets of a specific temporal type
+    """ Return a list of time stamped maps or space time datasets of a specific temporal type
          that are registred in the temporal database
     
          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, rast3d, vect)
-        @param temporal_type The temporal type of the datasets (absolute, relative)
-        @param columns A comma separated list of columns that will be selected
-        @param where A where statement for selected listing without "WHERE"
-        @param order A comma separated list of columns to order the
+        :param type: The type of the datasets (strds, str3ds, stvds, rast, rast3d, vect)
+        :param temporal_type: The temporal type of the datasets (absolute, relative)
+        :param columns: A comma separated list of columns that will be selected
+        :param where: A where statement for selected listing without "WHERE"
+        :param order: A comma separated list of columns to order the
                                datasets by category
                       
-        @return A dictionary with the rows of the SQL query for each available mapset
+        :return: A dictionary with the rows of the SQL query for each available mapset
         
-        >>> import grass.temporal as tgis
-        >>> tgis.init()
-        >>> name = "list_stds_test"
-        >>> sp = tgis.open_new_stds(name=name, type="strds", 
-        ... temporaltype="absolute", title="title", descr="descr", semantic="mean", dbif=None, overwrite=True)
-        >>> mapset = tgis.get_current_mapset()
-        >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name")
-        >>> rows =  stds_list[mapset]
-        >>> for row in rows:
-        ...     if row["name"] == name:
-        ...         print True
-        True
-        >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset))
-        >>> rows =  stds_list[mapset]
-        >>> for row in rows:
-        ...     if row["name"] == name and row["mapset"] == mapset:
-        ...         print True
-        True
-        >>> check = sp.delete()
+        .. code-block:: python
+        
+            >>> import grass.temporal as tgis
+            >>> tgis.init()
+            >>> name = "list_stds_test"
+            >>> sp = tgis.open_new_stds(name=name, type="strds", 
+            ... temporaltype="absolute", title="title", descr="descr", semantic="mean", dbif=None, overwrite=True)
+            >>> mapset = tgis.get_current_mapset()
+            >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name")
+            >>> rows =  stds_list[mapset]
+            >>> for row in rows:
+            ...     if row["name"] == name:
+            ...         print True
+            True
+            >>> stds_list = tgis.get_dataset_list("strds", "absolute", columns="name,mapset", where="mapset = '%s'"%(mapset))
+            >>> rows =  stds_list[mapset]
+            >>> for row in rows:
+            ...     if row["name"] == name and row["mapset"] == mapset:
+            ...         print True
+            True
+            >>> check = sp.delete()
+
     """
     id = None
     sp = dataset_factory(type, id)
@@ -106,29 +105,31 @@ def get_dataset_list(type,  temporal_type,  columns=None,  where=None,  order=No
 ###############################################################################
 
 def list_maps_of_stds(type, input, columns, order, where, separator, method, no_header=False, gran=None):
-    """! List the maps of a space time dataset using diffetent methods
+    """ List the maps of a space time dataset using diffetent methods
 
-        @param type The type of the maps raster, raster3d or vector
-        @param input Name of a space time raster dataset
-        @param columns A comma separated list of columns to be printed to stdout
-        @param order A comma separated list of columns to order the
+        :param type: The type of the maps raster, raster3d or vector
+        :param input: Name of a space time raster dataset
+        :param columns: A comma separated list of columns to be printed to stdout
+        :param order: A comma separated list of columns to order the
                       maps by category
-        @param where A where statement for selected listing without "WHERE"
+        :param where: A where statement for selected listing without "WHERE"
                       e.g: start_time < "2001-01-01" and end_time > "2001-01-01"
-        @param separator The field separator character between the columns
-        @param method String identifier to select a method out of cols,
+        :param separator: The field separator character between the columns
+        :param method: String identifier to select a method out of cols,
                        comma,delta or deltagaps
+                       
             - "cols" Print preselected columns specified by columns
             - "comma" Print the map ids ("name@mapset") as comma separated string
             - "delta" Print the map ids ("name@mapset") with start time,
-                       end time, relative length of intervals and the relative
-                       distance to the begin
+               end time, relative length of intervals and the relative
+               distance to the begin
             - "deltagaps" Same as "delta" with additional listing of gaps.
-                           Gaps can be simply identified as the id is "None"
+              Gaps can be simply identified as the id is "None"
             - "gran" List map using the granularity of the space time dataset,
-                      columns are identical to deltagaps
-       @param no_header Supress the printing of column names
-        @param gran The user defined granule to be used if method=gran is set, in case gran=None the
+              columns are identical to deltagaps
+                      
+        :param no_header: Supress the printing of column names
+        :param gran: The user defined granule to be used if method=gran is set, in case gran=None the
             granule of the space time dataset is used
     """
 

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

@@ -1,15 +1,12 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Raster and 3d raster mapcalculation functions
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from space_time_datasets import *
@@ -22,7 +19,7 @@ import grass.script as gscript
 
 def dataset_mapcalculator(inputs, output, type, expression, base, method,
                           nprocs=1, register_null=False, spatial=False):
-    """!Perform map-calculations of maps from different space time
+    """Perform map-calculations of maps from different space time
        raster/raster3d datasets, using a specific sampling method
        to select temporal related maps.
 
@@ -31,6 +28,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
        the r.mapcalc operators:
 
        Supported operators for relative and absolute time are:
+       
        - td() - the time delta of the current interval in days
                 and fractions of days or the unit in case of relative time
        - start_time() - The start time of the interval from the begin of
@@ -41,6 +39,7 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
                       unit in case of relative time
 
        Supported operators for absolute time:
+       
        - start_doy() - Day of year (doy) from the start time [1 - 366]
        - start_dow() - Day of week (dow) from the start time [1 - 7],
                        the start of the week is monday == 1
@@ -63,17 +62,17 @@ def dataset_mapcalculator(inputs, output, type, expression, base, method,
        - end_minute() - The minute of the end time [0 - 59]
        - end_second() - The minute of the end time [0 - 59]
 
-       @param inputs The names of the input space time raster/raster3d datasets
-       @param output The name of the extracted new space time raster(3d) dataset
-       @param type The type of the dataset: "raster" or "raster3d"
-       @param expression The r(3).mapcalc expression
-       @param base The base name of the new created maps in case a
+       :param inputs: The names of the input space time raster/raster3d datasets
+       :param output: The name of the extracted new space time raster(3d) dataset
+       :param type: The type of the dataset: "raster" or "raster3d"
+       :param expression: The r(3).mapcalc expression
+       :param base: The base name of the new created maps in case a
               mapclac expression is provided
-       @param method The method to be used for temporal sampling
-       @param nprocs The number of parallel processes to be used for
+       :param method: The method to be used for temporal sampling
+       :param nprocs: The number of parallel processes to be used for
               mapcalc processing
-       @param register_null Set this number True to register empty maps
-       @param spatial Check spatial overlap
+       :param register_null: Set this number True to register empty maps
+       :param spatial: Check spatial overlap
     """
 
     # We need a database interface for fast computation
@@ -363,37 +362,38 @@ def _operator_parser(expr, first, current):
        the temporal operators with numerical values.
 
        Supported operators for relative and absolute time are:
-       * td() - the time delta of the current interval in days
+       
+       - td() - the time delta of the current interval in days
          and fractions of days or the unit in case of relative time
-       * start_time() - The start time of the interval from the begin of the
+       - start_time() - The start time of the interval from the begin of the
                         time series in days and fractions of days or the unit
                         in case of relative time
-       * end_time() - The end time of the current interval from the begin of
+       - end_time() - The end time of the current interval from the begin of
                       the time series in days and fractions of days or the
                       unit in case of relative time
 
        Supported operators for absolute time:
-       * start_doy() - Day of year (doy) from the start time [1 - 366]
-       * start_dow() - Day of week (dow) from the start time [1 - 7],
+       
+       - start_doy() - Day of year (doy) from the start time [1 - 366]
+       - start_dow() - Day of week (dow) from the start time [1 - 7],
                        the start of the week is monday == 1
-       * start_year() - The year of the start time [0 - 9999]
-       * start_month() - The month of the start time [1 - 12]
-       * start_week() - Week of year of the start time [1 - 54]
-       * start_day() - Day of month from the start time [1 - 31]
-       * start_hour() - The hour of the start time [0 - 23]
-       * start_minute() - The minute of the start time [0 - 59]
-       * start_second() - The second of the start time [0 - 59]
-
-       * end_doy() - Day of year (doy) from the end time [1 - 366]
-       * end_dow() - Day of week (dow) from the end time [1 - 7],
+       - start_year() - The year of the start time [0 - 9999]
+       - start_month() - The month of the start time [1 - 12]
+       - start_week() - Week of year of the start time [1 - 54]
+       - start_day() - Day of month from the start time [1 - 31]
+       - start_hour() - The hour of the start time [0 - 23]
+       - start_minute() - The minute of the start time [0 - 59]
+       - start_second() - The second of the start time [0 - 59]
+       - end_doy() - Day of year (doy) from the end time [1 - 366]
+       - end_dow() - Day of week (dow) from the end time [1 - 7],
                      the start of the week is monday == 1
-       * end_year() - The year of the end time [0 - 9999]
-       * end_month() - The month of the end time [1 - 12]
-       * end_week() - Week of year of the end time [1 - 54]
-       * end_day() - Day of month from the end time [1 - 31]
-       * end_hour() - The hour of the end time [0 - 23]
-       * end_minute() - The minute of the end time [0 - 59]
-       * end_second() - The minute of the end time [0 - 59]
+       - end_year() - The year of the end time [0 - 9999]
+       - end_month() - The month of the end time [1 - 12]
+       - end_week() - Week of year of the end time [1 - 54]
+       - end_day() - Day of month from the end time [1 - 31]
+       - end_hour() - The hour of the end time [0 - 23]
+       - end_minute() - The minute of the end time [0 - 59]
+       - end_second() - The minute of the end time [0 - 59]
 
        The modified expression is returned.
 
@@ -414,16 +414,16 @@ def _operator_parser(expr, first, current):
 def _parse_start_operators(expr, is_time_absolute, current):
     """
        Supported operators for absolute time:
-       * start_doy() - Day of year (doy) from the start time [1 - 366]
-       * start_dow() - Day of week (dow) from the start time [1 - 7],
+       - start_doy() - Day of year (doy) from the start time [1 - 366]
+       - start_dow() - Day of week (dow) from the start time [1 - 7],
                        the start of the week is monday == 1
-       * start_year() - The year of the start time [0 - 9999]
-       * start_month() - The month of the start time [1 - 12]
-       * start_week() - Week of year of the start time [1 - 54]
-       * start_day() - Day of month from the start time [1 - 31]
-       * start_hour() - The hour of the start time [0 - 23]
-       * start_minute() - The minute of the start time [0 - 59]
-       * start_second() - The second of the start time [0 - 59]
+       - start_year() - The year of the start time [0 - 9999]
+       - start_month() - The month of the start time [1 - 12]
+       - start_week() - Week of year of the start time [1 - 54]
+       - start_day() - Day of month from the start time [1 - 31]
+       - start_hour() - The hour of the start time [0 - 23]
+       - start_minute() - The minute of the start time [0 - 59]
+       - start_second() - The second of the start time [0 - 59]
     """
 
     start, end = current.get_absolute_time()
@@ -505,7 +505,7 @@ def _parse_end_operators(expr, is_time_absolute, current):
        - end_minute() - The minute of the end time [0 - 59]
        - end_second() - The minute of the end time [0 - 59]
 
-       In case of time instances the end_* expression will be replaced by
+       In case of time instances the end* expression will be replaced by
        null()
     """
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 630 - 644
lib/python/temporal/metadata.py


+ 43 - 48
lib/python/temporal/open_stds.py

@@ -1,25 +1,21 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Functions to open or create space time datasets
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
 
-tgis.register_maps_in_space_time_dataset(type, name, maps)
+    import grass.temporal as tgis
+
+    tgis.register_maps_in_space_time_dataset(type, name, maps)
 
-...
-@endcode
 
 (C) 2012-2014 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from factory import *
@@ -27,18 +23,18 @@ from factory import *
 ###############################################################################
 
 def open_old_stds(name, type, dbif=None):
-    """!This function opens an existing space time dataset and return the
+    """This function opens an existing space time dataset and return the
        created and intialized object of the specified type.
 
        This function will call exit() or raise a grass.pygrass.messages.FatalError in case the type is wrong,
        or the space time dataset was not found.
 
-       @param name The name of the space time dataset, if the name does not
+       :param name: The name of the space time dataset, if the name does not
                     contain the mapset (name@mapset) then the current mapset
                     will be used to identifiy the space time dataset
-       @param type The type of the space time dataset (strd, str3ds, stvds,
+       :param type: The type of the space time dataset (strd, str3ds, stvds,
                                                        raster, vector, raster3d)
-       @param dbif The optional database interface to be used
+       :param dbif: The optional database interface to be used
 
     """
     mapset = get_current_mapset()
@@ -77,18 +73,18 @@ def open_old_stds(name, type, dbif=None):
 ###############################################################################
 
 def check_new_stds(name, type, dbif=None, overwrite=False):
-    """!Check if a new space time dataset of a specific type can be created
+    """Check if a new space time dataset of a specific type can be created
 
-       @param name The name of the new space time dataset
-       @param type The type of the new space time dataset (strd, str3ds, stvds,
+       :param name: The name of the new space time dataset
+       :param type: The type of the new space time dataset (strd, str3ds, stvds,
                                                       raster, vector, raster3d)
-       @param dbif The temporal database interface to be used
-       @param overwrite Flag to allow overwriting
+       :param dbif: The temporal database interface to be used
+       :param overwrite: Flag to allow overwriting
 
-       @return A space time dataset object that must be filled with
+       :return: A space time dataset object that must be filled with
                content before insertion in the temporal database
 
-       This function will raise a ScriptError in case of an error.
+       This function will raise a FatalError in case of an error.
     """
 
     #Get the current mapset to create the id of the space time dataset
@@ -131,19 +127,19 @@ def check_new_stds(name, type, dbif=None, overwrite=False):
 
 def open_new_stds(name, type, temporaltype, title, descr, semantic,
                               dbif=None, overwrite=False):
-    """!Create a new space time dataset of a specific type
+    """Create a new space time dataset of a specific type
 
-       @param name The name of the new space time dataset
-       @param type The type of the new space time dataset (strd, str3ds, stvds,
+       :param name: The name of the new space time dataset
+       :param type: The type of the new space time dataset (strd, str3ds, stvds,
                                                       raster, vector, raster3d)
-       @param temporaltype The temporal type (relative or absolute)
-       @param title The title
-       @param descr The dataset description
-       @param semantic Semantical information
-       @param dbif The temporal database interface to be used
-       @param overwrite Flag to allow overwriting
+       :param temporaltype: The temporal type (relative or absolute)
+       :param title: The title
+       :param descr: The dataset description
+       :param semantic: Semantical information
+       :param dbif: The temporal database interface to be used
+       :param overwrite: Flag to allow overwriting
 
-       @return The new created space time dataset
+       :return: The new created space time dataset
 
        This function will raise a FatalError in case of an error.
     """
@@ -177,18 +173,18 @@ def open_new_stds(name, type, temporaltype, title, descr, semantic,
 
 def check_new_map_dataset(name, layer=None, type="raster",
                           overwrite=False, dbif=None):
-    """!Check if a new map dataset of a specific type can be created in
+    """Check if a new map dataset of a specific type can be created in
         the temporal database
 
-       @param name The name of the new map dataset
-       @param layer The layer of the new map dataset
-       @param type The type of the new map dataset (raster, vector, raster3d)
-       @param dbif The temporal database interface to be used
-       @param overwrite Flag to allow overwriting
+       :param name: The name of the new map dataset
+       :param layer: The layer of the new map dataset
+       :param type: The type of the new map dataset (raster, vector, raster3d)
+       :param dbif: The temporal database interface to be used
+       :param overwrite: Flag to allow overwriting
 
-       @return A map dataset object
+       :return: A map dataset object
 
-       This function will raise a ScriptError in case of an error.
+       This function will raise a FatalError in case of an error.
     """
     mapset = get_current_mapset()
     msgr = get_tgis_message_interface()
@@ -215,18 +211,17 @@ def check_new_map_dataset(name, layer=None, type="raster",
 def open_new_map_dataset(name, layer=None, type="raster",
                          temporal_extent=None, overwrite=False,
                          dbif=None):
-    """!Create a new map dataset object of a specific type that can be
+    """Create a new map dataset object of a specific type that can be
         registered in the temporal database
 
-       @param name The name of the new map dataset
-       @param layer The layer of the new map dataset
-       @param type The type of the new map dataset (raster, vector, raster3d)
-       @param dbif The temporal database interface to be used
-       @param overwrite Flag to allow overwriting
+       :param name: The name of the new map dataset
+       :param layer: The layer of the new map dataset
+       :param type: The type of the new map dataset (raster, vector, raster3d)
+       :param dbif: The temporal database interface to be used
+       :param overwrite: Flag to allow overwriting
 
-       @return A map dataset object
+       :return: A map dataset object
 
-       This function will raise a ScriptError in case of an error.
     """
 
     mapset = get_current_mapset()

+ 34 - 39
lib/python/temporal/register.py

@@ -1,25 +1,20 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Functions to register map layer in space time datasets and the temporal database
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
 
-tgis.register_maps_in_space_time_dataset(type, name, maps)
+    import grass.temporal as tgis
 
-...
-@endcode
+    tgis.register_maps_in_space_time_dataset(type, name, maps)
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from open_stds import *
@@ -32,7 +27,7 @@ def register_maps_in_space_time_dataset(
     type, name, maps=None, file=None, start=None,
     end=None, unit=None, increment=None, dbif=None,
         interval=False, fs="|", update_cmd_list=True):
-    """!Use this method to register maps in space time datasets.
+    """Use this method to register maps in space time datasets.
 
        Additionally a start time string and an increment string can be
        specified to assign a time interval automatically to the maps.
@@ -40,28 +35,28 @@ 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 rast, rast3d or vect
-       @param name The name of the space time dataset. Maps will be registered in the
+       :param type: The type of the maps rast, rast3d or vect
+       :param name: The name of the space time dataset. Maps will be registered in the
                    temporal database if the name was set to None
-       @param maps A comma separated list of map names
-       @param file Input file, one map per line map with start and optional
+       :param maps: A comma separated list of map names
+       :param file: Input file, one map per line map with start and optional
                    end time
-       @param start The start date and time of the first raster map
+       :param 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 is integer 5)
-       @param end The end date and time of the first raster map
+       :param 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 is integer 5)
-       @param unit The unit of the relative time: years, months, days,
+       :param unit: The unit of the relative time: years, months, days,
                    hours, minutes, seconds
-       @param increment Time increment between maps for time stamp creation
+       :param increment: Time increment between maps for time stamp creation
                         (format absolute: NNN seconds, minutes, hours, days,
                         weeks, months, years; format relative: 1.0)
-       @param dbif The database interface to be used
-       @param interval If True, time intervals are created in case the start
+       :param dbif: The database interface to be used
+       :param interval: If True, time intervals are created in case the start
                        time and an increment is provided
-       @param fs Field separator used in input file
-       @param update_cmd_list If is True, the command that was invoking this process
+       :param fs: Field separator used in input file
+       :param update_cmd:_list If is True, the command that was invoking this process
                               will be written to the process history
     """
     start_time_in_file = False
@@ -346,24 +341,24 @@ def register_maps_in_space_time_dataset(
 
 def assign_valid_time_to_map(ttype, map, start, end, unit, increment=None,
                              mult=1, interval=False):
-    """!Assign the valid time to a map dataset
+    """Assign the valid time to a map dataset
 
-       @param ttype The temporal type which should be assigned
+       :param ttype: The temporal type which should be assigned
                      and which the time format is of
-       @param map A map dataset object derived from abstract_map_dataset
-       @param start The start date and time of the first raster map
+       :param map: A map dataset object derived from abstract_map_dataset
+       :param 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 is integer 5)
-       @param end The end date and time of the first raster map
+       :param 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 is integer 5)
-       @param unit The unit of the relative time: years, months,
+       :param unit: The unit of the relative time: years, months,
                     days, hours, minutes, seconds
-       @param increment Time increment between maps for time stamp creation
+       :param increment: Time increment between maps for time stamp creation
                         (format absolute: NNN seconds, minutes, hours, days,
                         weeks, months, years; format relative is integer 1)
-       @param mult A multiplier for the increment
-       @param interval If True, time intervals are created in case the start
+       :param mult: A multiplier for the increment
+       :param interval: If True, time intervals are created in case the start
                         time and an increment is provided
     """
 
@@ -437,12 +432,12 @@ 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 (rast, rast3d, vect)
-       @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
-       @param unit The temporal unit of the space time dataset
-       @param dbif The database interface to be used
+       :param type: The type of the map layer (rast, rast3d, vect)
+       :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
+       :param unit: The temporal unit of the space time dataset
+       :param dbif: The database interface to be used
        
     """
     import grass.pygrass.modules as pymod

+ 17 - 22
lib/python/temporal/sampling.py

@@ -1,25 +1,20 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Sampling functions for space time datasets
 
 Usage:
 
-@code
-import grass.temporal as tgis
+.. code-block:: python
 
-tgis.register_maps_in_space_time_dataset(type, name, maps)
+    import grass.temporal as tgis
 
-...
-@endcode
+    tgis.register_maps_in_space_time_dataset(type, name, maps)
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from factory import *
@@ -27,7 +22,7 @@ from factory import *
 def sample_stds_by_stds_topology(intype, sampletype, inputs, sampler, header,
                                  separator, method, spatial=False,
                                  print_only=True):
-    """!Sample the input space time datasets with a sample
+    """Sample the input space time datasets with a sample
        space time dataset, return the created map matrix and optionally
        print the result to stdout
 
@@ -39,21 +34,21 @@ def sample_stds_by_stds_topology(intype, sampletype, inputs, sampler, header,
 
         Attention: Do not use the comma as separator for printing
 
-        @param intype  Type of the input space time dataset (strds, stvds or str3ds)
-        @param sampletype Type of the sample space time datasets (strds, stvds or str3ds)
-        @param inputs Name or comma separated names of space time datasets or a list of map names
-        @param sampler Name of a space time dataset used for temporal sampling
-        @param header Set True to print column names
-        @param separator The field separator character between the columns
-        @param method The method to be used for temporal sampling
+        :param intype:  Type of the input space time dataset (strds, stvds or str3ds)
+        :param sampletype: Type of the sample space time datasets (strds, stvds or str3ds)
+        :param inputs: Name or comma separated names of space time datasets or a list of map names
+        :param sampler: Name of a space time dataset used for temporal sampling
+        :param header: Set True to print column names
+        :param separator: The field separator character between the columns
+        :param method: The method to be used for temporal sampling
                        (start,during,contain,overlap,equal) as comma separated string
                        or as a list of methods
-        @param spatial Perform spatial overlapping check
-        @param print_only If set True (default) then the result of the sampling will be
+        :param spatial: Perform spatial overlapping check
+        :param print_only: If set True (default) then the result of the sampling will be
                     printed to stdout, if set to False the resulting map matrix
                     will be returned.
 
-        @return The map matrix or None if nothing found
+        :return: The map matrix or None if nothing found
     """
     mapset = get_current_mapset()
     msgr = get_tgis_message_interface()

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 402 - 406
lib/python/temporal/space_time_datasets.py


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 589 - 613
lib/python/temporal/spatial_extent.py


+ 91 - 94
lib/python/temporal/spatial_topology_dataset_connector.py

@@ -1,9 +1,6 @@
 # -*- coding: utf-8 -*-
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in temporal GIS Python library package.
+"""
+Spatial topology connector class
 
 Usage:
 
@@ -15,17 +12,18 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 import copy
 
 class SpatialTopologyDatasetConnector(object):
-    """!This class implements a spatial topology access structure to connect spatial related datasets
+    """This class implements a spatial topology access structure to connect spatial related datasets
 
        This object will be set up by spatial topology creation method provided by the 
        SpatioTemporalTopologyBuilder.
 
        The following spatial relations with access methods are supported:
+       
        - equivalent
        - overlap
        - in
@@ -36,80 +34,79 @@ class SpatialTopologyDatasetConnector(object):
             
         Usage:
         
-        @code
+        .. code-block:: python
         
-        >>> import grass.temporal as tgis
-        >>> tgis.init()
-        >>> map = tgis.RasterDataset("a@P")
-        >>> tmr = tgis.SpatialTopologyDatasetConnector()
-        >>> tmr.append_equivalent(map)
-        >>> tmr.append_overlap(map)
-        >>> tmr.append_in(map)
-        >>> tmr.append_contain(map)
-        >>> tmr.append_meet(map)
-        >>> tmr.append_cover(map)
-        >>> tmr.append_covered(map)
-        >>> tmr.print_spatial_topology_info()
-         +-------------------- Spatial Topology --------------------------------------+
-         | Equivalent: ................ a@P
-         | Cover: ..................... a@P
-         | Covered: ................... a@P
-         | Overlap: ................... a@P
-         | In: ........................ a@P
-         | Contain: ................... a@P
-         | Meet: ...................... a@P
-        >>> tmr.print_spatial_topology_shell_info()
-        equivalent=a@P
-        cover=a@P
-        covered=a@P
-        overlap=a@P
-        in=a@P
-        contain=a@P
-        meet=a@P
-        >>> rlist = tmr.get_spatial_relations()
-        >>> if "COVER" in rlist.keys():
-        ...    print rlist["COVER"][0].get_id()
-        a@P
+            >>> import grass.temporal as tgis
+            >>> tgis.init()
+            >>> map = tgis.RasterDataset("a@P")
+            >>> tmr = tgis.SpatialTopologyDatasetConnector()
+            >>> tmr.append_equivalent(map)
+            >>> tmr.append_overlap(map)
+            >>> tmr.append_in(map)
+            >>> tmr.append_contain(map)
+            >>> tmr.append_meet(map)
+            >>> tmr.append_cover(map)
+            >>> tmr.append_covered(map)
+            >>> tmr.print_spatial_topology_info()
+             +-------------------- Spatial Topology --------------------------------------+
+             | Equivalent: ................ a@P
+             | Cover: ..................... a@P
+             | Covered: ................... a@P
+             | Overlap: ................... a@P
+             | In: ........................ a@P
+             | Contain: ................... a@P
+             | Meet: ...................... a@P
+            >>> tmr.print_spatial_topology_shell_info()
+            equivalent=a@P
+            cover=a@P
+            covered=a@P
+            overlap=a@P
+            in=a@P
+            contain=a@P
+            meet=a@P
+            >>> rlist = tmr.get_spatial_relations()
+            >>> if "COVER" in rlist.keys():
+            ...    print rlist["COVER"][0].get_id()
+            a@P
 
-        
-        @endcode
     """
 
     def __init__(self):
         self.reset_spatial_topology()
 
     def reset_spatial_topology(self):
-        """!Reset any information about temporal topology"""
+        """Reset any information about temporal topology"""
         self._spatial_topology = {}
         self._has_spatial_topology = False
         
     def get_spatial_relations(self):
-        """!Return the dictionary of spatial relationships
+        """Return the dictionary of spatial relationships
         
             Keys are the spatial relationships in upper case,
             values are abstract map objects.
             
-            @return The spatial relations dictionary
+            :return: The spatial relations dictionary
         """
         return copy.copy(self._spatial_topology)
     
     def get_number_of_spatial_relations(self):
-        """! Return a dictionary in which the keys are the relation names and the value
-        are the number of relations.
-        
-        The following relations are available:
-       - equivalent
-       - overlap
-       - in
-       - contain
-       - meet
-       - cover
-       - covered
-        
-        To access topological information the spatial topology must be build first
-        using the SpatialTopologyBuilder.
-        
-        @return the dictionary with relations as keys and number as values or None in case the topology wasn't build
+        """ Return a dictionary in which the keys are the relation names and the value
+            are the number of relations.
+
+            The following relations are available:
+
+            - equivalent
+            - overlap
+            - in
+            - contain
+            - meet
+            - cover
+            - covered
+
+            To access topological information the spatial topology must be build first
+            using the SpatialTopologyBuilder.
+
+            :return: the dictionary with relations as keys and number as values or None in case the topology wasn't build
         """
         if self._has_spatial_topology == False:
             return None
@@ -147,21 +144,21 @@ class SpatialTopologyDatasetConnector(object):
         return relations
 
     def set_spatial_topology_build_true(self):
-        """!Same as name"""
+        """Same as name"""
         self._has_spatial_topology = True
 
     def set_spatial_topology_build_false(self):
-        """!Same as name"""
+        """Same as name"""
         self._has_spatial_topology = False
 
     def is_spatial_topology_build(self):
-        """!Check if the temporal topology was build"""
+        """Check if the temporal topology was build"""
         return self._has_spatial_topology
 
     def append_equivalent(self, map):
-        """!Append a map with equivalent spatial extent as this map
+        """Append a map with equivalent spatial extent as this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "EQUIVALENT" not in self._spatial_topology:
@@ -169,18 +166,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["EQUIVALENT"].append(map)
 
     def get_equivalent(self):
-        """!Return a list of map objects with equivalent spatial extent as this map
+        """Return a list of map objects with equivalent spatial extent as this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "EQUIVALENT" not in self._spatial_topology:
             return None
         return self._spatial_topology["EQUIVALENT"]
 
     def append_overlap(self, map):
-        """!Append a map that this spatial overlap with this map
+        """Append a map that this spatial overlap with this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "OVERLAP" not in self._spatial_topology:
@@ -188,18 +185,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["OVERLAP"].append(map)
 
     def get_overlap(self):
-        """!Return a list of map objects that this map spatial overlap with
+        """Return a list of map objects that this map spatial overlap with
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "OVERLAP" not in self._spatial_topology:
             return None
         return self._spatial_topology["OVERLAP"]
 
     def append_in(self, map):
-        """!Append a map that this is spatial in this map
+        """Append a map that this is spatial in this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "IN" not in self._spatial_topology:
@@ -207,18 +204,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["IN"].append(map)
 
     def get_in(self):
-        """!Return a list of map objects that are spatial in this map
+        """Return a list of map objects that are spatial in this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "IN" not in self._spatial_topology:
             return None
         return self._spatial_topology["IN"]
 
     def append_contain(self, map):
-        """!Append a map that this map spatially contains
+        """Append a map that this map spatially contains
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "CONTAIN" not in self._spatial_topology:
@@ -226,18 +223,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["CONTAIN"].append(map)
 
     def get_contain(self):
-        """!Return a list of map objects that this map contains
+        """Return a list of map objects that this map contains
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "CONTAIN" not in self._spatial_topology:
             return None
         return self._spatial_topology["CONTAIN"]
 
     def append_meet(self, map):
-        """!Append a map that spatially meet with this map
+        """Append a map that spatially meet with this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "MEET" not in self._spatial_topology:
@@ -245,18 +242,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["MEET"].append(map)
 
     def get_meet(self):
-        """!Return a list of map objects that spatially meet with this map
+        """Return a list of map objects that spatially meet with this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "MEET" not in self._spatial_topology:
             return None
         return self._spatial_topology["MEET"]
 
     def append_cover(self, map):
-        """!Append a map that spatially cover this map
+        """Append a map that spatially cover this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "COVER" not in self._spatial_topology:
@@ -264,18 +261,18 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["COVER"].append(map)
 
     def get_cover(self):
-        """!Return a list of map objects that spatially cover this map
+        """Return a list of map objects that spatially cover this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "COVER" not in self._spatial_topology:
             return None
         return self._spatial_topology["COVER"]
 
     def append_covered(self, map):
-        """!Append a map that is spatially covered by this map
+        """Append a map that is spatially covered by this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "COVERED" not in self._spatial_topology:
@@ -283,9 +280,9 @@ class SpatialTopologyDatasetConnector(object):
         self._spatial_topology["COVERED"].append(map)
 
     def get_covered(self):
-        """!Return a list of map objects that are spatially covered by this map
+        """Return a list of map objects that are spatially covered by this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "COVERED" not in self._spatial_topology:
             return None
@@ -324,7 +321,7 @@ class SpatialTopologyDatasetConnector(object):
                                      fset=append_meet)
 
     def print_spatial_topology_info(self):
-        """!Print information about this class in human readable style"""
+        """Print information about this class in human readable style"""
         
         print " +-------------------- Spatial Topology --------------------------------------+"
         #          0123456789012345678901234567890
@@ -351,7 +348,7 @@ class SpatialTopologyDatasetConnector(object):
                 self._generate_map_list_string(self.meet)
 
     def print_spatial_topology_shell_info(self):
-        """!Print information about this class in shell style"""
+        """Print information about this class in shell style"""
 
         if self.equivalent is not None:
             print "equivalent=" + self._generate_map_list_string(self.equivalent, False)

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 476 - 482
lib/python/temporal/spatio_temporal_relationships.py


+ 31 - 30
lib/python/temporal/stds_export.py

@@ -1,31 +1,28 @@
-"""!@package grass.temporal
+"""
+Export functions for space time datasets
 
-@brief GRASS Python scripting module (temporal GIS functions)
+Usage:
 
-Temporal GIS export functions to be used in temporal modules
+.. code-block:: python
 
-Usage:
+    import grass.temporal as tgis
 
-@code
-import grass.temporal as tgis
+    input="temp_1950_2012@PERMANENT"
+    output="/tmp/temp_1950_2012.tar.gz"
+    compression="gzip"
+    workdir="/tmp"
+    where=None
+    format_="GTiff"
+    type_="strds"
+    tgis.export_stds(input, output, compression, workdir, where, format_, type_)
 
-input="temp_1950_2012@PERMANENT"
-output="/tmp/temp_1950_2012.tar.gz"
-compression="gzip"
-workdir="/tmp"
-where=None
-format_="GTiff"
-type_="strds"
-tgis.export_stds(input, output, compression, workdir, where, format_, type_)
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 import shutil
@@ -218,30 +215,34 @@ def _export_raster3d_maps(rows, tar, list_file, new_cwd, fs):
 
 def export_stds(input, output, compression, workdir, where, format_="pack",
                 type_="strds"):
-    """
-            !Export space time datasets as tar archive with optional compression
+    """Export space time datasets as tar archive with optional compression
+
+        This method should be used to export space time datasets
+        of type raster and vector as tar archive that can be reimported
+        with the method import_stds().
 
-            This method should be used to export space time datasets
-            of type raster and vector as tar archive that can be reimported
-            with the method import_stds().
+        :param input: The name of the space time dataset to export
+        :param output: The name of the archive file
+        :param compression: The compression of the archive file:
 
-            @param input The name of the space time dataset to export
-            @param output The name of the archive file
-            @param compression The compression of the archive file:
               - "no"  no compression
               - "gzip" GNU zip compression
               - "bzip2" Bzip compression
-            @param workdir The working directory used for extraction and packing
-            @param where The temporal WHERE SQL statement to select a subset
-                          of maps from the space time dataset
-            @param format_ The export format:
+          
+        :param workdir: The working directory used for extraction and packing
+        :param where: The temporal WHERE SQL statement to select a subset
+                      of maps from the space time dataset
+        :param format_: The export format:
+        
               - "GTiff" Geotiff format, only for raster maps
               - "AAIGrid" Arc/Info ASCII Grid format, only for raster maps
               - "pack" The GRASS raster, 3D raster or vector Pack format,
                        this is the default setting
               - "GML" GML file export format, only for vector maps,
                       v.out.ogr export option
-            @param type_ The space time dataset type
+                  
+        :param type_: The space time dataset type
+        
               - "strds" Space time raster dataset
               - "str3ds" Space time 3D raster dataset
               - "stvds" Space time vector dataset

+ 32 - 35
lib/python/temporal/stds_import.py

@@ -1,35 +1,32 @@
-"""!@package grass.temporal
+"""
+Space time dataset import functions
+
+Usage:
 
-@brief GRASS Python scripting module (temporal GIS functions)
+.. code-block:: python
 
-Temporal GIS export functions to be used in temporal modules
+    import grass.temporal as tgis
 
-Usage:
+    input="/tmp/temp_1950_2012.tar.gz"
+    output="temp_1950_2012"
+    extrdir="/tmp"
+    title="My new dataset"
+    descr="May new shiny dataset"
+    location=None
+    link=True
+    exp=True
+    overr=False
+    create=False
+    tgis.import_stds(input, output, extrdir, title, descr, location,
+                    link, exp, overr, create, "strds")
 
-@code
-import grass.temporal as tgis
-
-input="/tmp/temp_1950_2012.tar.gz"
-output="temp_1950_2012"
-extrdir="/tmp"
-title="My new dataset"
-descr="May new shiny dataset"
-location=None
-link=True
-exp=True
-overr=False
-create=False
-tgis.import_stds(input, output, extrdir, title, descr, location,
-                link, exp, overr, create, "strds")
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 import os
@@ -174,25 +171,25 @@ def _import_vector_maps(maplist):
 def import_stds(input, output, extrdir, title=None, descr=None, location=None,
         link=False, exp=False, overr=False, create=False, stds_type="strds", 
         base=None, set_current_region=False):
-    """!Import space time datasets of type raster and vector
+    """Import space time datasets of type raster and vector
 
-        @param input Name of the input archive file
-        @param output The name of the output space time dataset
-        @param extrdir The extraction directory
-        @param title The title of the new created space time dataset
-        @param descr The description of the new created
+        :param input: Name of the input archive file
+        :param output: The name of the output space time dataset
+        :param extrdir: The extraction directory
+        :param title: The title of the new created space time dataset
+        :param descr: The description of the new created
                      space time dataset
-        @param location The name of the location that should be created,
+        :param location: The name of the location that should be created,
                         maps are imported into this location
-        @param link Switch to link raster maps instead importing them
-        @param exp Extend location extents based on new dataset
-        @param overr Override projection (use location's projection)
-        @param create Create the location specified by the "location"
+        :param link: Switch to link raster maps instead importing them
+        :param exp: Extend location extents based on new dataset
+        :param overr: Override projection (use location's projection)
+        :param create: Create the location specified by the "location"
                       parameter and exit.
                       Do not import the space time datasets.
-        @param stds_type The type of the space time dataset that
+        :param stds_type: The type of the space time dataset that
                          should be imported
-        @param base The base name of the new imported maps, it will be extended
+        :param base: The base name of the new imported maps, it will be extended
                     using a numerical index.
     """
 

تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 428 - 434
lib/python/temporal/temporal_algebra.py


تفاوت فایلی نمایش داده نمی شود زیرا این فایل بسیار بزرگ است
+ 622 - 638
lib/python/temporal/temporal_extent.py


+ 212 - 218
lib/python/temporal/temporal_granularity.py

@@ -1,24 +1,21 @@
-"""!@package grass.temporal
+"""
+Functions to compute the temporal granularity of a map list
 
-@brief GRASS Python scripting module (temporal GIS functions)
+Usage:
 
-Temporal GIS related functions to be used in temporal GIS Python library package.
+.. code-block:: python
 
-Usage:
+    import grass.temporal as tgis
 
-@code
-import grass.temporal as tgis
+    tgis.compute_relative_time_granularity(maps)
 
-tgis.compute_relative_time_granularity(maps)
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 from abstract_dataset import *
 from datetime_math import *
@@ -26,50 +23,49 @@ from datetime_math import *
 ###############################################################################
 
 def check_granularity_string(granularity, temporal_type):
-    """!Check if the granularity string is valid
-
-        @param granularity The granularity string
-        @param temporal_type The temporal type of the granularity relative or absolute
-        @return True if valid, False if invalid
-
-        @code
-
-        >>> check_granularity_string("1 year", "absolute")
-        True
-        >>> check_granularity_string("1 month", "absolute")
-        True
-        >>> check_granularity_string("1 day", "absolute")
-        True
-        >>> check_granularity_string("1 minute", "absolute")
-        True
-        >>> check_granularity_string("1 hour", "absolute")
-        True
-        >>> check_granularity_string("1 second", "absolute")
-        True
-        >>> check_granularity_string("5 months", "absolute")
-        True
-        >>> check_granularity_string("5 days", "absolute")
-        True
-        >>> check_granularity_string("5 minutes", "absolute")
-        True
-        >>> check_granularity_string("5 years", "absolute")
-        True
-        >>> check_granularity_string("5 hours", "absolute")
-        True
-        >>> check_granularity_string("2 seconds", "absolute")
-        True
-        >>> check_granularity_string("1 secondo", "absolute")
-        False
-        >>> check_granularity_string("bla second", "absolute")
-        False
-        >>> check_granularity_string("bla", "absolute")
-        False
-        >>> check_granularity_string(1, "relative")
-        True
-        >>> check_granularity_string("bla", "relative")
-        False
-
-        @endcode
+    """Check if the granularity string is valid
+
+        :param granularity: The granularity string
+        :param temporal_type: The temporal type of the granularity relative or absolute
+        :return: True if valid, False if invalid
+
+        .. code-block:: python
+
+            >>> check_granularity_string("1 year", "absolute")
+            True
+            >>> check_granularity_string("1 month", "absolute")
+            True
+            >>> check_granularity_string("1 day", "absolute")
+            True
+            >>> check_granularity_string("1 minute", "absolute")
+            True
+            >>> check_granularity_string("1 hour", "absolute")
+            True
+            >>> check_granularity_string("1 second", "absolute")
+            True
+            >>> check_granularity_string("5 months", "absolute")
+            True
+            >>> check_granularity_string("5 days", "absolute")
+            True
+            >>> check_granularity_string("5 minutes", "absolute")
+            True
+            >>> check_granularity_string("5 years", "absolute")
+            True
+            >>> check_granularity_string("5 hours", "absolute")
+            True
+            >>> check_granularity_string("2 seconds", "absolute")
+            True
+            >>> check_granularity_string("1 secondo", "absolute")
+            False
+            >>> check_granularity_string("bla second", "absolute")
+            False
+            >>> check_granularity_string("bla", "absolute")
+            False
+            >>> check_granularity_string(1, "relative")
+            True
+            >>> check_granularity_string("bla", "relative")
+            False
+
     """
     temporal_type
 
@@ -103,102 +99,101 @@ def check_granularity_string(granularity, temporal_type):
 ###############################################################################
 
 def compute_relative_time_granularity(maps):
-    """!Compute the relative time granularity
+    """Compute the relative time granularity
 
         Attention: The computation of the granularity
         is only correct in case of not overlapping intervals.
         Hence a correct temporal topology is required for computation.
 
-        @param maps a ordered by start_time list of map objects
-        @return An integer
-
-
-        @code
-
-        >>> import grass.temporal as tgis
-        >>> tgis.init()
-        >>> maps = []
-        >>> for i in range(5):
-        ...   map = tgis.RasterDataset("a%i@P"%i)
-        ...   check = map.set_relative_time(i,i + 1,"seconds")
-        ...   if check:
-        ...     maps.append(map)
-        >>> tgis.compute_relative_time_granularity(maps)
-        1
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,3), (3,6), (6,9))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"years")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        3
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,3), (4,6), (8,11))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"years")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        1
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,8), (2,6), (5,9))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"months")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        4
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,8), (8,12), (12,18))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"days")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        2
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,None), (8,None), (12,None), (24,None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"minutes")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        4
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((0,None), (8,14), (18,None), (24,None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_relative_time(t[0],t[1],"hours")
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_relative_time_granularity(maps)
-        2
-
-        @endcode
+        :param maps: a ordered by start_time list of map objects
+        :return: An integer
+
+
+        .. code-block:: python
+
+            >>> import grass.temporal as tgis
+            >>> tgis.init()
+            >>> maps = []
+            >>> for i in range(5):
+            ...   map = tgis.RasterDataset("a%i@P"%i)
+            ...   check = map.set_relative_time(i,i + 1,"seconds")
+            ...   if check:
+            ...     maps.append(map)
+            >>> tgis.compute_relative_time_granularity(maps)
+            1
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,3), (3,6), (6,9))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"years")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            3
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,3), (4,6), (8,11))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"years")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            1
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,8), (2,6), (5,9))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"months")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            4
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,8), (8,12), (12,18))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"days")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            2
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,None), (8,None), (12,None), (24,None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"minutes")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            4
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((0,None), (8,14), (18,None), (24,None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_relative_time(t[0],t[1],"hours")
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_relative_time_granularity(maps)
+            2
+
     """
 
     # The interval time must be scaled to days resolution
@@ -244,7 +239,7 @@ def compute_relative_time_granularity(maps):
 
 
 def compute_absolute_time_granularity(maps):
-    """!Compute the absolute time granularity
+    """Compute the absolute time granularity
 
         Attention: The computation of the granularity
         is only correct in case of not overlapping intervals.
@@ -253,76 +248,75 @@ def compute_absolute_time_granularity(maps):
         The computed granularity is returned as number of seconds or minutes or hours
         or days or months or years.
 
-        @param maps a ordered by start_time list of map objects
-        @return The temporal topology as string "integer unit"
-
-        @code
-
-        >>> import grass.temporal as tgis
-        >>> import datetime
-        >>> dt = datetime.datetime
-        >>> tgis.init()
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((dt(2000,01,01),None), (dt(2000,02,01),None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_absolute_time(t[0],t[1])
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_absolute_time_granularity(maps)
-        '1 month'
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((dt(2000,01,01),None), (dt(2000,01,02),None), (dt(2000,01,03),None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_absolute_time(t[0],t[1])
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_absolute_time_granularity(maps)
-        '1 day'
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((dt(2000,01,01),None), (dt(2000,01,02),None), (dt(2000,05,04,0,5,30),None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_absolute_time(t[0],t[1])
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_absolute_time_granularity(maps)
-        '30 seconds'
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((dt(2000,01,01),dt(2000,05,02)), (dt(2000,05,04,2),None))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_absolute_time(t[0],t[1])
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_absolute_time_granularity(maps)
-        '2 hours'
-
-        >>> maps = []
-        >>> count = 0
-        >>> timelist = ((dt(2000,01,01),dt(2000,02,01)), (dt(2005,05,04,12),dt(2007,05,20,6)))
-        >>> for t in timelist:
-        ...   map = tgis.RasterDataset("a%i@P"%count)
-        ...   check = map.set_absolute_time(t[0],t[1])
-        ...   if check:
-        ...     maps.append(map)
-        ...   count += 1
-        >>> tgis.compute_absolute_time_granularity(maps)
-        '6 hours'
-
-        @endcode
+        :param maps: a ordered by start_time list of map objects
+        :return: The temporal topology as string "integer unit"
+
+        .. code-block:: python
+
+            >>> import grass.temporal as tgis
+            >>> import datetime
+            >>> dt = datetime.datetime
+            >>> tgis.init()
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((dt(2000,01,01),None), (dt(2000,02,01),None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_absolute_time(t[0],t[1])
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_absolute_time_granularity(maps)
+            '1 month'
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((dt(2000,01,01),None), (dt(2000,01,02),None), (dt(2000,01,03),None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_absolute_time(t[0],t[1])
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_absolute_time_granularity(maps)
+            '1 day'
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((dt(2000,01,01),None), (dt(2000,01,02),None), (dt(2000,05,04,0,5,30),None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_absolute_time(t[0],t[1])
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_absolute_time_granularity(maps)
+            '30 seconds'
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((dt(2000,01,01),dt(2000,05,02)), (dt(2000,05,04,2),None))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_absolute_time(t[0],t[1])
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_absolute_time_granularity(maps)
+            '2 hours'
+
+            >>> maps = []
+            >>> count = 0
+            >>> timelist = ((dt(2000,01,01),dt(2000,02,01)), (dt(2005,05,04,12),dt(2007,05,20,6)))
+            >>> for t in timelist:
+            ...   map = tgis.RasterDataset("a%i@P"%count)
+            ...   check = map.set_absolute_time(t[0],t[1])
+            ...   if check:
+            ...     maps.append(map)
+            ...   count += 1
+            >>> tgis.compute_absolute_time_granularity(maps)
+            '6 hours'
+
     """
 
     has_seconds = False
@@ -495,7 +489,7 @@ def compute_absolute_time_granularity(maps):
 
 
 def gcd(a, b):
-    """!The Euclidean Algorithm """
+    """The Euclidean Algorithm """
     a = abs(a)
     b = abs(b)
     while a:
@@ -506,7 +500,7 @@ def gcd(a, b):
 
 
 def gcd_list(list):
-    """!Finds the GCD of numbers in a list.
+    """Finds the GCD of numbers in a list.
     Input: List of numbers you want to find the GCD of
             E.g. [8, 24, 12]
     Returns: GCD of all numbers

+ 3 - 4
lib/python/temporal/temporal_raster3d_algebra.py

@@ -1,13 +1,12 @@
-"""!@package grass.temporal
-
-Temporal raster algebra
+"""
+Temporal 3d raster algebra
 
 (C) 2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
 
 """
 

+ 3 - 5
lib/python/temporal/temporal_raster_algebra.py

@@ -1,5 +1,4 @@
-"""!@package grass.temporal
-
+"""
 Temporal raster algebra
 
 (C) 2013 by the GRASS Development Team
@@ -7,9 +6,9 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
 
-@code
+.. code-block:: python
 
     >>> p = TemporalRasterAlgebraLexer()
     >>> p.build()
@@ -50,7 +49,6 @@ for details.
     LexToken(SUB,'-',1,40)
     LexToken(FLOAT,2.45,1,42)
 
-@endcode
 """
 
 from temporal_raster_base_algebra import *

+ 52 - 54
lib/python/temporal/temporal_raster_base_algebra.py

@@ -1,15 +1,14 @@
-"""!@package grass.temporal
-
-Temporal raster algebra
+"""
+Temporal raster algebra base class
 
 (C) 2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
 
-@code
+.. code-block:: python
 
     >>> p = TemporalRasterAlgebraLexer()
     >>> p.build()
@@ -93,7 +92,6 @@ for details.
     LexToken(NAME,'D',1,45)
     LexToken(RPAREN,')',1,46)
 
-@endcode
 """
 
 import grass.pygrass.modules as pymod
@@ -103,7 +101,7 @@ from temporal_algebra import *
 ##############################################################################
 
 class TemporalRasterAlgebraLexer(TemporalAlgebraLexer):
-    """!Lexical analyzer for the GRASS GIS temporal algebra"""
+    """Lexical analyzer for the GRASS GIS temporal algebra"""
 
     def __init__(self):
         TemporalAlgebraLexer.__init__(self)
@@ -204,56 +202,56 @@ class TemporalRasterBaseAlgebraParser(TemporalAlgebraParser):
     ######################### Temporal functions ##############################
 
     def eval_toperator(self, operator, comparison = False):
-        """!This function evaluates a string containing temporal operations.
+        """This function evaluates a string containing temporal operations.
 
-         @param operator String of temporal operations, e.g. {equal|during,=!:}.
+         :param operator: String of temporal operations, e.g. {equal|during,=!:}.
 
-         @return List of temporal relations (equal, during), the given function
+         :return: List of temporal relations (equal, during), the given function
           (!:) and the interval/instances (=).
-        @code
-         >>> init(True)
-         >>> p = TemporalRasterBaseAlgebraParser()
-         >>> operator = "{equal,:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], '=', ':')
-         >>> operator = "{equal|during,:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL', 'DURING'], '=', ':')
-         >>> operator = "{equal,!:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], '=', '!:')
-         >>> operator = "{equal|during,!:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL', 'DURING'], '=', '!:')
-         >>> operator = "{equal|during,=!:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL', 'DURING'], '=', '!:')
-         >>> operator = "{equal|during|starts,#}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL', 'DURING', 'STARTS'], '=', '#')
-         >>> operator = "{!:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], '=', '!:')
-         >>> operator = "{=:}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], '=', ':')
-         >>> operator = "{#}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], '=', '#')
-         >>> operator = "{equal|during}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL', 'DURING'], None, None)
-         >>> operator = "{equal}"
-         >>> p.eval_toperator(operator)
-         (['EQUAL'], None, None)
-         >>> operator = "{equal,||}"
-         >>> p.eval_toperator(operator, True)
-         (['EQUAL'], '=', '||')
-         >>> operator = "{equal|during,&&}"
-         >>> p.eval_toperator(operator, True)
-         (['EQUAL', 'DURING'], '=', '&&')
-
-        @endcode
+          
+        .. code-block:: python
+        
+             >>> init(True)
+             >>> p = TemporalRasterBaseAlgebraParser()
+             >>> operator = "{equal,:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], '=', ':')
+             >>> operator = "{equal|during,:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL', 'DURING'], '=', ':')
+             >>> operator = "{equal,!:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], '=', '!:')
+             >>> operator = "{equal|during,!:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL', 'DURING'], '=', '!:')
+             >>> operator = "{equal|during,=!:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL', 'DURING'], '=', '!:')
+             >>> operator = "{equal|during|starts,#}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL', 'DURING', 'STARTS'], '=', '#')
+             >>> operator = "{!:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], '=', '!:')
+             >>> operator = "{=:}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], '=', ':')
+             >>> operator = "{#}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], '=', '#')
+             >>> operator = "{equal|during}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL', 'DURING'], None, None)
+             >>> operator = "{equal}"
+             >>> p.eval_toperator(operator)
+             (['EQUAL'], None, None)
+             >>> operator = "{equal,||}"
+             >>> p.eval_toperator(operator, True)
+             (['EQUAL'], '=', '||')
+             >>> operator = "{equal|during,&&}"
+             >>> p.eval_toperator(operator, True)
+             (['EQUAL', 'DURING'], '=', '&&')
 
         """
         p = TemporalRasterOperatorParser()

+ 5 - 6
lib/python/temporal/temporal_raster_operator.py

@@ -1,5 +1,4 @@
-"""!@package grass.temporal
-
+"""
 Temporal operator evaluation with PLY
 
 (C) 2013 by the GRASS Development Team
@@ -7,9 +6,10 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
+
+.. code-block:: python
 
-@code
     >>> p = TemporalRasterOperatorParser()
     >>> expression =  "{equal| during | follows,+!:}"
     >>> p.parse(expression)
@@ -64,7 +64,6 @@ for details.
     >>> print(p.relations, p.temporal, p.function)
     (['equal', 'during', 'contains'], '|', '*')
 
-@endcode
 """
 
 try:
@@ -74,7 +73,7 @@ except:
     pass
 
 class TemporalRasterOperatorLexer(object):
-    """!Lexical analyzer for the GRASS GIS temporal operator"""
+    """Lexical analyzer for the GRASS GIS temporal operator"""
 
     # Functions that defines topological relations.
     relations = {

+ 133 - 137
lib/python/temporal/temporal_topology_dataset_connector.py

@@ -1,26 +1,25 @@
 # -*- coding: utf-8 -*-
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in temporal GIS Python library package.
+"""
+Temporal topology dataset connector class
 
 Usage:
 
->>> import grass.temporal as tgis
->>> tmr = tgis.TemporalTopologyDatasetConnector()
+.. code-block:: python:
+
+    >>> import grass.temporal as tgis
+    >>> tmr = tgis.TemporalTopologyDatasetConnector()
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 import copy
 
 class TemporalTopologyDatasetConnector(object):
-    """!This class implements a temporal topology access structure to connect temporal related datasets
+    """This class implements a temporal topology access structure to connect temporal related datasets
 
        This object will be set up by temporal topology creation method provided by the 
        SpatioTemporalTopologyBuilder.
@@ -29,6 +28,7 @@ class TemporalTopologyDatasetConnector(object):
        let the user walk temporally forward and backward in time.
 
        The following temporal relations with access methods are supported:
+       
        - equal
        - follows
        - precedes
@@ -42,100 +42,96 @@ class TemporalTopologyDatasetConnector(object):
        - finished
 
 
-       @code:
-       # We have build the temporal topology and we know the first map
-       start = first
-       while start:
+       .. code-block:: python:
+       
+           # We have build the temporal topology and we know the first map
+           start = first
+           while start:
 
-           # Print all maps this map temporally contains
-           dlist = start.get_contains()
-           for map in dlist:
-               map.print_info()
+               # Print all maps this map temporally contains
+               dlist = start.get_contains()
+               for map in dlist:
+                   map.print_info()
 
-           start = start.next()
-         @endcode  
+               start = start.next()
         
-        Usage:
-        
-        @code
-        
-        >>> import grass.temporal as tgis
-        >>> tgis.init()
-        >>> map = tgis.RasterDataset("a@P")
-        >>> tmr = tgis.TemporalTopologyDatasetConnector()
-        >>> tmr.set_next(map)
-        >>> tmr.set_prev(map)
-        >>> tmr.append_equal(map)
-        >>> tmr.append_follows(map)
-        >>> tmr.append_precedes(map)
-        >>> tmr.append_overlapped(map)
-        >>> tmr.append_overlaps(map)
-        >>> tmr.append_during(map)
-        >>> tmr.append_contains(map)
-        >>> tmr.append_starts(map)
-        >>> tmr.append_started(map)
-        >>> tmr.append_finishes(map)
-        >>> tmr.append_finished(map)
-        >>> tmr.print_temporal_topology_info()
-         +-------------------- Temporal Topology -------------------------------------+
-         | Next: ...................... a@P
-         | Previous: .................. a@P
-         | Equal:...................... a@P
-         | Follows: ................... a@P
-         | Precedes: .................. a@P
-         | Overlaps: .................. a@P
-         | Overlapped: ................ a@P
-         | During: .................... a@P
-         | Contains: .................. a@P
-         | Starts:.. .................. a@P
-         | Started:. .................. a@P
-         | Finishes:................... a@P
-         | Finished:................... a@P
-        >>> tmr.print_temporal_topology_shell_info()
-        next=a@P
-        prev=a@P
-        equal=a@P
-        follows=a@P
-        precedes=a@P
-        overlaps=a@P
-        overlapped=a@P
-        during=a@P
-        contains=a@P
-        starts=a@P
-        started=a@P
-        finishes=a@P
-        finished=a@P
-        >>> rlist = tmr.get_temporal_relations()
-        >>> if "FINISHED" in rlist.keys():
-        ...    print rlist["FINISHED"][0].get_id()
-        a@P
-
-        @endcode
+            >>> import grass.temporal as tgis
+            >>> tgis.init()
+            >>> map = tgis.RasterDataset("a@P")
+            >>> tmr = tgis.TemporalTopologyDatasetConnector()
+            >>> tmr.set_next(map)
+            >>> tmr.set_prev(map)
+            >>> tmr.append_equal(map)
+            >>> tmr.append_follows(map)
+            >>> tmr.append_precedes(map)
+            >>> tmr.append_overlapped(map)
+            >>> tmr.append_overlaps(map)
+            >>> tmr.append_during(map)
+            >>> tmr.append_contains(map)
+            >>> tmr.append_starts(map)
+            >>> tmr.append_started(map)
+            >>> tmr.append_finishes(map)
+            >>> tmr.append_finished(map)
+            >>> tmr.print_temporal_topology_info()
+             +-------------------- Temporal Topology -------------------------------------+
+             | Next: ...................... a@P
+             | Previous: .................. a@P
+             | Equal:...................... a@P
+             | Follows: ................... a@P
+             | Precedes: .................. a@P
+             | Overlaps: .................. a@P
+             | Overlapped: ................ a@P
+             | During: .................... a@P
+             | Contains: .................. a@P
+             | Starts:.. .................. a@P
+             | Started:. .................. a@P
+             | Finishes:................... a@P
+             | Finished:................... a@P
+            >>> tmr.print_temporal_topology_shell_info()
+            next=a@P
+            prev=a@P
+            equal=a@P
+            follows=a@P
+            precedes=a@P
+            overlaps=a@P
+            overlapped=a@P
+            during=a@P
+            contains=a@P
+            starts=a@P
+            started=a@P
+            finishes=a@P
+            finished=a@P
+            >>> rlist = tmr.get_temporal_relations()
+            >>> if "FINISHED" in rlist.keys():
+            ...    print rlist["FINISHED"][0].get_id()
+            a@P
+
     """
 
     def __init__(self):
         self.reset_temporal_topology()
 
     def reset_temporal_topology(self):
-        """!Reset any information about temporal topology"""
+        """Reset any information about temporal topology"""
         self._temporal_topology = {}
         self._has_temporal_topology = False
         
     def get_temporal_relations(self):
-        """!Return the dictionary of temporal relationships
+        """Return the dictionary of temporal relationships
         
             Keys are the temporal relationships in upper case,
             values are abstract map objects.
             
-            @return The temporal relations dictionary
+            :return: The temporal relations dictionary
         """
         return copy.copy(self._temporal_topology)
         
     def get_number_of_temporal_relations(self):
-        """! Return a dictionary in which the keys are the relation names and the value
+        """ Return a dictionary in which the keys are the relation names and the value
         are the number of relations.
         
         The following relations are available:
+        
         - equal
         - follows
         - precedes
@@ -151,7 +147,7 @@ class TemporalTopologyDatasetConnector(object):
         To access topological information the temporal topology must be build first
         using the SpatioTemporalTopologyBuilder.
         
-        @return the dictionary with relations as keys and number as values or None in case the topology wasn't build
+        :return: the dictionary with relations as keys and number as values or None in case the topology wasn't build
         """
         if self._has_temporal_topology == False:
             return None
@@ -205,65 +201,65 @@ class TemporalTopologyDatasetConnector(object):
         return relations
 
     def set_temporal_topology_build_true(self):
-        """!Same as name"""
+        """Same as name"""
         self._has_temporal_topology = True
 
     def set_temporal_topology_build_false(self):
-        """!Same as name"""
+        """Same as name"""
         self._has_temporal_topology = False
 
     def is_temporal_topology_build(self):
-        """!Check if the temporal topology was build"""
+        """Check if the temporal topology was build"""
         return self._has_temporal_topology
 
     def set_next(self, map):
-        """!Set the map that is temporally as closest located after this map.
+        """Set the map that is temporally as closest located after this map.
 
            Temporally located means that the start time of the "next" map is
            temporally located AFTER the start time of this map, but temporally
            near than other maps of the same dataset.
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         self._temporal_topology["NEXT"] = map
 
     def set_prev(self, map):
-        """!Set the map that is temporally as closest located before this map.
+        """Set the map that is temporally as closest located before this map.
 
            Temporally located means that the start time of the "previous" map is
            temporally located BEFORE the start time of this map, but temporally
            near than other maps of the same dataset.
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         self._temporal_topology["PREV"] = map
 
     def next(self):
-        """!Return the map with a start time temporally located after
+        """Return the map with a start time temporally located after
            the start time of this map, but temporal closer than other maps
 
-           @return A map object or None
+           :return: A map object or None
         """
         if "NEXT" not in self._temporal_topology:
             return None
         return self._temporal_topology["NEXT"]
 
     def prev(self):
-        """!Return the map with a start time temporally located before
+        """Return the map with a start time temporally located before
            the start time of this map, but temporal closer than other maps
 
-           @return A map object or None
+           :return: A map object or None
         """
         if "PREV" not in self._temporal_topology:
             return None
         return self._temporal_topology["PREV"]
 
     def append_equal(self, map):
-        """!Append a map with equivalent temporal extent as this map
+        """Append a map with equivalent temporal extent as this map
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "EQUAL" not in self._temporal_topology:
@@ -271,18 +267,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["EQUAL"].append(map)
 
     def get_equal(self):
-        """!Return a list of map objects with equivalent temporal extent as this map
+        """Return a list of map objects with equivalent temporal extent as this map
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "EQUAL" not in self._temporal_topology:
             return None
         return self._temporal_topology["EQUAL"]
 
     def append_starts(self, map):
-        """!Append a map that this map temporally starts with
+        """Append a map that this map temporally starts with
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "STARTS" not in self._temporal_topology:
@@ -290,18 +286,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["STARTS"].append(map)
 
     def get_starts(self):
-        """!Return a list of map objects that this map temporally starts with
+        """Return a list of map objects that this map temporally starts with
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "STARTS" not in self._temporal_topology:
             return None
         return self._temporal_topology["STARTS"]
 
     def append_started(self, map):
-        """!Append a map that this map temporally started with
+        """Append a map that this map temporally started with
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "STARTED" not in self._temporal_topology:
@@ -309,18 +305,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["STARTED"].append(map)
 
     def get_started(self):
-        """!Return a list of map objects that this map temporally started with
+        """Return a list of map objects that this map temporally started with
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "STARTED" not in self._temporal_topology:
             return None
         return self._temporal_topology["STARTED"]
 
     def append_finishes(self, map):
-        """!Append a map that this map temporally finishes with
+        """Append a map that this map temporally finishes with
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "FINISHES" not in self._temporal_topology:
@@ -328,18 +324,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["FINISHES"].append(map)
 
     def get_finishes(self):
-        """!Return a list of map objects that this map temporally finishes with
+        """Return a list of map objects that this map temporally finishes with
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "FINISHES" not in self._temporal_topology:
             return None
         return self._temporal_topology["FINISHES"]
 
     def append_finished(self, map):
-        """!Append a map that this map temporally finished with
+        """Append a map that this map temporally finished with
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "FINISHED" not in self._temporal_topology:
@@ -347,18 +343,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["FINISHED"].append(map)
 
     def get_finished(self):
-        """!Return a list of map objects that this map temporally finished with
+        """Return a list of map objects that this map temporally finished with
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "FINISHED" not in self._temporal_topology:
             return None
         return self._temporal_topology["FINISHED"]
 
     def append_overlaps(self, map):
-        """!Append a map that this map temporally overlaps
+        """Append a map that this map temporally overlaps
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "OVERLAPS" not in self._temporal_topology:
@@ -366,18 +362,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["OVERLAPS"].append(map)
 
     def get_overlaps(self):
-        """!Return a list of map objects that this map temporally overlaps
+        """Return a list of map objects that this map temporally overlaps
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "OVERLAPS" not in self._temporal_topology:
             return None
         return self._temporal_topology["OVERLAPS"]
 
     def append_overlapped(self, map):
-        """!Append a map that this map temporally overlapped
+        """Append a map that this map temporally overlapped
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "OVERLAPPED" not in self._temporal_topology:
@@ -385,18 +381,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["OVERLAPPED"].append(map)
 
     def get_overlapped(self):
-        """!Return a list of map objects that this map temporally overlapped
+        """Return a list of map objects that this map temporally overlapped
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "OVERLAPPED" not in self._temporal_topology:
             return None
         return self._temporal_topology["OVERLAPPED"]
 
     def append_follows(self, map):
-        """!Append a map that this map temporally follows
+        """Append a map that this map temporally follows
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "FOLLOWS" not in self._temporal_topology:
@@ -404,18 +400,18 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["FOLLOWS"].append(map)
 
     def get_follows(self):
-        """!Return a list of map objects that this map temporally follows
+        """Return a list of map objects that this map temporally follows
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "FOLLOWS" not in self._temporal_topology:
             return None
         return self._temporal_topology["FOLLOWS"]
 
     def append_precedes(self, map):
-        """!Append a map that this map temporally precedes
+        """Append a map that this map temporally precedes
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "PRECEDES" not in self._temporal_topology:
@@ -423,19 +419,19 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["PRECEDES"].append(map)
 
     def get_precedes(self):
-        """!Return a list of map objects that this map temporally precedes
+        """Return a list of map objects that this map temporally precedes
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "PRECEDES" not in self._temporal_topology:
             return None
         return self._temporal_topology["PRECEDES"]
 
     def append_during(self, map):
-        """!Append a map that this map is temporally located during
+        """Append a map that this map is temporally located during
            This includes temporal relationships starts and finishes
 
-           @param map This object should be of type 
+           :param map: This object should be of type 
                         AbstractMapDataset or derived classes
         """
         if "DURING" not in self._temporal_topology:
@@ -443,20 +439,20 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["DURING"].append(map)
 
     def get_during(self):
-        """!Return a list of map objects that this map is temporally located during
+        """Return a list of map objects that this map is temporally located during
            This includes temporally relationships starts and finishes
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "DURING" not in self._temporal_topology:
             return None
         return self._temporal_topology["DURING"]
 
     def append_contains(self, map):
-        """!Append a map that this map temporally contains
+        """Append a map that this map temporally contains
            This includes temporal relationships started and finished
 
-           @param map This object should be of type AbstractMapDataset 
+           :param map: This object should be of type AbstractMapDataset 
                         or derived classes
         """
         if "CONTAINS" not in self._temporal_topology:
@@ -464,10 +460,10 @@ class TemporalTopologyDatasetConnector(object):
         self._temporal_topology["CONTAINS"].append(map)
 
     def get_contains(self):
-        """!Return a list of map objects that this map temporally contains
+        """Return a list of map objects that this map temporally contains
            This includes temporal relationships started and finished
 
-           @return A list of map objects or None
+           :return: A list of map objects or None
         """
         if "CONTAINS" not in self._temporal_topology:
             return None
@@ -513,7 +509,7 @@ class TemporalTopologyDatasetConnector(object):
                                      fset=append_finished)
 
     def print_temporal_topology_info(self):
-        """!Print information about this class in human readable style"""
+        """Print information about this class in human readable style"""
         
         print " +-------------------- Temporal Topology -------------------------------------+"
         #          0123456789012345678901234567890
@@ -556,7 +552,7 @@ class TemporalTopologyDatasetConnector(object):
                 self._generate_map_list_string(self.finished)
 
     def print_temporal_topology_shell_info(self):
-        """!Print information about this class in shell style"""
+        """Print information about this class in shell style"""
         
         if self.next() is not None:
             print "next=" + self.next().get_id()

+ 68 - 71
lib/python/temporal/temporal_vector_algebra.py

@@ -1,5 +1,4 @@
-"""!@package grass.temporal
-
+"""
 Temporal vector algebra
 
 (C) 2014 by the GRASS Development Team
@@ -7,9 +6,9 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@authors Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
 
-@code
+.. code-block:: python
 
     >>> import grass.temporal as tgis
     >>> tgis.init(True)
@@ -416,7 +415,6 @@ for details.
     A* =  if condition True  then  A  else  B
     C = A*
 
-@endcode
 """
 
 import grass.pygrass.modules as pygrass
@@ -426,7 +424,7 @@ from temporal_algebra import *
 ##############################################################################
 
 class TemporalVectorAlgebraLexer(TemporalAlgebraLexer):
-    """!Lexical analyzer for the GRASS GIS temporal vector algebra"""
+    """Lexical analyzer for the GRASS GIS temporal vector algebra"""
 
     def __init__(self):
         TemporalAlgebraLexer.__init__(self)
@@ -511,7 +509,7 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
     ######################### Temporal functions ##############################
 
     def remove_intermediate_vector_maps(self):
-        """! Removes the intermediate vector maps.
+        """ Removes the intermediate vector maps.
         """
         if self.names != {}:
             namelist = self.names.values()
@@ -530,61 +528,60 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
                     m.run()
 
     def eval_toperator(self, operator, comparison = False):
-        """!This function evaluates a string containing temporal operations.
+        """This function evaluates a string containing temporal operations.
 
-          @param operator String of temporal operations, e.g. {equal|during,=!:}.
+          :param operator: String of temporal operations, e.g. {equal|during,=!:}.
 
-          @return List of temporal relations (equal, during), the given function
+          :return: List of temporal relations (equal, during), the given function
            (!:) and the interval/instances (=).
 
-          @code
-          >>> import grass.temporal as tgis
-          >>> tgis.init(True)
-          >>> p = tgis.TemporalVectorAlgebraParser()
-          >>> operator = "{equal,:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', ':')
-          >>> operator = "{equal|during,:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL', 'DURING'], '=', ':')
-          >>> operator = "{equal,!:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', '!:')
-          >>> operator = "{equal|during,!:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL', 'DURING'], '=', '!:')
-          >>> operator = "{equal|during,=!:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL', 'DURING'], '=', '!:')
-          >>> operator = "{equal|during|starts,#}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL', 'DURING', 'STARTS'], '=', '#')
-          >>> operator = "{!:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', '!:')
-          >>> operator = "{=:}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', ':')
-          >>> operator = "{#}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', '#')
-          >>> operator = "{equal|during}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL', 'DURING'], None, None)
-          >>> operator = "{equal}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], None, None)
-          >>> operator = "{equal,||}"
-          >>> p.eval_toperator(operator, True)
-          (['EQUAL'], '=', '||')
-          >>> operator = "{equal|during,&&}"
-          >>> p.eval_toperator(operator, True)
-          (['EQUAL', 'DURING'], '=', '&&')
-          >>> operator = "{&}"
-          >>> p.eval_toperator(operator)
-          (['EQUAL'], '=', '&')
-
-          @endcode
+          .. code-block:: python
+          
+              >>> import grass.temporal as tgis
+              >>> tgis.init(True)
+              >>> p = tgis.TemporalVectorAlgebraParser()
+              >>> operator = "{equal,:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', ':')
+              >>> operator = "{equal|during,:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL', 'DURING'], '=', ':')
+              >>> operator = "{equal,!:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', '!:')
+              >>> operator = "{equal|during,!:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL', 'DURING'], '=', '!:')
+              >>> operator = "{equal|during,=!:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL', 'DURING'], '=', '!:')
+              >>> operator = "{equal|during|starts,#}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL', 'DURING', 'STARTS'], '=', '#')
+              >>> operator = "{!:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', '!:')
+              >>> operator = "{=:}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', ':')
+              >>> operator = "{#}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', '#')
+              >>> operator = "{equal|during}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL', 'DURING'], None, None)
+              >>> operator = "{equal}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], None, None)
+              >>> operator = "{equal,||}"
+              >>> p.eval_toperator(operator, True)
+              (['EQUAL'], '=', '||')
+              >>> operator = "{equal|during,&&}"
+              >>> p.eval_toperator(operator, True)
+              (['EQUAL', 'DURING'], '=', '&&')
+              >>> operator = "{&}"
+              >>> p.eval_toperator(operator)
+              (['EQUAL'], '=', '&')
 
         """
 
@@ -596,15 +593,15 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
 
     def overlay_map_extent(self, mapA, mapB, bool_op = None, temp_op = '=',
                             copy = False):
-        """!Compute the spatio-temporal extent of two topological related maps
+        """Compute the spatio-temporal extent of two topological related maps
 
-           @param mapA The first map
-           @param mapB The second maps
-           @param bool_op The boolean operator specifying the spatial extent
+           :param mapA: The first map
+           :param mapB: The second maps
+           :param bool_op: The boolean operator specifying the spatial extent
                   operation (intersection, union, disjoint union)
-           @param temp_op The temporal operator specifying the temporal
+           :param temp_op: The temporal operator specifying the temporal
                   exntent operation (intersection, union, disjoint union)
-           @param copy Specifies if the temporal extent of mapB should be
+           :param copy: Specifies if the temporal extent of mapB should be
                   copied to mapA
         """
         returncode = TemporalAlgebraParser.overlay_map_extent(self, mapA, mapB,
@@ -789,15 +786,15 @@ class TemporalVectorAlgebraParser(TemporalAlgebraParser):
             t[0] = t[1]
 
     def create_overlay_operations(self, maplistA, maplistB, relations, temporal, function):
-        """!Create the spatial overlay operation commad list
+        """Create the spatial overlay operation commad list
 
-           @param maplistA A list of map objects
-           @param maplistB A list of map objects
-           @param relations The temporal relationships that must be fullfilled as list of strings
+           :param maplistA: A list of map objects
+           :param maplistB: A list of map objects
+           :param relations: The temporal relationships that must be fullfilled as list of strings
                             ("EQUAL", "DURING", ...)
-           @param temporal The temporal operator as string "=" or "&", ...
-           @param function The spatial overlay operations as string "&", "|", ...
-           @return Return the list of maps with overlay commands
+           :param temporal: The temporal operator as string "=" or "&", ...
+           :param function: The spatial overlay operations as string "&", "|", ...
+           :return: Return the list of maps with overlay commands
         """
         topolist = self.get_temporal_topo_list(maplistA, maplistB, topolist = relations)
 

+ 7 - 8
lib/python/temporal/temporal_vector_operator.py

@@ -1,5 +1,4 @@
-"""!@package grass.temporal
-
+"""
 Temporal vector operator evaluation with PLY
 
 (C) 2014 by the GRASS Development Team
@@ -7,9 +6,10 @@ This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@authors Thomas Leppelt and Soeren Gebbert
+:authors: Thomas Leppelt and Soeren Gebbert
+
+.. code-block:: python
 
-@code
     >>> import grass.temporal as tgis
     >>> tgis.init(True)
     >>> p = tgis.TemporalVectorOperatorParser()
@@ -62,7 +62,6 @@ for details.
     >>> print(p.relations, p.temporal, p.function)
     ([['overlaps', 'overlapped'], 'equal'], '|', '|')
     
-@endcode
 """
 try:
     import ply.lex as lex
@@ -71,7 +70,7 @@ except:
     pass
 
 class TemporalVectorOperatorLexer(object):
-    """!Lexical analyzer for the GRASS GIS temporal vector operators"""
+    """Lexical analyzer for the GRASS GIS temporal vector operators"""
     
     # Functions that defines topological relations.
     relations = {
@@ -164,7 +163,7 @@ class TemporalVectorOperatorLexer(object):
              print tok
              
 class TemporalVectorOperatorParser(object):
-    """!The parser for the GRASS GIS temporal vector operators"""
+    """The parser for the GRASS GIS temporal vector operators"""
     
     def __init__(self):
         self.lexer = TemporalVectorOperatorLexer()
@@ -346,4 +345,4 @@ class TemporalVectorOperatorParser(object):
 if __name__ == "__main__":
     import doctest
     doctest.testmod()
-    
+    

+ 3 - 15
lib/python/temporal/unit_tests.py

@@ -1,24 +1,12 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS unit tests
-
-Usage:
-
-@code
-import grass.temporal as tgis
-
-tgis.test_increment_datetime_by_string()
-...
-@endcode
+"""
+Depricazed unittests
 
 (C) 2008-2011 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 import copy
 from datetime import datetime, date, time, timedelta

+ 25 - 29
lib/python/temporal/univar_statistics.py

@@ -1,26 +1,22 @@
-"""!@package grass.temporal
-
-@brief GRASS Python scripting module (temporal GIS functions)
-
-Temporal GIS related functions to be used in Python scripts.
+"""
+Univariate statistic function for space time datasets
 
 Usage:
 
-@code
+.. code-block:: python
+
 import grass.temporal as tgis
 
-tgis.print_gridded_dataset_univar_statistics(
-    type, input, where, extended, no_header, fs)
+    tgis.print_gridded_dataset_univar_statistics(
+        type, input, where, extended, no_header, fs)
 
-...
-@endcode
 
 (C) 2012-2013 by the GRASS Development Team
 This program is free software under the GNU General Public
 License (>=v2). Read the file COPYING that comes with GRASS
 for details.
 
-@author Soeren Gebbert
+:authors: Soeren Gebbert
 """
 
 from open_stds import *
@@ -31,14 +27,14 @@ import grass.script as gscript
 
 def print_gridded_dataset_univar_statistics(type, input, where, extended,
                                             no_header=False, fs="|"):
-    """!Print univariate statistics for a space time raster or raster3d dataset
-
-       @param type Must be "strds" or "str3ds"
-       @param input The name of the space time dataset
-       @param where A temporal database where statement
-       @param extended If True compute extended statistics
-       @param no_header Supress the printing of column names
-       @param fs Field separator
+    """Print univariate statistics for a space time raster or raster3d dataset
+
+       :param type: Must be "strds" or "str3ds"
+       :param input: The name of the space time dataset
+       :param where: A temporal database where statement
+       :param extended: If True compute extended statistics
+       :param no_header: Supress the printing of column names
+       :param fs: Field separator
     """
 
     # We need a database interface
@@ -108,18 +104,18 @@ def print_gridded_dataset_univar_statistics(type, input, where, extended,
 
 def print_vector_dataset_univar_statistics(input, twhere, layer, type, column,
                                            where, extended, no_header=False, fs="|"):
-    """!Print univariate statistics for a space time vector dataset
+    """Print univariate statistics for a space time vector dataset
 
-       @param input The name of the space time dataset
-       @param twhere A temporal database where statement
-       @param layer The layer number used in case no layer is present
+       :param input: The name of the space time dataset
+       :param twhere: A temporal database where statement
+       :param layer: The layer number used in case no layer is present
               in the temporal dataset
-       @param type options: point,line,boundary,centroid,area
-       @param column The name of the attribute column
-       @param where A temporal database where statement
-       @param extended If True compute extended statistics
-       @param no_header Supress the printing of column names
-       @param fs Field separator
+       :param type: options: point,line,boundary,centroid,area
+       :param column: The name of the attribute column
+       :param where: A temporal database where statement
+       :param extended: If True compute extended statistics
+       :param no_header: Supress the printing of column names
+       :param fs: Field separator
     """
 
     # We need a database interface