-
Notifications
You must be signed in to change notification settings - Fork 24
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
IndexError: list index out of range in geometry reading #48
Comments
Can you check using the |
Yes, they can be viewed by Paraview. |
We should consider if we put
|
Pymech will only read the geometry if it's present in the file. There is usually no problem reading a file containing only velocity. If you look at the first 132 bytes of the file representing the header, it contains something like "XU", or "XUP" or similar if there is a geometry, and "U" or "UP" or similar if there isn't. Your problem looks like it has to do with the ordering of elements. There is a reordering going on inside Nek that I don't really understand, you can have two files with the same mesh but the elements are in a different order. This is what the |
If you want to use the geometry in file 1 for all subsequent files, you can do it manually: get the mesh from file 1, store it and use it for processing other files. There is no notion of file set right now in |
I am changing the mesh in the I am not sure, but maybe it could be related to not calling Edit: It is not related to |
Something strange is happening. When I run a simulation on 1 node and 10 cores of |
The element map (the permutation table describing in which order the elements are stored) seems broken in your second file. In your first file (00298), it is:
Here, each number between 0 and 767 is present exactly once. In your second file, it is instead
Note all the zeros and very large numbers in the second half... |
I checked with It's really confusing though. I've never seen it before. Is this straight out of |
Thank you very much. Yes, it is strange that we have this reordering of elements. You could see |
@akhoubani Did you encounter this error again? Should we prioritize it or fix it later? |
@ashwinvis Because I encountered this error for simulations on 20 cores (2*10), I limited the simulations to 10 cores. It would be nice to prioritize it. However, I encountered another error for simulations done on 20 cores related to the File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/pymech/dataset.py:36, in open_dataset(path, **kwargs)
33 else:
34 raise NotImplementedError(f"Filetype: {path.suffix} is not supported.")
---> 36 return _open(path, **kwargs)
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/pymech/dataset.py:152, in _open_nek_dataset(path)
150 elements = field.elem
151 elem_stores = [_NekDataStore(elem) for elem in elements]
--> 152 elem_dsets = [
153 xr.Dataset.load_store(store).set_coords(store.axes) for store in elem_stores
154 ]
156 # See: https://github.com/MITgcm/xmitgcm/pull/200
157 if xr.__version__ < "0.15.2":
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/pymech/dataset.py:153, in <listcomp>(.0)
150 elements = field.elem
151 elem_stores = [_NekDataStore(elem) for elem in elements]
152 elem_dsets = [
--> 153 xr.Dataset.load_store(store).set_coords(store.axes) for store in elem_stores
154 ]
156 # See: https://github.com/MITgcm/xmitgcm/pull/200
157 if xr.__version__ < "0.15.2":
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/xarray/core/dataset.py:770, in Dataset.load_store(cls, store, decoder)
768 if decoder:
769 variables, attributes = decoder(variables, attributes)
--> 770 obj = cls(variables, attrs=attributes)
771 obj.set_close(store.close)
772 return obj
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/xarray/core/dataset.py:750, in Dataset.__init__(self, data_vars, coords, attrs)
747 if isinstance(coords, Dataset):
748 coords = coords.variables
--> 750 variables, coord_names, dims, indexes, _ = merge_data_and_coords(
751 data_vars, coords, compat="broadcast_equals"
752 )
754 self._attrs = dict(attrs) if attrs is not None else None
755 self._close = None
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/xarray/core/merge.py:483, in merge_data_and_coords(data, coords, compat, join)
481 explicit_coords = coords.keys()
482 indexes = dict(_extract_indexes_from_coords(coords))
--> 483 return merge_core(
484 objects, compat, join, explicit_coords=explicit_coords, indexes=indexes
485 )
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/xarray/core/merge.py:640, in merge_core(objects, compat, join, combine_attrs, priority_arg, explicit_coords, indexes, fill_value)
635 variables, out_indexes = merge_collected(
636 collected, prioritized, compat=compat, combine_attrs=combine_attrs
637 )
638 assert_unique_multiindex_level_names(variables)
--> 640 dims = calculate_dimensions(variables)
642 coord_names, noncoord_names = determine_coords(coerced)
643 if explicit_coords is not None:
File ~/useful/project/20CONVECTION/miniconda3/lib/python3.9/site-packages/xarray/core/dataset.py:204, in calculate_dimensions(variables)
202 last_used[dim] = k
203 elif dims[dim] != size:
--> 204 raise ValueError(
205 f"conflicting sizes for dimension {dim!r}: "
206 f"length {size} on {k!r} and length {dims[dim]} on {last_used!r}"
207 )
208 return dims
ValueError: conflicting sizes for dimension 'y': length 10 on 'xmesh' and length 1 on {'x': 'x', 'y': 'y', 'z': 'z'} |
I share three field files for the same simulation: Without error: Error corresponding to conflicting sizes: Error corresponding to index: |
@akhoubani I have to de-prioritize this issue and #56 . Hopefully these are very rare. |
We encountered an
IndexError: list index out of range
in geometry reading for loading nek5000 field files.readnek
works fine for some dumped field files, while fails for some other files with the same geometry. I share two field files, one working and one broken.This field file works fine.
cbox0.f00298.txt
While the following gives the error.
cbox0.f00299.txt
The text was updated successfully, but these errors were encountered: