-
-
Notifications
You must be signed in to change notification settings - Fork 29
Description
I received the following error when I tried to run the test example. I would appreciate it if someone could help me.
import igrf
mag = igrf.igrf('2010-07-12', glat=65, glon=-148, alt_km=100)
I received the error message :
TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.
details:
Cell In[35], line 3
1 import igrf
----> 3 mag = igrf.igrf('2010-07-12', glat=65, glon=-148, alt_km=100)
File ~/miniconda3/lib/python3.8/site-packages/igrf/base.py:144, in igrf(time, glat, glon, alt_km, isv, itype)
131 mag = xarray.Dataset(
132 {
133 "north": ("alt_km", Bnorth),
(...)
139 attrs={"time": time, "isv": isv, "itype": itype, "glat": glat, "glon": glon},
140 )
142 decl, incl = mag_vector2incl_decl(mag.north, mag.east, mag.down)
--> 144 mag["incl"] = ("alt_km", incl)
145 mag["decl"] = ("alt_km", decl)
147 return mag
File ~/miniconda3/lib/python3.8/site-packages/xarray/core/variable.py:123, in as_variable(obj, name)
121 elif isinstance(obj, tuple):
122 if isinstance(obj[1], DataArray):
--> 123 raise TypeError(
124 "Using a DataArray object to construct a variable is"
125 " ambiguous, please extract the data using the .data property."
126 )
127 try:
128 obj = Variable(*obj)
TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.