Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/develop' into upcrossing
Browse files Browse the repository at this point in the history
  • Loading branch information
MShabara committed Dec 16, 2024
2 parents 3a7662d + caf8263 commit 0605d34
Show file tree
Hide file tree
Showing 3 changed files with 31 additions and 93 deletions.
78 changes: 14 additions & 64 deletions .github/workflows/unix_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -36,25 +36,10 @@ jobs:
run: |
conda activate mhkit_conda_env
conda install numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4
# conda install netcdf4 hdf5
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

# - name: pip install mhkit module from source
# shell: bash -l {0}
# run: |
# conda activate mhkit_conda_env
# pip install -e .
# working-directory: ${{env.mhkit-python-dir}}

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -204,12 +189,6 @@ jobs:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

- name: Install & Setup Miniconda
uses: conda-incubator/setup-miniconda@v3
with:
Expand All @@ -225,41 +204,6 @@ jobs:
run: |
conda activate mhkit_conda_env
conda install numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4
# conda install netcdf4 hdf5
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
# - name: Setup Python ${{ matrix.python-version }}
# shell: bash -l {0}
# run: |
# conda create --name mhkit_conda_env python=${{ matrix.python-version }} numpy==1.24.4 cython pip pytest hdf5 libnetcdf cftime netcdf4 --strict-channel-priority
# conda activate mhkit_conda_env
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
# pip install -e . --no-deps --force-reinstall

# - name: Setup MHKiT Dependencies on macOS
# if: ${{ matrix.os == 'macos-13' }}
# run: brew install hdf5 netcdf

# - name: Setup MHKiT Dependencies on ubuntu
# run: sudo apt install libhdf5-serial-dev libnetcdf-dev
# if: ${{ matrix.os == 'ubuntu-latest' }}

# - name: Setup MHKiT Dependencies on ubuntu
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: |
# sudo apt update
# sudo apt upgrade
# sudo apt install build-essential

# - name: Print GCC Version
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: |
# gcc --version
# g++ --version

# - name: Setup MATLAB Path on Ubuntu
# if: ${{ matrix.os == 'ubuntu-latest' }}
# run: echo "export LD_LIBRARY_PATH=/usr/local/MATLAB/${{ matrix.matlab-version }}/sys/os/glnxa64" >> "$GITHUB_ENV"
- name: Setup MATLAB Path on Ubuntu
if: ${{ matrix.os == 'ubuntu-latest' }}
Expand All @@ -277,14 +221,6 @@ jobs:
conda activate mhkit_conda_env
python --version
# - name: pip install mhkit module from source
# working-directory: ${{env.mhkit-python-dir}}
# shell: bash -l {0}
# run: |
# conda activate mhkit_conda_env
# export PATH="${CONDA_PREFIX}/bin:${CONDA_PREFIX}/Library/bin:$PATH" # so setup.py finds nc-config
# pip install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -345,6 +281,16 @@ jobs:
with:
release: ${{ matrix.matlab-version }}

- name: Configure OpenSSL for MacOS/MATLAB
if: matrix.os == 'macos-13'
shell: bash -l {0}
run: |
conda activate mhkit_conda_env
conda install openssl=="3.0.*"
CONDA_LIB_PATH=$(python -c "import sys; import os; print(os.path.join(os.path.dirname(sys.executable), 'lib'))")
export DYLD_LIBRARY_PATH="$CONDA_LIB_PATH:$DYLD_LIBRARY_PATH"
echo "export DYLD_LIBRARY_PATH=$DYLD_LIBRARY_PATH" >> $GITHUB_ENV
- name: Add Python Dir to Path
shell: bash -l {0}
run: |
Expand All @@ -357,6 +303,10 @@ jobs:
run: |
conda activate mhkit_conda_env
printf 'pyenv(Version="%s", ExecutionMode="OutOfProcess")\n' $(python -c "import sys; print(sys.executable)") >> run.m
# Pass dynamic library paths to MATLAB only on macOS
if [[ $OSTYPE == "darwin"* ]]; then
echo "setenv('DYLD_LIBRARY_PATH', getenv('DYLD_LIBRARY_PATH'));" >> run.m
fi
- name: Add MATLAB test commands
shell: bash
Expand Down
24 changes: 0 additions & 24 deletions .github/workflows/windows_unit_tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,18 +37,6 @@ jobs:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

# - name: pip install mhkit from source
# working-directory: ${{env.mhkit-python-dir}}
# run: |
# conda activate mhkit_conda_env
# pip3 install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
Expand Down Expand Up @@ -194,18 +182,6 @@ jobs:
- name: Check out MHKiT-MATLAB
uses: actions/checkout@v4

# - name: Check out MHKiT-Python
# uses: actions/checkout@v4
# with:
# repository: "MHKiT-Software/MHKiT-Python"
# path: ${{env.mhkit-python-dir}}

# - name: pip install mhkit from source
# working-directory: ${{env.mhkit-python-dir}}
# run: |
# conda activate mhkit_conda_env
# pip3 install -e .

- name: pip install mhkit from pypi
shell: bash -l {0}
run: |
Expand Down
22 changes: 17 additions & 5 deletions mhkit/river/IO/delft_3d/delft_3d_get_all_time.m
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,24 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

if ~isa(delft_3d_py_object, 'py.netCDF4._netCDF4.Dataset')
error('MATLAB:delft_3d_get_all_time:InvalidInput', ...
'Invalid input Delft3D data type: `delft_3d_get_all_time` expects a `py.netCDF4._netCDF4.Dataset` object. Please use the `delft_3d_open_netcdf` function to convert Delft3D netCDF files for use with this function.');
end
if ~isa(delft_3d_py_object, 'py.netCDF4._netCDF4.Dataset')
error('MATLAB:delft_3d_get_all_time:InvalidInput', ...
'Invalid input Delft3D data type: `delft_3d_get_all_time` expects a `py.netCDF4._netCDF4.Dataset` object. Please use the `delft_3d_open_netcdf` function to convert Delft3D netCDF files for use with this function.');
end

python_result = py.mhkit.river.io.d3d.get_all_time(delft_3d_py_object);

result = double(python_result);
% Handle masked arrays using numpy.ma.getdata
if isa(python_result, 'py.numpy.ma.MaskedArray')
% Extract the underlying data
data_array = py.numpy.ma.getdata(python_result);
else
% Convert directly if not masked
data_array = py.numpy.array(python_result);
end

% Ensure data is of type float
float_array = data_array.astype('float');

result = double(float_array);
end

0 comments on commit 0605d34

Please sign in to comment.