geoschem / integrated_methane_inversion

Integrated Methane Inversion workflow repository.
https://imi.readthedocs.org
MIT License
26 stars 22 forks source link

Inversion step fails using xarray version 2022.11.0 #121

Closed laestrada closed 1 year ago

laestrada commented 1 year ago

Recently while testing the IMI on our local cluster I hit this error when running the inversion step of the IMI:

Traceback (most recent call last):
  File "/n/holylfs05/LABS/jacob_lab/lestrada/IMI/imi-testing/Test_IMI/inversion/make_gridded_posterior.py", line 97, in <module>
    make_gridded_posterior(posterior_SF_path, state_vector_path, save_path)
  File "/n/holylfs05/LABS/jacob_lab/lestrada/IMI/imi-testing/Test_IMI/inversion/make_gridded_posterior.py", line 66, in make_gridded_posterior
    ds = xr.Dataset(
  File "/n/home03/lestrada/miniconda3/envs/ch4_inv/lib/python3.9/site-packages/xarray/core/dataset.py", line 604, in __init__
    variables, coord_names, dims, indexes, _ = merge_data_and_coords(
  File "/n/home03/lestrada/miniconda3/envs/ch4_inv/lib/python3.9/site-packages/xarray/core/merge.py", line 575, in merge_data_and_coords
    return merge_core(
  File "/n/home03/lestrada/miniconda3/envs/ch4_inv/lib/python3.9/site-packages/xarray/core/merge.py", line 755, in merge_core
    collected = collect_variables_and_indexes(aligned, indexes=indexes)
  File "/n/home03/lestrada/miniconda3/envs/ch4_inv/lib/python3.9/site-packages/xarray/core/merge.py", line 365, in collect_variables_and_indexes
    variable = as_variable(variable, name=name)
  File "/n/home03/lestrada/miniconda3/envs/ch4_inv/lib/python3.9/site-packages/xarray/core/variable.py", line 126, in as_variable
    raise TypeError(
TypeError: Using a DataArray object to construct a variable is ambiguous, please extract the data using the .data property.

It appears to be an issue with the version I used for xarray. originally, I ran with version xarray 2022.11.0 pyhd8ed1ab_0 conda-forge.

Switching to the following version with conda fixed the issue xarray 0.16.2 pyhd3eb1b0_0. Posting and then closing this issue to keep a record of this.