[GRASS-SVN] r71329 - grass-addons/grass7/raster/r.hypso
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Aug 5 01:49:54 PDT 2017
Author: madi
Date: 2017-08-05 01:49:54 -0700 (Sat, 05 Aug 2017)
New Revision: 71329
Modified:
grass-addons/grass7/raster/r.hypso/r.hypso.py
Log:
fixed warning: VisibleDeprecationWarning: using a non-integer number instead of an integer will result in an error in the future
Modified: grass-addons/grass7/raster/r.hypso/r.hypso.py
===================================================================
--- grass-addons/grass7/raster/r.hypso/r.hypso.py 2017-08-04 18:38:24 UTC (rev 71328)
+++ grass-addons/grass7/raster/r.hypso/r.hypso.py 2017-08-05 08:49:54 UTC (rev 71329)
@@ -4,10 +4,10 @@
# MODULE: r.hypso.py
#
# AUTHOR(S): Margherita Di Leo, Massimo Di Stefano, Francesco Di Stefano
-#
#
-# PURPOSE: Output a hypsometric and hypsographic graph
#
+# PURPOSE: Output a hypsometric and hypsographic graph
+#
# COPYRIGHT: (c) 2010 Margherita Di Leo, Massimo Di Stefano, Francesco Di Stefano
#
# This program is free software under the GNU General Public
@@ -16,8 +16,8 @@
#
# REQUIRES: Matplotlib
# http://matplotlib.sourceforge.net/
-#
#
+#
################################################################################
#%module
#% description: Outputs a hypsometric and hypsographic graph.
@@ -120,10 +120,10 @@
Xf = np.where(Xf==Xf.min())
item = itemgetter(0)(Xf)
Xf = item[0] # added this further step to handle the case the function has 2 min
- z1 = kl[float(Xf)][0]
- z2 = kl[float(Xf-1)][0]
- f1 = kl[float(Xf)][1]
- f2 = kl[float(Xf-1)][1]
+ z1 = kl[Xf][0]
+ z2 = kl[Xf-1][0]
+ f1 = kl[Xf][1]
+ f2 = kl[Xf-1][1]
z = z1 + ((z2 - z1) / (f2 - f1)) * (f - f1)
return z
@@ -136,11 +136,8 @@
plt.title(title)
plt.grid(True)
plt.savefig(image)
- plt.close('all')
-
+ plt.close('all')
+
if __name__ == "__main__":
options, flags = grass.parser()
sys.exit(main())
-
-
-
More information about the grass-commit
mailing list