Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

meb.xarray_to_griddata函数在xarray为0.19.0版本下出错,0.18.2版本没问题 #123

Open
LuckyBoy314 opened this issue Oct 11, 2021 · 0 comments

Comments

@LuckyBoy314
Copy link

meteva版本:1.5.9.4

报错信息如下:


TypeError Traceback (most recent call last)
/tmp/ipykernel_16868/2886223431.py in
----> 1 direction = meb.xarray_to_griddata(direction1, time_dim='forecast_reference_time', dtime_dim='forecast_period')
2 direction

/opt/anaconda3/lib/python3.8/site-packages/meteva/base/basicdata/grid_data.py in xarray_to_griddata(xr0, value_name, member_dim, level_dim, time_dim, dtime_dim, lat_dim, lon_dim)
268 ds.coords["dtime"] = ("dtime", dts)
269 else:
--> 270 ds.coords["dtime"] = ("dtime", dts)
271 attrs_name = list(dts.attrs)
272 for key in attrs_name:

/opt/anaconda3/lib/python3.8/site-packages/xarray/core/coordinates.py in setitem(self, key, value)
39
40 def setitem(self, key: Hashable, value: Any) -> None:
---> 41 self.update({key: value})
42
43 @Property

/opt/anaconda3/lib/python3.8/site-packages/xarray/core/coordinates.py in update(self, other)
161 def update(self, other: Mapping[Hashable, Any]) -> None:
162 other_vars = getattr(other, "variables", other)
--> 163 coords, indexes = merge_coords(
164 [self.variables, other_vars], priority_arg=1, indexes=self.xindexes
165 )

/opt/anaconda3/lib/python3.8/site-packages/xarray/core/merge.py in merge_coords(objects, compat, join, priority_arg, indexes, fill_value)
470 coerced, join=join, copy=False, indexes=indexes, fill_value=fill_value
471 )
--> 472 collected = collect_variables_and_indexes(aligned)
473 prioritized = _get_priority_vars_and_indexes(aligned, priority_arg, compat=compat)
474 variables, out_indexes = merge_collected(collected, prioritized, compat=compat)

/opt/anaconda3/lib/python3.8/site-packages/xarray/core/merge.py in collect_variables_and_indexes(list_of_mappings)
292 append_all(coords, indexes)
293
--> 294 variable = as_variable(variable, name=name)
295 if variable.dims == (name,):
296 variable = variable.to_index_variable()

/opt/anaconda3/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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant