spacepy.pybats.dgcpm.PlasmaFile¶
- class spacepy.pybats.dgcpm.PlasmaFile(filename, *args, **kwargs)[source]¶
DGCPM’s plasma files contain a plethora of values from the model’s 2D plane. This class produces objects that load the data and sort it into a PyBats data object.
Methods
add_contour
(var[, zlim, target, loc, title, ...])Create a polar contour plot of variable var and add it to target.
add_pcolor
(var[, zlim, target, loc, title, ...])Create a polar pcolor plot of variable var and add it to target.
add_separatrix
([target, loc, Lmax, title])Attempts to locate the separatrix (separator between closed and open drift paths) by finding the minimum velocity in the domain and tracing the path of constant potential that passes through that point.
calc_E
()Differentiate the equatorial electric potential to arrive at electric field (stored using keys 'Er', 'Ephi', and 'E').
Attributes
- add_contour(var, zlim=None, target=None, loc=111, title=None, Lmax=None, add_cbar=False, clabel=None, dolog=False, filled=True, nLev=31, labelsize=14, **kwargs)[source]¶
Create a polar contour plot of variable var and add it to target. Extra keyword arguments are handed to matplotlib’s contourf command.
- Parameters:
- varstring
The variable within the object to plot.
- Returns:
- figmatplotlib figure object
- axmatplotlib axes object
- contmatplotlib contour object
- cbarmatplotlib colorbar object
- Other Parameters:
- nLevint
Sets the number of contour levels. Defaults to 31.
- zlimtwo-element list or array
Set the color bar range. Some variables have default ranges. Others will use max and min of var.
- Lmaxreal
Set the radial extent of the plot.
- add_cbarbool
Set whether to add a color bar or not. Defaults to False.
- dologbool
If True, use a log scale to plot var. Defaults to False.
- labelsizeint
Sets the font size of the labels. Defaults to 14.
- titlestring
Sets the plot title. Defaults to ‘auto’, using the variable label.
- clabelstring
Set label for the color bar. Defaults to var and associated units.
- 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).
- add_pcolor(var, zlim=None, target=None, loc=111, title=None, Lmax=None, add_cbar=False, clabel=None, dolog=False, labelsize=14, **kwargs)[source]¶
Create a polar pcolor plot of variable var and add it to target. Extra keyword arguments are handed to matplotlib’s pcolor command.
- Parameters:
- varstring
The variable within the object to plot.
- Returns:
- figmatplotlib figure object
- axmatplotlib axes object
- contmatplotlib contour object
- cbarmatplotlib colorbar object
- Other Parameters:
- zlimtwo-element list or array
Set the color bar range. Some variables have default ranges. Others will use max and min of var.
- Lmaxreal
Set the radial extent of the plot.
- add_cbarbool
Set whether to add a color bar or not. Defaults to False.
- dologbool
If True, use a log scale to plot var. Defaults to False.
- labelsizeint
Sets the font size of the labels. Defaults to 14.
- titlestring
Sets the plot title. Defaults to ‘auto’, using the variable label.
- clabelstring
Set label for the color bar. Defaults to var and associated units.
- 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).
- add_separatrix(target=None, loc=111, Lmax=None, title=None, **kwargs)[source]¶
Attempts to locate the separatrix (separator between closed and open drift paths) by finding the minimum velocity in the domain and tracing the path of constant potential that passes through that point. The figure, axes, and contour object containing the separatrix line are returned to the user.
If kwarg target is None (default), a new figure is generated from scratch. If target is a matplotlib Figure object, a new axis is created to fill that figure at subplot location loc. If target is a matplotlib Axes object, the plot is placed into that axis.
Four values are returned: the matplotlib Figure and Axes objects, the matplotlib contour object, and the matplotlib colorbar object (defaults to False if not used.)
Kwargs that set line characteristics behave in the typical matplotlib manner (i.e. “colors” can be set to either a color name or a hexidecimal specifier.)
Kwarg
Description
target
Set plot destination. Defaults to new figure.
loc
Set subplot location. Defaults to 111.
linewidths
Set width of plotted line. Defaults to 3.0.
colors
Set color of line. Defaults to ‘orange’.
linestyles
Set line style. Defaults to ‘dashed’.
- calc_E()[source]¶
Differentiate the equatorial electric potential to arrive at electric field (stored using keys ‘Er’, ‘Ephi’, and ‘E’).
- attrs: collections.abc.Mapping¶