示例#1
0
def test_can_handle_query(time):
    LCClient = fermi_gbm.GBMClient()
    ans1 = LCClient._can_handle_query(time, a.Instrument.gbm)
    assert ans1 is True
    ans2 = LCClient._can_handle_query(time, a.Instrument.gbm, a.Detector.n5)
    assert ans2 is True
    ans3 = LCClient._can_handle_query(time, a.Instrument.gbm, a.Detector.n5,
                                      a.Resolution.ctime)
    assert ans3 is True
    ans4 = LCClient._can_handle_query(time)
    assert ans4 is False
示例#2
0
import pytest

from sunpy.time import parse_time
from sunpy.time.timerange import TimeRange
from sunpy.net.dataretriever.client import QueryResponse
import sunpy.net.dataretriever.sources.fermi_gbm as fermi_gbm
from sunpy.net.fido_factory import UnifiedResponse
from sunpy.net import Fido
from sunpy.net import attrs as a
from sunpy.net.tests.strategies import time_attr
from hypothesis import given

LCClient = fermi_gbm.GBMClient()


@pytest.mark.remote_data
@pytest.mark.parametrize("timerange,url_start,url_end",
                         [(TimeRange('2011/06/07', '2011/06/09'),
                          'https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/daily/2011/06/07/'
                          'current/glg_cspec_n5_110607_v00.pha',
                          'https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/daily/2011/06/09/'
                          'current/glg_cspec_n5_110609_v00.pha'),
                          (TimeRange('2016/09/09', '2016/09/11'),
                          'https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/daily/2016/09/09/'
                          'current/glg_cspec_n5_160909_v00.pha',
                          'https://heasarc.gsfc.nasa.gov/FTP/fermi/data/gbm/daily/'
                          '2016/09/11/current/glg_cspec_n5_160911_v00.pha')])
def test_get_url_for_time_range(timerange, url_start, url_end):
    urls = LCClient._get_url_for_timerange(timerange, detector='n5', resolution='cspec')
    assert isinstance(urls, list)
    assert urls[0] == url_start
示例#3
0
def LCClient():
    return fermi_gbm.GBMClient()