-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Shane Maloney
committed
Oct 18, 2020
1 parent
474f855
commit 961f860
Showing
7 changed files
with
92 additions
and
30 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,4 @@ | ||
# Import to register with Fido but keep out of namespace | ||
from .sources.psp import RFRClient | ||
|
||
__all__ = ['RFHClient'] |
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Empty file.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,61 @@ | ||
import pytest | ||
|
||
from astropy.time import Time | ||
from sunpy.net import Fido | ||
from sunpy.net import attrs as a | ||
from sunpy.time.timerange import TimeRange | ||
|
||
from radiospectra.net.sources.psp import RFRClient | ||
|
||
client = RFRClient() | ||
|
||
|
||
@pytest.mark.remote_data | ||
def test_fido(): | ||
atr = a.Time('2019/10/01', '2019/11/01') | ||
res = Fido.search(atr, a.Instrument('rfr')) | ||
res0 = res.get_response(0) | ||
isinstance(res0.client, RFRClient) | ||
assert len(res0) == 31 | ||
res_time_range = res0.time_range() | ||
assert res_time_range.start.datetime == Time('2019-10-01T00:00').datetime | ||
assert res_time_range.end.datetime == Time('2019-11-02T00:00').datetime | ||
|
||
|
||
@pytest.mark.remote_data | ||
def test_get_url_for_time_range(): | ||
url_start = 'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_hfr/2019/' \ | ||
'psp_fld_l2_rfs_hfr_20191001_v02.cdf' | ||
url_end = 'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_hfr/2019/' \ | ||
'psp_fld_l2_rfs_hfr_20191015_v02.cdf' | ||
tr = TimeRange('2019/10/01', '2019/10/15') | ||
urls = client._get_url_for_timerange(tr) | ||
assert isinstance(urls, list) | ||
assert urls[0] == url_start | ||
assert urls[-1] == url_end | ||
|
||
|
||
def test_get_time_for_url(): | ||
urls = ['https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_hfr/2019/' | ||
'psp_fld_l2_rfs_hfr_20191001_v02.cdf', | ||
'https://spdf.gsfc.nasa.gov/pub/data/psp/fields/l2/rfs_hfr/2019/' | ||
'psp_fld_l2_rfs_hfr_20191015_v02.cdf'] | ||
|
||
times = client._get_time_for_url(urls) | ||
assert times[0] == TimeRange('2019-10-01', '2019-10-02') | ||
assert times[1] == TimeRange('2019-10-15', '2019-10-16') | ||
|
||
|
||
def test_can_handle_query(): | ||
atr = a.Time('2019/10/01', '2019/11/01') | ||
res = client._can_handle_query(atr, a.Instrument('rfr')) | ||
assert res is True | ||
res = client._can_handle_query(atr) | ||
assert res is False | ||
|
||
|
||
@pytest.mark.remote_data | ||
def test_get(): | ||
query = client.search(a.Time('2019/10/05', '2019/10/10'), a.Instrument('rfr')) | ||
download_list = client.fetch(query) | ||
assert len(download_list) == len(query) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -8,4 +8,3 @@ | |
|
||
from .callisto import CallistoSpectrogram | ||
from .swaves import SWavesSpectrogram | ||
from .psp import RFRClient |
This file was deleted.
Oops, something went wrong.