The TimeSeriesMetaData class

This provides an overview of the basic functionality of the TimeSeriesMetaData class.

import astropy.units as u

import sunpy.data.sample
import sunpy.timeseries
from sunpy.net import Fido, attrs as a
from sunpy.time import TimeRange, parse_time

Search for Data

goes_res = Fido.search(a.Time("2010-11-02", "2010-11-07"), a.Instrument('XRS'))
norh_res = Fido.search(a.Time("2010-11-02", "2010-11-07"), a.Instrument('norh'),
                       a.Wavelength(17 * u.GHz))

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/astropy/units/quantity.py:1072: AstropyDeprecationWarning: The truth value of a Quantity is ambiguous. In the future this will raise a ValueError.
  AstropyDeprecationWarning)

Download the data and load it

goes_files = Fido.fetch(goes_res)
norh_files = Fido.fetch(norh_res)

goes_ts = sunpy.timeseries.TimeSeries(goes_files, source='XRS', concatenate=True)
norh_ts = sunpy.timeseries.TimeSeries(norh_files, source='NoRH', concatenate=True)

Out:

Files Downloaded:   0%|          | 0/6 [00:00<?, ?file/s]

go1520101102.fits:   0%|          | 0.00/694k [00:00<?, ?B/s]



go1520101104.fits:   0%|          | 0.00/694k [00:00<?, ?B/s]




go1520101105.fits:   0%|          | 0.00/694k [00:00<?, ?B/s]





go1520101106.fits:   0%|          | 0.00/694k [00:00<?, ?B/s]


go1520101103.fits:   0%|          | 0.00/688k [00:00<?, ?B/s]




go1520101105.fits:  64%|######4   | 444k/694k [00:00<00:00, 4.44MB/s]/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/aiohttp/client_proto.py:113: ResourceWarning: unclosed <socket.socket fd=18, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 49410), raddr=('198.118.248.134', 443)>
  super().resume_reading()
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=18 read=idle write=<idle, bufsize=0>>
  source=self)





                                                                     





go1520101106.fits:  64%|######3   | 443k/694k [00:00<00:00, 3.59MB/s]





                                                                     

go1520101102.fits:  85%|########5 | 590k/694k [00:00<00:00, 4.18MB/s]

                                                                     



go1520101104.fits:  85%|########5 | 590k/694k [00:00<00:00, 4.10MB/s]



                                                                     
Files Downloaded:  17%|#6        | 1/6 [00:00<00:01,  3.65file/s]


go1520101103.fits:  86%|########5 | 590k/688k [00:00<00:00, 4.12MB/s]


                                                                     




go1520101107.fits:   0%|          | 0.00/694k [00:00<?, ?B/s]




                                                             
Files Downloaded: 100%|##########| 6/6 [00:00<00:00, 16.12file/s]

Files Downloaded:   0%|          | 0/6 [00:00<?, ?file/s]/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/_strptime.py:323: ResourceWarning: unclosed <socket.socket fd=24, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 45212), raddr=('133.40.7.172', 42002)>
  for index, arg in enumerate([data_string, format]):
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/_strptime.py:323: ResourceWarning: unclosed <socket.socket fd=25, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 33788), raddr=('133.40.7.172', 43142)>
  for index, arg in enumerate([data_string, format]):
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/_strptime.py:323: ResourceWarning: unclosed <socket.socket fd=26, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 50812), raddr=('133.40.7.172', 41748)>
  for index, arg in enumerate([data_string, format]):
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=24 read=idle write=<idle, bufsize=0>>
  source=self)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=25 read=idle write=<idle, bufsize=0>>
  source=self)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=26 read=idle write=<idle, bufsize=0>>
  source=self)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/_strptime.py:323: ResourceWarning: unclosed <socket.socket fd=23, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 44030), raddr=('133.40.7.172', 38411)>
  for index, arg in enumerate([data_string, format]):
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/_strptime.py:323: ResourceWarning: unclosed <socket.socket fd=27, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 59312), raddr=('133.40.7.172', 38078)>
  for index, arg in enumerate([data_string, format]):
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=23 read=idle write=<idle, bufsize=0>>
  source=self)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=27 read=idle write=<idle, bufsize=0>>
  source=self)






tca101106:   0%|          | 0.00/60.5k [00:00<?, ?B/s]




tca101105:   0%|          | 0.00/60.5k [00:00<?, ?B/s]

tca101102:   0%|          | 0.00/60.5k [00:00<?, ?B/s]





tca101106:  35%|###4      | 21.1k/60.5k [00:00<00:00, 141kB/s]




tca101105:  35%|###4      | 21.1k/60.5k [00:00<00:00, 141kB/s]



tca101104:   0%|          | 0.00/60.5k [00:00<?, ?B/s]

tca101102:  35%|###4      | 21.1k/60.5k [00:00<00:00, 140kB/s]





tca101106:  82%|########2 | 49.6k/60.5k [00:00<00:00, 153kB/s]





                                                              




tca101105:  80%|#######9  | 48.2k/60.5k [00:00<00:00, 151kB/s]




                                                              


tca101103:   0%|          | 0.00/60.5k [00:00<?, ?B/s]



tca101104:  35%|###4      | 21.1k/60.5k [00:00<00:00, 140kB/s]

tca101102:  82%|########2 | 49.6k/60.5k [00:00<00:00, 152kB/s]

                                                              


tca101103:  33%|###3      | 20.0k/60.5k [00:00<00:00, 134kB/s]



tca101104:  82%|########2 | 49.6k/60.5k [00:00<00:00, 152kB/s]



                                                              


tca101103:  70%|#######   | 42.5k/60.5k [00:00<00:00, 138kB/s]


                                                              
Files Downloaded:  17%|#6        | 1/6 [00:04<00:22,  4.40s/file]
Files Downloaded:  50%|#####     | 3/6 [00:04<00:09,  3.10s/file]
Files Downloaded:  83%|########3 | 5/6 [00:04<00:02,  2.20s/file]/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/parfive/downloader.py:411: RuntimeWarning: coroutine 'Client.login' was never awaited
  client.login(parse.username, parse.password)






tca101107:   0%|          | 0.00/60.5k [00:00<?, ?B/s]





tca101107:  35%|###4      | 21.1k/60.5k [00:00<00:00, 139kB/s]





tca101107:  58%|#####8    | 35.3k/60.5k [00:00<00:00, 122kB/s]





tca101107:  99%|#########9| 60.0k/60.5k [00:00<00:00, 132kB/s]





                                                              
Files Downloaded: 100%|##########| 6/6 [00:08<00:00,  2.81s/file]
Files Downloaded: 100%|##########| 6/6 [00:08<00:00,  1.49s/file]
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/site-packages/astropy/config/configuration.py:543: ResourceWarning: unclosed <socket.socket fd=18, family=AddressFamily.AF_INET, type=SocketKind.SOCK_STREAM, proto=6, laddr=('172.17.0.3', 52848), raddr=('133.40.7.172', 37027)>
  return cobj[secname]
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/asyncio/selector_events.py:655: ResourceWarning: unclosed transport <_SelectorSocketTransport fd=18 read=idle write=<idle, bufsize=0>>
  source=self)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)

Combining the two series

large_ts = goes_ts.concatenate(norh_ts)

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)

The metadata can be easily viewed:

large_ts.meta

You can reduce the depth of the view:

print(large_ts.meta.to_string(2))

Out:

|-------------------------------------------------------------------------------------------------|
|TimeRange                  | Columns         | Meta                                              |
|-------------------------------------------------------------------------------------------------|
|2010-11-01 22:44:51.864000 | Correlation Coe | simple: True                                      |
|2010-11-02 06:29:58.864000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-01 23:59:59.754999 | xrsa            | simple: True                                      |
|2010-11-02 23:59:57.778999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-02 22:44:51.801000 | Correlation Coe | simple: True                                      |
|2010-11-03 06:29:58.801000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-02 23:59:59.828999 | xrsa            | simple: True                                      |
|2010-11-03 23:59:57.858999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 22:44:50.727000 | Correlation Coe | simple: True                                      |
|2010-11-04 06:29:58.727000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 23:59:59.904999 | xrsa            | simple: True                                      |
|2010-11-04 23:59:57.941999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 22:44:51.660000 | Correlation Coe | simple: True                                      |
|2010-11-05 06:29:58.660000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 23:59:59.988999 | xrsa            | simple: True                                      |
|2010-11-05 23:59:55.988999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-05 22:44:53.599000 | Correlation Coe | simple: True                                      |
|2010-11-06 06:29:59.599000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-05 23:59:58.034999 | xrsa            | simple: True                                      |
|2010-11-06 23:59:56.091999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-06 22:44:53.526000 | Correlation Coe | simple: True                                      |
|2010-11-07 06:29:59.526000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-06 23:59:58.138999 | xrsa            | simple: True                                      |
|2010-11-07 23:59:56.201999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|

The TimeSeriesMetaData class stores all the individual file metadata MetaDict objects as 3-tuple entries in it’s internal list with the TimeRange, list of column names and metadictionary. This list is stored in order of ascending TR.start. Access of the the list is done using the metadata property:

large_ts.meta.metadata

The TimeSeriesMetaData class has a number of other properties, including the timerange property that returns a TimeRange for the entire metadata:

large_ts.meta.time_range
# Further properties can be used to get lists of details, such as:
# lists of the values:
large_ts.meta.timeranges  # List of the time ranges
large_ts.meta.columns  # List of the column names
large_ts.meta.metas  # List of the meta dictionaries

When you truncate the TimeSeries, the metadata is truncated too:

large_trunc_ts = large_ts.truncate(TimeRange('2010-11-03 13:59:57.468999',
                                             '2010-11-05 13:59:56.091999'))
print(large_trunc_ts.meta.to_string(2))

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
|-------------------------------------------------------------------------------------------------|
|TimeRange                  | Columns         | Meta                                              |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 13:59:58.398999 | xrsa            | simple: True                                      |
|2010-11-03 23:59:57.858999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 22:44:50.727000 | Correlation Coe | simple: True                                      |
|2010-11-04 06:29:58.727000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 23:59:59.904999 | xrsa            | simple: True                                      |
|2010-11-04 23:59:57.941999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 22:44:51.660000 | Correlation Coe | simple: True                                      |
|2010-11-05 06:29:58.660000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 23:59:59.988999 | xrsa            | simple: True                                      |
|2010-11-05 13:59:54.471999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|

Finding metadata can be achieved using the find method and applying filters for time and/or colname. This returns another TimeSeriesMetaData object:

large_trunc_ts.meta.find(time=parse_time('2010-11-04 09:01:16'))
large_trunc_ts.meta.find(time='2010-11-04 09:01:16', colname='xrsb')

# You can get the time of a row a from the TimeSeries object's index:
large_trunc_ts.meta.find(time=large_trunc_ts.index[10])

# Note: with no filters you get a duplicate of the original TimeSeriesMetaData
# object.

Out:

/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)
/home/docs/checkouts/readthedocs.org/user_builds/sunpy/conda/stable/lib/python3.7/functools.py:827: UserWarning: Discarding nonzero nanoseconds in conversion
  return dispatch(args[0].__class__)(*args, **kw)

There is also a get method:

large_trunc_ts.meta.get('telescop')

# Again, filters can be used:
large_trunc_ts.meta.get('telescop', time='2010-11-04 09:01:16', colname='xrsb')

# And if we just want the values, the values method returns just a list:
large_trunc_ts.meta.get('telescop').values()

You can update values similar to dictionaries, though all of the contained MetaDict objects will be updated that match your filter criteria:

large_trunc_ts.meta.update({'new_key_1': 'added to all.'})
large_trunc_ts.meta.update({'new_key_2': 'added to some.'}, colname='xrsa')
print(large_trunc_ts.meta.to_string(2))

# but you can't overwrite previous entries without setting the overwrite kwarg,
# this is to protect the integrity of the metadata:

large_trunc_ts.meta.update({'new_key_1': 'changed'}, overwrite=True)
print(large_trunc_ts.meta.to_string(2))

Out:

|-------------------------------------------------------------------------------------------------|
|TimeRange                  | Columns         | Meta                                              |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 13:59:58.398999 | xrsa            | simple: True                                      |
|2010-11-03 23:59:57.858999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 22:44:50.727000 | Correlation Coe | simple: True                                      |
|2010-11-04 06:29:58.727000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 23:59:59.904999 | xrsa            | simple: True                                      |
|2010-11-04 23:59:57.941999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 22:44:51.660000 | Correlation Coe | simple: True                                      |
|2010-11-05 06:29:58.660000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 23:59:59.988999 | xrsa            | simple: True                                      |
|2010-11-05 13:59:54.471999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|

|-------------------------------------------------------------------------------------------------|
|TimeRange                  | Columns         | Meta                                              |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 13:59:58.398999 | xrsa            | simple: True                                      |
|2010-11-03 23:59:57.858999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 22:44:50.727000 | Correlation Coe | simple: True                                      |
|2010-11-04 06:29:58.727000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-03 23:59:59.904999 | xrsa            | simple: True                                      |
|2010-11-04 23:59:57.941999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 22:44:51.660000 | Correlation Coe | simple: True                                      |
|2010-11-05 06:29:58.660000 |                 | bitpix: 16                                        |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|
|2010-11-04 23:59:59.988999 | xrsa            | simple: True                                      |
|2010-11-05 13:59:54.471999 | xrsb            | bitpix: 8                                         |
|                           |                 | ...                                               |
|-------------------------------------------------------------------------------------------------|

Total running time of the script: ( 0 minutes 15.277 seconds)

Gallery generated by Sphinx-Gallery