Timeseries (sunpy.timeseries)#

One of the core classes in sunpy is a timeseries. A number of instruments are supported through subclasses of the base GenericTimeSeries class. See Instrument TimeSeries Classes for a list of them.

A timeseries can be created by calling TimeSeries.

Instrument TimeSeries Classes#

The generic method to create an instrument-specific TimeSeries is to call TimeSeries with a file path and the instrument-specific source keyword argument. In some cases the source can be determined automatically if a FITS file is being loaded.

The following example shows the factory loading a sample file:

>>> import sunpy.timeseries as ts
>>> import sunpy.data.sample  
>>> goes = ts.TimeSeries(sunpy.data.sample.GOES_XRS_TIMESERIES, source='XRS')  

The TimeSeries factory will load the file and create the timeseries instance. The following instrument classes are supported:

sunpy.timeseries Package#


TimeSeriesMetaData([meta, timerange, colnames])

Used to store metadata for TimeSeries that enables multiple sunpy.timeseries.TimeSeries metadata to be concatenated in an organized fashion.

GenericTimeSeries(data[, meta, units])

A generic time series object.



A factory for generating solar timeseries objects.

sunpy.timeseries.sources Package#

This module provides a collection of datasource-specific TimeSeries classes.

Each mission should have its own file with one or more classes defined. Typically, these classes will be subclasses of the sunpy.timeseries.TimeSeries.


ESPTimeSeries(data[, meta, units])

SDO EVE/ESP Level 1 data.

EVESpWxTimeSeries(data[, meta, units])

SDO EVE LightCurve for level 0CS data.

GBMSummaryTimeSeries(data[, meta, units])

Fermi/GBM Summary lightcurve TimeSeries.

XRSTimeSeries(data[, meta, units])

GOES XRS Time Series.

LYRATimeSeries(data[, meta, units])

Proba-2 LYRA Lightcurve TimeSeries.

NOAAIndicesTimeSeries(data[, meta, units])

NOAA Solar Cycle monthly indices.

NOAAPredictIndicesTimeSeries(data[, meta, units])

NOAA Solar Cycle Predicted Progression.

NoRHTimeSeries(data, header, units, **kwargs)

Nobeyama Radioheliograph Correlation lightcurve TimeSeries.

RHESSISummaryTimeSeries(data[, meta, units])

RHESSI X-ray Summary lightcurve TimeSeries.

Class Inheritance Diagram#

Inheritance diagram of sunpy.timeseries.sources.eve.ESPTimeSeries, sunpy.timeseries.sources.eve.EVESpWxTimeSeries, sunpy.timeseries.sources.fermi_gbm.GBMSummaryTimeSeries, sunpy.timeseries.sources.goes.XRSTimeSeries, sunpy.timeseries.sources.lyra.LYRATimeSeries, sunpy.timeseries.sources.noaa.NOAAIndicesTimeSeries, sunpy.timeseries.sources.noaa.NOAAPredictIndicesTimeSeries, sunpy.timeseries.sources.norh.NoRHTimeSeries, sunpy.timeseries.sources.rhessi.RHESSISummaryTimeSeries

CDF files#

GenericTimeSeries can load a single CDF file, or a list of CDF files if concatenate=True is passed.


The physical units of different columns in CDF files do not conform to a standard that astropy.units understands. sunpy internally stores a set of common mappings from unit strings to Unit, but you may see a warning about unrecognised unit strings when reading a CDF file. To register the correct unit definition astropy.units.add_enabled_units() can be used. For example, to register ‘deg K’ as representing Kelvin and ‘#/cc’ as 1/cm^3:

>>> import astropy.units as u
>>> _ = u.add_enabled_units([u.def_unit('deg K', represents=u.K), u.def_unit('#/cc', represents=u.cm**-3)])