コード例 #1
0
 def set_default(self):
     """Set the Region object to the default GRASS region.
     It works only in PERMANENT mapset"""
     from grass.pygrass.gis import Mapset
     mapset = Mapset()
     if mapset.name != 'PERMANENT':
         raise GrassError("ERROR: Unable to change default region. The " \
                          "current mapset is not <PERMANENT>.")
     self.adjust()
     if libgis.G_put_window(self.c_region) < 0:
         raise GrassError("Cannot change region (DEFAUL_WIND file).")
コード例 #2
0
    def write(self):
        """Writes the region from this region object

        This function writes this region to the Region file (WIND)
        in the users current mapset. This function should be
        carefully used, since the user will ot notice if his region
        was changed and would expect that only g.region will do this.

         Example ::

         >>> from copy import deepcopy
         >>> r = Region()
         >>> rn = deepcopy(r)
         >>> r.north = 20
         >>> r.south = 10

         >>> r.write()
         >>> r.read()
         >>> r.north
         20.0
         >>> r.south
         10.0

         >>> rn.write()
         >>> r.read()
         >>> r.north
         40.0
         >>> r.south
         0.0

         >>> r.read_default()
         >>> r.write()

         ..
        """
        self.adjust()
        if libgis.G_put_window(self.byref()) < 0:
            raise GrassError("Cannot change region (WIND file).")
コード例 #3
0
ファイル: region.py プロジェクト: cz172638/pygrass
 def set_default(self):
     self.adjust()
     if libgis.G_put_window(self.c_region) < 0:
         raise GrassError("Cannot change region (WIND file).")