spacepy.pybats.ram.GeoMltFile

class spacepy.pybats.ram.GeoMltFile(filename=None, scrub=True, compressed=False)[source]

GeoMltFile is a class to open, read, manipulate and write files that contain LANL geosynchronous multi-satellite averaged, MLT-interpolated fluxes.

__init__(filename=None, scrub=True, compressed=False)[source]

Methods

get_index_from_time(epoch)

Given a UTC time (datetime or Ticktock), return nearest index

plot_epoch_flux([epoch, target, loc, title])

Plot fluxes (j(E, MLT)) for a single time

read([compressed])

Load contents from self.filename.

scrub([lastflux])

GeoMlt files often have bad data througout in the form of negative or zero fluxes.

timeseries_append(other)

If other is of the same type as self, and both have a 'time' entry, append all arrays within other that have the same size as 'time' to the corresponding arrays within self.

get_index_from_time(epoch)[source]

Given a UTC time (datetime or Ticktock), return nearest index

Parameters:
epochdatetime.datetime or spacepy.time.Ticktock

Time as a supported type (UTC as datetime.datetime or spacepy.time.Ticktock). The nearest index to this time will be looked up and returned.

Returns:
idxinteger
plot_epoch_flux(epoch=0, target=None, loc=111, title=None)[source]

Plot fluxes (j(E, MLT)) for a single time

Parameters:
epochinteger or datetime or spacepy.time.Ticktock

If integer, the index corresponding to the time to be plotted. If a supported time type (datetime or Ticktock), the nearest index will be looked up and selected.

targetobject

Target for plotting. If kwarg target is None (default), a new figure is generated. If target is a matplotlib Figure object, a new axis is created to fill that figure at subplot location loc (defaults to 111). If target is a matplotlib Axes object, the plot is placed into that axis at subplot location loc.

locinteger

Designator for axis location. See description of target.

title: str or None

If not None, specifies the axis title.

Returns:
figobject

A matplotlib figure object on which to plot.

axobject

A matplotlib subplot object on which to plot.

read(compressed=False)[source]

Load contents from self.filename.

scrub(lastflux=None)[source]

GeoMlt files often have bad data througout in the form of negative or zero fluxes. In RAM-SCB, these are replaced with the last good data value. This function “scrubs” the data in the same manner as RAM-SCB. The kwarg lastflux may be given as a nLT x nE numpy array of the last good fluxes, e.g. the correct values at the epoch directly preceeding the first epoch of this file. These will be used if the first time entry of the file contains bad values. If not given, bad values at the first time entry will be set to zero.

timeseries_append(other)[source]

If other is of the same type as self, and both have a ‘time’ entry, append all arrays within other that have the same size as ‘time’ to the corresponding arrays within self. This is useful for combining time series data of consecutive data.