Comments (13)
Dear @Jiangchao3,
Perhaps you could pause the code when it appears "stuck" and see where it is? How long did you wait? This routine can become very costly.
from oceanmesh2d.
Hi @krober10nd , thanks for your kindly reply.
This time, I wait for about 5 minutes, pause it and enter the debug mode, find the code stuck in the following functions:
Gridded_to_Mesh_SeaBed_DepthAveraged:
I will continue to test the code.
from oceanmesh2d.
Hi @krober10nd, I think I found what the error lies:
in the function of Gridded_to_Mesh_SeaBed_DepthAveraged, it stuck in the iteration of zvalue = 82;
J is calculated as the following:
the result from the 54 line is a 12*1 NaN vector:
it seems that line 58 and 59 can not work when the input is a full NaN vector:
nothing can be fillmissing.
That may be why the Calc_IT_Fract stuck and can not move forward.
I also test the iteration zvalue = 81;
It's clear that the N_interp{zvalue}(J) is not a full NaN vector, so fillmissing in line 59 can work.
Hope the above description is clear to present the problem, thanks.
Finally, maybe the depth for each node is critical to calculate the IT fraction.
from oceanmesh2d.
Thanks Jiang. I think it's clear what the problem is now. When the interpolation returns back all missing values, it becomes stuck in an infinite loop. It would be helpful if @WPringle took a look at this since he is the creator of this script.
from oceanmesh2d.
Yeah, waiting for @WPringle have a look!
from oceanmesh2d.
@Jiangchao3 I see, so I guess the problem is partly with N
data being passed to the function, that there is too many NaNs at certain zcontour values. Perhaps then we need to fill NaNs in the N
data in the vertical direction too which could be done just using nearest neighbor from the zcontour value above. Can you try this?
The reason for this can be that the depth of the N
data at a certain location say goes to 1000 m but the mesh actually is at 1100 m, so at 1100 m the data has a NaN value but we want a value at the 1100 m contour on the mesh. A fix then is to extrapolate all the N values down the column using the nearest non-NaN value above. I think this may work better.
from oceanmesh2d.
@WPringle, thanks very much for your kindly reply. I am out of my office in recent days, I will check it after I come back!
from oceanmesh2d.
Dear @WPringle, today, I followed your suggestion to fix my Gridded_N_values.mat dataset. This is my code:
clearvars; clc;
load('H:\QJC\8-Github\OceanMesh2D_Jch\datasets\Gridded_N_values.mat')
%%% bangladesh
% lon from 60 to 110, (i from 960 to 1160)
% lat from 0 to 30, (j from 361 to 501)
for i = 960:1160
for j = 361:501
temp_vertical = N(i,j,:);
temp_vertical_new = fillmissing(temp_vertical,'previous');
N(i,j,:) = temp_vertical_new;
end
end
o_name = 'Gridded_N_values_new';
save([o_name '.mat'],'lon','lat','z','N');
Now, the Cal_IT_Fric function seems able to work well.
from oceanmesh2d.
Nice, thanks for letting me know!
I would welcome a PR to add this change into the function
from oceanmesh2d.
Sure, I will create a function called Calc_IT_Fric_fix_N.m and then add it into the unitities folder and add a note into the Calc_IT_Fric.m to remind users who meet with similar problem to know how to fix it.
from oceanmesh2d.
Could you just make the change directly to `Gridded_to_Mesh_SeaBed_DepthAveraged'?
from oceanmesh2d.
`Gridded_to_Mesh_SeaBed_DepthAveraged'?
Ok, let me have a try.
from oceanmesh2d.
Hi @WPringle , I have created a PR #280, please review.
from oceanmesh2d.
Related Issues (20)
- Mark to be removed triangles when using Fix_single_connec_edge_elements.m
- Additional package for converting .mat msh object into Telemac input files (slf and cli) HOT 4
- Thalweg data format HOT 1
- Error setup.sh link m_map HOT 1
- extra lines in fort.15 file! HOT 7
- make animation for fort.63.nc HOT 10
- meshgen.build Exiting early HOT 2
- Infinite loop when cleanup the mesh HOT 6
- Issue with using dynamic water level correction HOT 11
- Need for rapid changes in grid resolution HOT 4
- Issues with refining mesh in channels HOT 2
- Problem making fort.15 file for ADCIRC model in OceanMesh2D HOT 2
- Problem creating fort.13 file for ADCIRC model in OceanMesh2D HOT 3
- startup.sh HOT 2
- Issue regarding input files of ADCIRC model HOT 2
- How to specify the wind control and wind timestep parameters in Make_f15 function of OceanMesh2D? HOT 1
- How to make the fort.22 file for ADCIRC model? HOT 2
- Re-meshing patches function
- How to make a fort.15 file for NWS = 30 Blended GAHM & Background Gridded Wind and Pressure?
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
D3
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
-
Recommend Topics
-
javascript
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
-
web
Some thing interesting about web. New door for the world.
-
server
A server is a program made to process requests and deliver data to clients.
-
Machine learning
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from oceanmesh2d.