Skip to content

Commit

Permalink
correct test protocol
Browse files Browse the repository at this point in the history
  • Loading branch information
nkarasiak committed Jul 15, 2020
1 parent f1c1623 commit f28f0a9
Show file tree
Hide file tree
Showing 3 changed files with 12 additions and 12 deletions.
16 changes: 8 additions & 8 deletions museotoolbox/datasets/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -70,14 +70,14 @@ def load_historical_data(return_X_y=False, return_X_y_g=False,
>>> vector
/mnt/bigone/lib/MuseoToolBox/museotoolbox/datasets/_historicalmap/train.gpkg
"""
toReturn = []
to_return = []
separator = '/'
if low_res:
raster = __pathFile+'{0}_historicalmap{0}map_lowres.tif'.format(separator)
else:
raster = __pathFile+'{0}_historicalmap{0}map_compress.tif'.format(separator)

vector = __pathFile+'{0}_historicalmap{0}train.gpkg'.format('/')
vector = __pathFile+'{0}_historicalmap{0}train.gpkg'.format(separator)

if return_X_y or return_X_y_g:
from ..processing import extract_ROI
Expand All @@ -86,16 +86,16 @@ def load_historical_data(return_X_y=False, return_X_y_g=False,

if return_X_y_g:
X, y, g = extract_ROI(raster, vector, 'Class', 'uniquefid')
toReturn = (X, y, g)
to_return = (X, y, g)
else:
X, y = extract_ROI(raster, vector, 'Class')
toReturn = (X, y)
to_return = (X, y)
else:
toReturn.append(raster)
to_return.append(raster)
if centroid:
vectorCentroid = __pathFile+'{0}_historicalmap{0}train_centroid.gpkg'.format(separator)
toReturn.append(vectorCentroid)
to_return.append(vectorCentroid)
else:
toReturn.append(vector)
to_return.append(vector)

return toReturn
return to_return
2 changes: 1 addition & 1 deletion museotoolbox/processing/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -522,7 +522,7 @@ def rasterize(in_image, in_vector, in_field=False, out_image='MEM',
else:

driver = gdal.GetDriverByName('GTiff')
options = ['COMPRESS=PACKBITS', 'BIGTIFF=IF_SAFER']
options = ['BIGTIFF=IF_SAFER']

dst_ds = driver.Create(
out_image,
Expand Down
6 changes: 3 additions & 3 deletions test/test_processing.py
Original file line number Diff line number Diff line change
Expand Up @@ -148,7 +148,7 @@ def test_mask(self) :
rM_band = processing.RasterMath(raster,return_3d=is_3d)
for idx,band in enumerate(rM_band.read_band_per_band()):
pass
rM_band.add_function(np.mean,axis=1,out_image='/tmp/mean.tif')
rM_band.add_function(np.mean,axis=is_3d+1,out_image='/tmp/mean.tif')
rM_band.run()

self.assertRaises(MemoryError,rM_band.run,'1K')
Expand Down Expand Up @@ -186,11 +186,11 @@ def test_raster_math_mean(self):
if is_3d is False:
# test without compression with reading/writing pixel per pixel, very slow...
rM.custom_block_size(10,10) # to have full masked block
rM.add_function(np.mean,'/tmp/mean.tif',axis=1,dtype=np.int16)
rM.add_function(np.mean,'/tmp/mean.tif',axis=is_3d+1,dtype=np.int16)
rM.run()
else:
# test using default block size and high compressio of raster
rM.add_function(np.mean,'/tmp/mean.tif',axis=1,dtype=np.int16,compress='high')
rM.add_function(np.mean,'/tmp/mean.tif',axis=is_3d+1,dtype=np.int16,compress='high')
rM.run()
assert(gdal.Open('/tmp/mean.tif').RasterCount == 1)
assert(gdal.Open('/tmp/mean.tif').RasterXSize == rM.n_columns)
Expand Down

0 comments on commit f28f0a9

Please sign in to comment.