spacepy.pybats.rim.Iono

class spacepy.pybats.rim.Iono(infile, *args, **kwargs)[source]

A class for handling 2D output from the Ridley Ionosphere Model. Instantiate an object as follows:

>>> iono = rim.Iono('filename.idl')

…where filename.idl is the name of a RIM 2D output file.

__init__(infile, *args, **kwargs)[source]

Base class for “Data Model” representation data

Abstract method, reimplement

Attributes:
attrsdict

dictionary of the attributes of the SpaceData object

Methods

add_cont(var[, target, n, maxz, lines, ...])

Create a polar contour of variable var.

calc_I()

Integrate radial current to get the following values: I: The total radial current over one hemisphere.

calc_j()

Calculate total horizontal current as related values.

readascii()

Read an ascii ".idl" output file and load the contents into the object.

Attributes

add_cont(var, target=None, n=50, maxz=False, lines=False, cmap=False, add_cbar=False, label=None, loc=111, xticksize=12, yticksize=12, max_colat=40, **kwargs)[source]

Create a polar contour of variable var. Plot will be either drawn on a new matplotlib figure and axes, or you can specify a plot target using the target kwarg.

Parameters:
varstr

The name of the variable to plot.

Returns:
figmatplotlib figure object
axmatplotlib axes object
cntmatplotlib contour object
cbmatplotlib colorbar object
Other Parameters:
targetFigure or Axes

If None (default), a new figure is generated from scratch. If a matplotlib Figure object, a new axis is created to fill that figure. If a matplotlib Axes object, the plot is placed into that axis.

locint

Use to specify the subplot placement of the axis (e.g. loc=212, etc.) Used if target is a Figure or None. Default 111 (single plot).

nint

Set number of levels. Default is 50. If unfilled lines are added (see lines kwarg), multiples of three provide coherence between filled and unfilled contours.

linesbool

Add unfilled black solid/dashed contours to plot for additional contrast. Default is True.

maxzreal

Set the max/min value for the color bar. Default is set by data.

max_colatreal

Set the co-latitude range of the plot, in degrees. Defaults to 40.

cmapstr

Set the colormap. Default is to use Matplotlib’s “Reds” for data that is strictly positive and “Seismic” for diverging data. Alternatively, legacy Ridley Ionosphere Model color maps can be loaded using “l_wr” (white red) or “l_bwr” (blue-white-red), where the “l_” prefix indicates legacy and not Matplotlib color maps.

add_cbarbool

Add colorbar to plot. Default is False which will not add one to the plot.

labelstr or None

Label to place at top of plot. Defaults to variable name.

xticksizeint

Size of longitude markers in text points. Defaults to 12.

yticksizeint

Size of latitude markers in text points. Defaults to 12.

Extra keywords are passed to the contourf routine.
calc_I()[source]

Integrate radial current to get the following values: I: The total radial current over one hemisphere. Iup: The total upward current over one hemisphere. Idown: The total downward current over one hemisphere.

Values are stored in the object with the prefix n_ or s_ to indicate the hemisphere and may be accessed via self[‘n_I’], etc.

Values are stored in units of mega Amps.

Returns:
True

Examples

>>> a = rim.Iono('spacepy/tests/data/pybats_test/it000321_104510_000.idl.gz')
>>> a.calc_I()
>>> print(a['n_Iup'])
calc_j()[source]

Calculate total horizontal current as related values. Each will be stored into self using the typical key-value approach. Calculations are done for both the northern and southern hemisphere with the appropriate prefixes (n_ and s_) applied to each key.

key

Description

j

Total horizontal current, $sqrt(jx^2+jy^2+jz^2)$

jphi

Azimuthal current, positive values are eastward.

Returns:
True

Examples

>>> a = rim.Iono('spacepy/tests/data/pybats_test/it000321_104510_000.idl.gz')
>>> a.calc_j()
>>> print(a['n_jphi'])
readascii()[source]

Read an ascii “.idl” output file and load the contents into the object.

attrs: collections.abc.Mapping