Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4. Go directly to the new manual page here
Created on Fri May 25 12:57:10 2012
@author: Pietro Zambelli
Bases: object
This class is design to easily access and modify GRASS computational region.
>>> default = Region(default=True)
>>> current_original = Region()
>>> current = Region()
>>> current.align('elevation')
>>> default == current
True
>>> current.cols
1500
>>> current.ewres
10.0
>>> current.cols = 3000
>>> current.ewres
5.0
>>> current.ewres = 20.0
>>> current.cols
750
>>> current.set_current()
>>> default == current
False
>>> current.get_default()
>>> default = Region(default=True)
>>> default == current
True
>>> current_original.set_current()
Adjust rows and cols number according with the nsres and ewres resolutions. If rows or cols parameters are True, the adjust method update nsres and ewres according with the rows and cols numbers.
Adjust region cells to cleanly align with this raster map
Parameters: | raster_name (str) – the name of raster |
---|
Set and obtain bottom value
Set and obtain number of columns
Set and obtain east coordinate
Set and obtain east-west resolution value
Return a Bbox object with the extension of the region.
>>> reg = Region()
>>> reg.get_bbox()
Bbox(228500.0, 215000.0, 645000.0, 630000.0)
Return a list of tuple with key and value.
>>> reg = Region()
>>> reg.items()
[(u'proj', 99), ..., (u'cells', 2025000)]
Return a list of valid keys.
>>> reg = Region()
>>> reg.keys()
[u'proj', u'zone', ..., u'cols', u'cells']
Set and obtain north coordinate
Set and obtain north-south resolution value
Set and obtain number of rows
Set region extent from Bbox
Parameters: | bbox (Bbox object) – a Bbox object to set the extent |
---|
>>> from grass.pygrass.vector.basic import Bbox
>>> b = Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
>>> reg = Region()
>>> reg.set_bbox(b)
>>> reg.get_bbox()
Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
>>> reg.get_current()
Set the Region object to the default GRASS region. It works only in PERMANENT mapset
Set and obtain south coordinate
Set and obtain top-bottom 3D value
Set and obtain top value
Adjust bounding box of region using a vector
Parameters: | vector_name (str) – the name of vector |
---|
>>> reg = Region()
>>> reg.vect('census')
>>> reg.get_bbox()
Bbox(230963.640878, 212125.562878, 645837.437393, 628769.374393)
>>> reg.get_default()
Set and obtain west coordinate
Bases: object
Return Gisdbase object.
>>> from grass.script.core import gisenv
>>> gisdbase = Gisdbase()
>>> gisdbase.name == gisenv()['GISDBASE']
True
Return a list of locations that are available in the gisdbase:
>>> gisdbase = Gisdbase()
>>> gisdbase.locations()
[...]
Set or obtain the name of GISDBASE
Bases: object
Location object
>>> from grass.script.core import gisenv
>>> location = Location()
>>> location
Location(...)
>>> location.gisdbase == gisenv()['GISDBASE']
True
>>> location.name == gisenv()['LOCATION_NAME']
True
Set or obtain the name of GISDBASE
Return a list of the available mapsets.
Parameters: |
|
---|---|
Returns: | a list of mapset’s names |
Return type: | list of strings |
>>> location = Location()
>>> sorted(location.mapsets())
['PERMANENT', 'user1']
Set or obtain the name of LOCATION
Bases: object
Mapset
>>> mapset = Mapset()
>>> mapset
Mapset('user1')
>>> mapset.gisdbase
'/home/...'
>>> mapset.location
'nc_basic_spm_grass7'
>>> mapset.name
'user1'
Set or obtain the name of GISDBASE
Return a list of grass types like:
- ‘group’,
- ‘label’,
- ‘raster’,
- ‘raster_3d’,
- ‘region’,
- ‘vector’,
Parameters: |
|
---|
>>> mapset = Mapset('PERMANENT')
>>> rast = mapset.glist('rast')
>>> rast.sort()
>>> rast
['basins', 'elevation', ...]
>>> sorted(mapset.glist('rast', pattern='el*'))
['elevation', 'elevation_shade']
Set or obtain the name of LOCATION
Set or obtain the name of MAPSET
Bases: object
VisibleMapset object:
>>> mapset = VisibleMapset('user1')
>>> mapset
['user1', 'PERMANENT']
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.4. Go directly to the new manual page here
Help Index | Topics Index | Keywords Index | Full Index
© 2003-2018 GRASS Development Team, GRASS GIS 7.0.7svn Reference Manual