Beispiel #1
0
def get_obssumm_file(time_range):
    """
    Download the RHESSI observing summary data from one of the RHESSI
    servers.

    Parameters
    ----------
    time_range : `str`, `sunpy.time.TimeRange`
        A TimeRange or time range compatible string

    Returns
    -------
    out : tuple
        Return a tuple (filename, headers) where filename is the local file
        name under which the object can be found, and headers is
        whatever the info() method of the object returned by urlopen.

    Examples
    --------
    >>> import sunpy.instr.rhessi as rhessi
    >>> fname, hdrs = rhessi.get_obssumm_file(('2011/04/04', '2011/04/05'))   # doctest: +REMOTE_DATA

    .. note::
        This API is currently limited to providing data from whole days only.

    """
    _check_one_day(TimeRange(time_range))

    filenames = get_obssum_filename(time_range)

    # As we only support providing data from one whole day, only get the first file
    return urlretrieve(filenames[0])
Beispiel #2
0
def get_obssumm_file(time_range):
    """
    Download the RHESSI observing summary data from one of the RHESSI
    servers.

    Parameters
    ----------
    time_range : `str`, `sunpy.time.TimeRange`
        A TimeRange or time range compatible string

    Returns
    -------
    out : tuple
        Return a tuple (filename, headers) where filename is the local file
        name under which the object can be found, and headers is
        whatever the info() method of the object returned by urlopen.

    Examples
    --------
    >>> import sunpy.instr.rhessi as rhessi
    >>> fname, hdrs = rhessi.get_obssumm_file(('2011/04/04', '2011/04/05'))   # doctest: +SKIP

    .. note::
        This API is currently limited to providing data from whole days only.

    """
    _check_one_day(TimeRange(time_range))

    filenames = get_obssum_filename(time_range)

    # As we only support providing data from one whole day, only get the first file
    return urlretrieve(filenames[0])
Beispiel #3
0
def get_obssumm_dbase_file(time_range):
    """
    Download the RHESSI observing summary database file. This file lists the
    name of observing summary files for specific time ranges.

    Parameters
    ----------
    time_range : `str`, `sunpy.time.TimeRange`
        A `~sunpy.time.TimeRange` or `~sunpy.time.TimeRange` compatible string.

    Returns
    -------
    value : `tuple`
        Return a `tuple` (filename, headers) where filename is the local file
        name under which the object can be found, and headers is
        whatever the info() method of the object returned by urlopen.

    Examples
    --------
    >>> import sunpy.instr.rhessi as rhessi
    >>> fname, hdrs = rhessi.get_obssumm_dbase_file(('2011/04/04', '2011/04/05'))   # doctest: +SKIP

    References
    ----------
    | https://hesperia.gsfc.nasa.gov/ssw/hessi/doc/guides/hessi_data_access.htm#Observing%20Summary%20Data

    .. note::
        This API is currently limited to providing data from whole days only.

    """
    _time_range = TimeRange(time_range)

    if _time_range.start < parse_time("2002/02/01"):
        raise ValueError(
            "RHESSI summary files are not available for before 2002-02-01")

    _check_one_day(_time_range)

    url = posixpath.join(
        get_base_url(), 'dbase',
        _time_range.start.strftime("hsi_obssumm_filedb_%Y%m.txt"))

    return urlretrieve(url)
Beispiel #4
0
def get_obssumm_dbase_file(time_range):
    """
    Download the RHESSI observing summary database file. This file lists the
    name of observing summary files for specific time ranges.

    Parameters
    ----------
    time_range : `str`, `sunpy.time.TimeRange`
        A `~sunpy.time.TimeRange` or `~sunpy.time.TimeRange` compatible string.

    Returns
    -------
    value : `tuple`
        Return a `tuple` (filename, headers) where filename is the local file
        name under which the object can be found, and headers is
        whatever the info() method of the object returned by urlopen.

    Examples
    --------
    >>> import sunpy.instr.rhessi as rhessi
    >>> fname, hdrs = rhessi.get_obssumm_dbase_file(('2011/04/04', '2011/04/05'))   # doctest: +REMOTE_DATA

    References
    ----------
    | https://hesperia.gsfc.nasa.gov/ssw/hessi/doc/guides/hessi_data_access.htm#Observing%20Summary%20Data

    .. note::
        This API is currently limited to providing data from whole days only.

    """
    _time_range = TimeRange(time_range)

    if _time_range.start < parse_time("2002/02/01"):
        raise ValueError("RHESSI summary files are not available for before 2002-02-01")

    _check_one_day(_time_range)

    url = posixpath.join(get_base_url(), 'dbase',
                         _time_range.start.strftime("hsi_obssumm_filedb_%Y%m.txt"))

    return urlretrieve(url)