[GRASS-SVN] r73604 - grass-addons/grass7/raster/r.gsflow.hydrodem
svn_grass at osgeo.org
svn_grass at osgeo.org
Tue Oct 23 07:42:09 PDT 2018
Author: awickert
Date: 2018-10-23 07:42:09 -0700 (Tue, 23 Oct 2018)
New Revision: 73604
Modified:
grass-addons/grass7/raster/r.gsflow.hydrodem/r.gsflow.hydrodem.py
Log:
r.gsflow.hydrodem: restore grid-resolution finder
Modified: grass-addons/grass7/raster/r.gsflow.hydrodem/r.gsflow.hydrodem.py
===================================================================
--- grass-addons/grass7/raster/r.gsflow.hydrodem/r.gsflow.hydrodem.py 2018-10-23 13:34:29 UTC (rev 73603)
+++ grass-addons/grass7/raster/r.gsflow.hydrodem/r.gsflow.hydrodem.py 2018-10-23 14:42:09 UTC (rev 73604)
@@ -105,6 +105,15 @@
#resolution = float(options['resolution'])
streams_MODFLOW = options['streams_modflow']
DEM_MODFLOW = options['dem_modflow']
+
+ # Get number of rows and columns
+ colNames = np.array(gscript.vector_db_select(grid, layer=1)['columns'])
+ colValues = np.array(gscript.vector_db_select(grid, layer=1)['values'].values())
+ cats = colValues[:,colNames == 'cat'].astype(int).squeeze()
+ rows = colValues[:,colNames == 'row'].astype(int).squeeze()
+ cols = colValues[:,colNames == 'col'].astype(int).squeeze()
+ nRows = np.max(rows)
+ nCols = np.max(cols)
gscript.use_temp_region()
@@ -114,8 +123,7 @@
type='line', overwrite=gscript.overwrite(), quiet=True)
r.mapcalc('tmp'+" = "+streams_MODFLOW+" * " + dem, overwrite=True)
g.rename(raster=('tmp',streams_MODFLOW), overwrite=True, quiet=True)
- g.region(raster=DEM_MODFLOW, quiet=True)
- print "ALTERED"
+ g.region(vector=grid, rows=nRows, cols=nCols, quiet=True)
r.resamp_stats(input=streams_MODFLOW, output=streams_MODFLOW,
method='average', overwrite=gscript.overwrite(), quiet=True)
r.resamp_stats(input=dem, output=DEM_MODFLOW, method='average',
More information about the grass-commit
mailing list