TimeSeries#
- sunpy.timeseries.TimeSeries = <sunpy.timeseries.timeseries_factory.TimeSeriesFactory object>#
A factory for generating solar timeseries objects.
This factory takes a variety of inputs to generate
GenericTimeSeries
objects.- Parameters:
*inputs – Inputs to parse for timeseries objects. See the example section for a detailed list of possible inputs.
source ({‘gbmsummary’, ‘norh’, ‘eve’, ‘noaapredictindices’, ‘xrs’, ‘lyra’, ‘noaaindices’, ‘esp’, ‘rhessi’}, optional) – A string to select the observational source of the data, currently necessary to define how files should be read for all instruments.
concatenate (
bool
, optional) – Defaults toFalse
. If set, combine any resulting list of TimeSeries objects into a single TimeSeries, using successive concatenate methods.
- Returns:
sunpy.timeseries.GenericTimeSeries
– If the input results in a single timeseries object that will be returned, or ifconcatenate=True
.list
ofGenericTimeSeries
– If multiple inputs are parsed, they will be returned in a list, unlessconcatenate=True
is set when they will be combined into a single timeseries.
Examples
>>> import sunpy.timeseries >>> import sunpy.data.sample >>> my_timeseries = sunpy.timeseries.TimeSeries(sunpy.data.sample.GOES_XRS_TIMESERIES)
The SunPy TimeSeries factory accepts a wide variety of inputs for creating timeseries
Preloaded tuples of (data, header) pairs or (data, header, units)
>>> my_timeseries = sunpy.timeseries.TimeSeries((data, header))
Headers and units must be either a
dict
,OrderedDict
orMetaDict
.data, header pairs, or data, header units triples, not in tuples
>>> my_timeseries = sunpy.timeseries.TimeSeries(data, header) >>> my_timeseries = sunpy.timeseries.TimeSeries(data, header, units)
File names for files understood by the file reader and for those that are not
>>> my_timeseries = sunpy.timeseries.TimeSeries('filename.fits') >>> my_timeseries = sunpy.timeseries.TimeSeries('filename.fits', source='lyra')
Multiple files can be combined into one TimeSeries, as long as they are the same source
>>> my_timeseries = sunpy.timeseries.TimeSeries(['goesfile1.fits', 'goesfile2.fits'], ... concatenate=True)
All fits files in a directory by giving a directory
>>> my_timeseries = sunpy.timeseries.TimeSeries('local_dir/sub_dir')
Some regex globs
>>> my_timeseries = sunpy.timeseries.TimeSeries('eit_*.fits')
URLs
>>> my_timeseries = sunpy.timeseries.TimeSeries(url)
Lists of any of the above
>>> my_timeseries = sunpy.timeseries.TimeSeries(['file1.fits', 'file2.fits', ... 'file3.fits', 'directory1/'])
Any mixture of the above not in a list
>>> my_timeseries = sunpy.timeseries.TimeSeries((data, header), data2, header2, ... 'file1.fits', url, 'eit_*.fits')