#[non_exhaustive]pub struct ChunkOptions {Show 16 fields
pub alg: ResampleAlg,
pub scaling: KernelScaling,
pub memory_limit: f64,
pub src_pixel_bits: f64,
pub dst_pixel_bits: f64,
pub min_fill_ratio: f64,
pub min_split_size: usize,
pub dst_block_size: Option<[usize; 2]>,
pub special_points: Vec<[f64; 2]>,
pub sample_grid: bool,
pub sample_steps: SampleSteps,
pub source_extra: Option<usize>,
pub scale_origin: ScaleOrigin,
pub pad_for_fixed_scale: bool,
pub split_antimeridian: bool,
pub round_trip: Option<RoundTrip>,
}Expand description
Options for plan_chunks and ChunkPlanner. Build with
ChunkOptions::new or ChunkOptions::gdalwarp and the with_
methods.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.alg: ResampleAlgThe resampling method: its kernel radius pads source windows.
scaling: KernelScalingHow each chunk’s kernel scale is chosen: estimated per chunk
(KernelScaling::WidenWhenDownsampling), given
(KernelScaling::Fixed, GDAL’s XSCALE/YSCALE) or 1
(KernelScaling::Point).
memory_limit: f64Bytes of working memory a chunk may take before it is split
(gdalwarp’s -wm). Default DEFAULT_MEMORY_LIMIT.
src_pixel_bits: f64Bits of working memory per source pixel, masks included (GDAL’s
GetWorkingMemoryForWindow). See ChunkOptions::set_pixel_cost.
dst_pixel_bits: f64Bits of working memory per target pixel, masks included.
min_fill_ratio: f64A chunk whose source fill ratio is above 0 and below this is split
(GDAL: 0.5; 0 turns the heuristic off, as
SRC_FILL_RATIO_HEURISTICS=NO).
min_split_size: usize… if either side of it is longer than this (GDAL: 100).
dst_block_size: Option<[usize; 2]>Block size of the target dataset, for GDAL’s OPTIMIZE_SIZE=AUTO,
which splits on block boundaries when the target is at least two
blocks each way. None (GDAL with no target dataset, as with an
in-memory or striped target) never applies it.
special_points: Vec<[f64; 2]>Target pixel positions that force grid sampling of every chunk when
one falls in the target (0 <= x <= width, 0 <= y <= height).
GDAL uses longitude 0 at latitudes -89.9999 and 89.9999 of the
source’s geographic CRS, transformed to target pixels; the caller
computes them, as they need the CRS. For a source CRS that is
itself geographic in degrees, GDAL 3.6 and later skip the
reprojection (GDALTransformLonLatToDestGenImgProjTransformer) and
apply the target’s inverse geotransform to (0, -89.9999) and
(0, 89.9999) as if they were target coordinates; to match
gdalwarp, do the same.
sample_grid: boolSample a grid over each chunk from the start (SAMPLE_GRID=YES).
sample_steps: SampleStepsPoints per edge (SAMPLE_STEPS).
source_extra: Option<usize>Pixels added to every side of each source window (SOURCE_EXTRA).
None: 10 when any sample point failed to transform, as GDAL does.
scale_origin: ScaleOriginWhere each chunk’s kernel scale is estimated. Default
ScaleOrigin::Chunk; GDAL’s is ScaleOrigin::Output.
pad_for_fixed_scale: boolWith KernelScaling::Fixed, pad source windows for the smaller
of the given and the estimated scale, so a kernel stretched by the
given scale is not clipped at the window edge. GDAL pads for the
estimate only. Default true.
split_antimeridian: boolWhen a chunk’s source window spans the whole source width (GDAL’s 90% rule, as at the antimeridian), find the target columns where source x jumps and split the chunk there, into compact windows either side. The few columns at the jump (the gap) map near both source edges: they become two chunks on the same target window, one window at each edge, so nothing reads the whole width. GDAL does not split (its fill ratio stays high); off by default. Independent of the fill ratio split, apart from its minimum chunk size. Where there is no jump (a window that spans the width because the target covers it), or splitting at it reads no less (round a pole), the chunk is planned by GDAL’s rule, memory and fill ratio both, so the plan is gdalwarp’s plus the splits at jumps.
round_trip: Option<RoundTrip>A round-trip check on the forward probe; None (GDAL) checks
nothing.
Implementations§
Source§impl ChunkOptions
impl ChunkOptions
Sourcepub fn new(alg: ResampleAlg) -> Self
pub fn new(alg: ResampleAlg) -> Self
rwarp’s defaults for alg: gdalwarp’s planning with a Byte,
one-band, nodata-free working memory cost, except for
ScaleOrigin::Chunk and ChunkOptions::pad_for_fixed_scale.
Sourcepub fn gdalwarp(alg: ResampleAlg) -> Self
pub fn gdalwarp(alg: ResampleAlg) -> Self
gdalwarp’s planning exactly: ScaleOrigin::Output and no padding
for a fixed scale beyond GDAL’s.
Sourcepub fn with_alg(self, alg: ResampleAlg) -> Self
pub fn with_alg(self, alg: ResampleAlg) -> Self
Set ChunkOptions::alg.
Sourcepub fn with_scaling(self, scaling: KernelScaling) -> Self
pub fn with_scaling(self, scaling: KernelScaling) -> Self
Sourcepub fn with_memory_limit(self, bytes: f64) -> Self
pub fn with_memory_limit(self, bytes: f64) -> Self
Set ChunkOptions::memory_limit, in bytes.
Sourcepub fn with_pixel_cost(
self,
working: DataType,
nbands: usize,
src_nodata: bool,
dst_nodata: bool,
) -> Self
pub fn with_pixel_cost( self, working: DataType, nbands: usize, src_nodata: bool, dst_nodata: bool, ) -> Self
ChunkOptions::set_pixel_cost, as a builder.
Sourcepub fn with_fill_ratio_split(
self,
min_fill_ratio: f64,
min_split_size: usize,
) -> Self
pub fn with_fill_ratio_split( self, min_fill_ratio: f64, min_split_size: usize, ) -> Self
Sourcepub fn with_dst_block_size(self, block: Option<[usize; 2]>) -> Self
pub fn with_dst_block_size(self, block: Option<[usize; 2]>) -> Self
Sourcepub fn with_special_points(self, points: Vec<[f64; 2]>) -> Self
pub fn with_special_points(self, points: Vec<[f64; 2]>) -> Self
Sourcepub fn with_sample_grid(self, grid: bool) -> Self
pub fn with_sample_grid(self, grid: bool) -> Self
Sourcepub fn with_sample_steps(self, steps: SampleSteps) -> Self
pub fn with_sample_steps(self, steps: SampleSteps) -> Self
Sourcepub fn with_source_extra(self, extra: Option<usize>) -> Self
pub fn with_source_extra(self, extra: Option<usize>) -> Self
Sourcepub fn with_scale_origin(self, origin: ScaleOrigin) -> Self
pub fn with_scale_origin(self, origin: ScaleOrigin) -> Self
Sourcepub fn with_pad_for_fixed_scale(self, pad: bool) -> Self
pub fn with_pad_for_fixed_scale(self, pad: bool) -> Self
Sourcepub fn with_split_antimeridian(self, split: bool) -> Self
pub fn with_split_antimeridian(self, split: bool) -> Self
Sourcepub fn with_round_trip(self, round_trip: Option<RoundTrip>) -> Self
pub fn with_round_trip(self, round_trip: Option<RoundTrip>) -> Self
Sourcepub fn set_pixel_cost(
&mut self,
working: DataType,
nbands: usize,
src_nodata: bool,
dst_nodata: bool,
)
pub fn set_pixel_cost( &mut self, working: DataType, nbands: usize, src_nodata: bool, dst_nodata: bool, )
Set the working memory cost per pixel as GDAL counts it for
nbands bands in the working type, with a per-band validity mask
when the source or the target has nodata. gdalwarp gives the target
the source’s nodata unless told otherwise. Add 32 bits to
ChunkOptions::src_pixel_bits for a source alpha band or a
cutline, 1 for a per-dataset mask; 32 to
ChunkOptions::dst_pixel_bits for a target alpha band.