-
Notifications
You must be signed in to change notification settings - Fork 5
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #42 from GeoscienceAustralia/tests
Add first iteration of tests to repo
- Loading branch information
Showing
13 changed files
with
145 additions
and
42 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,8 @@ | ||
ignore: | ||
- "intertidal/validation.py" | ||
- "intertidal/composites.py" | ||
|
||
coverage: | ||
precision: 1 | ||
round: down | ||
range: "50...90" |
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,4 +6,8 @@ | |
!*.ipynb | ||
!*.sh | ||
!*.yaml | ||
!*.gitignore | ||
!*.yml | ||
!*.in | ||
!*.gitignore | ||
!*.dockerignore | ||
!*Dockerfile |
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
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
Empty file.
Binary file not shown.
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,53 @@ | ||
import pytest | ||
from click.testing import CliRunner | ||
from intertidal.elevation import intertidal_cli, elevation | ||
import pickle | ||
|
||
|
||
@pytest.fixture() | ||
def satellite_ds(): | ||
with open("tests/data/satellite_ds.pickle", "rb") as handle: | ||
return pickle.load(handle) | ||
|
||
|
||
def test_intertidal_cli(): | ||
runner = CliRunner() | ||
result = runner.invoke( | ||
intertidal_cli, | ||
[ | ||
"--study_area", | ||
"testing", | ||
"--start_date", | ||
"2020", | ||
"--end_date", | ||
"2022", | ||
"--modelled_freq", | ||
"3h", | ||
], | ||
) | ||
assert result.exit_code == 0 | ||
|
||
|
||
def test_elevation(satellite_ds): | ||
ds, ds_aux, tide_m = elevation( | ||
satellite_ds, | ||
valid_mask=None, | ||
ndwi_thresh=0.1, | ||
min_freq=0.01, | ||
max_freq=0.99, | ||
min_correlation=0.15, | ||
windows_n=20, | ||
window_prop_tide=0.15, | ||
max_workers=None, | ||
tide_model="FES2014", | ||
tide_model_dir="/var/share/tide_models", | ||
study_area=None, | ||
log=None, | ||
) | ||
|
||
# Verify that ds contains correct variables | ||
assert "elevation" in ds.data_vars | ||
assert "elevation_uncertainty" in ds.data_vars | ||
|
||
# Verify that ds is a single layer | ||
assert "time" not in ds.dims |