xbout.region.Region#

class xbout.region.Region(*, name, ds=None, xinner_ind=None, xouter_ind=None, ylower_ind=None, yupper_ind=None, connection_inner_x=None, connection_outer_x=None, connection_lower_y=None, connection_upper_y=None)[source]#

Bases: object

Contains the global indices bounding a single topological region, i.e. a region with logically rectangular contiguous data.

Also stores the names of any neighbouring regions.

__init__(*, name, ds=None, xinner_ind=None, xouter_ind=None, ylower_ind=None, yupper_ind=None, connection_inner_x=None, connection_outer_x=None, connection_lower_y=None, connection_upper_y=None)[source]#
Parameters:
  • name (str) – Name of the region

  • ds (BoutDataset, optional) – Dataset to get variables to calculate coordinates from

  • xinner_ind (int, optional) – Global x-index of the inner points of this region

  • xouter_ind (int, optional) – Global x-index of the points just beyond the outer edge of this region

  • ylower_ind (int, optional) – Global y-index of the lower points of this region

  • yupper_ind (int, optional) – Global y-index of the points just beyond the upper edge of this region

  • connection_inner_x (str, optional) – The region inside this one in the x-direction

  • connection_outer_x (str, optional) – The region outside this one in the x-direction

  • connection_lower_y (str, optional) – The region below this one in the y-direction

  • connection_upper_y (str, optional) – The region above this one in the y-direction

Methods

__init__(*, name[, ds, xinner_ind, ...])

type name:

get_inner_guards_slices(*, mxg[, myg])

Return x- and y-dimension slices that select mxg guard cells on the inner-x side of this region from the global DataArray.

get_lower_guards_slices(*, myg[, mxg])

Return x- and y-dimension slices that select myg guard cells on the lower-y side of this region from the global DataArray.

get_outer_guards_slices(*, mxg[, myg])

Return x- and y-dimension slices that select mxg guard cells on the outer-x side of this region from the global DataArray.

get_slices([mxg, myg])

Return x- and y-dimension slices that select this region from the global DataArray.

get_upper_guards_slices(*, myg[, mxg])

Return x- and y-dimension slices that select myg guard cells on the upper-y side of this region from the global DataArray.

get_inner_guards_slices(*, mxg, myg=0)[source]#

Return x- and y-dimension slices that select mxg guard cells on the inner-x side of this region from the global DataArray.

Parameters:
  • mxg (int) – Number of guard cells

  • myg (int, optional) – Number of y-guard cells to include at the corners

get_lower_guards_slices(*, myg, mxg=0)[source]#

Return x- and y-dimension slices that select myg guard cells on the lower-y side of this region from the global DataArray.

Parameters:
  • myg (int) – Number of guard cells

  • mxg (int, optional) – Number of x-guard cells to include at the corners

get_outer_guards_slices(*, mxg, myg=0)[source]#

Return x- and y-dimension slices that select mxg guard cells on the outer-x side of this region from the global DataArray.

Parameters:
  • mxg (int) – Number of guard cells

  • myg (int, optional) – Number of y-guard cells to include at the corners

get_slices(mxg=0, myg=0)[source]#

Return x- and y-dimension slices that select this region from the global DataArray.

Returns:

xslice, yslice

Return type:

slice, slice

get_upper_guards_slices(*, myg, mxg=0)[source]#

Return x- and y-dimension slices that select myg guard cells on the upper-y side of this region from the global DataArray.

Parameters:
  • myg (int) – Number of guard cells

  • mxg (int, optional) – Number of x-guard cells to include at the corners