mirror of
https://github.com/rasterio/rasterio.git
synced 2025-12-08 17:36:12 +00:00
* This is the maint-1.4 branch * Check for lowerCase netCDF instead of NetCDF (#3189) Some tests were accidentally skipped even though netCDF driver was installed due to incorrect capitalization. * Return ints from dataset index() (#3195) Resolves #3192 * Mark additional tests that use the network (#3193) The network marker is already used in other places, but these tests are new. * Restore xy transform of grid coordinates (#3198) Resolves #3191 * Add fsspec to test dependencies (#3197) Resolve #3190 * This is 1.4.1 * Configuration for our internal use of MEM:: datasets --------- Co-authored-by: Wei Ji <23487320+weiji14@users.noreply.github.com> Co-authored-by: Elliott Sales de Andrade <quantum.analyst@gmail.com>
27 lines
825 B
Python
27 lines
825 B
Python
import pytest
|
|
|
|
import rasterio
|
|
|
|
with rasterio.Env() as env:
|
|
HAVE_NETCDF = "netCDF" in env.drivers().keys()
|
|
HAVE_HDF5 = "HDF5" in env.drivers().keys()
|
|
|
|
|
|
@pytest.mark.skipif(not HAVE_NETCDF, reason="GDAL not compiled with NetCDF driver.")
|
|
def test_subdatasets():
|
|
"""Get subdataset names and descriptions"""
|
|
with rasterio.open("netcdf:tests/data/RGB.nc") as src:
|
|
subs = src.subdatasets
|
|
assert len(subs) == 3
|
|
for name in subs:
|
|
assert name.startswith("netcdf")
|
|
|
|
|
|
@pytest.mark.skipif(not HAVE_HDF5, reason="GDAL not compiled with HDF5 driver.")
|
|
def test_subdatasets_h5():
|
|
"""Get subdataset names and descriptions"""
|
|
with rasterio.open("tests/data/two-subs.h5") as src:
|
|
subs = src.subdatasets
|
|
assert len(subs) == 2
|
|
assert src.profile["count"] == 0
|