[GRASS-SVN] r74326 - grass/trunk/lib/python/script

svn_grass at osgeo.org svn_grass at osgeo.org
Thu Mar 28 08:14:10 PDT 2019


Author: sbl
Date: 2019-03-28 08:14:10 -0700 (Thu, 28 Mar 2019)
New Revision: 74326

Modified:
   grass/trunk/lib/python/script/array.py
Log:
fix doctests

Modified: grass/trunk/lib/python/script/array.py
===================================================================
--- grass/trunk/lib/python/script/array.py	2019-03-28 15:13:13 UTC (rev 74325)
+++ grass/trunk/lib/python/script/array.py	2019-03-28 15:14:10 UTC (rev 74326)
@@ -23,10 +23,10 @@
 ...
 >>> # Lets have a look at the array
 ... print(map2d_1)
-[[ 0.  1.  2.  3.  4.  5.]
- [ 1.  2.  3.  4.  5.  6.]
- [ 2.  3.  4.  5.  6.  7.]
- [ 3.  4.  5.  6.  7.  8.]]
+[[0. 1. 2. 3. 4. 5.]
+ [1. 2. 3. 4. 5. 6.]
+ [2. 3. 4. 5. 6. 7.]
+ [3. 4. 5. 6. 7. 8.]]
 >>> # This will write the numpy array as GRASS raster map
 ... # with name map2d_1
 ... map2d_1.write(mapname="map2d_1", overwrite=True)
@@ -39,10 +39,10 @@
 ... map2d_2 %= 3
 >>> # Show the result
 ... print(map2d_2)
-[[ 0.  1.  2.  0.  1.  2.]
- [ 1.  2.  0.  1.  2.  0.]
- [ 2.  0.  1.  2.  0.  1.]
- [ 0.  1.  2.  0.  1.  2.]]
+[[0. 1. 2. 0. 1. 2.]
+ [1. 2. 0. 1. 2. 0.]
+ [2. 0. 1. 2. 0. 1.]
+ [0. 1. 2. 0. 1. 2.]]
 >>> # Write the result as new raster map with name map2d_2
 ... map2d_2.write(mapname="map2d_2", overwrite=True)
 0
@@ -60,20 +60,20 @@
 ...
 >>> # Lets have a look at the 3D array
 ... print(map3d_1)
-[[[  0.   1.   2.   3.   4.   5.]
-  [  1.   2.   3.   4.   5.   6.]
-  [  2.   3.   4.   5.   6.   7.]
-  [  3.   4.   5.   6.   7.   8.]]
+[[[ 0.  1.  2.  3.  4.  5.]
+  [ 1.  2.  3.  4.  5.  6.]
+  [ 2.  3.  4.  5.  6.  7.]
+  [ 3.  4.  5.  6.  7.  8.]]
 <BLANKLINE>
- [[  1.   2.   3.   4.   5.   6.]
-  [  2.   3.   4.   5.   6.   7.]
-  [  3.   4.   5.   6.   7.   8.]
-  [  4.   5.   6.   7.   8.   9.]]
+ [[ 1.  2.  3.  4.  5.  6.]
+  [ 2.  3.  4.  5.  6.  7.]
+  [ 3.  4.  5.  6.  7.  8.]
+  [ 4.  5.  6.  7.  8.  9.]]
 <BLANKLINE>
- [[  2.   3.   4.   5.   6.   7.]
-  [  3.   4.   5.   6.   7.   8.]
-  [  4.   5.   6.   7.   8.   9.]
-  [  5.   6.   7.   8.   9.  10.]]]
+ [[ 2.  3.  4.  5.  6.  7.]
+  [ 3.  4.  5.  6.  7.  8.]
+  [ 4.  5.  6.  7.  8.  9.]
+  [ 5.  6.  7.  8.  9. 10.]]]
 >>> # This will write the numpy array as GRASS 3D raster map
 ... # with name map3d_1
 ... map3d_1.write(mapname="map3d_1", overwrite=True)
@@ -85,20 +85,20 @@
 ... map3d_2 %= 3
 >>> # Show the result
 ... print(map3d_2)
-[[[ 0.  1.  2.  0.  1.  2.]
-  [ 1.  2.  0.  1.  2.  0.]
-  [ 2.  0.  1.  2.  0.  1.]
-  [ 0.  1.  2.  0.  1.  2.]]
+[[[0. 1. 2. 0. 1. 2.]
+  [1. 2. 0. 1. 2. 0.]
+  [2. 0. 1. 2. 0. 1.]
+  [0. 1. 2. 0. 1. 2.]]
 <BLANKLINE>
- [[ 1.  2.  0.  1.  2.  0.]
-  [ 2.  0.  1.  2.  0.  1.]
-  [ 0.  1.  2.  0.  1.  2.]
-  [ 1.  2.  0.  1.  2.  0.]]
+ [[1. 2. 0. 1. 2. 0.]
+  [2. 0. 1. 2. 0. 1.]
+  [0. 1. 2. 0. 1. 2.]
+  [1. 2. 0. 1. 2. 0.]]
 <BLANKLINE>
- [[ 2.  0.  1.  2.  0.  1.]
-  [ 0.  1.  2.  0.  1.  2.]
-  [ 1.  2.  0.  1.  2.  0.]
-  [ 2.  0.  1.  2.  0.  1.]]]
+ [[2. 0. 1. 2. 0. 1.]
+  [0. 1. 2. 0. 1. 2.]
+  [1. 2. 0. 1. 2. 0.]
+  [2. 0. 1. 2. 0. 1.]]]
 >>> # Write the result as new 3D raster map with name map3d_2
 ... map3d_2.write(mapname="map3d_2", overwrite=True)
 0



More information about the grass-commit mailing list