Skip to content

REOF function fails #5

@kaileymohamed

Description

@kaileymohamed

TypeError Traceback (most recent call last)
/var/folders/z4/1gpfvpc91k58ljkw_dt89vgr0000gr/T/ipykernel_2342/4137204616.py in
1 # apply rotated eof process
----> 2 reof_ds = fierpy.reof(ds.VV,n_modes=4)

~/opt/miniconda3/envs/fier/lib/python3.8/site-packages/fierpy/fier.py in reof(stack, variance_threshold, n_modes)
82
83 # structure the spatial and temporal reof components in a Dataset
---> 84 reof_ds = xr.Dataset(
85 {
86 "spatial_modes": (["lat","lon","mode"],spatial_rotated),

~/opt/miniconda3/envs/fier/lib/python3.8/site-packages/xarray/core/dataset.py in init(self, data_vars, coords, attrs)
752 coords = coords.variables
753
--> 754 variables, coord_names, dims, indexes, _ = merge_data_and_coords(
755 data_vars, coords, compat="broadcast_equals"
756 )

~/opt/miniconda3/envs/fier/lib/python3.8/site-packages/xarray/core/merge.py in merge_data_and_coords(data, coords, compat, join)
481 objects = [data, coords]
482 explicit_coords = coords.keys()
--> 483 indexes = dict(_extract_indexes_from_coords(coords))
484 return merge_core(
485 objects, compat, join, explicit_coords=explicit_coords, indexes=indexes

~/opt/miniconda3/envs/fier/lib/python3.8/site-packages/xarray/core/merge.py in _extract_indexes_from_coords(coords)
490 """Yields the name & index of valid indexes from a mapping of coords"""
491 for name, variable in coords.items():
--> 492 variable = as_variable(variable, name=name)
493 if variable.dims == (name,):
494 yield name, variable._to_xindex()

~/opt/miniconda3/envs/fier/lib/python3.8/site-packages/xarray/core/variable.py in as_variable(obj, name)
119 elif isinstance(obj, tuple):
120 if isinstance(obj[1], DataArray):
--> 121 raise TypeError(
122 "Using a DataArray object to construct a variable is"
123 " ambiguous, please extract the data using the .data property."

TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.

Here is the version information:

INSTALLED VERSIONS
------------------
commit: None
python: 3.8.12 | packaged by conda-forge | (default, Sep 29 2021, 19:44:33) 
[Clang 11.1.0 ]
python-bits: 64
OS: Darwin
OS-release: 20.6.0
machine: x86_64
processor: i386
byteorder: little
LC_ALL: None
LANG: en_US.UTF-8
LOCALE: ('en_US', 'UTF-8')
libhdf5: 1.12.1
libnetcdf: 4.8.1

xarray: 0.19.0
pandas: 1.3.3
numpy: 1.21.2
scipy: 1.7.1
netCDF4: 1.5.7
pydap: None
h5netcdf: None
h5py: None
Nio: None
zarr: None
cftime: 1.5.1
nc_time_axis: None
PseudoNetCDF: None
rasterio: 1.2.10
cfgrib: None
iris: None
bottleneck: None
dask: None
distributed: None
matplotlib: 3.4.3
cartopy: None
seaborn: None
numbagg: None
pint: None
setuptools: 58.2.0
pip: 21.3
conda: None
pytest: None
IPython: 7.28.0
sphinx: None

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions