You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
I am using PR #95, but I think this issue affects main. When I use open_dataset and open_variable an extra dimension is added to my DataArray, which I think is happening here.
import xarray as xr
from xcdat.dataset import open_dataset
from xcdat.variable import open_variable
# open file
fn = 'tas_Amon_CESM2_historical_r1i1p1f1_gn_185001-201412.nc'
ds = open_dataset(fn)
# show dataarray shape
print('original shape', ds.tas.shape)
# show dataarray shape after calling open_variable
tas = open_variable(ds, 'tas')
print('altered shape', tas.shape)
ds.close()
This is actually an expected behavior. You need to have the bounds dimension set in the DataArray first before propagating the bounds from the parent Dataset. Otherwise, an xarray error is thrown: "ValueError: cannot add coordinates with new dimensions to a DataArray"
I am using PR #95, but I think this issue affects main. When I use
open_dataset
andopen_variable
an extra dimension is added to my DataArray, which I think is happening here.What were you expecting to happen?
It appears that an extraneous
nbnd
dimension is added to the dataarray (and should not be).Any other comments?
I assume this is related to this issue + fix.
The text was updated successfully, but these errors were encountered: