Skip to content

Commit 86799b7

Browse files
scottyhqshoyer
authored andcommitted
changed url for rasterio network test (#3162)
* changed url for rasterio network test * added boto3 to ci requirements.ymls
1 parent dfa97da commit 86799b7

File tree

5 files changed

+16
-20
lines changed

5 files changed

+16
-20
lines changed

ci/requirements/py36-hypothesis.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies:
2222
- seaborn
2323
- toolz
2424
- rasterio
25+
- boto3
2526
- bottleneck
2627
- zarr
2728
- pydap

ci/requirements/py36.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ dependencies:
2222
- seaborn
2323
- toolz
2424
- rasterio
25+
- boto3
2526
- bottleneck
2627
- zarr
2728
- pseudonetcdf>=3.0.1

ci/requirements/py37-windows.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,4 +22,5 @@ dependencies:
2222
- seaborn
2323
- toolz
2424
- rasterio
25+
- boto3
2526
- zarr

ci/requirements/py37.yml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@ dependencies:
2323
- seaborn
2424
- toolz
2525
- rasterio
26+
- boto3
2627
- bottleneck
2728
- zarr
2829
- pseudonetcdf>=3.0.1

xarray/tests/test_backends.py

Lines changed: 12 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -3752,15 +3752,13 @@ def test_rasterio_vrt(self):
37523752
with rasterio.vrt.WarpedVRT(src, crs='epsg:4326') as vrt:
37533753
expected_shape = (vrt.width, vrt.height)
37543754
expected_crs = vrt.crs
3755-
print(expected_crs)
37563755
expected_res = vrt.res
37573756
# Value of single pixel in center of image
37583757
lon, lat = vrt.xy(vrt.width // 2, vrt.height // 2)
37593758
expected_val = next(vrt.sample([(lon, lat)]))
37603759
with xr.open_rasterio(vrt) as da:
37613760
actual_shape = (da.sizes['x'], da.sizes['y'])
37623761
actual_crs = da.crs
3763-
print(actual_crs)
37643762
actual_res = da.res
37653763
actual_val = da.sel(dict(x=lon, y=lat),
37663764
method='nearest').data
@@ -3799,35 +3797,29 @@ def test_rasterio_vrt_with_transform_and_size(self):
37993797

38003798
@network
38013799
def test_rasterio_vrt_network(self):
3800+
# Make sure loading w/ rasterio give same results as xarray
38023801
import rasterio
3803-
3804-
url = 'https://storage.googleapis.com/\
3805-
gcp-public-data-landsat/LC08/01/047/027/\
3806-
LC08_L1TP_047027_20130421_20170310_01_T1/\
3807-
LC08_L1TP_047027_20130421_20170310_01_T1_B4.TIF'
3808-
env = rasterio.Env(GDAL_DISABLE_READDIR_ON_OPEN='EMPTY_DIR',
3809-
CPL_VSIL_CURL_USE_HEAD=False,
3810-
CPL_VSIL_CURL_ALLOWED_EXTENSIONS='TIF')
3811-
with env:
3812-
with rasterio.open(url) as src:
3802+
# use same url that rasterio package uses in tests
3803+
prefix = "https://landsat-pds.s3.amazonaws.com/L8/139/045/"
3804+
image = "LC81390452014295LGN00/LC81390452014295LGN00_B1.TIF"
3805+
httpstif = prefix + image
3806+
with rasterio.Env(aws_unsigned=True):
3807+
with rasterio.open(httpstif) as src:
38133808
with rasterio.vrt.WarpedVRT(src, crs='epsg:4326') as vrt:
3814-
expected_shape = (vrt.width, vrt.height)
3815-
expected_crs = vrt.crs
3809+
expected_shape = vrt.width, vrt.height
38163810
expected_res = vrt.res
38173811
# Value of single pixel in center of image
38183812
lon, lat = vrt.xy(vrt.width // 2, vrt.height // 2)
38193813
expected_val = next(vrt.sample([(lon, lat)]))
38203814
with xr.open_rasterio(vrt) as da:
3821-
actual_shape = (da.sizes['x'], da.sizes['y'])
3822-
actual_crs = da.crs
3815+
actual_shape = da.sizes['x'], da.sizes['y']
38233816
actual_res = da.res
38243817
actual_val = da.sel(dict(x=lon, y=lat),
38253818
method='nearest').data
38263819

3827-
assert_equal(actual_shape, expected_shape)
3828-
assert_equal(actual_crs, expected_crs)
3829-
assert_equal(actual_res, expected_res)
3830-
assert_equal(expected_val, actual_val)
3820+
assert actual_shape == expected_shape
3821+
assert actual_res == expected_res
3822+
assert expected_val == actual_val
38313823

38323824

38333825
class TestEncodingInvalid:

0 commit comments

Comments
 (0)