postgkyl.map¶
- postgkyl.map(data, mapping, *, space='conf', basis_type=None, poly_order=None, inplace=False, tag=None, label=None)¶
Replace a block of
data’s grid axes with mapped coordinates.Evaluates the mapping’s DG coefficients at
data’s existing grid points (no resolution parameter, no alignment arithmetic – the mapped axes always keep the shape of the axes they replace) and splices the result into a copy ofdata’s grid.- Parameters:
data – The dataset whose grid is deformed; must be NumPy-backed (post-
interpolate()), likeselect.mapping – The coordinate-mapping field, as a filename or an already-loaded dataset. Read from its native modal coefficients – never interpolated. Its number of dimensions (
m) sets how many ofdata’s axes are replaced.space –
'conf'deforms the leadingmaxes (offset 0), curvilinearly (every physical coordinate is evaluated over allmmapped dimensions, so non-separable maps such as rotations work); its component count must bem * num_basisfor anm-D basis.'vel'deforms the trailingmaxes (offsetdata.num_dims - m); Gkeyll’s velocity-space maps (mapc2p_vel) are diagonal – each dimension is evaluated by its own 1-D map, so the component count must bem * num_basisfor a 1-D basis. For a combined map, apply the verb twice.basis_type –
mapping’sbasis_type(long name, e.g."serendipity"), set at the moment this call loads it – only takes effect whenmappingis given as a filename (a property of already-loaded data can’t be re-specified here). Velocity-space mapping files (mapc2p_vel) commonly carry no basis metadata at all, so this is typically required forspace="vel".poly_order –
mapping’spoly_order, set the same way asbasis_type.inplace – mutate and return
datainstead of a new dataset.tag – optional tag for the returned dataset.
label – optional label for the returned dataset.
- Returns:
A dataset carrying the deformed grid;
ctx["grid_type"]is set to"mapped"andctx["mapped_axes"]records, for every absolute dimension touched so far (by this call and any earlier one), theoffsetof the mapped block it belongs to –select’s curvilinear guard needs this to convert an absolute dimension index back to the curvilinear grid array’s own (relative) axis. The values array is untouched.- Raises:
ValueError – if
datais native modal (gkyl-backed); ifspaceis neither'conf'nor'vel'; if the map does not fitdata’s dimensionality; if the mapping has nobasis_type/poly_ordermetadata (and none was given at load time); or if its component count does not match the expectedm * num_basis.