Description
What happened?
I was trying to access the VIIRS L1 data via xarray, but I got a dimension error.
What did you expect to happen?
Works well like pydap:
from pydap.net import create_session
from pydap.client import open_url
my_session = create_session()
url_VNP02IMG = 'https://ladsweb.modaps.eosdis.nasa.gov/opendap/RemoteResources/laads/allData/5200/VNP02IMG/2024/001/VNP02IMG.A2024001.0000.002.2024006095039.nc'
ds_VNP02IMG = open_url(url_VNP02IMG, session=my_session, protocol='dap4')
Minimal Complete Verifiable Example
import xarray as xr
from pydap.net import create_session
my_session = create_session()
url_VNP02IMG = 'https://ladsweb.modaps.eosdis.nasa.gov/opendap/RemoteResources/laads/allData/5200/VNP02IMG/2024/001/VNP02IMG.A2024001.0000.002.2024006095039.nc'
ds_pydap = xr.open_dataset(url_VNP02IMG, session=my_session, engine="pydap", decode_times=False, decode_cf=False)
MVCE confirmation
- Minimal example — the example is as focused as reasonably possible to demonstrate the underlying issue in xarray.
- Complete example — the example is self-contained, including all data and the text of any traceback.
- Verifiable example — the example copy & pastes into an IPython prompt or Binder notebook, returning the result.
- New issue — a search of GitHub Issues suggests this is not a duplicate.
- Recent environment — the issue occurs with the latest version of xarray and its dependencies.
Relevant log output
---------------------------------------------------------------------------
ValueError Traceback (most recent call last)
Cell In[13], line 1
----> 1 ds_pydap = xr.open_dataset(url_VNP02IMG, session=my_session, engine="pydap", decode_times=False, decode_cf=False)
File ~/opt/miniconda3/envs/viirs/lib/python3.12/site-packages/xarray/backends/api.py:687, in open_dataset(filename_or_obj, engine, chunks, cache, decode_cf, mask_and_scale, decode_times, decode_timedelta, use_cftime, concat_characters, decode_coords, drop_variables, inline_array, chunked_array_type, from_array_kwargs, backend_kwargs, **kwargs)
675 decoders = _resolve_decoders_kwargs(
676 decode_cf,
677 open_backend_dataset_parameters=backend.open_dataset_parameters,
(...) 683 decode_coords=decode_coords,
684 )
686 overwrite_encoded_chunks = kwargs.pop("overwrite_encoded_chunks", None)
--> 687 backend_ds = backend.open_dataset(
688 filename_or_obj,
689 drop_variables=drop_variables,
690 **decoders,
691 **kwargs,
692 )
693 ds = _dataset_from_backend_dataset(
694 backend_ds,
695 filename_or_obj,
(...) 705 **kwargs,
706 )
707 return ds
...
511 )
512 if len(set(dims)) < len(dims):
513 repeated_dims = {d for d in dims if dims.count(d) > 1}
ValueError: dimensions () must have the same length as the number of data dimensions, ndim=1
Anything else we need to know?
No response
Environment
INSTALLED VERSIONS
commit: None
python: 3.12.10 | packaged by conda-forge | (main, Apr 10 2025, 22:19:24) [Clang 18.1.8 ]
python-bits: 64
OS: Darwin
OS-release: 24.5.0
machine: arm64
processor: arm
byteorder: little
LC_ALL: en_US.UTF-8
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: None
libnetcdf: None
xarray: 2025.4.0
pandas: 2.2.3
numpy: 2.2.6
scipy: 1.15.2
netCDF4: None
pydap: 3.5.5
h5netcdf: None
h5py: None
zarr: 2.18.7
cftime: None
nc_time_axis: None
iris: None
bottleneck: None
dask: 2025.5.1
distributed: 2025.5.1
matplotlib: None
cartopy: None
seaborn: None
numbagg: None
fsspec: 2025.5.1
cupy: None
pint: None
sparse: None
flox: None
numpy_groupies: None
setuptools: 80.9.0
pip: 25.1.1
conda: None
pytest: None
mypy: None
IPython: 9.3.0
sphinx: None