[GRASS-SVN] r71676 - grass-addons/grass7/raster/r.cell.area
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Nov 11 08:29:42 PST 2017
Author: awickert
Date: 2017-11-11 08:29:42 -0800 (Sat, 11 Nov 2017)
New Revision: 71676
Modified:
grass-addons/grass7/raster/r.cell.area/r.cell.area.py
Log:
unicode to str
Modified: grass-addons/grass7/raster/r.cell.area/r.cell.area.py
===================================================================
--- grass-addons/grass7/raster/r.cell.area/r.cell.area.py 2017-11-11 15:44:51 UTC (rev 71675)
+++ grass-addons/grass7/raster/r.cell.area/r.cell.area.py 2017-11-11 16:29:42 UTC (rev 71676)
@@ -1,6 +1,5 @@
#! /usr/bin/env python
-#!/usr/bin/env python
############################################################################
#
# MODULE: r.cell.area
@@ -69,14 +68,15 @@
if not grass.overwrite():
grass.fatal("Raster map '" + options['output'] +
"' already exists. Use '--o' to overwrite.")
-
+
+ projunits = str(projinfo['units']) # Unicode to str
# Then compute
- if (projinfo['units'] == 'meters') or (projinfo['units'] == 'Meters'):
+ if (projunits == 'meters') or (projunits == 'Meters'):
if units == 'm2':
grass.mapcalc(output+' = nsres() * ewres()')
elif units == 'km2':
grass.mapcalc(output+' = nsres() * ewres() / 10.^6')
- elif (projinfo['units'] == 'degrees') or (projinfo['units'] == 'Degrees'):
+ elif (projunits == 'degrees') or (projunits == 'Degrees'):
if units == 'm2':
grass.mapcalc(output+' = ( 111195. * nsres() ) * \
( ewres() * '+str(np.pi/180.)+' * 6371000. * cos(y()) )')
@@ -84,7 +84,7 @@
grass.mapcalc(output+' = ( 111.195 * nsres() ) * \
( ewres() * '+str(np.pi/180.)+' * 6371. * cos(y()) )')
else:
- print 'Units: ', projinfo['units'], ' not currently supported'
+ print 'Units: ', projunits, ' not currently supported'
if __name__ == "__main__":
main()
More information about the grass-commit
mailing list