Skip to content

step

Implementation of Step objects.

Note

This module and the classes it defines are internals of StagPy, they should not be used in an external script. Instead, use the StagyyData class.

Geometry

Geometry information.

It is deduced from the information in the header of binary field files output by StagYY.

nttot cached property

nttot: int

Number of grid point along the x/theta direction.

nptot cached property

nptot: int

Number of grid point along the y/phi direction.

nrtot cached property

nrtot: int

Number of grid point along the z/r direction.

nbtot cached property

nbtot: int

Number of blocks.

nxtot property

nxtot: int

Same as nttot.

nytot property

nytot: int

Same as nptot.

nztot property

nztot: int

Same as nrtot.

r_walls cached property

r_walls: NDArray

Position of FV walls along the z/r direction.

r_centers cached property

r_centers: NDArray

Position of FV centers along the z/r direction.

t_walls cached property

t_walls: NDArray

Position of FV walls along x/theta.

t_centers cached property

t_centers: NDArray

Position of FV centers along x/theta.

p_walls cached property

p_walls: NDArray

Position of FV walls along y/phi.

p_centers cached property

p_centers: NDArray

Position of FV centers along y/phi.

z_walls property

z_walls: NDArray

Same as r_walls.

z_centers property

z_centers: NDArray

Same as r_centers.

x_walls property

x_walls: NDArray

Same as t_walls.

x_centers property

x_centers: NDArray

Same as t_centers.

y_walls property

y_walls: NDArray

Same as p_walls.

y_centers property

y_centers: NDArray

Same as p_centers.

rcmb cached property

rcmb: float

Radius of CMB, 0 in cartesian geometry.

cartesian property

cartesian: bool

Whether the grid is in cartesian geometry.

curvilinear property

curvilinear: bool

Whether the grid is in curvilinear geometry.

cylindrical property

cylindrical: bool

Whether the grid is in cylindrical geometry (2D spherical).

spherical property

spherical: bool

Whether the grid is in spherical geometry.

yinyang property

yinyang: bool

Whether the grid is in Yin-yang geometry (3D spherical).

twod_xz property

twod_xz: bool

Whether the grid is in the XZ plane only.

twod_yz property

twod_yz: bool

Whether the grid is in the YZ plane only.

twod property

twod: bool

Whether the grid is 2 dimensional.

threed property

threed: bool

Whether the grid is 3 dimensional.

at_z

at_z(zval: float) -> int

Return iz closest to given zval position.

In spherical geometry, the bottom boundary is considered to be at z=0. Use at_r to find a cell at a given radial position.

at_r

at_r(rval: float) -> int

Return ir closest to given rval position.

If called in cartesian geometry, this is equivalent to at_z.

Fields

Bases: Mapping

Fields data structure.

The Step.fields attribute is an instance of this class.

Fields implements collections.abc.Mapping. Keys are fields names defined in stagpy.phyvars.[S]FIELD[_EXTRA]. Each item is a Field instance.

geom cached property

geom: Geometry

Geometry information.

Geometry instance holding geometry information. It is issued from binary files holding field information.

Tracers

Tracers data structure.

The Step.tracers attribute is an instance of this class.

Tracers implements the getitem mechanism. Items are tracervar names such as "Type" or "Mass". The position of tracers are the "x", "y" and "z" items.

Rprofs

Radial profiles data structure.

The Step.rprofs attribute is an instance of this class.

Rprofs implements the getitem mechanism. Keys are profile names defined in stagpy.phyvars.RPROF[_EXTRA]. Items are Rprof instances.

stepstr property

stepstr: str

String representation of the parent :class:Step.

centers cached property

centers: NDArray

Radial position of cell centers.

walls cached property

walls: NDArray

Radial position of cell walls.

bounds cached property

bounds: tuple[float, float]

Radial or vertical position of boundaries.

Radial/vertical positions of boundaries of the domain.

Step

Time step data structure.

Elements of Steps and Snaps instances are all Step instances. Note that Step objects are not duplicated.

Examples:

Here are a few examples illustrating some properties of Step instances.

sdat = StagyyData(Path("path/to/run"))
istep_last_snap = sdat.snaps[-1].istep
assert(sdat.steps[istep_last_snap] is sdat.snaps[-1])
n = 0  # or any valid time step / snapshot index
assert(sdat.steps[n].sdat is sdat)
assert(sdat.steps[n].istep == n)
assert(sdat.snaps[n].isnap == n)
assert(sdat.steps[n].geom is sdat.steps[n].fields.geom)
assert(sdat.snaps[n] is sdat.snaps[n].fields.step)

Attributes:

Name Type Description
istep int

the index of the time step that the instance represents.

sdat StagyyData

the owner of the Step instance.

fields Fields

fields available at this time step.

sfields Fields

surface fields available at this time step.

tracers Tracers

tracers available at this time step.

geom property

geom: Geometry

Geometry information.

Geometry instance holding geometry information. It is issued from binary files holding field information. It is set to None if not available for this time step.

timeinfo property

timeinfo: Series

Time series data of the time step.

time property

time: float

Time of this time step.

isnap property

isnap: Optional[int]

Snapshot index corresponding to time step.

It is None if no snapshot exists for the time step.