-
Notifications
You must be signed in to change notification settings - Fork 18
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Unit test for IONEX functionalities (#80)
* Unit test for IONEX functionalities * Add ionex unit test data * adopt pytest fixtures * Allocate variables in conftest * rewrite Docker command * Test with pytest in circleci docker - moved copy of source after miniconda install * fix tec URL
- Loading branch information
Showing
8 changed files
with
11,595 additions
and
52 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
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
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
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 |
---|---|---|
|
@@ -6,5 +6,7 @@ gdal>=3 | |
lxml | ||
pandas | ||
pyproj | ||
pytest | ||
ruamel.yaml | ||
scipy | ||
yamale |
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
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,50 @@ | ||
import os | ||
import pytest | ||
import types | ||
|
||
from compass.utils import iono | ||
|
||
@pytest.fixture(scope='session') | ||
def ionex_params(download_data=True): | ||
''' | ||
Prepare IONEX data for unit test | ||
Parameters | ||
---------- | ||
download_data: bool | ||
Boolean flag allow to download TEC data | ||
for unit test if set to True | ||
Returns | ||
------- | ||
tec_file: str | ||
Path to local or downloaded TEC file to | ||
use in the unit test | ||
''' | ||
test_params = types.SimpleNamespace() | ||
|
||
# Set the path to fetch data for the test | ||
test_params.tec_dir = os.path.join(os.path.dirname(__file__), "data") | ||
test_params.date_str = '20151115' | ||
test_params.sol_code = 'jpl' | ||
|
||
# Create TEC directory | ||
os.makedirs(test_params.tec_dir, exist_ok=True) | ||
|
||
# Generate the TEC filename | ||
test_params.tec_file = iono.get_ionex_filename(test_params.date_str, | ||
tec_dir=test_params.tec_dir, | ||
sol_code=test_params.sol_code) | ||
|
||
# TODO figure out how to toggle download | ||
|
||
# If prep_mode=True, download data | ||
if download_data: | ||
if not os.path.isfile(test_params.tec_file): | ||
print(f'Download IONEX file at {test_params.date_str} from ' | ||
f'{test_params.sol_code} to {test_params.tec_dir}') | ||
test_params.tec_file = iono.download_ionex(test_params.date_str, | ||
test_params.tec_dir, | ||
sol_code=test_params.sol_code) | ||
|
||
return test_params |
Oops, something went wrong.