API Reference

Core functions

HAPIClient.get_data — Function
get_data(server, dataset, parameters, tmin, tmax; format="csv", mask=true, kw...)

Get data and metadata from a HAPI server for a given dataset and parameters within a time range [tmin, tmax].

With mask = true, values equal to a parameter's fill read as NaN, so an integer parameter with a fill reads as Float64.

Supported keyword arguments:

  • format = "csv": Data format (other options: "binary", "json").
  • verbose = 0: Verbosity level passed to HTTP.get (other options: 1, 2).
source
get_data(path, tmin, tmax; kwargs...)

Get data and metadata using a path in the format "server/dataset/parameter".

source

Types

HAPIClient.HAPIVariable — Type

An array-like object that represents a HAPI variable.

Fields

  • data: The underlying data values (use parent(x) to access).
  • time: The time axis (use times(x) to access).
  • meta: The metadata (use meta(x) to access).
source
HAPIClient.HAPIVariable — Method
HAPIVariable(data, params, i; mask = true)

Construct a HAPIVariable object for parameter params[i + 1] from data: a CSV.File (or any Tables.jl table) in the HAPI CSV column layout, or a JSON-parsed response. With mask, values equal to the parameter's fill read as NaN.

source
HAPIClient.Server — Method
Server(id)

Get a HAPI server instance by its ID.

Examples

cdaweb = Server("CDAWeb") # same as HAPIClient.CDAWeb
source

Predefined Servers

Convenient constants for commonly used HAPI servers are automatically exported (the valid keys of the SERVERS dictionary, e.g. DAS2, CDAWeb, etc.) and can be used directly:

using HAPIClient
HAPIClient.SERVERS
Dict{String, Server} with 15 entries:
  "CCMC_ISWA"                   => Server("https://iswa.gsfc.nasa.gov/hapi", "C…
  "NESDIS_SPACE_WEATHER_PORTAL" => Server("https://www.ncei.noaa.gov/cloud-acce…
  "INTERMAGNET"                 => Server("https://imag-data.bgs.ac.uk/GIN_V1/h…
  "LISIRD"                      => Server("https://lasp.colorado.edu/lisird/hap…
  "AMDA"                        => Server("https://amda.irap.omp.eu/service/hap…
  "CDAWEB"                      => Server("https://cdaweb.gsfc.nasa.gov/hapi", …
  "UCALGARY/SRS"                => Server("https://api.phys.ucalgary.ca/hapi", …
  "CSA"                         => Server("https://csatools.esac.esa.int/HapiSe…
  "WDC-KYOTO-HAPI"              => Server("https://wdc.kugi.kyoto-u.ac.jp/hapi"…
  "SSCWEB"                      => Server("http://hapi-server.org/servers/SSCWe…
  "HELIOVIEWER"                 => Server("https://api.helioviewer.org/hapi/Hel…
  "WDC"                         => Server("https://wdcapi.bgs.ac.uk/hapi", "WDC…
  "VIRES-FOR-SWARM"             => Server("https://vires.services/hapi", "VirES…
  "KNMI"                        => Server("https://hapi.spaceweather.knmi.nl/ha…
  "DAS2"                        => Server("https://planet.physics.uiowa.edu/das…

Public

HAPIClient.get_data — Method
get_data(server, dataset, parameters, tmin, tmax; format="csv", mask=true, kw...)

Get data and metadata from a HAPI server for a given dataset and parameters within a time range [tmin, tmax].

With mask = true, values equal to a parameter's fill read as NaN, so an integer parameter with a fill reads as Float64.

Supported keyword arguments:

  • format = "csv": Data format (other options: "binary", "json").
  • verbose = 0: Verbosity level passed to HTTP.get (other options: 1, 2).
source
HAPIClient.get_data — Method
get_data(path, tmin, tmax; kwargs...)

Get data and metadata using a path in the format "server/dataset/parameter".

source
HAPIClient.refresh_servers! — Method
refresh_servers!(; url=DEFAULT_SERVERS_JSON_URL)

Fetch the latest server list from the remote URL and update the registry.

source

Private

HAPIClient.HAPIParameter — Type
HAPIParameter(dataset, name)
HAPIParameter(dataset, names)

dataset[name], whose getdata returns a HAPIVariable; dataset[names] fetches several parameters in one request as HAPIVariables.

source
HAPIClient.Parameter — Type
Parameter

Represents a HAPI parameter with validation according to the specification.

Required fields:

  • name: String identifier for the parameter
  • type: One of "string", "double", "integer", or "isotime"
  • units: String, array of strings, or nothing for dimensionless quantities
  • fill: String or nothing indicating no fill value

Type-specific requirements:

  • For string and isotime types: must specify length
  • For array parameters: must specify size

Optional fields:

  • description: Brief description of the parameter
  • label: Display label or array of labels
  • size: Array dimensions for array parameters
  • bins: Array parameter bin information
  • stringType: For string parameters that represent URIs
  • coordinateSystemName: Name of coordinate system for vector quantities
  • vectorComponents: Component names for vector quantities
source
HAPIClient.HAPIDateTime — Method
HAPIDateTime(t)

Format t (a string or any Dates.TimeType) as a HAPI request time string, at millisecond precision unless t carries sub-millisecond digits.

source
HAPIClient.get_catalog — Method
get_catalog(server)

Get a list of datasets available from the server.

HAPI info response JSON structure: https://github.com/hapi-server/data-specification/blob/master/hapi-dev/HAPI-data-access-spec-dev.md#35-catalog

source
HAPIClient.get_parameters — Method
get_parameters(server, id, parameters)

Get a dictionary containing the HAPI info metadata for each parameter in the comma-separated string parameters.

source
HAPIClient.get_parameters — Method
get_parameters(server, id)

Get a dictionary containing the HAPI info metadata for all parameters in the id dataset. Returns a tuple of (info, parameters) where info is the full response and parameters is a Vector of Parameter objects.

HAPI info response JSON structure: https://github.com/hapi-server/data-specification/blob/master/hapi-dev/HAPI-data-access-spec-dev.md#36-info

source
HAPIClient.get_servers — Function
get_servers()

Get a list of available HAPI server URLs from https://github.com/hapi-server/servers/raw/master/all.txt

source
HAPIClient.parse_hapi_time — Method
parse_hapi_time(s) -> Timestamp{Nanosecond}

Parse a (possibly truncated) HAPI time string, in yyyy-mm-dd or day-of-year yyyy-ddd form, with up to nanosecond precision.

source