pydata / pydata/xarray

Dimension error when accessing OPeNDAP data

Open
#10,396 6 comments 1 reaction 0 assignees View on GitHub

Nobody has claimed this yet.

usage question
Dominant language
Python
Stars
4.2k
Forks
1.4k
Avg merge
2d 15h
Merged PRs (30d)
14

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

Contributor guide

Open the contributing guide

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start by running the minimal example at xr.open_dataset with engine="pydap" against the supplied OPeNDAP URL and inspect the reported dimension error. Trace the pydap backend path involved in opening the dataset; done means the example opens successfully without the ValueError and remains compatible with the expected pydap behavior.

Written by the indexing model from the issue text.

Assessment

Tech stack
python
Domain
data
Issue type
Bug
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.