sidescanpy.export.windows.geo#
Real-meters export windows: the geometric and georef render levels.
extract_geo_style_window() resamples a loaded neighborhood (see
sidescanpy.export.windows.neighborhood) into a size_px square
grid at one resolution_m on both axes, for any style, and places the
window’s targets in it. geometric grids are along/across-track meters;
georef grids are UTM northing/easting.
2026 rshomberg@uri.edu
Contents
Percentile of per-ping reach that sets a |
|
Geometric-level resamplers (see |
|
Across-track |
|
Candidates whose real position falls inside a geometric window. |
|
Candidates whose per-sample lat/lon falls inside a georef window. |
|
|
- sidescanpy.export.windows.geo.SWATH_FILL_PCT = 10.0#
Percentile of per-ping reach that sets a
swath_fillframe’s edges.The far edge is where at least
100 - SWATH_FILL_PCT% of pings still have data; the near (nadir-side, single swath only) edge is where at least that share already do. Longer-reaching pings are cropped slightly instead of every row carrying an empty margin.
- sidescanpy.export.windows.geo.RESAMPLE_METHODS = ('kdtree', 'binned', 'griddata')#
Geometric-level resamplers (see
extract_geo_style_window()).
- sidescanpy.export.windows.geo.swath_fill_extent(across, values, *, combine, channel_idx)#
Across-track
(lo, hi)meters the recorded data fills, for a swath frame.A sample counts only where both its coordinate and its backscatter are finite (in slant mode the coordinate is finite everywhere, including the masked nadir gap).
- Parameters:
- across, valuesnp.ndarray
(ping, channel, sample)signed across-track meters and backscatter.- combinebool
True(dual swath): port’s far edge to starboard’s far edge, not centered on nadir; a side with no data mirrors the other so nadir stays centered.False(single swath):channel_idx’s near edge to its far edge.- channel_idxint or None
Channel for
combine=False.
- Returns:
- tuple of float or None
Nonewhen there is no usable data.
- sidescanpy.export.windows.geo.geo_targets_within_window(candidates, masked, lo, along_dist, size_px, meta, locate_fn, along_size_px=None, *, margin_px=0.0)#
Candidates whose real position falls inside a geometric window.
The real-world counterpart of
targets_within_window(): each candidate’s along-track distance (at its ping) and across-track meters (at its own channel and sample) are located in the window withlocate_fnand kept if inside the grid. Candidates outsidemasked’s pings or sample axis, or with no finite across-track value, are skipped.- Parameters:
- candidateslist of (Target, int)
Targets and their pings, where
ping - loindexesmasked.- maskedxr.Dataset
The neighborhood the window was resampled from.
- loint
Ping offset of
masked.- along_distnp.ndarray
Along-track distance per
maskedping, as used for the window.- size_pxint
Grid column count (and row count unless
along_size_px).- metadict
The window extractor’s
meta.- locate_fncallable
(along_m, across_m, meta) -> (row, col), e.g.locate_point().- along_size_pxint, optional
Grid row count when it differs from
size_px.- margin_pxfloat, default 0.0
Also keep candidates up to this many pixels outside the grid (for background-window exclusion).
- Returns:
- list of Target
Copies with window-local
sample(column) andextra_attributes["window_row"], before orientation (seeflip_geo_vertical()).
- sidescanpy.export.windows.geo.georef_targets_within_window(candidates, masked, lo, meta, size_px, *, margin_px=0.0)#
Candidates whose per-sample lat/lon falls inside a georef window.
Like
geo_targets_within_window(), but each candidate is located bylatitude_per_sample/longitude_per_sampleat its ping, channel and sample withlocate_point(). Candidates without a finite position are skipped.- Returns:
- list of Target
Copies with window-local
sample/extra_attributes["window_row"].
- sidescanpy.export.windows.geo.extract_geo_style_window(masked, *, center_sample, channel_idx, local_ping, style, level, size_px, jitter_px, rng, mps, items_by_channel, lo, primary=None, resolution_m_override=None, backscatter_var='backscatter_intensity', resample_method='griddata', swath_fill=False)#
geometricorgeorefwindow for one style, with its targets.Resolution (unless
resolution_m_override): chip – the nativemax(meters_per_sample, ping_spacing); swath styles – the swath width oversize_px, floored at the ping spacing. Withswath_fill(swath styles, no override) the frame instead spans the across-track extent the data fills (swath_fill_extent()) at square pixels, with no ping-spacing floor and not pinned to nadir.geometricwindows include every co-located candidate fromitems_by_channel(both channels for dual swath) and are oriented withorient_geo_window().georefwindows carry only the primary target and are not reoriented (rows follow northing).resample_methodselects the geometric resampler:"kdtree"(average of measurements within a search radius; no fabricated values, some directional blur),"binned"(per-cell mean of the samples inside it; empty cells stay NaN) or"griddata"(scipy interpolation; no gaps inside coverage, but at a resolution finer than the ping spacing most cells are interpolated).georefwindows useextract_georef_window(): with"griddata", scipy interpolation in the map frame (cells farther than the largest typical ping gap from every sample are NaN); with"kdtree"or"binned", the mean within that radius.- Parameters:
- maskedxr.Dataset
Loaded neighborhood (see
GeoNeighborhood).- center_sampleint
Window center on
channel_idx’s sample axis (maskedunits).- channel_idxint
Channel of the center sample (and of a single-channel window).
- local_pingint
Center ping, indexed into
masked.- style, levelstr
- size_px, jitter_pxint
Output size and center jitter (pixels at
resolution_m).- rngnp.random.Generator
- mpsfloat
masked’s meters per sample.- items_by_channeldict
{channel: [(target, ping), ...]},ping - loindexingmasked.- loint
- primaryTarget, optional
The window’s own target (positioned at
center_sample).Nonefor a background window: every candidate is searched and the result lists only candidates found inside.- resolution_m_overridefloat, optional
- backscatter_varstr, default “backscatter_intensity”
Variable resampled into the grid.
- resample_methodstr, default “griddata”
- swath_fillbool, default False
- Returns:
- RenderedWindow or None
Nonewhen the window can’t be built: center sample outsidemasked, geometry/georef variables missing, no finite geometry around the center, or (georef, or a background chip) a center sample with no position.