Commit d320148e92e3f99299a5b102de1f97960603aef1

Authored by Vincent Thierion
2 parents 85795025 3aa39780

Merge branch 'dev' of https://framagit.org/thierionv/iota2 into dev

Conflicts:
	scripts/simplification/RastersToSqlitePoint.py
.gitignore
... ... @@ -6,3 +6,5 @@
6 6 data/simplification
7 7 data/test_raster/
8 8 data/test_vector/
  9 +*.o*
  10 +*.e*
... ...
scripts/simplification/RastersToSqlitePoint.py
... ... @@ -60,7 +60,7 @@ def maskSampleSelection(path, raster, maskmer, ram):
60 60  
61 61 return out
62 62  
63   -def sampleSelection(path, raster, vecteur, field, ram='128', split="", mask=""):
  63 +def sampleSelection(path, raster, vecteur, field, ram='128', split=None, mask=None):
64 64  
65 65 timeinit = time.time()
66 66  
... ... @@ -72,11 +72,11 @@ def sampleSelection(path, raster, vecteur, field, ram='128', split="", mask=""):
72 72  
73 73 timestats = time.time()
74 74 print " ".join([" : ".join(["Stats calculation", str(timestats - timeinit)]), "seconds"])
75   -
76   - if mask != '':
  75 + print mask
  76 + if mask is not None:
77 77 mask = maskSampleSelection(path, raster, mask, ram)
78 78 else:
79   - mask = ''
  79 + mask = None
80 80  
81 81 # Sample selection
82 82 outsqlite = os.path.join(path, 'sample_selection' + str(split) + '.sqlite')
... ... @@ -103,7 +103,7 @@ def sampleExtraction(raster, sample, field, outname, split, ram='128'):
103 103 timeextract = time.time()
104 104 print " ".join([" : ".join(["Sample extraction", str(timeextract - timesample)]), "seconds"])
105 105  
106   -def RastersToSqlitePoint(path, vecteur, field, outname, ram, rtype, rasters, maskmer="", split=""):
  106 +def RastersToSqlitePoint(path, vecteur, field, outname, ram, rtype, rasters, maskmer=None, split=None):
107 107  
108 108 timeinit = time.time()
109 109 # Rasters concatenation
... ...
scripts/vector-tools/RandomSelectionPolygonsAreaThreshold.py
... ... @@ -69,7 +69,7 @@ def get_randomPolyAreaThresh(shapefile, field, classe, thresh, outShapefile, nol
69 69 sumarea += float(elt[0][1])
70 70  
71 71 strCondglob = ",".join([str(x) for x in listToChoice])
72   - f = open('/mnt/data/home/thierionv/RPG/listfid11RPG_val.txt','w')
  72 + f = open('/mnt/data/home/thierionv/RPG/listfid12RPG_val.txt','w')
73 73 f.write(strCondglob)
74 74 f.close()
75 75 '''
... ...
scripts/vector-tools/checkGeometryAreaThreshField.py
... ... @@ -19,7 +19,7 @@ def checkGeometryAreaThreshField(shapefile, pixelArea, pix_thresh, outshape):
19 19 tmpfile = []
20 20  
21 21 # Verification de la géométrie
22   - vf.checkValidGeom(shapefile)
  22 + #vf.checkValidGeom(shapefile)
23 23  
24 24 # Empty geometry identification
25 25 try:
... ... @@ -37,7 +37,7 @@ def checkGeometryAreaThreshField(shapefile, pixelArea, pix_thresh, outshape):
37 37 shapefileNoDupspoly = outShapefileGeom[:-4] + 'spoly' + '.shp'
38 38 tmpfile.append(shapefileNoDupspoly)
39 39 try:
40   - MultiPolyToPoly.multipoly2poly(shapefileNoDup, shapefileNoDupspoly)
  40 + MultiPolyToPoly.multipoly2poly(outShapefileGeom, shapefileNoDupspoly)
41 41 print 'Conversion of multipolygons shapefile to single polygons succeeded'
42 42 except Exception as e:
43 43 print 'Conversion of multipolygons shapefile to single polygons did not work for the following error :'
... ... @@ -68,7 +68,7 @@ def checkGeometryAreaThreshField(shapefile, pixelArea, pix_thresh, outshape):
68 68 print e
69 69  
70 70 # Check geometry
71   - vf.checkValidGeom(outshape)
  71 + #vf.checkValidGeom(outshape)
72 72  
73 73 # delete tmp file
74 74 for fileDel in tmpfile:
... ...
scripts/vector-tools/vector_functions.py
... ... @@ -433,7 +433,7 @@ def checkValidGeom(shp):
433 433 #feat = layer.GetFeature(i)
434 434 fid = feat.GetFID()
435 435 if feat.GetGeometryRef() is None:
436   - #print fid
  436 + print fid
437 437 layer.DeleteFeature(fid)
438 438 ds.ExecuteSQL('REPACK '+layer.GetName())
439 439 layer.ResetReading()
... ...