spacepy.pybats.NgdcIndex

class spacepy.pybats.NgdcIndex(filename=None, load=True, *args, **kwargs)[source]

Many models incorporated into the SWMF rely on National Geophysical Data Center (NGDC) provided index files (especially F10.7 and Kp). These files, albeit simple ascii, have a unique format and expansive header that can be cumbersome to handle. Data files can be obtained from http://spidr.ngdc.noaa.gov .

NgdcIndex objects aid in reading, creating, and visualizing these files.

Creating an NgdcIndex object is simple:

>>> from spacepy import pybats
>>> obj=pybats.NgdcIndex(filename='ngdc_example.dat')

Upon instantiation, if filename is a valid file AND kwarg load is set to boolean True, the contents of filename are loaded into the object and no other work needs to be done.

If filename is False or load is False, a blank NgdcIndex is created for the user to manipulate. The user can set the time array and the ssociated data values to any values desired and use the method obj.write() to dump the contents to an NGDC formatted input file. See the documentation for the write method for more details.

This class is a work-in-progress. It is especially tuned for SWMF-needs and cannot be considered a general function for the handling of generic NGDC files.

Kwarg

Description

filename

Set the input/output file name.

load

Read file upon instantiation? Defaults to True

__init__(filename=None, load=True, *args, **kwargs)[source]

Base class for “Data Model” representation data

Abstract method, reimplement

Attributes:
attrsdict

dictionary of the attributes of the SpaceData object

Methods

write([outfile])

Write the NgdcIndex object to file.

Attributes

write(outfile=False)[source]

Write the NgdcIndex object to file. Kwarg outfile can be used to specify the path of the output file; if it is not set, self.attrs[‘file’] is used. If this is not set, default to “ngdc_index.dat”.

attrs: collections.abc.Mapping