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

generate-xdmf: Better error message for running on 1D data #6372

Closed
wthrowe opened this issue Nov 12, 2024 · 1 comment · Fixed by #6374
Closed

generate-xdmf: Better error message for running on 1D data #6372

wthrowe opened this issue Nov 12, 2024 · 1 comment · Fixed by #6374
Labels
cli/pybindings Command line interface & Python bindings enhancement

Comments

@wthrowe
Copy link
Member

wthrowe commented Nov 12, 2024

generate-xdmf doesn't handle 1D data, for obvious reasons, but if you run it on such the error is not great:

╭─────────────────────────────── Traceback (most recent call last) ────────────────────────────────╮
│ /home/wthrowe/spectre-work/bin/python/spectre/Visualization/GenerateXdmf.py:412 in generate_xdmf │
│                                                                                                  │
│   409 │   │   │   # Construct the grid for this observation                                      │
│   410 │   │   │   observation = vol_subfile[temporal_id]                                         │
│   411 │   │   │   xmf_timestep_grid.append(                                                      │
│ ❱ 412 │   │   │   │   _xmf_grid(                                                                 │
│   413 │   │   │   │   │   observation,                                                           │
│   414 │   │   │   │   │   topo_dim=topo_dim,                                                     │
│   415 │   │   │   │   │   filename=filename_in_output,                                           │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                  coordinates = 'InertialCoordinates'                                         │ │
│ │                     filename = 'ScalarWavePlaneWave1DVolume0.h5'                             │ │
│ │           filename_in_output = 'ScalarWavePlaneWave1DVolume0.h5'                             │ │
│ │                       h5file = <HDF5 file "ScalarWavePlaneWave1DVolume0.h5" (mode r)>        │ │
│ │                      h5files = [                                                             │ │
│ │                                │   (                                                         │ │
│ │                                │   │   <HDF5 file "ScalarWavePlaneWave1DVolume0.h5" (mode    │ │
│ │                                r)>,                                                          │ │
│ │                                │   │   'ScalarWavePlaneWave1DVolume0.h5'                     │ │
│ │                                │   )                                                         │ │
│ │                                ]                                                             │ │
│ │                  observation = <HDF5 group "/TimeStep.vol/ObservationId9039309379094327651"  │ │
│ │                                (14 members)>                                                 │ │
│ │                       output = 'ScalarWavePlaneWave1DVolume.xmf'                             │ │
│ │               relative_paths = True                                                          │ │
│ │                   start_time = None                                                          │ │
│ │                    stop_time = None                                                          │ │
│ │                       stride = 1                                                             │ │
│ │                 subfile_name = 'TimeStep.vol'                                                │ │
│ │                     subfiles = ['TimeStep.vol']                                              │ │
│ │                  temporal_id = 'ObservationId9039309379094327651'                            │ │
│ │      temporal_ids_and_values = [                                                             │ │
│ │                                │   ('ObservationId9039309379094327651', np.float64(0.0)),    │ │
│ │                                │   ('ObservationId12883908474027188397', np.float64(0.25)),  │ │
│ │                                │   ('ObservationId3786051601093629449', np.float64(0.5)),    │ │
│ │                                │   ('ObservationId17146722629450312499', np.float64(0.75)),  │ │
│ │                                │   ('ObservationId369472061476405199', np.float64(1.0)),     │ │
│ │                                │   ('ObservationId18302919226753717980', np.float64(1.25)),  │ │
│ │                                │   ('ObservationId937941305938352075', np.float64(1.5)),     │ │
│ │                                │   ('ObservationId17662617711199699994', np.float64(1.75)),  │ │
│ │                                │   ('ObservationId13175458069999519017', np.float64(2.0))    │ │
│ │                                ]                                                             │ │
│ │                         time = np.float64(0.0)                                               │ │
│ │                    timesteps = {                                                             │ │
│ │                                │   'ObservationId9039309379094327651': <Element 'Grid' at    │ │
│ │                                0x7f2f15ce4270>                                               │ │
│ │                                }                                                             │ │
│ │                     topo_dim = 1                                                             │ │
│ │ use_tetrahedral_connectivity = False                                                         │ │
│ │                  vol_subfile = <HDF5 group "/TimeStep.vol" (9 members)>                      │ │
│ │                   xmf_domain = <Element 'Domain' at 0x7f2f15ca78d0>                          │ │
│ │                     xmf_root = <Element 'Xdmf' at 0x7f2f15ca7e20>                            │ │
│ │            xmf_timestep_grid = <Element 'Grid' at 0x7f2f15ce4270>                            │ │
│ │                xmf_timesteps = <Element 'Grid' at 0x7f2f15ca7920>                            │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
│                                                                                                  │
│ /home/wthrowe/spectre-work/bin/python/spectre/Visualization/GenerateXdmf.py:230 in _xmf_grid     │
│                                                                                                  │
│   227 │   │   │   topology_type = {3: "Tetrahedron", 2: "Triangle"}[topo_dim]                    │
│   228 │   │   │   connectivity_name = "tetrahedral_connectivity"                                 │
│   229 │   │   else:                                                                              │
│ ❱ 230 │   │   │   topology_type = {3: "Hexahedron", 2: "Quadrilateral"}[topo_dim]                │
│   231 │   │   │   connectivity_name = "connectivity"                                             │
│   232 │   │                                                                                      │
│   233 │   │   xmf_topology = _xmf_topology(                                                      │
│                                                                                                  │
│ ╭─────────────────────────────────────────── locals ───────────────────────────────────────────╮ │
│ │                  coordinates = 'InertialCoordinates'                                         │ │
│ │                          dim = 1                                                             │ │
│ │                      extents = array([[2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2],                                                   │ │
│ │                                │      [2]], dtype=uint64)                                    │ │
│ │                     filename = 'ScalarWavePlaneWave1DVolume0.h5'                             │ │
│ │                filling_poles = False                                                         │ │
│ │                    grid_path = 'ScalarWavePlaneWave1DVolume0.h5:/TimeStep.vol/ObservationId… │ │
│ │                 num_elements = 16                                                            │ │
│ │                   num_points = np.uint64(32)                                                 │ │
│ │                  observation = <HDF5 group "/TimeStep.vol/ObservationId9039309379094327651"  │ │
│ │                                (14 members)>                                                 │ │
│ │                 subfile_name = 'TimeStep.vol'                                                │ │
│ │                  temporal_id = 'ObservationId9039309379094327651'                            │ │
│ │                     topo_dim = 1                                                             │ │
│ │                total_extents = <HDF5 dataset "total_extents": shape (16,), type "<u8">       │ │
│ │ use_tetrahedral_connectivity = False                                                         │ │
│ │                     xmf_grid = <Element 'Grid' at 0x7f2f15ce4770>                            │ │
│ ╰──────────────────────────────────────────────────────────────────────────────────────────────╯ │
╰──────────────────────────────────────────────────────────────────────────────────────────────────╯
KeyError: 1
@wthrowe wthrowe added enhancement cli/pybindings Command line interface & Python bindings labels Nov 12, 2024
@nilsdeppe
Copy link
Member

Can you try out #6374? That will hopefully give you something better...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
cli/pybindings Command line interface & Python bindings enhancement
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants