本文整理汇总了Python中sunpy.net.Fido.search方法的典型用法代码示例。如果您正苦于以下问题:Python Fido.search方法的具体用法?Python Fido.search怎么用?Python Fido.search使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类sunpy.net.Fido
的用法示例。
在下文中一共展示了Fido.search方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: test_no_time_error
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_no_time_error():
query = (a.Instrument('EVE'), a.Level(0))
with pytest.raises(ValueError) as excinfo:
Fido.search(*query)
assert all(str(a) in str(excinfo.value) for a in query)
query1 = (a.Instrument('EVE') & a.Level(0))
query2 = (a.Time("2012/1/1", "2012/1/2") & a.Instrument("AIA"))
with pytest.raises(ValueError) as excinfo:
Fido.search(query1 | query2)
assert all(str(a) in str(excinfo.value) for a in query1.attrs)
assert all(str(a) not in str(excinfo.value) for a in query2.attrs)
示例2: test_unifiedresponse_slicing_reverse
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_unifiedresponse_slicing_reverse():
results = Fido.search(
a.Time("2012/1/1", "2012/1/5"), a.Instrument("lyra"))
assert isinstance(results[::-1], UnifiedResponse)
assert len(results[::-1]) == len(results)
assert isinstance(results[0, ::-1], UnifiedResponse)
assert results[0, ::-1]._list[0] == results._list[0][::-1]
示例3: test_fido_indexing
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_fido_indexing(queries):
query1, query2 = queries
# This is a work around for an aberration where the filter was not catching
# this.
assume(query1.attrs[1].start != query2.attrs[1].start)
res = Fido.search(query1 | query2)
assert len(res) == 2
assert len(res[0]) == 1
assert len(res[1]) == 1
aa = res[0, 0]
assert isinstance(aa, UnifiedResponse)
assert len(aa) == 1
assert len(aa.get_response(0)) == 1
aa = res[:, 0]
assert isinstance(aa, UnifiedResponse)
assert len(aa) == 2
assert len(aa.get_response(0)) == 1
aa = res[0, :]
assert isinstance(aa, UnifiedResponse)
assert len(aa) == 1
with pytest.raises(IndexError):
res[0, 0, 0]
with pytest.raises(IndexError):
res["saldkal"]
with pytest.raises(IndexError):
res[1.0132]
示例4: test_save_path
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_save_path():
with tempfile.TemporaryDirectory() as target_dir:
qr = Fido.search(a.Instrument('EVE'), a.Time("2016/10/01", "2016/10/02"), a.Level(0))
files = Fido.fetch(qr, path=os.path.join(target_dir, "{instrument}"+os.path.sep+"{level}"))
for f in files:
assert target_dir in f
assert "eve{}0".format(os.path.sep) in f
示例5: test_client_fetch_wrong_type
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_client_fetch_wrong_type(mock_fetch):
query = a.Time("2011/01/01", "2011/01/02") & a.Instrument("goes")
qr = Fido.search(query)
with pytest.raises(TypeError):
Fido.fetch(qr)
示例6: test_unified_response
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_unified_response():
start = parse_time("2012/1/1")
end = parse_time("2012/1/2")
qr = Fido.search(a.Instrument('EVE'), a.Level(0), a.Time(start, end))
assert qr.file_num == 2
strings = ['eve', 'SDO', start.strftime(TIMEFORMAT), end.strftime(TIMEFORMAT)]
assert all(s in qr._repr_html_() for s in strings)
示例7: test_fido
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_fido(query):
qr = Fido.search(query)
client = qr.get_response(0).client
assert isinstance(qr, UnifiedResponse)
assert isinstance(client, eve.EVEClient)
response = Fido.fetch(qr)
assert len(response) == qr._numfile
示例8: test_fido
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_fido(mock_fetch):
qr = Fido.search(a.Time("2012/10/4", "2012/10/6"),
a.Instrument('noaa-indices'))
assert isinstance(qr, UnifiedResponse)
response = Fido.fetch(qr)
assert len(response) == qr._numfile
示例9: test_no_wait_fetch
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_no_wait_fetch():
qr = Fido.search(a.Instrument('EVE'),
a.Time("2016/10/01", "2016/10/02"),
a.Level(0))
res = Fido.fetch(qr, wait=False)
assert isinstance(res, DownloadResponse)
assert isinstance(res.wait(), list)
示例10: test_responses
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_responses():
results = Fido.search(
a.Time("2012/1/1", "2012/1/5"), a.Instrument("lyra"))
for i, resp in enumerate(results.responses):
assert isinstance(resp, QueryResponse)
assert i + 1 == len(results)
示例11: test_save_path
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_save_path(tmpdir):
qr = Fido.search(a.Instrument('EVE'), a.Time("2016/10/01", "2016/10/02"), a.Level(0))
# Test when path is str
files = Fido.fetch(qr, path=str(tmpdir / "{instrument}" / "{level}"))
for f in files:
assert str(tmpdir) in f
assert "eve{}0".format(os.path.sep) in f
示例12: test_repr
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_repr():
results = Fido.search(
a.Time("2012/1/1", "2012/1/5"), a.Instrument("lyra"))
rep = repr(results)
rep = rep.split('\n')
# 6 header lines, the results table and two blank lines at the end
assert len(rep) == 7 + len(list(results.responses)[0]) + 2
示例13: test_levels
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_levels(time):
"""
Test the correct handling of level 0 / 1.
The default should be level 1 from VSO, level 0 comes from EVEClient.
"""
eve_a = a.Instrument('EVE')
qr = Fido.search(time, eve_a)
client = qr.get_response(0).client
assert isinstance(client, VSOClient)
qr = Fido.search(time, eve_a, a.Level(0))
client = qr.get_response(0).client
assert isinstance(client, eve.EVEClient)
qr = Fido.search(time, eve_a, a.Level(0) | a.Level(1))
clients = {type(a.client) for a in qr.responses}
assert clients.symmetric_difference({VSOClient, eve.EVEClient}) == set()
示例14: test_multiple_match
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_multiple_match():
"""
Using the builtin clients a multiple match is not possible so we create a
dummy class.
"""
new_registry = copy.deepcopy(Fido.registry)
Fido.registry = new_registry
class DummyClient():
@classmethod
def _can_handle_query(cls, *query):
return True
Fido.registry.update({DummyClient: DummyClient._can_handle_query})
with pytest.raises(MultipleMatchError):
Fido.search(a.Time("2016/10/1", "2016/10/2"), a.Instrument('lyra'))
Fido.registry = CLIENTS
示例15: test_add_entries_from_fido_search_result_JSOC_client
# 需要导入模块: from sunpy.net import Fido [as 别名]
# 或者: from sunpy.net.Fido import search [as 别名]
def test_add_entries_from_fido_search_result_JSOC_client(database):
assert len(database) == 0
search_result = Fido.search(
net_attrs.jsoc.Time('2014-01-01T00:00:00', '2014-01-01T01:00:00'),
net_attrs.jsoc.Series('hmi.m_45s'),
net_attrs.jsoc.Notify("[email protected]")
)
with pytest.raises(ValueError):
database.add_from_fido_search_result(search_result)