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:
Downloader.intervals()
: given a time interval, this method should split the interval up into sub-intervals. Each of these sub-intervals corresponds directly to a single file to download, store, and read in.Downloader.local_dir()
: given an interval, returns the local directory in which the file is stored.Downloader.fname()
: given an interval, returns the local filename in which the file is stored.Downloader.download()
: given an interval, download the data for that interval.Downloader.load_local_file()
: given an interval, load the local file and return apandas.DataFrame
object containing the data.
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
-
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
-
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
starttime (datetime.datetime) –
endtime (datetime.datetime) –
- 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
-
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
-
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.