Repository navigation
Keep dotted names when building geometry view and object paths - #1003
Merged
agianno merged 1 commit intoNov 23, 2026
Merged
Conversation
#geometry_view and #geometry_objects_write used Path.with_suffix on the user's base name, so a name such as layer_0.1m was cut to layer_0 and distinct outputs overwrote each other. Append the extension instead and only replace a known output extension, as the VTKHDF writer and snapshots already do.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Fixes #1002
#geometry_viewand#geometry_objects_writepassed the user's base name throughPath.with_suffix, solayer_0.1mbecamelayer_0.h5/layer_0.vtkhdf. Two outputs that differ only after the dot then wrote the same file and the second silently replaced the first, and with-nthe per-model geometry views collided too (survey_v1.2+ model number gavesurvey_v1.vtkhdffor every model).Changes:
GeometryView.set_filenamenow appends.vtkhdfto the base name plus model number. It only replaces the suffix when the name already ends in.vtkhdf,.h5or.vtk, which is the same rule the VTKHDF writer already uses.GeometryObjectnow appends.h5unless the name already ends in.h5. The materials database name is unchanged.test_replaces_an_existing_suffixintests/outputs/test_geometry_views.pyasserted the truncation (geo.old->geo.vtkhdf). Its docstring said "as for snapshots", but snapshots keep the dot now, so I changed it to expectgeo.old.vtkhdfand added cases for the model number and for names that already carry a known extension.tests/outputs/test_geometry_output_dotted_names.py) that runs a hash-command input with two dotted views and two dotted objects throughgprMax.run(..., n=2, geometry_only=True).Testing:
['view_0.vtkhdf'] == ['view_0.1m1.vtkhdf', ...],'layer_0.h5' == 'layer_0.1m.h5','survey_v1.vtkhdf' == 'survey_v1.22.vtkhdf') and pass with the fix.pytest tests/outputs/test_geometry_*.py tests/outputs/test_subgrid_geometry_view_origin.py tests/geometry_objects tests/hash_cmds -k "not mpi": 613 passed, 7 skipped (no CUDA). Other tests that use geometry views or#geometry_objects_write(tests/user_objects/test_cmds_output.py,tests/impedance_surfaces/test_impedance_geometry_roundtrip.py,tests/fractals/test_material_range_solve.pyand a few more): 164 passed, 16 skipped (no CUDA/OpenCL). MPI tests were not run, mpi4py is not installed here.python -m gprMax ... --geometry-only: the input from the issue now writeslayer_0.1m.h5,layer_0.2m.h5,view_0.1m.vtkhdfandview_0.2m.vtkhdf,-n 2givessurvey_v1.21.vtkhdfandsurvey_v1.22.vtkhdf, and#geometry_objects_read: 0 0 0 layer_0.1m.h5 layer_0_1m_materialsreads the object back.