Changelog
All notable changes to rwarp. Dates are when the change reached main.
0.5.1 (unreleased)
Added
-
rwarp::view: which chunks, at which level, a view on a screen needs from a chunked source with resolution levels (a Zarr with multiscales, a COG with overviews), as a value, with no I/O.plan_viewtakes aView(extent and screen size), aSource(per level a geotransform, a size and a chunk shape; whether its CRS wraps, and its poles) and the CRS transforms, and returns aViewPlan: chunk keys nearest the centre first, and per screen tile the level it needs. The screen is planned in tiles of 64 pixels, each with its own level from the local scale (the Jacobian of screen pixel to source,Need::AreaorNeed::Shortest; gdalwarp's-ovr AUTOrule per tile) and its own footprint, unwrapped across the source's seam; a tile holding a pole takes the full row of longitudes; tiles at the limb of a globe are sampled a pixel at a time.ViewOptions::max_chunksandmax_cellsare a budget, met by moving the outermost tiles coarser;ViewPlan::diffgives what to fetch and drop on a pan.plan_single_boxis the one box, one level rule most viewers use, for comparison: for a polar view of a global lon/lat pyramid it asks for 6.5 times the cells, across 180 degrees 8.5 times. The cases are data (tests/fixtures/view/cases.json) for other planners to run. Withserde, the inputs and the plan derive it. In rwarp-wasm:planView,planSingleBox,planViewWith. -
Footprint::Adaptive { densify, tolerance }andWeightOptions::refine_tolerance(with_refine_tolerance): the exact footprint with each segment of the outline bisected where the transform bends it, until it is within the tolerance of the true curve (curvilinear stage 5a, #38). It is d3-geo's adaptive resampling through bigcurve, one transformer call per level. The tolerance is in source pixels, or in world units for a source with cells (geolocation, mesh,SetTransformer). The error follows the tolerance, and the points grow as its inverse square root, as a fixeddensify's do, but they go only where edges bend. Where the transform is affine the weights areExact { densify }'s bit for bit. Tiles, threads andwarp()againstapplyagree bit for bit as before.Footprintisnon_exhaustive, so the new variant is not breaking. -
QuadMesh::burn_fromandRectilinear::burn_from(and_par): polygons and points in another CRS, their edges straight there, densified into the grid's world by bigcurve to a tolerance in world units (curvilinear stage 5b, #38). Each edge is first cut at the grid's tallest cell, and the polygons are cut to the grid's y range in their CRS, asMeshSet::burndoes for a band, so a polygon round the far pole doesn't come out inside out. With a declared period, rings are unwrapped across the seam, and one round a pole is refused. The area burned converges on the closed form at the tolerance's rate, with the points growing as its inverse square root. -
mesh::PolyMesh, a mesh of polygonal faces (ICON's triangles, MPAS's hexagons, a UGRID or ESMF mesh;newfrom compressed rows,from_paddedfrom a padded table), and conservative weights between it and a grid both ways:weights_onto(grid to mesh) andweights_to(mesh to grid), one table of overlaps turned round (conservative stage 5, #39). Each face is measured asexact_weightsmeasures a destination pixel: its edges densified (or refined by bigcurve) through the transformer into the grid's pixels, under the grid's measure, across a seam and round a pole. Faces that share an edge get bitwise the same points on it, so they tile the grid. With a period (with_period), edges go the shorter way round. Against ESMF (Cartesian, hexagons and triangles over part of a grid) the weights agree to 6e-14 both ways. -
PolyMesh::with_great_circles: edges on great circles, as ICON's and MPAS's are, nodes in longitude and latitude (conservative stage 5b, #39). Each edge is cut atdensifyequal angles, or refined by bigcurve's great-circle model; one across the equator is cut there first, where its curve in longitude and latitude turns and refinement can't see it. A node on a pole joins its edges along their meridians, whatever longitude it is written with. Each face's area converges on its spherical excess, at the tolerance's rate (densify's inverse square), and the faces tile a global grid at every tolerance. Against ESMF's spherical maps (a geodesic mesh and its dual, both ways, with a global 5 degree grid) the faces' areas agree to 8e-8; the weights differ by the grid's cells, which rwarp bounds by parallels and ESMF by great circles (Sto 3.8e-3). -
PolyMesh::weights_ontoandweights_towith a grid whose cells are in its world coordinates: geolocation arrays (GenImgGeolocTransformer), aQuadMesh(MeshTransformer) or aMeshSet(SetTransformer), each with destination geotransformWORLD_GT(conservative stage 5c, #39). Each face is measured as such a source measures a destination pixel: its outline in the source's world, walked onto its cells, across a seam and round a pole; for a set, in each band's world, left out of one where it comes out inside out, judged against the face's own turn. Onto a curvilinear mesh the fractions are the faces' clipped overlaps to 1.1e-13; onto a set the faces tile every cell to 1e-12. The world-cell measure is factored out of the exact footprint's lattice (WorldCells); warp and weights hashes are unchanged. -
PolyMesh::weights_onto_parandweights_to_par: on threads, a transformer built on each, the faces in ranges taken in turn and joined in order, the serial table bit for bit (conservative stage 5, #39). A geodesic mesh of 20480 great-circle triangles onto a global 0.25 degree grid, refined: 0.52 s serial, 0.12 s on 8 threads; to the grid 0.63 s and 0.25 s.weights_tonow groups its entries by cell with a counting sort (same order, faster). -
Second-order conservative remapping (conservative stage 6a, #40): ESMF's
conserve_2nd.-
What it does: each source cell's value becomes a plane over the cell, and each overlap takes the plane's mean over it.
-
The API:
WeightOptions::with_moments(true)records each overlap's first moments (Weights::moment), from controlledburn'sCoverageWindow::set_moments.Weights::apply_second_orderremaps a field with them, andWeights::second_orderfolds the gradients into one table, as ESMF's weight files hold it. -
As ESMF does it: the gradient comes from the cell's eight neighbours by Green's theorem, zero where they don't surround the cell. It is centred on the part of the cell the table covers, so the integral is conserved exactly under
DestArea.apply_second_ordertakes the gradients from the field, so neighbours without data drop out of them. -
Checks: fields linear in source pixels come out exact to 1e-14, planar and on the sphere. Halving the cell size quarters the error on a quadratic. The folded table is ESMF's to 6e-14 for a grid onto a grid (new fixtures
<case>.cart2.txt). -
One difference from ESMF: ESMF centres each overlap on the mean of its polygon's vertices, not its centroid. So where a projected grid cuts general polygons from a lon/lat one, ESMF is off by up to 0.035 on a linear field and rwarp is exact. Given ESMF's vertex means, rwarp gives ESMF's table to 1e-12.
-
Scope: any grid source, a grid onto a mesh, and a
PolyMesh's faces onto a grid. -
Sources with world cells (6b): geolocation arrays, a
QuadMeshthroughMeshTransformer, aMeshSet(throughSetTransformerorweights_to), and a grid onto aPolyMesh(weights_onto) or a set (weights_onto). The planes are in the cells' index space under the walk's equal-area map, where the overlaps are measured (decided 2026-11-19). The moments there are exact centroids: they are the overlaps clipped against each cell's four triangles to 3e-15. A field linear in the grid's indices comes out exact to 1e-14. A world quadratic on a curved grid is second order (its error falls 3.9 times as the cells halve) though not exact, as the map is affine only on each quarter of a cell.Weights::second_order(src, valid, areas)takes the window's world cell areas for such a source, from the newweights::source_cell_areas, as a gradient draws on cells the table may not reach. An empty table takes them too (it can't say what its source was). -
A
PolyMesh's faces as sources (6c):PolyMesh::weights_to(and_par) records moments, about each overlap's grid cell corner, and the newPolyMesh::apply_second_orderandPolyMesh::second_orderremap and fold with them. A face's plane is in the grid's space, where its overlaps are measured (its pixels, or a curvilinear grid's indices), as decided on 2026-11-19. Its neighbours are the faces sharing a node, as in ESMF, each centred on the part of it the table covers. A field linear in the grid's space comes out exact to 3e-14, in pixels, on the sphere and in a curvilinear grid's indices (first order is off by 1.2 to 2.3). On a quadratic, halving mesh and grid divides the error by 3.9. At a seam without a period in the table (see below for one with it), the gradients are one-sided: a face the seam cuts is first order (its cells aren't one piece), and a neighbour across the seam is left out (its cells aren't next to the face's). Without moments the tables are as before, bit for bit. -
A limiter (6d), opt-in:
ApplyOptions::with_limiter(Limiter::BarthJespersen)(newweights::Limiter,Offby default, as in ESMF). Barth and Jespersen's: each source cell's gradient scaled so its plane, at each of its overlaps' centroids, stays within the values of the cell and its neighbours. Next to a sharp front, values overshot their sources by 0.1 to 7 without it (fronts over grid cells, world cells and a mesh's faces); with it, each destination value (FracArea) is within its sources' and their neighbours' values to 1e-15, band by band, cells without data left out. It is a factor per cell, so the integral is conserved as before. Inside a window a linear field comes out as without it; on a smooth sine it costs 16 to 72% in rms (planes at extrema are flattened too) and stays 7 to 49 times closer than first order. It depends on the field, so it is forapply_second_orderonly; a folded table can't hold it. Overlaps under 1e-12 of their cell (rounding, 2 to 4% of a table's entries, centroids up to 45 cells off) are left out of the factor and take their cell's value.ApplyOptionsisnon_exhaustive, so the new field is not breaking. -
On the sphere, against ESMF (6d): new fixtures
<case>.sph2.txt, ESMF's sphericalconserve_2nd, for the three second-order grid cases and both sphere meshes both ways (tests/esmf_second_order_sphere.rs). ESMF's method works in three dimensions, rwarp's in longitude and latitude, so the comparison is of accuracy: each against exact cell means in its own cells (great circles for ESMF's, parallels for rwarp's). A grid onto a grid: both second order, 15 to 1,300 times closer than first inside, close to each other for lon/lat onto lon/lat and rwarp 19 times closer projected. A grid onto a mesh: rwarp 5 to 17 times closer than ESMF everywhere (ESMF's vertex means). A mesh onto a grid: below 60 degrees of latitude rwarp is 1.7 to 4.9 times closer, next to the grid's seam (with its period, below) and away from it. Nearer the poles, where a plane in longitude and latitude fits less well, ESMF is 1.6 times closer for the geodesic mesh and rwarp 2.5 times for its dual. -
Across a global grid's seam: a table made with moments on a grid that wraps round the globe every whole number of its columns (
Transformer::source_wrap) records that number in the newWeights::period. That coversexact_weights,PolyMesh::weights_ontoandPolyMesh::weights_to, and their_parforms. It isNonewithout moments, for world cells, or for a period that isn't whole. Second order then takes neighbours across the seam:- a grid cell on the seam takes the cells at the grid's other end;
- a mesh face the seam cuts has its cells taken across it to meet, so it has a plane;
- a face's neighbour across the seam is moved by whole periods to it;
- a face whose cells take every column (round a pole) is first order and no one's neighbour.
With the seam on the far side of the globe, the same mesh comes out the same to 1e-10 (its faces' refinement differs by as much in first order); without the period, by up to 0.22. Within 15 degrees of the seam and below 60 degrees of latitude, a mesh onto a global grid had been near first order (rms 5.3e-2 and 8.1e-2). It is now 9.2e-3 and 1.4e-2, as away from the seam, against ESMF's 1.6e-2 and 6.0e-2 (
tests/second_order_period.rs,tests/esmf_second_order_sphere.rs).Weightsisnon_exhaustive, so the field isn't breaking, and tables without it come out as before, bit for bit. -
Inside, relative to the polygon: a cell's centre is outside its neighbours' polygon if it is past an edge by more than ESMF's 1e-14, or by an angle of more than 1e-9 seen from the edge's start. A centre on an edge by symmetry (as for a geodesic mesh's faces at a pole) had been in or out as the faces' measure rounded. So a whole face's plane came and went with where the seam was. The ORCA2 and second-order bitwise checks and the ESMF comparisons are unchanged.
-
Dependency: controlledburn 0.3.3 (from 0.3.1), for
set_moments.
-
Changed
- Decision N2 (#44): the equal-area split's fallback for a non-convex cell whose balanced line misses its kernel (the best kernel point, the cell flagged inexact) now panics in a debug build, naming the decision, and runs only in a release build. A property test searches for such a cell (59,754 simple non-convex cells in four variants, all exact), as do eORCA1's and ORCA2's sets (6 non-convex cells, all exact).
- Decisions C1 to C4 (#48 to #51) are recorded:
u32indices per axis,FracAreathe default normalisation (now said prominently, with what to ask for to compare with ESMF'sDSTAREAdefault), the lattice shared bywarp()andexact_weights, and the measure on the source side only, said in the docs. - Decision N5 (#47), built: the curvilinear walk (
QuadMesh::burn,cover_ring,ring_to_index, and a mesh source's exact footprint) keeps plainf64orientation tests, made consistent where near-degenerate input meets them. A ring vertex within 1e-12 (index space) of its cell's corner or side is put on it, and a crossing within 1e-12 of an edge's end is put at the end, so a ring through the mesh's own corners covers its cells exactly once and their neighbours not at all (it gave a neighbour a sliver up to 2e-16 before). Each segment is walked from its lexicographically smaller end, so a side two polygons share has bitwise the same path from both (they could differ by 3e-12 in coverage). Property tests (tests/mesh_walk_degenerate.rs, 71,000 checks, 290,000 at twenty times the cases) search vertices on and within rounding of corners, sides, spokes and centres, segments through them, along sides and at shallow angles, against the world clip, complementary tilings and the ring reversed. No failure is left, so adaptive predicates aren't needed. Output changes only in rounding: on ORCA2 as a set,warp()andweights_ontoare bit for bit the same, andweights_toloses 560 entries of at most 1.4e-14 (1,171 at densify 4) and moves no other by more than 1.8e-12.
Fixed
- The curvilinear walk (
QuadMesh::burn,cover_ring,ring_to_index) no longer loses a segment that starts an ulp off a corner (found by the N5 property tests). Such a point can be owned, to rounding, by a cell whose bounding box it is just outside, and the flood of cells along the segment then stopped at that cell. The segment was taken as outside the mesh, and the ring closed by a boundary arc, covering cells it doesn't reach. The owner now counts as touched. Likewise a segment that enters the mesh within rounding of an outer corner (an ulp off it, next to 0) was missed: whether it meets an outer side is now decided by the orientation tests' signs, not a box test they could contradict. And a segment that leaves just past an outer corner now leaves through the wall, not from inside the mesh by up to 1e-12 of its length: short pieces of it are kept. ChunkOptions::split_antimeridianwith the fill ratio split (with_fill_ratio_split) no longer loses that split on a window that spans the source width with no jump in source x (#76), such as a narrow source the target covers whole. Such a window was marked for a split at the jump, its fill ratio replaced, and with no jump found it was split for memory only. Now the jump is looked for first, and a window not split at one, for want of a jump or because splitting saves nothing (round a pole), takes GDAL's rule with its own fill ratio. So vapour'ssst.tif(143 x 286, 140 to 150 E) to EPSG:3031 at 10 km is gdalwarp's 9 chunks, not 1 (a new gdalwarp fixture,narrow_stere_bilinear), and every gdalwarp fixture's plan is gdalwarp's with the option on. Plans that split at a jump are unchanged. rwarp-r gets this with its next crate update.
0.5.0 (2026-11-18)
Whole ocean-model grids as mesh::MeshSet (regridding to and from them,
burning onto them, warping from them, NEMO's halos), curvilinear sources
measured in their own world coordinates, and threads for warps, chunked
warps and weights.
Upgrading from 0.4:
- No public item of 0.4.1 is removed or has a new signature.
Transformergainssource_cellsandsource_wrap, both with defaults. - Values change for the exact footprint (
Footprint::Exact,exact_weights) over geolocation sources, now measured in the source's world coordinates, and across a geographic source's antimeridian and round its poles (see below). Point kernels, the GDAL box footprint and affine sources are unchanged bit for bit. - Mesh burns change on meshes with cells of no area inside them, and for a ring touching a mesh at one point (see Fixed). Other meshes give the same records bit for bit.
- New blanket impls:
Transformerfor&T, andCrsTransformforBox<C>and&C. A crate that implements either trait for a reference or a box of its own type conflicts with them; drop that impl. meshis unstable (decision N4): it may break at a 0.x minor release.
Changed
- The exact footprint (
Footprint::Exact,exact_weights) over a geolocation source measures in the source's world coordinates (#36, stage 3 ofdesign/curvilinear-frontend.md). Each destination pixel's outline goes to source world coordinates and is walked onto the source window's cells under the equal-area map. Each source pixel is the quadrilateral through its corners' positions. So weights are fractions of each cell's world area, andAverageandModeweight each source pixel by its world area. Before, the outline went through the inverse geolocation transform and was measured in source pixel space.- Effect: for a destination pixel inside the source, weight times cell area now sums to the outline's area to 2e-13 (relative). The old measure was off by up to 3e-3 on a polar-sector grid, and 6e-3 on a curved longitude/latitude grid to polar stereographic.
- Across the antimeridian (#72): with
lon_wrap, the arrays' longitudes are unwrapped by continuity, so cells across the seam are whole. Each outline is unwrapped too and walked at each whole turn that reaches the cells, and one that goes round a pole is closed along latitude 90 or -90. The same swath stored with its seam in different places gives the same weights (to 1e-11, the rounding of areas at longitude 180), and weight times cell area sums to the outline's area across the seam. - Fallback: arrays with a missing sample, arrays that fold, and, with
lon_wrap, arrays whose longitudes don't unwrap consistently (a swath over a pole) or span more than 360 degrees keep the old measure, decided once per set of arrays (GeolocArrays::world_cells). - Values change for exact-footprint warps and weights from geolocation sources. Point kernels, the GDAL box footprint and affine sources are unchanged bit for bit. rwarp-r doesn't expose geolocation sources.
- Speed: 3 to 9 times the old measure at densify 2 (4 to 6 microseconds a pixel in the timings for #36).
exact_weights_with'sCellWeightsgainssrc_area, each entry's source cell measure.- The mesh walk (
QuadMesh::ring_to_index, and soburn,burn_parandcover_ring) is 4 to 30 times faster, with the same output bit for bit (checked over 17,806 rings). The changes:- outer sides are found through a bucket index, instead of every outer side being tested for each segment that leaves the mesh;
- a cell is clipped only if the segment meets its bounding box;
- the flood's buffers are reused along a ring.
Natural Earth 10m land onto the warped 1440 x 720 mesh of
examples/mesh_burn_par.rsnow takes 0.24 s withburn(1.15 s before), and 0.06 s at 8 threads (0.23 s).
- Decision N1 (#43): coverage uses the equal-area map on every mesh.
QuadMesh::ring_to_index,burn,burn_parandcover_ringno longer refuse a mesh built withCellMap::Bilinear; they give the same records as on aCellMap::EqualAreamesh. A mesh'sCellMapis now the map of its point methods only (to_index,to_world,local,world),Bilinearby default for GDAL parity. meshsays what "unstable" means (decision N4): the module may break at a 0.x minor release, not at a patch release. Its docs show one mesh per scan for a swath whose scans overlap (decision N3; a doctest), andQuadMesh::from_cornerssays that overlap keeping orientation (a row or column stored twice, such as an ocean model's halo) isn't detected yet.
Fixed
-
QuadMesh::ring_to_index(and soburn,burn_par,cover_ring) on meshes with cells of no area inside them, such as a T-point pivot of a tripolar grid, a collapsed column, or a pole row in a polar projection (stage 4b, #37). Four fixes:- A ring crossing such a cell jumps in index space at one world point. It was joined straight to the next piece's end, misplacing the following cell's coverage. It's now linked through the collapsed cell, and, where that cell is on the boundary, across the walls. A jump the walk can't follow is an error, not a wrong ring.
- The equal-area split of a cell with a side of no length (a triangle) put its centre on the collapsed corner and its unit centre outside the unit square, so it was inexact and placed index points outside the cell. It's now exact.
- A vertex at a collapsed corner took a position from another of the cell's triangles.
- A ring starting on a corner whose owner had no area was taken as starting outside the mesh.
- Bounded meshes without such cells give the same output bit for bit.
- Also: a cell's area that is zero to rounding is now zero, so a cell collapsed onto a line, with its corners not quite on it, no longer takes an orientation and gets the mesh refused as folded.
-
QuadMesh::ring_to_indexfor a ring that touches the mesh at a single boundary point from outside: it left and re-entered at the same point, and the walk closed it along the whole boundary, soburnandcover_ringcovered every cell. Now the ring misses the mesh. A ring around the whole mesh that touches it at one point still covers it. -
The exact footprint (
Footprint::Exact,exact_weights) across a geographic source's antimeridian and around a pole (#36, the cases #11's comparison found). A destination pixel whose outline crosses the source's seam is unwrapped and measured at each whole-period offset that reaches the source; one that goes around a pole is closed along the pole's row. On a global 1 degree grid to 41 x 41 polar stereographic pixels, the weights no longer depend on where the source's seam is (to 5e-14), every pixel's weights sum to its outline's area, and the pole pixel's converge to the polar cap at second order in densify; before, weights across the seam were off by up to 0.92.
Added
-
mesh::MeshSet: a whole curvilinear grid as rectangular pieces, each aQuadMeshin the projection of its band of rows, for an ocean model's whole global grid (stage 4g ofdesign/curvilinear-frontend.md, #37).MeshSet::from_cf_bounds(ncol, nrow, xb, yb, halo, bands, droppable)projects eachBandto its own world. It leaves out cells that are bow-ties there, turned the wrong way or overlapping others, wheredroppableallows (land), and refuses them otherwise. The rest are covered byPieces, so a cell left out is a hole.weights_toandweights_ontogive conservative weights from and onto the whole grid as oneWeightsin the file's numbering, fromexact_weightsthrough aMeshTransformerorMeshTargetper piece. Each piece is measured only over the pixels it reaches.- For ORCA: bands in north-polar and south-polar LAEA on the model's sphere, both equal-area, so areas add up across them. Where they meet the cells bow apart, a gap of about dlam^2 / (6 dphi) of a cell (under 1% at 20 S on ORCA2).
- Checks (
tests/mesh_set.rs): an analytic global tripolar grid with damaged land, conservation to 7e-15, the gap within its bound, the rest unchanged by the damage. On CMIP6's eORCA1 and ORCA2 whole (in scratch): every ocean cell kept, 716 and 801 land cells left out, to 1 degree in about 1 s each. MeshSet::burn(geoms, bands, tolerance, opts)(stage 4h) burns polygons and points in the bounds' coordinates (longitude and latitude) onto the set. It returns controlledburn's tables in the set's numbering, as fractions of each cell's area.- Edges are straight in the bounds' coordinates. bigcurve densifies
them into each band's world to
tolerance(world units). - Each band takes only the polygons' part within its cells' y range, so a polygon round the far pole isn't turned inside out.
- Rings are split where a cut at 180 or along a pole brings them back onto themselves.
- Checks: boxes on the analytic grid against closed-form areas, to
8e-8. On eORCA1 and ORCA2 (scratch): a whole-world box covers
every kept cell, and boxes agree with
weights_ontoto 8e-6. Natural Earth's 10 m countries burn in 0.7 to 1.1 s. - Each piece walks only what can reach it. Tiles mark where its cells are, so polygons elsewhere are skipped and runs of edges away from it cut short, with the same result bit for bit. On ORCA2 the countries went from 3.0 s to 1.1 s.
- Each ring's edges are tested against a piece 32 at a time by their box, one by one only near it, and far runs are cut short a chunk at a time, again bit for bit. On one thread ORCA2's countries take 0.96 s at 1 m (1.1 s before) and 4.6 s at 0.01 m (5.6 s).
MeshSet::burn_par(geoms, bands, tolerance, opts, threads)gives the same records on several threads. Pieces filter, walk and burn their polygons in parallel. Projection stays on the calling thread, since a band's transform needn't be thread-safe. On 8 threads ORCA2's countries take 0.44 s.MeshSet::burn_par_with(geoms, bands, tolerance, opts, threads, to_world)projects on the threads too: each thread builds its own copy of bandk's transform withto_world(k). The records are the same again. On 8 threads ORCA2's countries take 0.18 s at 1 m and 0.92 s at 0.01 m (2.2 s withburn_par).
- Edges are straight in the bounds' coordinates. bigcurve densifies
them into each band's world to
- New dependency: bigcurve 0.3 (pure Rust, no dependencies of its own, builds for wasm).
-
MeshSet::from_file_layout,to_file_layoutandfill_halo: fields between the file's grid (halo and all) and the set's numbering.MeshSetkeeps the file's size and halo (file_size,halo).from_file_layoutdrops the halo, for aSetTransformer's source buffer.to_file_layoutputs a field back with the halo masked by a fill. Where the fold runs through the last row's centres (T cells at a T-point pivot), the two halves of a model cell give it their mean by area.fill_halo(file, nbands, point)writes NEMO's halo for a set with a NEMO halo: the cyclic columns and the north fold's rows, for a field at the grid's T, U, V or F points (Stagger), as NEMO 4.0 writes them (3.6 takes the last column of U and F points at an F pivot from the wrong column). On eORCA1 and ORCA2, cell centres taken to the set and back, halo filled, match the file's to 2e-16 in every row but the first, and the positions of all four points from the T cells' bounds come back exactly.to_file_layout_vectorandfill_halo_vector, for components of a vector in the grid's directions: the fold's copies change sign (NEMO'spsgn = -1), and a fold row's halves are turned round before their mean. Components east and north are scalars here. On both files, components along each cell's own directions come back to 1e-16, halo and all.
-
Sets of NEMO's U, V and F cells:
Halo::nemo(pivot, cells), withPivotand the cells'Stagger(Halo::NEMO_F_PIVOTandNEMO_T_PIVOTare the T cells'). V and F cells at a T pivot drop the last two rows; the fold runs through the centres of the last row kept for T and U cells at a T pivot and for V and F cells at an F pivot.Halo::nemorecords the grid (the fieldnemo: Option<Nemo>), forfill_halo's pivot and to pair a fold row's halves by NEMO's mirror for the cells' point. On both files, each point's cells cover the cap north of 60 N to 2e-7 of its area. -
MeshSet::weights_to_parandweights_onto_par:weights_toandweights_ontoon up tothreadsthreads, the same tables bit for bit. Pieces with at least1 / threadsof the set's cells are measured one after another, each on every thread (exact_weights_par, a transformer per thread from the closure); the rest at once, one a thread, the most cells first; merged in the pieces' order. To 1 degree at densify 8: eORCA1'sweights_to3.0 s on one thread, 0.42 s on 8. -
weights::exact_weights_par:exact_weightson up tothreadsthreads, the same table entry for entry and bit for bit.- Each thread builds its own transformer and takes bands of the target's rows into a table of its own, with one lattice moved to each band; the tables are joined in row order.
- A 0.1 degree global source to 1000 x 1000 south polar stereographic
at densify 2 (6.7 M entries) through libproj: 3.0 s on one thread,
0.58 s on 8. Through a
SetTransformer, ORCA2 to 1 degree at densify 8: 2.3 s and 0.35 s.
-
plan::warp_chunks_par:warp_chunkson up tothreadsthreads, with the same values bit for bit.- Each thread builds its own transformer, and takes bands of each chunk's rows from one queue, about four bands a thread over the plan. So a plan of one chunk runs on every thread, and one of many warps several chunks at once.
- A chunk's source window is copied when its first band starts (borrowed when it is whole rows of the buffer) and dropped after its last. Bands go into the target in the plan's order, as on one thread (the two chunks of an antimeridian gap share a target window).
- A 0.1 degree global grid to 4000 x 4000 south polar stereographic pixels through libproj, 8 chunks: bilinear 1.48 s on one thread, 0.26 s on 8; cubic 3.09 s and 0.46 s.
-
Targets are filled with their nodata by copying (
slice::repeat), not pixel by pixel.warp_chunksof a one-chunk plan to 16 million pixels took 0.94 s on one thread, 1.03 s before. -
warp::warp_parandwarp_to_par:warpandwarp_toon up tothreadsthreads, with the same values bit for bit.- Each thread builds its own transformer with a closure, as GDAL's
-wo NUM_THREADSclones one a thread (a libproj transformer can't be shared). It takes bands of the target's rows from one queue. - What a warp works out once (the cutline's density over the source, the kernel scale over the whole target) is worked out once. The exact footprint's lattice is built once a thread and moved to each band.
- A 0.1 degree global grid to 2000 x 2000 south polar stereographic pixels through libproj: bilinear 0.48 s on one thread, 0.08 s on 8; the exact-footprint average 3.4 s and 0.45 s.
Transformerfor&T, so aSynctransformer serves every thread as|| Ok(&t).
- Each thread builds its own transformer with a closure, as GDAL's
-
mesh::SetTransformer: aMeshSetas a warp source (stage 4i ofdesign/curvilinear-frontend.md, #37), forwarp()andexact_weightsfrom a whole ocean grid in pieces with every method.- Source pixels are the set's cells in its numbering, so a field on the whole grid (less its halo) is one source buffer.
- Area methods with the exact footprint walk each destination pixel's
outline in every band's world onto each piece it reaches, into one
reduction.
Averageisweights_toandapplybit for bit, and on ORCA2 to 1 degree 0.88 s against 1.21 s. An outline turned inside out round a polar projection's far pole isn't measured in that band. - Point kernels map into the set's index space through the piece that holds the point, and read neighbours across pieces and bands.
-
SourceCellsgainsworlds,dst_to_world_inandsheets(withSourceSheet), defaulted to one world and one sheet, for sources whose cells are in several worlds.MeshTargetpasses them on. Sources that are one sheet warp and weigh as before, bit for bit. -
CrsTransformforBox<C>and&C(C: CrsTransform + ?Sized), socrs_pair's boxed transforms go where aT: CrsTransformis asked for, such asMeshSet::burn_par_with'sto_world. -
mesh::MeshTarget: aQuadMeshas a warp target, for regridding onto a curvilinear grid given by its corners, such as an ocean model's tripolar grid (stage 4f ofdesign/curvilinear-frontend.md, #37).- How: target pixel
(col, row)is mesh cell(row, col). A target pixel goes to the mesh's world coordinates and then through an inner transformer to the source.from_grid(src_crs, src_gt, src_size, mesh, mesh_crs)makes that aGenImgProjTransformer, wrapping a lon/lat source's longitudes as gdalwarp does.new(mesh, inner)takes any transformer whose destination geotransform ismesh::WORLD_GT: geolocation arrays, or another mesh (MeshTransformer), for mesh to mesh. - What it gives:
exact_weightsmeasures each cell as a target pixel in the source's space, under any measure (lonlat_measurefor areas on the sphere), across a lon/lat source's seam and over its pole.warp()regrids onto the mesh with any kernel; point kernels sample each cell's centre. - Checks (
tests/mesh_target.rs): in one plane, the overlaps are the mesh source's transposed (2e-14), and mesh to mesh is symmetric. From a global lon/lat grid every cell is covered in full and the seam's position doesn't matter.warp()isWeights::applybit for bit. - Against ESMF onto the tripolar cap (
tests/esmf_tripolar.rs, newonto_tripolarfixtures fromgen.py; the existing fixtures are unchanged bit for bit): Cartesian in the plane to rounding (3e-13); spherical recorded, S up to 3e-2 on the cap's smallest cells and 3e-3 over cells more than 100 km across.
- How: target pixel
-
A declared period for coordinates that jump at the seam, such as longitude:
QuadMesh::with_periodandRectilinear::with_period(stage 4e ofdesign/curvilinear-frontend.md, #37).- Polygons:
burn,burn_parandcover_ringtake each polygon at each whole period at which it overlaps the grid, so polygons from -180 to 180 burn onto a grid from 0 to 360, and across its seam. - Points:
locate,locate_all,to_indexandRectilinear::cellfind a point at any whole period. - A mesh source:
MeshTransformerover a mesh with a period takes target pixels across its seam, and round a pole (closed along latitude 90 or -90). mesh::unwrap_gridandmesh::unwrap_boundsmake longitudes stored with a jump ([-180, 180),[0, 360)) continuous;from_cornersandfrom_cf_boundsname them when they refuse such corners.- Refused: a cell half a period wide or more (round a pole, as at a
tripolar grid's north), and a mesh that goes round more than once.
find_overlapincludes the period once it is declared. - Checks (
tests/mesh_period.rs): generator 5, a regular global grid with its columns rotated, against controlledburn's regular burn (bitwise atf32); the same weights wherever a mesh's seam is, for a lon/lat destination and a polar one whose centre pixel holds the pole;warp()againstWeights::apply. - Meshes without a period are unchanged bit for bit.
- Polygons:
-
mesh::MeshTransformer: aQuadMeshas a warp source, for data with one value per cell on a curvilinear grid given by its corners, such as an ocean model's tripolar grid (stage 4d ofdesign/curvilinear-frontend.md, #37).- Constructors:
new(mesh, mesh_crs, dst_gt, dst_crs)with the CRS backend, orwith_backendwith your ownCrsTransforms. - What it gives: it reports the mesh as the source's cells
(
Transformer::source_cells). Soexact_weightsgives conservative weights from the mesh, as fractions of each cell's world area across the seam and fold, andwarp()withFootprint::Exactregrids with the area methods. - Point kernels go through the mesh's cell map (
QuadMesh::to_index). - Checks:
warp()withAverageisWeights::apply(FracArea)bit for bit, every cell's weights sum to 1, and source windows tile the mesh (tests/mesh_transformer.rs).
- Constructors:
-
QuadMesh::window: a window's cells as a mesh of their own. -
ESMF on a tripolar grid (stage 4c of
design/curvilinear-frontend.md, #37;tests/esmf_tripolar.rs). The weights come fromexact_weightsthroughMeshTransformer, on an analytic tripolar cap with a seam into one pole and an F-point fold. They are compared on two destinations: a grid in the cap's own plane, and lon/lat up to the pole.- Cartesian ESMF in the plane: the weights agree to rounding (3e-14).
- Spherical ESMF: the differences are great-circle edges, recorded as ceilings. S differs by up to 2.6e-3 and areas by up to 9e-4, and the area difference falls with the square of cell size.
- The NEMO layout of the same grid gives the same mesh to the bit.
- Fixtures come from
tests/fixtures/esmf/gen.py, which now takes case names. Its existing fixtures are unchanged bit for bit.
-
QuadMesh::from_cf_bounds: a mesh from each cell's own four vertices, CF bounds (lon_bnds(j, i, 4)) or SCRIP corners (grid_corner_lon(grid_size, 4)), with aHaloof rows and columns dropped first (stage 4b, #37, decision N3).- Vertex order: found from the data (CF's or any rotation or reflection of it).
- Shared corners: neighbours must share them, to a thousandth of a cell.
- Overlap: refused, as a halo left in gives.
- NEMO:
Halo::NEMO_F_PIVOTandHalo::NEMO_T_PIVOTare the ORCA layouts as CMIP6 files have them (the last two columns, the first row and the last row), for the T cells;Halo::nemogives the cells round the grid's other points (above). At a T pivot the row the fold runs through is halved, and its model cells are two mesh cells. - Real data: checked on IPSL's eORCA1 and ORCA2. Areas agree with
areacelloto 1e-4 in total, and a cap over the fold is covered to 1e-10 of its area. Both files have land cells (eORCA1 south of 76 S, flattened by a north-polar projection; corrupt bounds in ORCA2) that are refused, so for now those rows are dropped.
-
QuadMesh::find_overlap: two cells that overlap, a point inside one owned by the other too, for copies that keep orientation, whichfrom_cornersdoesn't check. -
QuadMesh::ring_to_index, and soburn,burn_parandcover_ring, cross outer walls that meet in the world: a periodic grid's seam (column linencolon column line 0) and a tripolar grid's fold (the last row line on itself, cornerion cornerncol - i), with nothing declared (stage 4a ofdesign/curvilinear-frontend.md, #37). Give the grid's corners in a projection in which it is one sheet: for an ocean grid's tripolar north, Lambert azimuthal equal-area on the north pole, whose planar areas are true areas. The walls need to agree only to rounding.- Before: a ring crossing a seam or fold was joined across the mesh in index space, and cells along the crossing were off by up to a whole cell.
- Bounded meshes: the same output bit for bit. Tested against the
per-cell world clip on an annulus, a fold and a tripolar disk
(
tests/mesh_glued.rs). - Not yet: coordinates that jump at the seam (longitudes 360 apart).
-
Transformer::source_cellsandtransform::SourceCells: a transformer reports a source whose pixels are cells in its own world coordinates. It provides the map from destination pixels to source world coordinates (dst_to_world) and the cells of a source window (mesh), for the exact footprint. DefaultNone.GenImgGeolocTransformerwith geolocation arrays on the source side, andGeolocArrayson its own, report it whenGeolocArrays::world_cells()isOk;ApproxTransformerpasses it through, withdst_to_worldunapproximated.SourceCells::lon_wrap(defaultfalse) says world x is longitude that wraps. -
GeolocArrays::world_cells, whether the exact footprint measures a source with these arrays in world coordinates (and if not, why), andGeolocArrays::window_mesh, a source window's cells. -
Weights::src_cell_area: each entry's source cell area, for a geolocation source (empty otherwise, and not serialised when empty).Weights::src_areauses it. -
Transformer::source_wrapandtransform::SourceWrap: a transformer reports a source that wraps in longitude (its period in source pixels and the rows of the poles), for the exact footprint. DefaultNone;GenImgProjTransformerreports it for a north-up geographic source of at most 360 degrees wrapped around a centre longitude (afterwith_source_size), andApproxTransformerpasses it through.
0.4.1 (2026-11-16)
Added
QuadMesh::burn_parandRectilinear::burn_par: the mesh burns on up tothreadsthreads (0 for all available), with the same result asburn, record for record. The ring walk into index space runs on contiguous chunks of the geometries of about equal vertex counts, taken in turn by the threads, and the burn uses controlledburn'sburn_par. Natural Earth 10m land (6,837 polygons, 446,175 vertices) onto a warped 1440 x 720 mesh: 1.16 s withburn; 0.58 s, 0.31 s and 0.24 s at 2, 4 and 8 threads, and no faster past 8, as one geometry is never split (the largest, 19% of the vertices, takes 0.33 s alone).examples/mesh_burn_par.rstimes it.
0.4.0 (2026-11-12)
Changed
- controlledburn 0.3.1 (from 0.2.4). Breaking for rwarp because its types
are in rwarp's API (
weights::Measure, andGeometry,BurnOptionsandBurnResultinQuadMesh::burnandRectilinear::burn). Options are#[non_exhaustive]in 0.3, so build them withBurnOptions::coverage()and thewith_*methods. A multi-part geometry now gets one record per cell in a mesh burn (merge_parts, on by default);BurnOptions::paritykeeps one per part. Cutlines burn each polygon separately and are unchanged. Otherwise the test suite gives the same results as on 0.2.4.
0.3.3 (2026-11-12)
Changed
ChunkOptions::split_antimeridianno longer reads the whole source width for the columns at the jump (the gap). Each gap pixel needs only one edge of the source, so the gap becomes two chunks on the same target window, one source window at each edge, sampled every half pixel and padded for the gap's own kernel scale. A 384x384 Lambert azimuthal target centred on 180 degrees over GEBCO at overview 3 reads 200,600 source pixels instead of 2,257,200, with the same values (exact transformer; nearest, bilinear and cubic; Int16, Float32 and Byte).- The split is kept only when it reads under half of the full-width window, so a target around a pole (where every longitude is needed) keeps GDAL's plan, and it no longer depends on the fill ratio split being on.
warp_chunksplaces only the pixels a chunk wrote (not equal to the fill, NaN equal to NaN), through the newplan::merge_tile. For chunks that don't overlap this is the plain copy it was.
0.3.2 (2026-11-04)
Added
- The curvilinear front end, stage 2 of
design/curvilinear-frontend.md(unstable):QuadMesh::ring_to_indexwalks a world ring into the mesh's index space, cutting each segment at every cell side and split spoke it crosses (Cyrus-Beck clipping per triangle over a flood of the cells it passes, so vertices, corners and centres on a segment need no special case). A cut point is placed by its parameter along the edge's canonical direction, so rings sharing an edge get bitwise the same point. Stretches outside the mesh are replaced by the boundary arc whose loop with the excursion does not wind around the mesh; a ring around the whole mesh gives its outline.QuadMesh::burnburns polygons (holes, multipolygons) and points through controlledburn with the mesh's own(row, col)and fractions of each cell's world area;QuadMesh::cover_ringdoes one small ring through a reusedCoverageWindow.mesh::Rectilinearis the same for grids given by column and row edges (cut at every wall, piecewise linear per axis). Checked against world-space clipping of every cell (Sutherland-Hodgman per split triangle) on rotated, jittered, non-convex, polar, sheared and flipped meshes with polygons crossing the boundary, holes and vertices steered onto corners and centres; against the affine burn for a rotated grid; and rectilinear against the mesh, all to 2e-6 (controlledburn'sf32fractions). Lines and approx mode are refused for now. (2026-11-01) meshmodule, stage 1 ofdesign/curvilinear-frontend.md(unstable):QuadMeshholds a curvilinear grid as straight-edged quadrilateral cells (from_corners,from_centres), refuses bow-ties and folds, and maps between world coordinates and index space withCellMap::Bilinear(GDAL's model; equal toGeolocArrays::geo_to_pixelwith corner samples, to 1e-9) orCellMap::EqualArea(four triangles per cell with matching area shares, so index-space area fractions are world-area fractions; checked to 1e-9 on jittered, non-convex, polar and sheared grids, where the bilinear measure is off by more than 1e-3). Every point has at most one owning cell: side orientations are computed once in a canonical direction, and points on a shared wall go to the low-index cell.locatewalks from a hint and falls back to CSR buckets built on first use;locate_allreturns every owner (for checks). No CRS: builds with--no-default-features. (2026-10-31)- A spherical measure for conservative weights (stage 3a of
design/conservative.md):WeightOptions::with_measurewithweights::lonlat_measure(src_gt)measures areas on the sphere for a source on a regular longitude/latitude grid, through controlledburn'sMeasure::CosLatitude(closed-form edge integrals ofcos(lat); the cell partition and conservation are unchanged).Weightsrecords themeasure,Weights::src_area(k)gives an entry's source cell measure, andnormalised,dst_coveredandapplyweight overlaps by it; for the default planar measure every cell is 1 and results are unchanged, bit for bit. Exact against closed-form lon/lat box overlaps on the sphere (to 1e-14). Needs controlledburn 0.2.4. (2026-10-29) - ESMF oracle suite (stage 2 of
design/conservative.md,tests/esmf.rs): six cases, each against ESMPy 8.9.1's first-order conservative weights in Cartesian source pixel space (rwarp's cell definition: equal to about 1e-12) and on the sphere with great-circle edges (differences recorded as ceilings to shrink). Fixtures fromtests/fixtures/esmf/gen.py, run inghcr.io/hypertidy/gdal-r-esmfby.github/workflows/esmf-fixtures.yml. (2026-10-29)
Changed
- The
serdefeature also enables controlledburn's, forMeasureinWeightOptionsandWeights. (2026-10-29)
0.3.1 (2026-10-28)
Added
- Longitude wrapping of a geographic source, GDAL's
CENTER_LONG:GenImgProjTransformer::with_source_sizelets the transformer wrap source longitudes around the source raster's centre as gdalwarp does (InsertCenterLong,OGRProjCT), so a source stored as 170..190, -190..-170 or 0..360 is found by a target crossing 180 degrees.CenterLong(Auto, the default;Off;At(lon),#[non_exhaustive]) withwith_center_long,with_target_extentfor gdalwarp's-te,center_long(),source_center_longfor GDAL's centre, andcrs::is_geographic_degrees. A transformer built withoutwith_source_sizewraps nothing, as before. Checked against GDAL 3.14.0dev on 11 cases across 180 degrees (LAEA, Mercator, polar stereographic, lon/lat targets; chunked and whole): centres, exact transformer points, chunk lists and every output pixel, with both CRS backends. The LAEA chunk fixtures are back across 180 degrees. Theprojfeature now also depends onproj-sys(already a dependency ofproj), to ask PROJ whether a CRS is geographic. weightsmodule: conservative remapping weights from the exact footprint, as values (stage 1 ofdesign/conservative.md).exact_weightsreturnsWeights, one entry per overlapping (target cell, source cell) pair with full-grid indices and the overlap as an unroundedf64fraction of the source cell, plus each target cell's outline area in source pixel space (dst_area,NaNwhere it failed).Weights::normalisedgives ESMF'sSunderNormalization::FracAreaorDestArea;Weights::applyapplies the weights to one or more bands, skipping source nodata;Weights::esmf_row_colgives ESMF/SCRIP's 1-based flattened indices.exact_weights_withstreams them per target cell.WeightOptions(densify, target offset for tiling, drop and snap tolerances,f32rounding;WeightOptions::warp_compatible),ApplyOptionsandGridWindow, all#[non_exhaustive]with builders; serde derives behindserde.apply(FracArea)with warp-compatible weights reproduceswarp()withFootprint::ExactandAveragebit for bit.warp()shares the lattice and per-pixel coverage step and its output is unchanged. (2026-10-28)- GDAL's backmap geolocation inverse, as an option beside the quad index:
GeolocOptions::with_inverse(GeolocInverse::Backmap)(GeolocInverse:QuadIndex, the default;Backmap;BackmapEstimateforGDAL_GEOLOC_USE_MAX_ACCURACY=NO;#[non_exhaustive]), withwith_backmap_oversample(GEOLOC_BACKMAP_OVERSAMPLE_FACTOR) andGeolocArrays::backmap_grid. Ported from GDAL 3.14 in its arithmetic order (float32 backmap,GDALFillNodatahole filling, the spiral search), by way of wxylib'swxy-warp(geoloc.rs, GDAL 3.12; the geolocation code is unchanged since), addingPIXEL_OFFSET/STEP. Checked against GDAL 3.14.0dev on 9 new cases (swath by centres and by corners, lon/lat and polar stereographic targets, a polar ring and a swath across the antimeridian, holes in the arrays with source nodata, overlapping scans): success and position at every target pixel, the backmap's estimate, and 24 warps (near, bilinear, cubic;-et 0and0.125) identical to gdalwarp, every pixel, with proj4rs and the fixtures' PROJ (with an older libproj, nearest identical and interpolated values within 2e-8 relative). Where the two inverses differ, and why, is in the curvilinear guide. (2026-10-28)
Changed
- The chunk fixtures' special points are computed as GDAL computes them for
a geographic source (not reprojected; see
ChunkOptions::special_points). No chunk list changes. warp()does GDAL'sGWKAdjustSrcOffsetOnEdge: when a corner of the source buffer fails to transform forward and a sample point lands on an invalid source pixel whose corners fail too, a valid neighbour (right, below, left, above) is used instead. This changes output only where the transformer has holes or edges inside the source, as geolocation arrays with missing samples do (12 of 4560 pixels in the holes test case, now identical to gdalwarp).warp()therefore calls the transformer source to destination too, for such pixels only. Point methods; GDAL's variant for alpha and cutline densities is not reproduced. (2026-10-28)- The geolocation swath fixture is regenerated with GDAL 3.14.0dev (was 3.8.4): positions moved by up to 3e-8 pixels (PROJ), nothing else.
- controlledburn 0.2.3 (corner passes, near-coincident edges, exact centre
ties). The cutline centre rule now matches gdalwarp on centres exactly on
diagonal edges: 5 pixels of the
mask_diamond_tiefixture that differed now agree. They came from controlledburn 0.2.2's rounded intercepts; the parity page had put them down to GDAL.
0.3.0 (2026-10-28)
This release changes the API: options types are #[non_exhaustive].
Changed
warp()retries a sample point that lands less than one pixel outside the source buffer by transforming it again on its own, as GDAL does (GWKCheckAndComputeSrcOffsets). ThroughApproxTransformerthat is exact, so interpolation error no longer drops pixels at the edge of a chunk's source window; with an exact transformer nothing changes. Point methods only (nearest, bilinear, cubic, cubic spline, lanczos), as in GDAL. (2026-10-28)WarpOptions,GeolocOptionsandAverageThresholdsare#[non_exhaustive], as areResampleAlg,KernelScaling,Footprint,BandNodata,Nodata,DstNodata,DataTypeandGeolocConvention. New options and methods can then come in minor releases. Outside rwarp, build options withWarpOptions::new(alg)and thewith_methods (GeolocOptions::default().with_convention(..), and so on) instead of struct literals, and add a_arm when matching on the enums. Fields stay public for reading and assignment.
Added
WarpOptions::newandwith_builder methods onWarpOptions,GeolocOptionsandAverageThresholds.planmodule:plan_chunksandChunkPlannergive gdalwarp's chunk list as values (WarpPlanofChunks: target window, source window, fill ratio, kernel scale), following GDAL 3.14'sCollectChunkListandComputeSourceWindowexactly: warp memory limit (-wm) and per-pixel cost, fill ratio splits,OPTIMIZE_SIZEon target blocks, special points, the forward probe,SAMPLE_GRID,SAMPLE_STEPS,SOURCE_EXTRA.ChunkOptions(builders,#[non_exhaustive]);ChunkOptions::gdalwarpfor gdalwarp's planning exactly; an optional round-trip check for backends that do not fail at a projection's antipode; the antimeridian split of 0.2'scollect_chunk_listassplit_antimeridian.warp_chunkswarps a plan from a source buffer in memory. Ported from wxylib'swxy-warp(chunked.rs). (2026-10-28)serdefeature:Serialize/DeserializeforWarpPlanandChunk. (2026-10-28)- Parity fixtures for whole rasters warped in many chunks
(
tests/chunks.rs,tests/fixtures/chunks/): seven gdalwarp cases, chunk lists and output identical. (2026-10-28) - Cutlines (gdalwarp
-cutline):WarpOptions::cutline/with_cutline, and thecutlinemodule withCutline(polygons in source pixel/line),CutlineRule::Centre(GDAL's default, with its tie rules),CutlineRule::AllTouched(CUTLINE_ALL_TOUCHED), blend distance (-cblend), andCutlineRule::Exact, which weights each source pixel by the fraction of it the cutline covers (not a GDAL mode).Cutline::from_geotransformandCutline::from_transformer(densified as gdalwarp does) map world geometry to source pixels;Cutline::densityis the per-pixel density the warp uses. The cutline is rasterized over the source buffer only, withcontrolledburn.
Removed
source_window::collect_chunk_listandChunkPlan: useplan::plan_chunks(withChunkOptions::split_antimeridianfor the same split at the antimeridian).compute_source_windowstays. (2026-10-28)
0.2.0 (2026-10-28)
This release changes the API: warp() with WarpOptions and
SourceBuffer replaces the warp entry points of 0.1, and ResampleAlg
gains variants.
Added
-
geoloc_transform: geolocation-array transformers, for a curvilinear source (gdalwarp -geoloc), a curvilinear target (DST_METHOD=GEOLOC_ARRAY), or both. Both of GDAL's georeferencing conventions; offsets and steps; nodata; antimeridian handling. (2026-10-28) -
warp(),WarpOptions,SourceBuffer: one entry point for every sample type, method and option.WarpOptionscarries a destination offset for warping one tile of a larger grid. (2026-10-28) -
KernelScaling: GDAL's kernel widening when downsampling, now the default;FixedandPointalternatives.estimate_scaleis public. (2026-10-28) -
ResampleAlg::Average, withFootprint::GdalBox(gdalwarp's) andFootprint::Exact(first-order conservative).controlledburnis a new dependency. (2026-10-28) -
ResampleAlg::ModewithModeTies(MODE_TIES). (2026-10-28) -
BandNodata(UNIFIED_SRC_NODATA) andAverageThresholds(NODATA_VALUES_PCT_THRESHOLD,EXCLUDED_VALUES). (2026-10-28) -
ResampleAlg::CubicSpline,Min,Max,Med,Q1,Q3andRms, andResampleAlg::is_area(). (2026-10-28) -
Samplefori64,u64, andhalf::f16behind a newf16feature. (2026-10-28) -
warp_to::<S, D>: a different output type from the source's, through GDAL's working type (DataType::working) andGDALCopyWordsconversion. (2026-10-28) -
NodataandDstNodata: source and destination nodata per band, as gdalwarp's-srcnodataand-dstnodata. (2026-10-28) -
Examples:
tile_laea,curvilinear_swath. -
A documentation site, with the browser demo under
/demo/.
Changed
- Integer outputs round half up and clamp, and a resampled value equal to nodata is moved off it, as gdalwarp does with an integer working type.
- Sample points outside
[0, n)of the source are off the source for every point method, as in GDAL. - Lanczos clips its window and renormalises at edges and nodata, and a target pixel whose centre lands on nodata gets no value, for every interpolating kernel. Some edge and nodata pixels change compared with 0.1.
- Multi-band nodata follows GDAL's default (a pixel is nodata only where
every band is); the 0.1 rule is
BandNodata::AnyBand. SamplerequiresPartialOrd.Footprint::Exactis 2 to 6x faster. The destination pixel lattice is transformed once per row band (shared corners and edge points) instead of four points per pixel, and coverage comes fromcontrolledburn::CoverageWindow(0.2.2) instead of oneburncall per pixel. With an exact transformer the output is unchanged, except for pixels straddling the antimeridian, which the exact footprint does not handle (it gave a different wrong answer before). The lattice's row lines go to the transformer as scanlines, so anApproxTransformernow approximates them, as for the box footprint; before, it transformed the exact footprint's points exactly.WarpOptionsis not generic:nodata: Option<T>is replaced bysrc_nodata: Nodataanddst_nodata: DstNodata.- Bilinear uses GDAL's general formula for types and cases where GDAL does, which can change the last bit (and so integer rounding near 2^40 for 64-bit values).
Deprecated
warp_resample_tandwarp_resample_u8, kept as shims with the 0.1 point-kernel behaviour. Usewarp().
Fixed
- Nearest neighbour mapped source coordinates in (-1, 0) to pixel 0.
ApproxTransformerleft one point untransformed and reported it failed when subdivision reached a left half of two points, which happens on strongly curved transforms or with a small error threshold (whole columns of a polar warp came out as nodata). GDAL transforms it.
0.1.2 (2026-03-11, not on crates.io)
- Use the system libproj through
proj0.31.
Not released to crates.io. On main after it (2026-09 to 2026-10):
rwarp-wasm: browser shim and demo (OSM, WMTS, ArcGIS tile services, COG sources),Warper.withTransformsfor JavaScript CRS transforms.- A generic
Samplekernel overu8tof64, interleaved bands, nodata as a value or an alpha band. - The
CrsTransformtrait withprojandproj4rsbackends; builds forwasm32-unknown-unknown.
0.1.1 (2026-03-06)
GcpTransformer: polynomial transformer from ground control points, order 1 to 3.- Use the published
vastercrate; crate documentation.
0.1.0 (2026-03-06)
- First release, extracted from cogcache:
GenImgProjTransformer,ApproxTransformer,compute_source_window,collect_chunk_listand the nearest, bilinear, cubic and lanczos kernels.