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

update Gridded_to_Mesh_SeaBed_DepthAveraged.m to fix the infinite loop in using Cal_IT_Fric.m #280

Merged
merged 19 commits into from
Feb 21, 2023

Conversation

Jiangchao3
Copy link
Contributor

The IT calculation process sometimes gets stuck in an infinite loop when using the original N data. Here NaNs in the originally generated N data in the vertical direction are firstly filled by extrapolating all N values down the column using the nearest non-NaN value above.

Jiangchao3 and others added 17 commits September 13, 2020 09:39
adding plot numticks option to `plot(m,'b')` (CHLNDDEV#165)
update for making a riverine boundary
The IT calculation process sometimes gets stuck in an infinite loop when using the original N data. Here NaNs in the originally generated N data in the vertical direction are firstly filled by extrapolating all N values down the column using the nearest non-NaN value above.
Copy link
Collaborator

@WPringle WPringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm wondering about these lines:

 [~,index_lon_min] = min(abs(lon_N-min(lon_M)));
 [~,index_lon_max] = min(abs(lon_N-max(lon_M)));
 [~,index_lat_min] = min(abs(lat_N-min(lat_M)));
 [~,index_lat_max] = min(abs(lat_N-max(lat_M)));

With the use of the abs() of the difference then the difference could be negative and therefore would not encompass the full extents of lat_M, lon_M.
For example, for
[~,index_lat_max] = min(abs(lat_N-max(lat_M)));
if lat_N = [4.5, 4.9, 5.2], and max(lat_M) = 5 then the smallest absolute difference is for lat_N = 4.9, but that is less than max(lat_M) = 5.
So as a post-processing we would want to add 1 to index_lat_max to have that at the 5.2 value, right? I think need to test that if lat_N(index_lat_max) < max(lat_M) then add 1 (assuming that index_lat_max < length(lat_N)).
Similar post-processing should be done for all four indices.

add if conditions to address the boundary values
@Jiangchao3
Copy link
Contributor Author

Hi @WPringle, agree with you and I add four if-end conditions to address the boundary values. Please review. Thanks.

Copy link
Collaborator

@WPringle WPringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good thank you!

@krober10nd
Copy link
Collaborator

Change log and link PR.

@WPringle WPringle merged commit e5a6ce9 into CHLNDDEV:Projection Feb 21, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants