postgkyl.select¶
- postgkyl.select(data, *, comp=None, z0=None, z1=None, z2=None, z3=None, z4=None, z5=None, inplace=False, tag=None, label=None)¶
Select part of a dataset by coordinate (
z0-z5) and/or component.Each selector accepts an int index, a float coordinate value, or a slice string
"start:end";compadditionally accepts"a,b". Unspecified axes are kept in full. The selected dimension is retained (length-1), matching the legacy behaviour. Floats snap to the nearest stored point, or cell center on an edge grid; ties choose the first index and out-of-domain coordinates snap to an endpoint. No values are evaluated or interpolated. Modal DG selection copies whole cells with every coefficient unchanged.compon modal DG data selects whole physical fields, retaining each field’s complete basis coefficient block. Slice stops are exclusive.A curvilinear axis (a multi-dimensional grid array, produced by
.map()withspace="conf") has no single 1-D coordinate array of its own to search – a coordinate value or slice string is resolved against a 1-D cross-section instead (_curvilinear_coord_curve()), holding every other axis of the same mapped block at cell 0, unless that axis was already narrowed to a single cell by an earlier selector – either in this same call, or in a priorselect()call in the chain (recorded the only place it needs to be: the dataset’s own values shape). Selecting one axis of a block also narrows every sibling axis’ grid array along that same relative axis, so the block stays internally consistent and a later selector on a sibling sees the narrowed cross-section rather than the original full extent. If the array still varies along an as-yet-unresolved sibling axis (a genuinely non-separable map, e.g. a rotation), the coordinate/slice selector has no single answer and raises – pick an integer index for that sibling axis first (in the same call, or an earlier one in the chain).- Parameters:
data – Dataset whose cells or point values are selected.
comp – Component selector such as
"0","0:3", or"0,2".z0 – Selector for coordinate direction 0.
z1 – Selector for coordinate direction 1.
z2 – Selector for coordinate direction 2.
z3 – Selector for coordinate direction 3.
z4 – Selector for coordinate direction 4.
z5 – Selector for coordinate direction 5.
inplace – Mutate and return
datainstead of creating a dataset.tag – Optional tag for the returned dataset.
label – Optional label for the returned dataset.
- Raises:
ValueError – if a selection is empty or nonfinite, or a coordinate/slice selector targets a curvilinear axis whose physical coordinate still varies along an unresolved sibling axis.