[GRASS-SVN] r65613 - in grass/trunk: lib/python/gunittest/testsuite lib/vector/testsuite raster/r.recode/testsuite vector/v.net/testsuite vector/v.what/testsuite
svn_grass at osgeo.org
svn_grass at osgeo.org
Sat Jul 18 09:05:13 PDT 2015
Author: wenzeslaus
Date: 2015-07-18 09:05:13 -0700 (Sat, 18 Jul 2015)
New Revision: 65613
Modified:
grass/trunk/lib/python/gunittest/testsuite/test_assertions.py
grass/trunk/lib/python/gunittest/testsuite/test_assertions_vect.py
grass/trunk/lib/vector/testsuite/test_topology_vgeneralize.sh
grass/trunk/raster/r.recode/testsuite/test_rrecode_ncspm.py
grass/trunk/vector/v.net/testsuite/test_v_net.py
grass/trunk/vector/v.what/testsuite/test_vwhat_ncspm.py
Log:
migrate tests to NC basic location (mostly aligned with new std dataset)
Modified: grass/trunk/lib/python/gunittest/testsuite/test_assertions.py
===================================================================
--- grass/trunk/lib/python/gunittest/testsuite/test_assertions.py 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/lib/python/gunittest/testsuite/test_assertions.py 2015-07-18 16:05:13 UTC (rev 65613)
@@ -173,7 +173,7 @@
precision=0.01)
self.assertRaises(self.failureException,
self.assertRasterFitsUnivar,
- 'aspect', R_UNIVAR_ELEVATION_SUBSET, precision=0.01)
+ 'geology', R_UNIVAR_ELEVATION_SUBSET, precision=0.01)
self.assertRaises(ValueError,
self.assertRasterFitsUnivar,
'elevation', RANDOM_KEYVALUES)
@@ -182,7 +182,7 @@
self.assertRasterFitsInfo('elevation', R_INFO_ELEVATION_SUBSET)
self.assertRaises(self.failureException,
self.assertRasterFitsInfo,
- 'elev_lid792_1m', R_INFO_ELEVATION_SUBSET)
+ 'geology', R_INFO_ELEVATION_SUBSET)
self.assertRaises(ValueError,
self.assertRasterFitsInfo,
'elevation', RANDOM_KEYVALUES)
@@ -208,7 +208,7 @@
self.assertRaises(self.failureException,
self.assertRastersNoDifference,
actual='elevation',
- reference='aspect',
+ reference='geology',
precision=1,
msg="Different maps should have difference")
@@ -222,7 +222,7 @@
self.assertRaises(self.failureException,
self.assertRastersNoDifference,
actual='elevation',
- reference='aspect',
+ reference='geology',
precision=1,
statistics=dict(mean=0),
msg="The difference of different maps should have huge mean")
Modified: grass/trunk/lib/python/gunittest/testsuite/test_assertions_vect.py
===================================================================
--- grass/trunk/lib/python/gunittest/testsuite/test_assertions_vect.py 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/lib/python/gunittest/testsuite/test_assertions_vect.py 2015-07-18 16:05:13 UTC (rev 65613)
@@ -9,14 +9,15 @@
from grass.gunittest.main import test
-V_UNIVAR_BRIDGES_WIDTH_SUBSET = """n=10938
+V_UNIVAR_SCHOOLS_WIDTH_SUBSET = """n=144
nmissing=0
-nnull=0
+nnull=23
min=0
-max=1451
-range=1451
-sum=2.6299e+06
-mean=240.437
+max=2294
+range=2294
+sum=109978
+mean=763.736
+mean_abs=763.736
"""
RANDOM_KEYVALUES = """abc=2025000
@@ -24,32 +25,32 @@
bbb=156.329864501953
"""
-# v.info bridges -t
-V_UNIVAR_BRIDGES_TOPO = dict(
+# v.info schools -t
+V_UNIVAR_SCHOOLS_TOPO = dict(
nodes=0,
- points=10938,
+ points=167,
lines=0,
boundaries=0,
centroids=0,
areas=0,
islands=0,
- primitives=10938,
+ primitives=167,
map3d=0,
)
-# v.info bridges -g and rounded
-V_UNIVAR_BRIDGES_REGION = dict(
- north=317757,
- south=14691,
- east=915045,
- west=125794,
+# v.info schools -g and rounded
+V_UNIVAR_SCHOOLS_REGION = dict(
+ north=248160,
+ south=203560,
+ east=671715,
+ west=619215,
top=0,
bottom=0,
)
-# v.info bridges -g and reduced to minumum
-V_UNIVAR_BRIDGES_EXTENDED = dict(
- name='bridges',
+# v.info schools -g and reduced to minumum
+V_UNIVAR_SCHOOLS_EXTENDED = dict(
+ name='schools',
level=2,
num_dblinks=1,
)
@@ -59,67 +60,67 @@
"""Test assertions of map meta and statistics"""
# pylint: disable=R0904
def test_assertVectorFitsUnivar(self):
- self.assertVectorFitsUnivar(map='bridges', column='WIDTH',
- reference=V_UNIVAR_BRIDGES_WIDTH_SUBSET,
+ self.assertVectorFitsUnivar(map='schools', column='CORECAPACI',
+ reference=V_UNIVAR_SCHOOLS_WIDTH_SUBSET,
precision=0.01)
self.assertRaises(self.failureException,
self.assertVectorFitsUnivar,
- map='bridges', column='YEAR_BUILT',
- reference=V_UNIVAR_BRIDGES_WIDTH_SUBSET,
+ map='schools', column='GLEVEL',
+ reference=V_UNIVAR_SCHOOLS_WIDTH_SUBSET,
precision=0.01)
self.assertRaises(ValueError,
self.assertVectorFitsUnivar,
- map='bridges', column='WIDTH',
+ map='schools', column='CORECAPACI',
reference=RANDOM_KEYVALUES)
def test_assertVectorFitsTopoInfo(self):
- self.assertVectorFitsTopoInfo('bridges', V_UNIVAR_BRIDGES_TOPO)
+ self.assertVectorFitsTopoInfo('schools', V_UNIVAR_SCHOOLS_TOPO)
self.assertRaises(self.failureException,
self.assertVectorFitsTopoInfo,
- 'lakes',
- V_UNIVAR_BRIDGES_TOPO)
+ 'hospitals',
+ V_UNIVAR_SCHOOLS_TOPO)
self.assertRaises(ValueError,
self.assertVectorFitsTopoInfo,
- 'bridges', RANDOM_KEYVALUES)
+ 'schools', RANDOM_KEYVALUES)
self.assertRaises(ValueError,
self.assertVectorFitsTopoInfo,
- 'bridges', V_UNIVAR_BRIDGES_REGION)
+ 'schools', V_UNIVAR_SCHOOLS_REGION)
def test_assertVectorFitsRegionInfo(self):
- self.assertVectorFitsRegionInfo('bridges', V_UNIVAR_BRIDGES_REGION, precision=1.0)
+ self.assertVectorFitsRegionInfo('schools', V_UNIVAR_SCHOOLS_REGION, precision=1.0)
self.assertRaises(self.failureException,
self.assertVectorFitsRegionInfo,
- 'lakes', V_UNIVAR_BRIDGES_REGION, precision=1.0)
+ 'hospitals', V_UNIVAR_SCHOOLS_REGION, precision=1.0)
self.assertRaises(ValueError,
self.assertVectorFitsRegionInfo,
- 'bridges', RANDOM_KEYVALUES, precision=1.0)
+ 'schools', RANDOM_KEYVALUES, precision=1.0)
self.assertRaises(ValueError,
self.assertVectorFitsRegionInfo,
- 'bridges', V_UNIVAR_BRIDGES_TOPO, precision=1.0)
+ 'schools', V_UNIVAR_SCHOOLS_TOPO, precision=1.0)
def test_assertVectorFitsExtendedInfo(self):
- self.assertVectorFitsExtendedInfo('bridges', V_UNIVAR_BRIDGES_EXTENDED)
+ self.assertVectorFitsExtendedInfo('schools', V_UNIVAR_SCHOOLS_EXTENDED)
self.assertRaises(self.failureException,
self.assertVectorFitsExtendedInfo,
- 'lakes',
- V_UNIVAR_BRIDGES_EXTENDED)
+ 'hospitals',
+ V_UNIVAR_SCHOOLS_EXTENDED)
self.assertRaises(ValueError,
self.assertVectorFitsExtendedInfo,
- 'bridges',
+ 'schools',
RANDOM_KEYVALUES)
self.assertRaises(ValueError,
self.assertVectorFitsExtendedInfo,
- 'bridges',
- V_UNIVAR_BRIDGES_TOPO)
+ 'schools',
+ V_UNIVAR_SCHOOLS_TOPO)
def test_assertVectorInfoEqualsVectorInfo(self):
- self.assertVectorInfoEqualsVectorInfo('bridges', 'bridges', precision=0.00000001)
+ self.assertVectorInfoEqualsVectorInfo('schools', 'schools', precision=0.00000001)
self.assertRaises(self.failureException,
self.assertVectorInfoEqualsVectorInfo,
- 'lakes', 'bridges', precision=0.00000001)
+ 'hospitals', 'schools', precision=0.00000001)
self.assertRaises(CalledModuleError,
self.assertVectorInfoEqualsVectorInfo,
- 'bridges', 'does_not_exist', precision=0.00000001)
+ 'schools', 'does_not_exist', precision=0.00000001)
class TestVectorGeometryAssertions(TestCase):
@@ -144,15 +145,15 @@
def test_assertVectorEqualsVector_basic(self):
"""Check completely different maps."""
- self.assertVectorEqualsVector(actual='bridges', reference='bridges',
+ self.assertVectorEqualsVector(actual='schools', reference='schools',
precision=0.01, digits=15)
self.assertRaises(self.failureException,
self.assertVectorEqualsVector,
- actual='bridges', reference='lakes',
+ actual='schools', reference='hospitals',
precision=0.01, digits=7)
self.assertRaises(CalledModuleError,
self.assertVectorEqualsVector,
- actual='does_not_exist', reference='lakes',
+ actual='does_not_exist', reference='hospitals',
precision=0.01, digits=7)
def test_assertVectorEqualsVector_geometry_same_header(self):
Modified: grass/trunk/lib/vector/testsuite/test_topology_vgeneralize.sh
===================================================================
--- grass/trunk/lib/vector/testsuite/test_topology_vgeneralize.sh 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/lib/vector/testsuite/test_topology_vgeneralize.sh 2015-07-18 16:05:13 UTC (rev 65613)
@@ -26,15 +26,15 @@
# (equivalent of set -e in a script)
# prepare
-g.region rast=landuse96_28m
-r.to.vect input=landuse96_28m output=landuse96_28m type=area
+g.region rast=landuse
+r.to.vect input=landuse output=landuse type=area
# use the v.generalize debug mode
export GRASS_VECTOR_TOPO_DEBUG=1
# test will fail if this (and any other) command fails
-v.generalize input=landuse96_28m output=landuse96_28m_dp method=douglas threshold=21
+v.generalize input=landuse output=landuse_dp method=douglas threshold=21
# clean up (executed if successful)
-g.remove -f type=vector name=landuse96_28m
-g.remove -f type=raster name=landuse96_28m_dp
+g.remove -f type=vector name=landuse
+g.remove -f type=raster name=landuse_dp
Modified: grass/trunk/raster/r.recode/testsuite/test_rrecode_ncspm.py
===================================================================
--- grass/trunk/raster/r.recode/testsuite/test_rrecode_ncspm.py 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/raster/r.recode/testsuite/test_rrecode_ncspm.py 2015-07-18 16:05:13 UTC (rev 65613)
@@ -85,7 +85,7 @@
"which suggests input map values were read as integers.")
def test_formats_landcover(self):
- recode = SimpleModule('r.recode', input='landuse96_28m at PERMANENT',
+ recode = SimpleModule('r.recode', input='landuse at PERMANENT',
output='recoded', rules='-', overwrite=True)
recode.inputs.stdin = rules4
self.assertModule(recode)
Modified: grass/trunk/vector/v.net/testsuite/test_v_net.py
===================================================================
--- grass/trunk/vector/v.net/testsuite/test_v_net.py 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/vector/v.net/testsuite/test_v_net.py 2015-07-18 16:05:13 UTC (rev 65613)
@@ -15,7 +15,7 @@
def test_nodes(self):
"""Test"""
- self.assertModule('v.net', input='streets_wake', output=self.network, operation='nodes')
+ self.assertModule('v.net', input='streets', output=self.network, operation='nodes')
topology = dict(points=41813, nodes=41813, lines=49746)
self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
layers = read_command('v.category', input=self.network, option='layers').strip()
@@ -23,7 +23,7 @@
def test_nodes_layers(self):
"""Test"""
- self.assertModule('v.net', input='streets_wake', output=self.network, operation='nodes', flags='c')
+ self.assertModule('v.net', input='streets', output=self.network, operation='nodes', flags='c')
topology = dict(points=41813, nodes=41813, lines=49746)
self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
layers = read_command('v.category', input=self.network, option='layers').strip()
@@ -31,7 +31,7 @@
def test_connect(self):
"""Test"""
- self.assertModule('v.net', input='streets_wake', points='schools_wake',
+ self.assertModule('v.net', input='streets', points='schools',
output=self.network, operation='connect', threshold=1000)
topology = dict(points=167, nodes=42136, lines=50069)
self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
@@ -40,7 +40,7 @@
def test_connect_snap(self):
"""Test"""
- self.assertModule('v.net', input='streets_wake', points='schools_wake', flags='s',
+ self.assertModule('v.net', input='streets', points='schools', flags='s',
output=self.network, operation='connect', threshold=1000)
topology = dict(points=167, nodes=41969, lines=49902)
self.assertVectorFitsTopoInfo(vector=self.network, reference=topology)
Modified: grass/trunk/vector/v.what/testsuite/test_vwhat_ncspm.py
===================================================================
--- grass/trunk/vector/v.what/testsuite/test_vwhat_ncspm.py 2015-07-18 15:48:22 UTC (rev 65612)
+++ grass/trunk/vector/v.what/testsuite/test_vwhat_ncspm.py 2015-07-18 16:05:13 UTC (rev 65613)
@@ -1,13 +1,16 @@
# -*- coding: utf-8 -*-
+# Author: Anna Petrasova
+
from grass.gunittest.case import TestCase
from grass.gunittest.main import test
from grass.gunittest.gmodules import SimpleModule
+# v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000
out1 = """East: 636661
North: 226489
------------------------------------------------------------------
-Map: bridges
+Map: schools
Mapset: PERMANENT
Nothing found.
------------------------------------------------------------------
@@ -19,29 +22,26 @@
Layer: 1
Category: 231
------------------------------------------------------------------
-Map: precip_30ynormals_3d
+Map: elev_points
Mapset: PERMANENT
-Type: Point
-Id: 96
-Point height: 121.920000
-Layer: 1
-Category: 96
+Nothing found.
------------------------------------------------------------------
-Map: lakes
+Map: geology
Mapset: PERMANENT
Type: Area
-Sq Meters: 9397.338
-Hectares: 0.940
-Acres: 2.322
-Sq Miles: 0.0036
+Sq Meters: 261215323.454
+Hectares: 26121.532
+Acres: 64547.712
+Sq Miles: 100.8558
Layer: 1
-Category: 7168
+Category: 217
"""
+# v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
out2 = """East: 636661
North: 226489
------------------------------------------------------------------
-Map: bridges
+Map: schools
Mapset: PERMANENT
Nothing found.
------------------------------------------------------------------
@@ -65,65 +65,39 @@
OBJECTID : 231
SHAPE_LEN : 7616.150435
------------------------------------------------------------------
-Map: precip_30ynormals_3d
+Map: elev_points
Mapset: PERMANENT
-Type: Point
-Id: 96
-Point height: 121.920000
-Layer: 1
-Category: 96
-
-Driver: ...
-Database: ...
-Table: precip_30ynormals_3d
-Key column: cat
-cat : 96
-station : 317079
-lat : 35.79444
-long : -78.69889
-elev : 121.92
-jan : 113.284
-feb : 89.662
-mar : 113.284
-apr : 75.692
-may : 102.362
-jun : 103.124
-jul : 110.49
-aug : 109.22
-sep : 108.458
-oct : 96.012
-nov : 77.724
-dec : 81.534
-annual : 1178.56
+Nothing found.
------------------------------------------------------------------
-Map: lakes
+Map: geology
Mapset: PERMANENT
Type: Area
-Sq Meters: 9397.338
-Hectares: 0.940
-Acres: 2.322
-Sq Miles: 0.0036
+Sq Meters: 261215323.454
+Hectares: 26121.532
+Acres: 64547.712
+Sq Miles: 100.8558
Layer: 1
-Category: 7168
+Category: 217
Driver: ...
Database: ...
-Table: lakes
+Table: geology
Key column: cat
-cat : 7168
-AREA : 101151.70356
-PERIMETER : 1549.92239
-FULL_HYDRO : 7169
-FULL_HYDR2 : 157379
-FTYPE : LAKE/POND
-FCODE : 39000
-NAME :
+cat : 217
+onemap_pro : 261215328
+PERIMETER : 198808.71875
+GEOL250_ : 218
+GEOL250_ID : 217
+GEO_NAME : CZfg
+SHAPE_area : 261215323.454
+SHAPE_len : 198808.723525
"""
+# v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=1000 -ag
out3 = """East=636661
North=226489
-Map=bridges
+Map=schools
Mapset=PERMANENT
Map=roadsmajor
@@ -145,63 +119,37 @@
OBJECTID=231
SHAPE_LEN=7616.150435
-Map=precip_30ynormals_3d
+Map=elev_points
Mapset=PERMANENT
-Type=Point
-Id=96
-Point_height=121.920000
-Layer=1
-Category=96
-Driver=...
-Database=...
-Table=precip_30ynormals_3d
-Key_column=cat
-cat=96
-station=317079
-lat=35.79444
-long=-78.69889
-elev=121.92
-jan=113.284
-feb=89.662
-mar=113.284
-apr=75.692
-may=102.362
-jun=103.124
-jul=110.49
-aug=109.22
-sep=108.458
-oct=96.012
-nov=77.724
-dec=81.534
-annual=1178.56
-Map=lakes
+Map=geology
Mapset=PERMANENT
Type=Area
-Sq_Meters=9397.338
-Hectares=0.940
-Acres=2.322
-Sq_Miles=0.0036
+Sq_Meters=261215323.454
+Hectares=26121.532
+Acres=64547.712
+Sq_Miles=100.8558
Layer=1
-Category=7168
+Category=217
Driver=...
Database=...
-Table=lakes
+Table=geology
Key_column=cat
-cat=7168
-AREA=101151.70356
-PERIMETER=1549.92239
-FULL_HYDRO=7169
-FULL_HYDR2=157379
-FTYPE=LAKE/POND
-FCODE=39000
-NAME=
+cat=217
+onemap_pro=261215328
+PERIMETER=198808.71875
+GEOL250_=218
+GEOL250_ID=217
+GEO_NAME=CZfg
+SHAPE_area=261215323.454
+SHAPE_len=198808.723525
"""
+# v.what map=schools,roadsmajor,elev_points,geology layer=-1,-1,-1,-1 coordinates=636661,226489 distance=100
out4 = """East: 636661
North: 226489
------------------------------------------------------------------
-Map: bridges
+Map: schools
Mapset: PERMANENT
Nothing found.
------------------------------------------------------------------
@@ -209,26 +157,26 @@
Mapset: PERMANENT
Nothing found.
------------------------------------------------------------------
-Map: precip_30ynormals_3d
+Map: elev_points
Mapset: PERMANENT
Nothing found.
------------------------------------------------------------------
-Map: lakes
+Map: geology
Mapset: PERMANENT
Type: Area
-Sq Meters: 9397.338
-Hectares: 0.940
-Acres: 2.322
-Sq Miles: 0.0036
+Sq Meters: 261215323.454
+Hectares: 26121.532
+Acres: 64547.712
+Sq Miles: 100.8558
Layer: 1
-Category: 7168
+Category: 217
"""
class TestNCMaps(TestCase):
def setUp(self):
- self.vwhat = SimpleModule('v.what', map=['bridges', 'roadsmajor', 'precip_30ynormals_3d', 'lakes'],
+ self.vwhat = SimpleModule('v.what', map=['schools', 'roadsmajor', 'elev_points', 'geology'],
layer=['-1', '-1', '-1', '-1'], coordinates=[636661, 226489],
distance=1000)
More information about the grass-commit
mailing list