Skip to content

.subset with da that has time dimension #1444

@Chrismarsh

Description

@Chrismarsh

Version

2025.11.0

How did you install UXarray?

Source

What happened?

I have a dataset that looks like

>>> da = du.sel(time=["2018-04-28 00:00:00", "2023-03-22 00:00:00"])[['Elevation']]
>>> print(da)

<xarray.UxDataset> Size: 1GB
Dimensions:       (met: 2, time: 2, n_face: 28495325)
Coordinates:
  * time          (time) datetime64[ns] 16B 2018-04-28 2023-03-22
  * met           (met) object 16B 'hrdps' 'capa'
    Mesh2_face_x  (n_face) float64 228MB -123.8 -123.4 -123.9 ... -116.3 -116.3
    Mesh2_face_y  (n_face) float64 228MB 46.49 46.61 46.49 ... 52.56 52.33 52.34
Dimensions without coordinates: n_face
Data variables:
    Elevation     (met, time, n_face) float64 912MB dask.array<chunksize=(1, 1, 1000000), meta=np.ndarray

which I want to clip to a lat lon box:

tmp = da.Elevation.subset.bounding_box(lon, lat)

but it errors as:

IndexError: dimension coordinate 'time' conflicts between indexed and indexing objects:
<xarray.DataArray 'time' (time: 2)> Size: 16B
array(['2018-04-28T00:00:00.000000000', '2023-03-22T00:00:00.000000000'],
      dtype='datetime64[ns]')
Coordinates:
  * time     (time) datetime64[ns] 16B 2018-04-28 2023-03-22
Attributes:
    standard_name:  time
    long_name:      Time
vs.
<xarray.Variable ()> Size: 8B
array('2016-10-01T00:00:00.000000000', dtype='datetime64[ns]')
Attributes:
    standard_name:  time
    long_name:      Time

which I don't totally understand. Weirdly, this code used to work, I want to say 1 or 2 releases ago.

What did you expect to happen?

It to subset across all dim, time included

Metadata

Metadata

Assignees

No one assigned

    Labels

    bugSomething isn't working

    Type

    No type

    Projects

    Status

    📚 Backlog

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions