API Reference
Core functions
HAPIClient.hapi — Function
hapi()- List available HAPI servers (get_servers)hapi(server, dataset, parameters)- Get parameter information for specific parameters (get_parameters)
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 toHTTP.get(other options: 1, 2).
get_data(path, tmin, tmax; kwargs...)Get data and metadata using a path in the format "server/dataset/parameter".
Types
HAPIClient.HAPIVariable — Type
An array-like object that represents a HAPI variable.
Fields
data: The underlying data values (useparent(x)to access).time: The time axis (usetimes(x)to access).meta: The metadata (usemeta(x)to access).
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.
HAPIClient.HAPIVariables — Type
A thin wrapper over NamedTuple for HAPI variables that shares the same time axis.
HAPIClient.Server — Method
Server(id)Get a HAPI server instance by its ID.
Examples
cdaweb = Server("CDAWeb") # same as HAPIClient.CDAWebPredefined 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.SERVERSDict{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 toHTTP.get(other options: 1, 2).
HAPIClient.get_data — Method
get_data(path, tmin, tmax; kwargs...)Get data and metadata using a path in the format "server/dataset/parameter".
HAPIClient.hapi — Function
hapi()- List available HAPI servers (get_servers)hapi(server, dataset, parameters)- Get parameter information for specific parameters (get_parameters)
HAPIClient.refresh_servers! — Method
refresh_servers!(; url=DEFAULT_SERVERS_JSON_URL)Fetch the latest server list from the remote URL and update the registry.
Private
HAPIClient.HAPIDataset — Type
HAPIDataset(server, id)The dataset id of a HAPI server.
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.
HAPIClient.HAPISchema — Type
HAPIClient.Parameter — Type
ParameterRepresents a HAPI parameter with validation according to the specification.
Required fields:
name: String identifier for the parametertype: One of "string", "double", "integer", or "isotime"units: String, array of strings, or nothing for dimensionless quantitiesfill: String or nothing indicating no fill value
Type-specific requirements:
- For
stringandisotimetypes: must specifylength - For array parameters: must specify
size
Optional fields:
description: Brief description of the parameterlabel: Display label or array of labelssize: Array dimensions for array parametersbins: Array parameter bin informationstringType: For string parameters that represent URIscoordinateSystemName: Name of coordinate system for vector quantitiesvectorComponents: Component names for vector quantities
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.
HAPIClient.format — Method
Default format for HAPI servers.
HAPIClient.get_capabilities — Method
get_capabilities(server)Get server capabilities.
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
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.
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
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
HAPIClient.is_time_parameter — Method
is_time_parameter(param::Parameter)Check if a parameter is a valid time parameter (first parameter in a dataset).
HAPIClient.load_servers_from_json — Function
load_servers_from_json(source=joinpath(@__DIR__, "abouts.json"); register=false)Load HAPI servers from a local JSON file or remote URL.
HAPIClient.parameters — Method
Parse parameters into a Vector of Parameter objects and validate first parameter is time.
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.