@@ -3752,15 +3752,13 @@ def test_rasterio_vrt(self):
3752
3752
with rasterio .vrt .WarpedVRT (src , crs = 'epsg:4326' ) as vrt :
3753
3753
expected_shape = (vrt .width , vrt .height )
3754
3754
expected_crs = vrt .crs
3755
- print (expected_crs )
3756
3755
expected_res = vrt .res
3757
3756
# Value of single pixel in center of image
3758
3757
lon , lat = vrt .xy (vrt .width // 2 , vrt .height // 2 )
3759
3758
expected_val = next (vrt .sample ([(lon , lat )]))
3760
3759
with xr .open_rasterio (vrt ) as da :
3761
3760
actual_shape = (da .sizes ['x' ], da .sizes ['y' ])
3762
3761
actual_crs = da .crs
3763
- print (actual_crs )
3764
3762
actual_res = da .res
3765
3763
actual_val = da .sel (dict (x = lon , y = lat ),
3766
3764
method = 'nearest' ).data
@@ -3799,35 +3797,29 @@ def test_rasterio_vrt_with_transform_and_size(self):
3799
3797
3800
3798
@network
3801
3799
def test_rasterio_vrt_network (self ):
3800
+ # Make sure loading w/ rasterio give same results as xarray
3802
3801
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 :
3813
3808
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
3816
3810
expected_res = vrt .res
3817
3811
# Value of single pixel in center of image
3818
3812
lon , lat = vrt .xy (vrt .width // 2 , vrt .height // 2 )
3819
3813
expected_val = next (vrt .sample ([(lon , lat )]))
3820
3814
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' ]
3823
3816
actual_res = da .res
3824
3817
actual_val = da .sel (dict (x = lon , y = lat ),
3825
3818
method = 'nearest' ).data
3826
3819
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
3831
3823
3832
3824
3833
3825
class TestEncodingInvalid :
0 commit comments