Skip to content

Commit

Permalink
Merge pull request #280 from Jiangchao3/Projection
Browse files Browse the repository at this point in the history
update Gridded_to_Mesh_SeaBed_DepthAveraged.m to fix the infinite loop in using Cal_IT_Fric.m
  • Loading branch information
WPringle authored Feb 21, 2023
2 parents 56f6849 + 838a9ac commit e5a6ce9
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 1 deletion.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -169,6 +169,7 @@ The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/)
- `msh.offset63` struct and associated write/make routines for dynamicwaterlevel offset functionality. https://github.com/CHLNDDEV/OceanMesh2D/pull/259
- dynamicWaterLevelCorrection to fort.15 namelist, and PRBCKGRND option to met fort.15 namelist. https://github.com/CHLNDDEV/OceanMesh2D/pull/261
## Fixed
- updated `Gridded_to_Mesh_SeaBed_DepthAveraged.m` to fix the infinite loop in using `Cal_IT_Fric.m` by filling in the NaNs at greater depths with values from above. https://github.com/CHLNDDEV/OceanMesh2D/pull/280
- Recursive cleaning issues: infinite loop and preservation of fixed points.
- `msh.interp` method for `K` argument of length 1, and for the test to determine whether the bathymetry grid is irregular. https://github.com/CHLNDDEV/OceanMesh2D/pull/259
- Printing of namelist character strings or numbers. https://github.com/CHLNDDEV/OceanMesh2D/pull/261
Expand Down
33 changes: 32 additions & 1 deletion utilities/Gridded_to_Mesh_SeaBed_DepthAveraged.m
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,38 @@
% decreasing weights from bottom to surface)
%
% Author: William Pringle, CHL, Notre Dame University
% Created: 2017-9-28
% Created: 2017-9-28,
% Updated: 2023-02-15 by Jiangchao Qiu

%% updated Gridded_N_values.mat file regionally
% fill NaNs in the original N in the vertical direction by extrapolating
% all N values down the column using the nearest non-NaN value above

[~,index_lon_min] = min(abs(lon_N-min(lon_M)));
if lon_N(index_lon_min) > min(lon_M)
index_lon_min = index_lon_min - 1;
end
[~,index_lon_max] = min(abs(lon_N-max(lon_M)));
if lon_N(index_lon_max) < max(lon_M)
index_lon_max = index_lon_max + 1;
end
[~,index_lat_min] = min(abs(lat_N-min(lat_M)));
if lat_N(index_lat_min) > min(lat_M)
index_lat_min = index_lat_min - 1;
end
[~,index_lat_max] = min(abs(lat_N-max(lat_M)));
if lat_N(index_lat_max) < max(lat_M)
index_lat_max = index_lat_max + 1;
end

for i = index_lon_min:index_lon_max
for j = index_lat_min:index_lat_max
temp_vertical = N(i,j,:);
temp_vertical_new = fillmissing(temp_vertical,'previous');
N(i,j,:) = temp_vertical_new;
end
end
%%

if nargin == 7
fillNaN = 1;
Expand Down

0 comments on commit e5a6ce9

Please sign in to comment.