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
With leaving the line 192, “dset = dset.reset_index(["XTIME", "datetime"], drop=True)”, of monetio/models/_wrfchem_mm.py on, it will complain messages below when I read the sample wrf-chem data on Cheyenne.
“Traceback (most recent call last):
File "/glade/work/swei/Git/mmm/read_fcst.py", line 28, in <module>
an.open_models()
File "/glade/work/swei/Git/MELODIES-MONET/melodies_monet/driver.py", line 525, in open_models
m.open_model_files()
File "/glade/work/swei/Git/MELODIES-MONET/melodies_monet/driver.py", line 322, in open_model_files
self.obj = mio.models._wrfchem_mm.open_mfdataset(self.files,**self.mod_kwargs)
File "/glade/work/swei/Git/monetio/monetio/models/_wrfchem_mm.py", line 192, in open_mfdataset
dset = dset.reset_index(["XTIME", "datetime"], drop=True)
File "/glade/work/swei/conda-envs/melodies-monet/lib/python3.9/site-packages/xarray/core/dataset.py", line 4183, in reset_index
raise ValueError(
ValueError: ('datetime', 'XTIME') are not coordinates with an index”
The text was updated successfully, but these errors were encountered:
It looks like this line of code worked with older versions of xarray and then with more recent updates it stopped working. On xarray's website it says reset_index is legacy code from pandas, so we should probably move away from it.
I think all that has to happen to get this working again with both older and newer versions of xarray is to replace this:
dset = dset.reset_index(["XTIME", "datetime"], drop=True)
With this instead:
dset = dset.reset_coords(["XTIME", "datetime"], drop=True)
The overall goal was just to remove XTIME and datetime as coordinates and it seems like the second option does this equally well and is the preferred method. I'm at a conference, but @zmoon I may be able to test this more tomorrow or if you agree with this change and just want to update this in MONETIO feel free.
This is fixed on the develop branch of MONETIO now (noaa-oar-arl/monetio#95). I will close this once this fix is pushed to the stable branch of MONETIO.
With leaving the line 192, “dset = dset.reset_index(["XTIME", "datetime"], drop=True)”, of monetio/models/_wrfchem_mm.py on, it will complain messages below when I read the sample wrf-chem data on Cheyenne.
The text was updated successfully, but these errors were encountered: