@@ -7281,27 +7281,29 @@ def test_remote_url_backend_auto_detection() -> None:
7281
7281
("https://example.com/store.zarr" , "zarr" ),
7282
7282
("http://example.com/data.zarr/" , "zarr" ),
7283
7283
("s3://bucket/path/to/data.zarr" , "zarr" ),
7284
- # Remote netCDF URLs (non-DAP) - h5netcdf wins (first in order)
7284
+ # Remote netCDF URLs (non-DAP) - h5netcdf wins (first in order, no query params )
7285
7285
("https://example.com/file.nc" , "h5netcdf" ),
7286
7286
("http://example.com/data.nc4" , "h5netcdf" ),
7287
7287
("https://example.com/test.cdf" , "h5netcdf" ),
7288
- ("https://example.com/data.nc?var=temperature&time=0" , "h5netcdf" ),
7289
- # DAP URLs with query parameters - h5netcdf wins (has .nc4 ext, first in order)
7288
+ ("s3://bucket/path/to/data.nc" , "h5netcdf" ),
7289
+ # Remote netCDF URLs with query params - netcdf4 wins
7290
+ # Note: Query params are typically indicative of DAP URLs (e.g., OPeNDAP constraint expressions),
7291
+ # so we prefer netcdf4 (which has DAP support) over h5netcdf (which doesn't)
7292
+ ("https://example.com/data.nc?var=temperature&time=0" , "netcdf4" ),
7290
7293
(
7291
7294
"http://test.opendap.org/opendap/dap4/StaggeredGrid.nc4?dap4.ce=/time[0:1:0]" ,
7292
- "h5netcdf " ,
7295
+ "netcdf4 " ,
7293
7296
),
7294
7297
# DAP URLs without extensions - pydap wins
7295
7298
("dap2://opendap.earthdata.nasa.gov/collections/dataset" , "pydap" ),
7296
7299
("dap4://opendap.earthdata.nasa.gov/collections/dataset" , "pydap" ),
7297
7300
("DAP2://example.com/dataset" , "pydap" ), # uppercase scheme
7298
7301
("DAP4://example.com/dataset" , "pydap" ), # uppercase scheme
7299
7302
("https://example.com/services/DAP2/dataset" , "pydap" ), # uppercase in path
7300
- # DAP URLs with .nc extensions - h5netcdf wins (first in order)
7303
+ # DAP URLs with .nc extensions (no query params) - h5netcdf wins (first in order)
7301
7304
("http://test.opendap.org/opendap/dap4/StaggeredGrid.nc4" , "h5netcdf" ),
7302
7305
("https://example.com/DAP4/data.nc" , "h5netcdf" ),
7303
7306
("http://example.com/data/Dap4/file.nc" , "h5netcdf" ),
7304
- ("s3://bucket/path/to/data.nc" , "h5netcdf" ),
7305
7307
]
7306
7308
7307
7309
for url , expected_backend in test_cases :
0 commit comments