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

Error in xarray #114

Open
ricardofrantz opened this issue Jul 16, 2024 · 2 comments
Open

Error in xarray #114

ricardofrantz opened this issue Jul 16, 2024 · 2 comments
Labels

Comments

@ricardofrantz
Copy link

Hey pymechs,

When trying to read a field with xarray wrapper, I have the error :

  File "/Users/r/Desktop/bffunc.py", line 1583, in rdnek3d
    ds = open_dataset(fname)
         ^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/pymech/dataset.py", line 57, in open_dataset
    return _open(path, **kwargs)
           ^^^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/pymech/dataset.py", line 93, in _open_nek_dataset
    ds = xr.combine_by_coords(elem_dsets, combine_attrs="drop")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 958, in combine_by_coords
    concatenated_grouped_by_data_vars = tuple(
                                        ^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 959, in <genexpr>
    _combine_single_variable_hypercube(
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 630, in _combine_single_variable_hypercube
    concatenated = _combine_nd(
                   ^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 232, in _combine_nd
    combined_ids = _combine_all_along_first_dim(
                   ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 267, in _combine_all_along_first_dim
    new_combined_ids[new_id] = _combine_1d(
                               ^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/combine.py", line 290, in _combine_1d
    combined = concat(
               ^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/concat.py", line 276, in concat
    return _dataset_concat(
           ^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/concat.py", line 513, in _dataset_concat
    align(*datasets, join=join, copy=False, exclude=[dim], fill_value=fill_value)
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 882, in align
    aligner.align()
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 582, in align
    self.reindex_all()
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 557, in reindex_all
    self.results = tuple(
                   ^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 558, in <genexpr>
    self._reindex_one(obj, matching_indexes)
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 544, in _reindex_one
    dim_pos_indexers = self._get_dim_pos_indexers(matching_indexes)
                       ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/alignment.py", line 510, in _get_dim_pos_indexers
    indexers = obj_idx.reindex_like(aligned_idx, **self.reindex_kwargs)
               ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/r/miniforge3/lib/python3.12/site-packages/xarray/core/indexes.py", line 834, in reindex_like
    raise ValueError(
ValueError: cannot reindex or align along dimension 'x' because the (pandas) index has duplicate values

Any idea what could I be doing wrong?

thanks,
R

@ashwinvis
Copy link
Member

Not sure. What kind of geometry are you loading?

@ashwinvis
Copy link
Member

@ricardofrantz What happened, did you fix this?

Could you provide some example data if you need to have this fixed?

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

No branches or pull requests

2 participants