metpy attributes lost when copying a DataArray in a DataSet #1994
Unanswered
abakleriche
asked this question in
Q&A
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I get a DataSet fro et WRF file with something like that :
from metpy.units import units
import xarray as xr
ds = xr.open_dataset("data/wrfout_d01_2017-03-01_00_00_00")
Then I assign a time coordinate to the variable QVAPOR :
QVAPOR_new = ds['QVAPOR'].metpy.assign_coordinates({'time':'XTIME'}})
print(QVAPOR_new.metpy.time) : result is correct.
If I copy QVAPOR_new in a local variable, it is OK too
myLocVar = QVAPOR_new
print(myLocVar .metpy.time) : result is correct.
But if I copy QVAPOR_new in the dataset (to replace the original QVAPOR), it is not OK.
ds['QVAPOR'] = QVAPOR_new
print(ds['QVAPOR'] .metpy.time) : time attribute is not available.
What do I wrong ?
Beta Was this translation helpful? Give feedback.
All reactions