Downloader

class heliopy.data.util.Downloader

Bases: abc.ABC

A template class, that should be sub-classed to provide methods for downloading a single dataset.

The following methods must be implemented by sub-classes:

units
Type

dict

Methods Summary

download(interval)

Download data for a given interval.

fname(interval)

Return the filename to which the data is saved for a given interval.

intervals(starttime, endtime)

The complete list of sub-intervals that cover a time range Each sub-interval is associated with a single file to be downloaded and read in.

intervals_daily(starttime, endtime)

intervals_monthly(starttime, endtime)

Returns all monthly intervals between starttime and endtime.

intervals_yearly(starttime, endtime)

Returns all annual intervals between starttime and endtime.

load(starttime, endtime)

Load all data between starttime and endtime.

load_local_file(interval)

Load local file for a given interval.

local_dir(interval)

Local directory for a given interval.

local_file_exists(interval)

Return True if the local file exists.

local_hdf_path(interval)

Absolute path to a single .hdf file.

local_path(interval)

Absolute path to a single local file.

Methods Documentation

abstract download(interval)

Download data for a given interval.

Parameters

interval (sunpy.time.TimeRange) –

Returns

dl_path – Path to the downloaded file.

Return type

pathlib.Path

fname(interval)

Return the filename to which the data is saved for a given interval.

n.b. this does not in general have to be equal to the remote filename of the data.

Parameters

interval (sunpy.time.TimeRange) –

Returns

fname – Filename

Return type

str

abstract intervals(starttime, endtime)

The complete list of sub-intervals that cover a time range Each sub-interval is associated with a single file to be downloaded and read in.

Parameters
Returns

fnames – List of intervals

Return type

list of sunpy.time.TimeRange

static intervals_daily(starttime, endtime)
static intervals_monthly(starttime, endtime)

Returns all monthly intervals between starttime and endtime.

static intervals_yearly(starttime, endtime)

Returns all annual intervals between starttime and endtime.

load(starttime, endtime)

Load all data between starttime and endtime.

abstract load_local_file(interval)

Load local file for a given interval.

Parameters

interval (sunpy.time.TimeRange) –

Returns

data

Return type

pandas.DataFrame

abstract local_dir(interval)

Local directory for a given interval. This is relative to the base HelioPy data directory.

Parameters

interval (sunpy.time.TimeRange) –

Returns

dir – Local directory

Return type

pathlib.Path

local_file_exists(interval)

Return True if the local file exists.

local_hdf_path(interval)

Absolute path to a single .hdf file.

local_path(interval)

Absolute path to a single local file.