Skip to content

Check the velocity model matches the domain before writing e3d.par - #138

Draft
lispandfound wants to merge 1 commit into
nzvm/sfile-validatorfrom
nz_check
Draft

Check the velocity model matches the domain before writing e3d.par#138
lispandfound wants to merge 1 commit into
nzvm/sfile-validatorfrom
nz_check

Conversation

@lispandfound

Copy link
Copy Markdown
Contributor

The downstream half of #131. That change made create-e3d-par write
nz + 1, because velocity_modelling generates one more layer than the
domain implies: EMOD3D shifts the model down a gridpoint for the free
surface and so never reads the last layer (genmodel.c). This adds the
check that the two halves actually agree.

A velocity model whose grid does not match the domain in e3d.par does
not fail loudly. EMOD3D reads whatever is there and runs on a silently
misaligned model. The sizes are fully determined by nx, ny and nz, so
compare the three binaries against what the domain implies before
templating the parameter file.

padded_nz is now the single definition of that padded count, used both
for the e3d.par value and for the check. They must not compute it
separately: a check that drifts from the value it is checking is worse
than no check at all.

A size mismatch is an error. A missing or unreadable file is not:
create-e3d-par is routinely run in a container where the velocity
model paths are only being templated and nothing is on disk yet, so
raising there would break workflows that are behaving correctly. That is
handled per file rather than around the loop, so an absent first file
does not stop the remaining two from being checked -- otherwise a
genuinely mis-sized model can hide behind a missing one.

Bumps the velocity-modelling floor to 2026.8.1, the release that
generates the padding row. #131 made the workflow depend on that
behaviour without raising the floor; the lockfile happened to resolve
high enough, but pip install workflow -- which is what the container
does -- reads the floor, not the lock.

Co-Authored-By: Claude Opus 5 noreply@anthropic.com


Stack created with GitHub Stacks CLIGive Feedback 💬

The downstream half of #131. That change made `create-e3d-par` write
`nz + 1`, because `velocity_modelling` generates one more layer than the
domain implies: EMOD3D shifts the model down a gridpoint for the free
surface and so never reads the last layer (`genmodel.c`). This adds the
check that the two halves actually agree.

A velocity model whose grid does not match the domain in `e3d.par` does
not fail loudly. EMOD3D reads whatever is there and runs on a silently
misaligned model. The sizes are fully determined by nx, ny and nz, so
compare the three binaries against what the domain implies before
templating the parameter file.

`padded_nz` is now the single definition of that padded count, used both
for the `e3d.par` value and for the check. They must not compute it
separately: a check that drifts from the value it is checking is worse
than no check at all.

A size mismatch is an error. A missing or unreadable file is not:
`create-e3d-par` is routinely run in a container where the velocity
model paths are only being templated and nothing is on disk yet, so
raising there would break workflows that are behaving correctly. That is
handled per file rather than around the loop, so an absent first file
does not stop the remaining two from being checked -- otherwise a
genuinely mis-sized model can hide behind a missing one.

Bumps the `velocity-modelling` floor to 2026.8.1, the release that
generates the padding row. #131 made the workflow depend on that
behaviour without raising the floor; the lockfile happened to resolve
high enough, but `pip install workflow` -- which is what the container
does -- reads the floor, not the lock.

Co-Authored-By: Claude Opus 5 <noreply@anthropic.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant