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 of data’s grid.

Parameters:
  • data – The dataset whose grid is deformed; must be NumPy-backed (post-interpolate()), like select.

  • 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 of data’s axes are replaced.

  • space – 'conf' deforms the leading m axes (offset 0), curvilinearly (every physical coordinate is evaluated over all m mapped dimensions, so non-separable maps such as rotations work); its component count must be m * num_basis for an m-D basis. 'vel' deforms the trailing m axes (offset data.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 be m * num_basis for a 1-D basis. For a combined map, apply the verb twice.

  • basis_type – mapping’s basis_type (long name, e.g. "serendipity"), set at the moment this call loads it – only takes effect when mapping is 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 for space="vel".

  • poly_order – mapping’s poly_order, set the same way as basis_type.

  • inplace – mutate and return data instead 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" and ctx["mapped_axes"] records, for every absolute dimension touched so far (by this call and any earlier one), the offset of 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 data is native modal (gkyl-backed); if space is neither 'conf' nor 'vel'; if the map does not fit data’s dimensionality; if the mapping has no basis_type/poly_order metadata (and none was given at load time); or if its component count does not match the expected m * num_basis.

CLI: map