Skip to content

Instantly share code, notes, and snippets.

@springmeyer
Last active July 10, 2016 15:16
Show Gist options
  • Save springmeyer/0596532f833bfdce66d8 to your computer and use it in GitHub Desktop.
Save springmeyer/0596532f833bfdce66d8 to your computer and use it in GitHub Desktop.
rasterio test failures
~/projects/rasterio[master]$ py.test
============================================================================= test session starts =============================================================================
platform darwin -- Python 2.7.5 -- py-1.4.20 -- pytest-2.5.2
collected 54 items
rasterio/tests/test_band.py .
rasterio/tests/test_blocks.py ...........
rasterio/tests/test_colormap.py .
rasterio/tests/test_coords.py ....
rasterio/tests/test_copy.py .
rasterio/tests/test_driver_management.py ..
rasterio/tests/test_dtypes.py ...
rasterio/tests/test_features_rasterize.py ..
rasterio/tests/test_features_shapes.py ....
rasterio/tests/test_features_sieve.py .
rasterio/tests/test_read.py .......
rasterio/tests/test_revolvingdoor.py .
rasterio/tests/test_tags.py ..
rasterio/tests/test_update.py ...
rasterio/tests/test_warp.py FF..
rasterio/tests/test_write.py .......
================================================================================== FAILURES ===================================================================================
_______________________________________________________________________________ test_reproject ________________________________________________________________________________
def test_reproject():
"""Ndarry to ndarray"""
with rasterio.drivers():
with rasterio.open('rasterio/tests/data/RGB.byte.tif') as src:
source = src.read_band(1)
dst_transform = [-8789636.708, 300.0, 0.0, 2943560.235, 0.0, -300.0]
dst_crs = dict(
proj='merc',
a=6378137,
b=6378137,
lat_ts=0.0,
lon_0=0.0,
x_0=0.0,
y_0=0,
k=1.0,
units='m',
nadgrids='@null',
wktext=True,
no_defs=True)
destin = numpy.empty(src.shape, dtype=numpy.uint8)
reproject(
source,
destin,
src_transform=src.transform,
src_crs=src.crs,
dst_transform=dst_transform,
dst_crs=dst_crs,
resampling=RESAMPLING.nearest )
> assert destin.any()
E assert <built-in method any of numpy.ndarray object at 0x7fb1e3236f70>()
E + where <built-in method any of numpy.ndarray object at 0x7fb1e3236f70> = array([[0, 0, 0, ..., 0, 0, 0],\n [0, 0, 0, ..., 0, 0, 0],\n [0, 0, ...,\n [0, 0, 0, ..., 0, 0, 0],\n [0, 0, 0, ..., 0, 0, 0]], dtype=uint8).any
rasterio/tests/test_warp.py:41: AssertionError
------------------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------------------
DEBUG:rasterio:Creating a chief GDALEnv in drivers()
DEBUG:rasterio:Got coordinate system
DEBUG:rasterio:Params: +proj=utm +zone=18 +ellps=WGS84 +units=m +no_defs
DEBUG:rasterio:Got coordinate system
DEBUG:rasterio:Created temp source dataset
DEBUG:rasterio:Set transform on temp source dataset: 0
DEBUG:rasterio:Set CRS on temp source dataset:
DEBUG:rasterio:Got temp source band
DEBUG:rasterio:Wrote array to temp source dataset
DEBUG:rasterio:Created temp destination dataset
DEBUG:rasterio:Set transform on temp destination dataset: 0
DEBUG:rasterio:Proj4 string: +a=6378137 +lon_0=0.0 +k=1.0 +y_0=0 +nadgrids=@null +no_defs +proj=merc +x_0=0.0 +units=m +lat_ts=0.0 +b=6378137 +wktext
DEBUG:rasterio:Setting Projection: 0
DEBUG:rasterio:Set CRS on temp destination dataset: PROJCS["unnamed",GEOGCS["unnamed ellipse",DATUM["unknown",SPHEROID["unnamed",6378137,0],EXTENSION["PROJ4_GRIDS","@null"]],PRIMEM["Greenwich",0],UNIT["degree",0.0174532925199433]],PROJECTION["Mercator_2SP"],PARAMETER["standard_parallel_1",0],PARAMETER["central_meridian",0],PARAMETER["false_easting",0],PARAMETER["false_northing",0],UNIT["Meter",1],EXTENSION["PROJ4","+a=6378137 +lon_0=0.0 +k=1.0 +y_0=0 +nadgrids=@null +no_defs +proj=merc +x_0=0.0 +units=m +lat_ts=0.0 +b=6378137 +wktext"]]
DEBUG:rasterio:Created transformer
DEBUG:rasterio:Created warp options
DEBUG:rasterio:Set transformer options
DEBUG:rasterio:Chunk and warp window: 0, 0, 791, 718
ERROR:GDAL:CPLE_AppDefined in CPLCreateJoinableThread() failed in ChunkAndWarpMulti()
DEBUG:rasterio:Chunked and warped: 0
DEBUG:rasterio:Wrote data to destination: 0
_____________________________________________________________________________ test_warp_from_file _____________________________________________________________________________
def test_warp_from_file():
"""File to ndarray"""
with rasterio.open('rasterio/tests/data/RGB.byte.tif') as src:
dst_transform = [-8789636.708, 300.0, 0.0, 2943560.235, 0.0, -300.0]
dst_crs = dict(
proj='merc',
a=6378137,
b=6378137,
lat_ts=0.0,
lon_0=0.0,
x_0=0.0,
y_0=0,
k=1.0,
units='m',
nadgrids='@null',
wktext=True,
no_defs=True)
destin = numpy.empty(src.shape, dtype=numpy.uint8)
reproject(
rasterio.band(src, 1),
destin,
dst_transform=dst_transform,
dst_crs=dst_crs)
> assert destin.any()
E assert <built-in method any of numpy.ndarray object at 0x7fb1e0c85940>()
E + where <built-in method any of numpy.ndarray object at 0x7fb1e0c85940> = array([[0, 0, 0, ..., 0, 0, 0],\n [0, 0, 0, ..., 0, 0, 0],\n [0, 0, ...,\n [0, 0, 0, ..., 0, 0, 0],\n [0, 0, 0, ..., 0, 0, 0]], dtype=uint8).any
rasterio/tests/test_warp.py:73: AssertionError
------------------------------------------------------------------------------- Captured stderr -------------------------------------------------------------------------------
DEBUG:rasterio:Got coordinate system
DEBUG:rasterio:Params: +proj=utm +zone=18 +ellps=WGS84 +units=m +no_defs
DEBUG:rasterio:Got coordinate system
DEBUG:rasterio:Created temp destination dataset
DEBUG:rasterio:Set transform on temp destination dataset: 0
DEBUG:rasterio:Proj4 string: +a=6378137 +lon_0=0.0 +k=1.0 +y_0=0 +nadgrids=@null +no_defs +proj=merc +x_0=0.0 +units=m +lat_ts=0.0 +b=6378137 +wktext
DEBUG:rasterio:Setting Projection: 0
DEBUG:rasterio:Set CRS on temp destination dataset: i}
DEBUG:rasterio:Created transformer
DEBUG:rasterio:Created warp options
DEBUG:rasterio:Set transformer options
DEBUG:rasterio:Chunk and warp window: 0, 0, 791, 718
ERROR 1: CPLCreateJoinableThread() failed in ChunkAndWarpMulti()
DEBUG:rasterio:Chunked and warped: 0
DEBUG:rasterio:Wrote data to destination: 0
===================================================================== 2 failed, 52 passed in 1.05 seconds =====================================================================
@springmeyer
Copy link
Author

solved by building gdal with --with-threads=yes.

@AlmuHS
Copy link

AlmuHS commented Jul 10, 2016

How can I add that argument in gentoo ebuild?

@AlmuHS
Copy link

AlmuHS commented Jul 10, 2016

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment