Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

General updates #71

Merged
merged 67 commits into from
Feb 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
67 commits
Select commit Hold shift + click to select a range
c016b31
Setup CI, v16.2, try to fix HDF5 issue, try fix outlined in Troublesh…
Matthew-Boyd Oct 29, 2021
fbce239
Setup CI, v16.3, try to fix HDF5 issue, try fix outlined in Troublesh…
Matthew-Boyd Oct 29, 2021
6e1a5bb
Setup CI, v16.4, try to fix HDF5 issue, try fix outlined in Troublesh…
Matthew-Boyd Oct 29, 2021
2b3a846
Setup CI, v16.5, try to fix HDF5 issue, try fix outlined in Troublesh…
Matthew-Boyd Oct 29, 2021
ccb2655
Setup CI, v16.6, try to fix HDF5 issue, try fix outlined in Troublesh…
Matthew-Boyd Oct 29, 2021
acdf864
Setup CI, v16.7, list installed toolboxes and addons
Matthew-Boyd Oct 29, 2021
9ac032f
Setup CI, v17, uninstall all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
026dcd4
Setup CI, v17.1, uninstall all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
0e01825
Setup CI, v17.2, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
768b788
Setup CI, v17.3, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
c08dd6e
Setup CI, v17.4, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
ae1719e
Setup CI, v17.5, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
e6f557b
Setup CI, v17.6, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
d257e54
Setup CI, v17.7, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
3931196
Setup CI, v17.8, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 29, 2021
36f2cf3
Setup CI, v17.9, toggle off all pre-installed toolboxes
Matthew-Boyd Oct 30, 2021
bf5c6e4
Setup CI, v17.10, list installed addons and toolboxes
Matthew-Boyd Nov 19, 2021
6fbcccb
Setup CI, v17.11, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
b2a4cb7
Setup CI, v17.12, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
5f88f7f
Setup CI, v17.13, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
911d772
Setup CI, v17.14, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
397a942
Setup CI, v17.15, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
1ea23f3
Setup CI, v17.16, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
915c814
Setup CI, v17.17, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
18b8f16
Setup CI, v17.18, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
6a3756c
Setup CI, v17.19, start uninstalling toolboxes
Matthew-Boyd Nov 19, 2021
05a7f7f
Setup CI, v17.20, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
2e6ef19
Setup CI, v17.21, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
4a1dce4
Setup CI, v17.22, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
57a4cc8
Setup CI, v17.23, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
f2e840f
Setup CI, v17.24, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
6e1ac94
Setup CI, v17.25, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
d8d344a
Setup CI, v17.26, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
e244857
Setup CI, v17.27, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
8dae0f6
Setup CI, v17.28, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
554c7cf
Setup CI, v17.29, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
37e48c7
Setup CI, v17.30, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
5468d0a
Setup CI, v17.31, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
7ad0acf
Setup CI, v17.32, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
3e8d32d
Setup CI, v17.33, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
351bc78
Setup CI, v17.34, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
b681055
Setup CI, v17.35, start uninstalling toolboxes
Matthew-Boyd Nov 20, 2021
cf5beca
updates to spectrum and elevation functions
rpauly18 Nov 22, 2021
bd12021
updating io paths
rpauly18 Nov 22, 2021
5ce0479
Setup CI, v18, simplify to most basic test
Matthew-Boyd Nov 23, 2021
c6b43fa
Setup CI, v19, install mhkit toolbox
Matthew-Boyd Nov 23, 2021
6931cab
Setup CI, v20, run a single test that uses mhkit
Matthew-Boyd Nov 23, 2021
5025e57
Setup CI, v21, run a single different test that uses mhkit
Matthew-Boyd Nov 23, 2021
7dc9f9e
Setup CI, v21.1, run a single different test that uses mhkit
Matthew-Boyd Nov 23, 2021
bb95e9a
Setup CI, v21.2, run a single different test that uses mhkit
Matthew-Boyd Nov 23, 2021
15eefe0
Add function to reload python in matlab after python code changes
Matthew-Boyd Nov 24, 2021
0cce6cf
Fix paths to python usgs and noaa functions
Matthew-Boyd Nov 25, 2021
8c0a3f4
Update pierson_moskowitz_spectrum wrapper with additional Hs parameter
Matthew-Boyd Nov 25, 2021
50dba0d
Update create_spectra with additional Hs parameter
Matthew-Boyd Nov 25, 2021
32012fa
Update tests fixing mostly broken relative file paths
Matthew-Boyd Nov 25, 2021
d17c5a3
Merge QC_Test into master (#63)
parangat94 Jan 24, 2022
deedd7e
Bug fix io request data (#78)
Matthew-Boyd Feb 8, 2022
45e15fd
Move CI Unit Tests to GitHub Actions (#80)
H0R5E Feb 10, 2022
0c6da14
resolving merge conflicts
rpauly18 Feb 18, 2022
8759c93
resolve merge conflict
rpauly18 Feb 18, 2022
fa1a7bf
resolving test issues
rpauly18 Feb 18, 2022
2a017f8
Add Windows MATLAB-Actions Runners (#81)
H0R5E Feb 24, 2022
3d94b54
Merge branch 'master' of github.com:MHKiT-Software/MHKiT-MATLAB into …
rpauly18 Feb 24, 2022
3d0c449
fixing tests
rpauly18 Feb 24, 2022
852077b
removing trouble test temporairly
rpauly18 Feb 25, 2022
83401dc
restarting tests
rpauly18 Feb 25, 2022
2d54892
updating python calls
rpauly18 Feb 25, 2022
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
35 changes: 19 additions & 16 deletions .github/workflows/unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@ name: Unit Tests

on:
push:
branches: [ master ]
branches: [ master, develop ]
pull_request:
branches: [ master ]
branches: [ master, develop ]

jobs:
main:
strategy:
fail-fast: false
matrix:
os: [macos-latest, ubuntu-latest] # windows-latest
os: [macos-latest, ubuntu-latest, windows-latest]
python-version: [3.7, 3.8, 3.9]
runs-on: ${{ matrix.os }}
env:
Expand All @@ -31,21 +31,24 @@ jobs:
with:
python-version: ${{ matrix.python-version }}
- name: Install mhkit module (from source)
run: python -m pip install -e . "matplotlib<3.4.2"
run: python -m pip install -e .
working-directory: ${{env.mhkit-python-dir}}
- name: Install mhkit-python-utils module
run: python -m pip install -e .
- name: Create MATLAB batch command
- name: Set MATLAB OutOfProcess Python execution mode
shell: bash
run: echo "pyenv('ExecutionMode', 'OutOfProcess')" > run.m
if: ${{ matrix.os == 'macos-latest' || matrix.os == 'ubuntu-latest' }}
- name: Add MATLAB test commands
shell: bash
run: echo "COMMAND=pyenv('ExecutionMode', 'OutOfProcess'),
version,
addpath(genpath('mhkit')),
import matlab.unittest.TestSuite,
import matlab.unittest.TestRunner,
testFolder = ['mhkit' filesep 'tests'],
suite = TestSuite.fromFolder(testFolder),
runner = TestRunner.withTextOutput,
results = runner.run(suite),
assertSuccess(results)" >> "$GITHUB_ENV"
run: echo "version,
addpath(genpath('mhkit')),
import matlab.unittest.TestSuite,
import matlab.unittest.TestRunner,
testFolder = ['mhkit' filesep 'tests'],
suite = TestSuite.fromFolder(testFolder),
runner = TestRunner.withTextOutput,
results = runner.run(suite),
assertSuccess(results)" >> run.m
- name: Install and test MHKiT-MATLAB
run: matlab -batch "${{ env.COMMAND }}"
run: matlab -batch "run"
3 changes: 3 additions & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,6 @@ Thumbs.db
*build
*.prj
.gitignore

# Test results
mhkit/tests/test_results/*
1 change: 1 addition & 0 deletions mhkit/river/IO/request_usgs_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -80,6 +80,7 @@
+ "&siteStatus=all";
end


% Display query
disp("Data request URL: " + data_url + api_query)

Expand Down
18 changes: 2 additions & 16 deletions mhkit/tests/Wave_TestResourceSpectrum.m
Original file line number Diff line number Diff line change
Expand Up @@ -7,26 +7,12 @@ function test_pierson_moskowitz_spectrum(testCase)
Obj.Tp = 8;
Obj.Hs = 2.5;

S = create_spectra('pierson_moskowitz_spectrum',Obj.f,Obj.Tp,Obj.Hs);
S = pierson_moskowitz_spectrum(Obj.f,Obj.Tp,Obj.Hs);
Tp0 = peak_period(S);
error = abs(Obj.Tp - Tp0)/Obj.Tp;
assertLessThan(testCase,error, 0.01);
end

% This test and function no longer in corresponding Python code
% function test_bretschneider_spectrum(testCase)
% Obj.f = 0.1/(2*pi):0.01/(2*pi):3.5/(2*pi);
% Obj.Tp = 8;
% Obj.Hs = 2.5;
%
% S = create_spectra('bretschneider_spectrum',Obj.f,Obj.Tp,Obj.Hs);
% Tp0 = peak_period(S);
% Hm0 = significant_wave_height(S);
% errorHm0 = abs(Obj.Tp - Tp0)/Obj.Tp;
% errorTp0 = abs(Obj.Hs - Hm0)/Obj.Hs;
% assertLessThan(testCase,errorHm0, 0.01);
% assertLessThan(testCase,errorTp0, 0.01);
% end

function test_surface_elevation_seed(testCase)
Obj.f = 0.1/(2*pi):0.01/(2*pi):3.5/(2*pi);
Expand Down Expand Up @@ -69,7 +55,7 @@ function test_surface_elevation_moments(testCase)
Obj.t = 0:0.05:Trep;
dt = Obj.t(2)-Obj.t(1);

S = create_spectra('jonswap_spectrum',Obj.f, Obj.Tp, Obj.Hs);
S = jonswap_spectrum(Obj.f, Obj.Tp, Obj.Hs);
wave_elevation = surface_elevation(S, Obj.t);
Sn = elevation_spectrum(wave_elevation.elevation, 1/dt,length(wave_elevation.elevation),Obj.t,"window","boxcar","detrend",false,"noverlap",0);
m0 = frequency_moment(S,0);
Expand Down
2 changes: 1 addition & 1 deletion mhkit/tests/runTests.m
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
runner.addPlugin(plugin);

% Add PDF
pdfFile = fullfile(testsFolder, 'test_results.pdf');
pdfFile = fullfile(htmlFolder, 'test_results.pdf');
plugin = TestReportPlugin.producingPDF(pdfFile);
runner.addPlugin(plugin);

Expand Down
4 changes: 2 additions & 2 deletions mhkit/tidal/graphics/plot_tidal_phase_exceedance.m
Original file line number Diff line number Diff line change
Expand Up @@ -98,9 +98,9 @@
py.importlib.import_module('scipy');
kwa = pyargs('bounds_error',false);

f_ebb = py.scipy.interpolate.interpolate.interp1d(s_ebb.Discharge,...
f_ebb = py.scipy.interpolate.interp1d(s_ebb.Discharge,...
F_ebb, kwa);
f_flood = py.scipy.interpolate.interpolate.interp1d(s_flood.Discharge,...
f_flood = py.scipy.interpolate.interp1d(s_flood.Discharge,...
F_flood, kwa);

F_ebb = double(f_ebb(s_new));
Expand Down
2 changes: 2 additions & 0 deletions mhkit/tidal/io/request_noaa_data.m
Original file line number Diff line number Diff line change
Expand Up @@ -90,6 +90,7 @@
elseif is_first_query
data = data_in_period;
is_first_query = false;

else
% Append to existing data structure
for i = 1:length(timeseries_fields)
Expand All @@ -100,6 +101,7 @@
end
end


start_period_datetime = end_period_datetime + days(1);
end

Expand Down
50 changes: 0 additions & 50 deletions mhkit/wave/resource/bretschneider_spectrum.m

This file was deleted.

93 changes: 0 additions & 93 deletions mhkit/wave/resource/create_spectra.m

This file was deleted.

1 change: 1 addition & 0 deletions mhkit/wave/resource/pierson_moskowitz_spectrum.m
Original file line number Diff line number Diff line change
Expand Up @@ -48,3 +48,4 @@
char_arr=char(S_py.index.values);
S.frequency=double(py.array.array('d',py.numpy.nditer(S_py.index))).';
S.Tp=Tp;
S.Hs = Hs;