API Reference

swxsoc Package

Functions

print_config(config)

Print the current configuration options.

swxsoc.swxdata Module

Container class for Measurement Data.

Classes

SWXData(timeseries[, support, spectra, ...])

A generic object for loading, storing, and manipulating space weather time series data.

swxsoc.util Package

Functions

warn_user(msg[, stacklevel])

Raise a SWXUserWarning.

warn_deprecated(msg[, stacklevel])

Raise a SWXDeprecationWarning.

create_science_filename(instrument, time, ...)

Return a compliant filename.

parse_science_filename(filepath)

Parses a science filename into its constituent properties.

Classes

SWXWarning

The base warning class from which all SWX warnings should inherit.

SWXUserWarning

The primary warning class for SWxSOC.

SWXDeprecationWarning

A warning class to indicate a deprecated feature.

SWXPendingDeprecationWarning

A warning class to indicate a soon-to-be deprecated feature.

swxsoc.util.config Module

This module provides configuration file functionality.

This code is based on that provided by SunPy see

licenses/SUNPY.rst

Functions

load_config()

Load and read the configuration file.

copy_default_config([overwrite])

Copy the default configuration file to the user's configuration directory.

print_config(config)

Print the current configuration options.

swxsoc.util.const Module

Various constants defined in cdf.h and used in spacepy.pycdf. Most constants referred to in the CDF manuals are provided by this module.

This code is based on that provided by SpacePy see

licenses/SPACEPY.rst

swxsoc.util.exceptions Module

This module provides errors/exceptions and warnings of general use.

Exceptions that are specific to a given package should not be here, but rather in the particular package.

This code is based on that provided by SunPy see

licenses/SUNPY.rst

Functions

warn_user(msg[, stacklevel])

Raise a SWXUserWarning.

warn_deprecated(msg[, stacklevel])

Raise a SWXDeprecationWarning.

Classes

SWXWarning

The base warning class from which all SWX warnings should inherit.

SWXUserWarning

The primary warning class for SWxSOC.

SWXDeprecationWarning

A warning class to indicate a deprecated feature.

SWXPendingDeprecationWarning

A warning class to indicate a soon-to-be deprecated feature.

swxsoc.io Package

Input/output handlers for SWxSOC heliophysics data.

This package provides the abstract SWXIOHandler interface together with concrete file-format handlers (currently CDFHandler for CDF files) and shared utilities such as swxsoc.io.fillval for converting between in-memory NaN/mask representations and on-disk FILLVAL sentinels.

swxsoc.io.base_handler Module

Abstract base class for SWxSOC input/output handlers.

Classes

SWXIOHandler()

Abstract base class for handling input/output operations of heliophysics data.

swxsoc.io.cdf_handler Module

CDF (Common Data Format) implementation of SWXIOHandler.

Handles reading SWxSOC-style CDF files into the SWXData container and writing SWXData instances back out to CDF.

Classes

CDFHandler()

A concrete implementation of SWXIOHandler for handling heliophysics data in CDF format.

swxsoc.io.fillval Module

Helpers for converting between in-memory NaN/mask representations and on-disk CDF FILLVAL sentinels.

This module is intentionally CDF-agnostic; it operates on plain numpy arrays and scalar FILLVAL values so it can be unit-tested in isolation from spacepy.pycdf.

Conventions

  • Floats round-trip both np.nan and a parallel boolean mask.

  • Integers preserve dtype; the FILLVAL sentinel stays in .data and the mask marks fill positions.

  • Strings (S / U dtypes) use the ISTP single-space sentinel (b" " / " "). As a write-time convenience numpy’s coercion of np.nan to the literal bytes b"nan" (and b"NaN") is also treated as fill. The reader is strict: only the spec sentinel maps to a mask bit.

  • The ISTP FILLVAL values for specific CDF types (including the Epoch variants) are owned by swxsoc.io.fillval.get_fillval().

Functions

is_float_dtype(arr)

Return True if arr has a numpy floating-point dtype (real or complex).

is_string_dtype(arr)

Return True if arr has a numpy byte-string (S) or unicode (U) dtype.

compute_fill_mask(arr, fillval)

Compute a boolean mask of fill positions in arr.

apply_fill_on_write(arr, mask, fillval)

Return a copy of arr with fill positions replaced by fillval.

apply_fillval_to_nan(arr, fillval)

For float arrays, return a copy of arr with fillval positions replaced by np.nan.

swxsoc.util.logger Module

This code is based on that provided by SunPy and AstroPy see

licenses/SUNPY.rst and licenses/ASTROPY.rst

Functions

_init_log([config])

Initializes the log.

_config_to_loggerConf(config)

Translates a user-provided YAML config dictionary to astropy.logger.LoggerConf.

Classes

MyLogger(name[, level])

This class is used to set up logging.

swxsoc.util.schema Module

This module provides schema metadata derivations.

This code is based on that provided by SpacePy see

licenses/SPACEPY.rst

Classes

SWXSchema([global_schema_layers, ...])

Class representing a schema for data requirements and formatting.

swxsoc.util.util Module

This module provides general utility functions.

Functions

create_science_filename(instrument, time, ...)

Return a compliant filename.

parse_science_filename(filepath)

Parses a science filename into its constituent properties.

swxsoc.util.grafana Module

Grafana annotation and dashboard utility functions.

This module provides functions for interacting with Grafana’s annotation API, including querying, creating, and removing annotations.

Functions

get_dashboard_id(dashboard_name[, ...])

Retrieves the dashboard UID by its name.

get_panel_id(dashboard_id, panel_name[, ...])

Retrieves the panel ID by dashboard UID and panel name.

query_annotations(start_time[, end_time, ...])

Queries annotations within a specific timeframe with optional filters for tags, dashboard, and panel names.

create_annotation(start_time, text, tags[, ...])

Creates a new annotation for a specified event or time period, with optional filtering by dashboard and panel names.

remove_annotation_by_id(annotation_id[, ...])

Deletes an annotation by its ID.

swxsoc.util.validation Module

Functions

validate(file_path[, schema])

Validate a data file such as a CDF.

Classes

SWXDataValidator([schema])

Abstract base class for heliophysics data validators.

CDFValidator([schema])

Validator for CDF files.

swxsoc.net Package

swxsoc.net.attr Module

Search attribute classes and walker for the SWXSOC FIDO client.

This module defines custom search attributes used by the SWXSOCClient to query SWXSOC data archives on AWS S3.

Classes

SearchTime(start[, end, near])

Attribute for specifying the time range for the search.

Level(value)

Attribute for specifying the data level for the search.

Instrument(value)

Attribute for specifying the instrument for the search.

Descriptor(value)

Attribute to specify the data type for the search.

DevelopmentBucket(value)

Attribute for specifying whether to search in the DevelopmentBucket for testing purposes.

swxsoc.net.client Module

SWXSOC FIDO Client for searching and fetching data from AWS S3.

This module provides the SWXSOCClient class, which implements the sunpy BaseClient interface for querying SWXSOC data archives.

Classes

SWXSOCClient()

Client for searching for SWXSOC data on AWS.

swxsoc.db Package

swxsoc.db.timeseries Module

AWS Timestream recording functions for SWXSOC data.

This module provides functions to record timeseries data and individual measurements to AWS Timestream for viewing on dashboards like Grafana.

Functions

record_timeseries(ts[, ts_name, instrument_name])

Record a timeseries of measurements to AWS Timestream for viewing on a dashboard like Grafana.

_record_dimension_timestream(dimensions[, ...])

Record a single measurement to an AWS timestream for viewing on a dashboard such as Grafana.