Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8. Go directly to the new manual page here
Bases: object
Run GRASS raster commands in a multiprocessing mode.
Parameters: |
|
---|
>>> grd = GridModule('r.slope.aspect',
... width=500, height=500, overlap=2,
... processes=None, split=False,
... elevation='elevation',
... slope='slope', aspect='aspect', overwrite=True)
>>> grd.run()
Remove all created mapsets.
Parameters: | location (Location object) – a Location instance where we are running the analysis |
---|
Create a mapset, and execute a cmd inside.
Parameters: | args (tuple) – is a tuple that contains several information see below |
---|---|
Returns: | None |
The puple has to contain:
Copy group from one mapset to another, crop the raster to the region
Parameters: |
|
---|---|
Returns: | None |
Copy mapset to another place without copying raster and vector data.
Parameters: |
|
---|---|
Returns: | the instance of the new Mapset. |
>>> from grass.script.core import gisenv
>>> mname = gisenv()['MAPSET']
>>> mset = Mapset()
>>> mset.name == mname
True
>>> import tempfile as tmp
>>> import os
>>> path = os.path.join(tmp.gettempdir(), 'my_loc', 'my_mset')
>>> copy_mapset(mset, path)
Mapset(...)
>>> sorted(os.listdir(path))
[...'PERMANENT'...]
>>> sorted(os.listdir(os.path.join(path, 'PERMANENT')))
[u'DEFAULT_WIND', u'PROJ_EPSG', u'PROJ_INFO', u'PROJ_UNITS', u'VAR', u'WIND']
>>> sorted(os.listdir(os.path.join(path, mname)))
[...u'SEARCH_PATH',...u'WIND']
>>> import shutil
>>> shutil.rmtree(path)
Copy rasters from one mapset to another, crop the raster to the region.
Parameters: |
|
---|---|
Returns: | None |
Copy all the special GRASS files that are contained in a mapset to another mapset
Parameters: |
|
---|
Copy vectors from one mapset to another, crop the raster to the region.
Parameters: |
|
---|---|
Returns: | None |
Transform a cmd dictionary to a list of parameters. It is useful to pickle a Module class and cnvert into a string that can be used with Popen(get_cmd(cmdd), shell=True).
Parameters: | cmdd (dict) – a module dictionary with all the parameters |
---|
>>> slp = Module('r.slope.aspect',
... elevation='ele', slope='slp', aspect='asp',
... overwrite=True, run_=False)
>>> get_cmd(slp.get_dict())
['r.slope.aspect', u'elevation=ele', u'format=degrees', ..., u'--o']
Get mapset from a GISRC source to a GISRC destination.
Parameters: |
|
---|---|
Returns: | a tuple with Mapset(src), Mapset(dst) |
Read a GISRC file and return a tuple with the mapset, location and gisdbase.
Parameters: | gisrc (str) – the path to GISRC file |
---|---|
Returns: | a tuple with the mapset, location and gisdbase |
>>> import os
>>> from grass.script.core import gisenv
>>> genv = gisenv()
>>> (read_gisrc(os.environ['GISRC']) == (genv['MAPSET'],
... genv['LOCATION_NAME'],
... genv['GISDBASE']))
True
Select only a certain type of parameters.
Parameters: |
|
---|---|
Returns: | An iterator with the value of the parameter. |
>>> slp = Module('r.slope.aspect',
... elevation='ele', slope='slp', aspect='asp',
... run_=False)
>>> for rast in select(slp.outputs, 'raster'):
... print(rast)
...
slp
asp
Set a region into two different mapsets.
Parameters: |
|
---|---|
Returns: | None |
Created on Tue Apr 2 18:57:42 2013
@author: pietro
Convert a Bounding Box to a list of the index of column start, end, row start and end
Parameters: | bbox_list (list of BBox object) – a list of BBox object to convert |
---|
Patch raster using a bounding box list to trim the raster.
Parameters: |
|
---|
Created on Tue Apr 2 19:00:15 2013
@author: pietro
Return a Bbox
Parameters: |
|
---|
Get the Bbox of the overlapped region.
Parameters: |
|
---|
Spit a region into a list of Bbox.
Parameters: |
|
---|
>>> reg = Region()
>>> reg.north = 1350
>>> reg.south = 0
>>> reg.nsres = 1
>>> reg.east = 1500
>>> reg.west = 0
>>> reg.ewres = 1
>>> reg.cols
1500
>>> reg.rows
1350
>>> split_region_tiles(region=reg, width=1000, height=700, overlap=0)
[[Bbox(1350.0, 650.0, 1000.0, 0.0), Bbox(1350.0, 650.0, 1500.0, 1000.0)],
[Bbox(650.0, 0.0, 1000.0, 0.0), Bbox(650.0, 0.0, 1500.0, 1000.0)]]
>>> split_region_tiles(region=reg, width=1000, height=700, overlap=10)
[[Bbox(1350.0, 640.0, 1010.0, 0.0), Bbox(1350.0, 640.0, 1500.0, 990.0)],
[Bbox(660.0, 0.0, 1010.0, 0.0), Bbox(660.0, 0.0, 1500.0, 990.0)]]
Note: A new GRASS GIS stable version has been released: GRASS GIS 7.8. Go directly to the new manual page here
Help Index | Topics Index | Keywords Index | Full Index
© 2003-2020 GRASS Development Team, GRASS GIS 7.6.2dev Reference Manual