Skip to content

Commit

Permalink
Actions: Convert d3d.get_all_time output to a list
Browse files Browse the repository at this point in the history
Fix for this error on windows, python 3.10

```
  Error occurred in River_TestIO_Delft/testGetAllDataPoints and it did not run to completion.
      ---------
      Error ID:
      ---------
      'MATLAB:Python:ConverterError'
      --------------
      Error Details:
      --------------
      Error using py.numpy.ndarray/double
      Conversion of Python 'ndarray' type to MATLAB 'double' is only supported for real numbers and logicals.

      Error in delft_3d_get_all_time (line 26)
          result = double(python_result);

      Error in River_TestIO_Delft/testGetAllDataPoints (line 107)
                  run_timestamps = delft_3d_get_all_time(data);
```
  • Loading branch information
simmsa committed Dec 4, 2024
1 parent bfe70c7 commit e051a46
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 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,15 +16,17 @@
%
%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%

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);

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

disp(python_result);
disp(class(python_result));
disp(python_result);
disp(class(python_result));

result = double(python_result);
result = double(python_result);
end

0 comments on commit e051a46

Please sign in to comment.