pisces.geometry.grids.core.GenericGrid.__init__#

GenericGrid.__init__(coordinate_system: CoordinateSystem, *edges, axes: str | tuple[str, ...] = 'all', fill_values: dict[str, Any] | None = None, units: dict[str, str | Unit] | None = None, **kwargs)[source]#

Initialize a generic grid from a set of edge arrays.

Parameters:
  • coordinate_system (CoordinateSystem) – The coordinate system in which the grid is defined. This coordinate system will determine the labels for the coordinate axes and the dimension of the grid.

  • edges (numpy.ndarray or unyt.array.unyt_array) –

    1D arrays representing the edges of each grid cell along each axis. There must be as many edge arrays as there are active axes (see axes parameter) in the grid. For each axis, center each cell will be positioned between the adjacent edge.

    These arrays must be strictly monotonic. If an edges array contains units, they will be converted to the specified unit in the units parameter if possible. Otherwise an error will be raised.

  • axes (str or list of str, optional) –

    The active axes of the grid. This defines which of the coordinate axes are actually incorporated into the grid and which are fixed. If "all" (default), then all of the coordinate axes are used in the grid. Otherwise, only those specified are used.

    If an axis is excluded, it must then be present in the fill_values parameter to ensure that the grid is fully defined.

  • fill_values (dict, optional) –

    A dictionary mapping axis names (as strings) to fixed values for any axes that are not included in the grid (i.e., axes that are not in axes if axes is not "all"). This ensures that the grid is fully defined in the coordinate system.

    If an axis is excluded from the grid but not provided in this dictionary, an error will be raised.

  • units (dict, optional) – A dictionary mapping axis names (as strings) to units (either as strings or unyt.Unit objects) for each axis in the grid. If provided, the edge arrays will be converted to these units. If not provided, the units of the edge arrays will be used as-is.

  • kwargs