yt.frontends.stream.data_structures.load_amr_grids

yt.frontends.stream.data_structures.load_amr_grids(grid_data, domain_dimensions, field_units=None, bbox=None, sim_time=0.0, length_unit=None, mass_unit=None, time_unit=None, velocity_unit=None, magnetic_unit=None, periodicity=(True, True, True), geometry='cartesian', refine_by=2)[source]

Load a set of grids of data into yt as a StreamHandler. This should allow a sequence of grids of varying resolution of data to be loaded directly into yt and analyzed as would any others. This comes with several caveats:

  • Units will be incorrect unless the unit system is explicitly specified.
  • Some functions may behave oddly, and parallelism will be disappointing or non-existent in most cases.
  • Particles may be difficult to integrate.
  • No consistency checks are performed on the index
Parameters:

grid_data : list of dicts

This is a list of dicts. Each dict must have entries “left_edge”, “right_edge”, “dimensions”, “level”, and then any remaining entries are assumed to be fields. Field entries must map to an NDArray. The grid_data may also include a particle count. If no particle count is supplied, the dataset is understood to contain no particles. The grid_data will be modified in place and can’t be assumed to be static.

domain_dimensions : array_like

This is the domain dimensions of the grid

field_units : dict

A dictionary mapping string field names to string unit specifications. The field names must correspond to the fields in grid_data.

length_unit : string or float

Unit to use for lengths. Defaults to unitless. If set to be a string, the bbox dimensions are assumed to be in the corresponding units. If set to a float, the value is a assumed to be the conversion from bbox dimensions to centimeters.

mass_unit : string or float

Unit to use for masses. Defaults to unitless.

time_unit : string or float

Unit to use for times. Defaults to unitless.

velocity_unit : string or float

Unit to use for velocities. Defaults to unitless.

magnetic_unit : string or float

Unit to use for magnetic fields. Defaults to unitless.

bbox : array_like (xdim:zdim, LE:RE), optional

Size of computational domain in units specified by length_unit. Defaults to a cubic unit-length domain.

sim_time : float, optional

The simulation time in seconds

periodicity : tuple of booleans

Determines whether the data will be treated as periodic along each axis

geometry : string or tuple

“cartesian”, “cylindrical”, “polar”, “spherical”, “geographic” or “spectral_cube”. Optionally, a tuple can be provided to specify the axis ordering – for instance, to specify that the axis ordering should be z, x, y, this would be: (“cartesian”, (“z”, “x”, “y”)). The same can be done for other coordinates, for instance: (“spherical”, (“theta”, “phi”, “r”)).

refine_by : integer

Specifies the refinement ratio between levels. Defaults to 2.

Examples

>>> grid_data = [
...     dict(left_edge = [0.0, 0.0, 0.0],
...          right_edge = [1.0, 1.0, 1.],
...          level = 0,
...          dimensions = [32, 32, 32],
...          number_of_particles = 0)
...     dict(left_edge = [0.25, 0.25, 0.25],
...          right_edge = [0.75, 0.75, 0.75],
...          level = 1,
...          dimensions = [32, 32, 32],
...          number_of_particles = 0)
... ]
...
>>> for g in grid_data:
...     g["density"] = np.random.random(g["dimensions"]) * 2**g["level"]
...
>>> units = dict(density='g/cm**3')
>>> ds = load_amr_grids(grid_data, [32, 32, 32], field_units=units,
...                     length_unit=1.0)