Repository navigation
Conversation
…ack#761) apply_align_buffer_coarsen now stops, naming the file and axis, when the align shift passes the window end, matching Python's EmptyAlignedCropWindow. Previously the run continued silently with a point outside the crop. Adds a topo_crop regression for topo types 3 and 4 and records the status in the topo input roadmap. Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
… topo roadmap Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…ack#760) A crop_extent the file does not cover is an error at make data for types 2/3/4, allowing half a cell at the edges; type-4 crops across the antimeridian still split. Adds a Fortran backstop regression for a crop that misses its file, and corrects roadmap §2.7. Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…wpack#760) TopographyData.write checks crop_extent against the file's cell edges (half a cell past the outermost points) for types 2/3 (after x/y_shift) and 4 (allowing the +/-360 wrap), with one message naming the file, its extent and the usable overlap. Fortran type 4 now stops when a requested crop misses its file, as types 2/3 already do. ASCII crops past the file, including across the antimeridian, now error instead of being clipped. Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
The fatal branch of the topo coverage check (over 1% of the domain uncovered) ended with a bare stop, which exits 0, so scripts and CI could not tell it from success. The 'do not quite cover' warning branch is unchanged. Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…nder x/y_shift (§2.8) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…rop round-off tolerance (§2.8) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…ws.md) Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
…an for each Signed-off-by: Kyle Mandli <kyle.mandli@gmail.com> Assisted-by: claude claude-opus-5-5
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.
This PR ties together and tries to address a lot of the confusion around the new windows into files, especially the netCDF files. Much of the language should apply to the ASCII files as well as netCDF, so I may have missed some of those. The diagram is also editable if someone wants to make it more clear.
Stacked on #763, which is stacked on #762. Please review only the commits
after
86bc5002:140f52e0adds the failing tests.2b8d3c9eis the fix.d6e579f8adds the design doc and diagram.This PR will be rebased as #762 and #763 land.
This answers @rjleveque's question about
crop_boundsversuscrop_extentin
topo.data. It is PR A of the plan indev/design/topo_input_roadmap.md§2.8. Start with the new reference pagedev/design/topo_crop_windows.md. It names every crop "window" (file extent,crop_extent, each entry's window in the file, the window actually loaded,the array extent, and the domain), gives each one's coordinate frame, and has a
diagram for a netCDF crop across the antimeridian.
What was wrong
crop_boundswas not a duplicate ofcrop_extent. It was eachtopo.dataentry's crop in that file's own coordinates. It differs fromcrop_extentwhen a crop is split at the antimeridian, and Fortran used itin place of
crop_extent.x_shift/y_shiftwasset. ASCII applied the crop after the shift, as documented. netCDF applied
it before the shift, in both Python and Fortran. With
x_shift = 10andcrop_extent = [0, 20, …], ASCII loaded[0, 20]and netCDF loaded[10, 30], so a run on[0, 20]stopped with "topo arrays do not coverdomain".
edges exactly, while Fortran allowed
1e-6·dx. For example, crop[-99.5, -99.0]on a 0.1° grid written byTopography.writegave Python 5points and Fortran 6. Over 1,905 crop edges on grid lines, the two disagreed
on 1,017.
What changes
crop_extentis in domain coordinates (afterx_shift/y_shift) for everytopo type, in Python and in Fortran.
topo.datano longer hascrop_boundsfor topo, dtopo or met. Fortran getseach entry's window from
crop_extent − lon_wrap_offset − shiftand clips itto the file. A hand-built
[4, path, TopoMetadata]entry whose crop existsonly in its metadata now has it written as
crop_extent.CROP_TOL = 1e-6of the grid spacing, is shared byPython (
coordinate_tools.CROP_TOL) and Fortran (topo_module.f90). Itguards round-off only and does not move crop edges.
Behavior changes (for release notes)
x_shift/y_shiftnow selects thedocumented region. The old window was the crop moved by the shift.
topo.datathat contains acrop_boundsline stops with"Regenerate topo.data with 'make data'". Without that stop, an old file
whose crop was only in
crop_boundswould load the wrong window silently.1e-6·dxof a grid point now keeps that point in Python,matching Fortran.
Verification
tests/test_topo_crop_frame.py: types 2/3/4 under a shift, for read andfor the write-time coverage check.
test_shifted_crop_is_in_domain_coordinatesintests/regression/topo_crop: an end-to-end Fortran run. Every cell'stopography matches an exact linear field to 1e-8, using the cos(latitude)
area weighting of the spherical cell average.
tests/test_crop_tolerance.py: Python and Fortran use the same constant;on the 1,905-edge sweep Python picks the same points as Fortran's index
formula; the
-99.5case keeps 6 points. With the constant set to 0,5 of these fail.
topo.datawithcrop_boundsstops.tests/: 661 passed.tests/regression,bowl-slosh-netcdf(including coarsened),dtopo,chile2010: 43 passed, 1 expected failure (marked xfail).chile2010includeslon_360, which buildstopo_entries()entries byhand with a −360 offset.
Not in this PR
Topographycan be plotted across theantimeridian (§2.8 PR A2).
value =: keynotation fortopo.data(§2.8 PR B).fetch_remote_topoand deprecation ofread_netcdfandetopo1_downloadrjleveque/doc#5, so they will follow it.Topography.writestorescellsizefromx[1] - x[0]; the met reader'scrop comparison is still exact. Both are recorded in §2.8.