Comments (20)
Hi,
FYI my usual workflow in GRASS is to use:
g.region # to set grid bounds and resolution
r.in.xyz # to import x,y,z data into a raster map. it is very fast and can handle datasets that are many 100s of GB in size and 10s of billions of xyz points. good for lidar and multibeam bathymetry
r.surf.nnbathy # to interpolate over the gaps (an addon module *because it uses the Triangle library which is not GPL compatible)
r.mapcalc # to multiply it by -1 it so depth is positive. can also use the 'zscale' option during the r.in.xyz step
r.out.gdal # to export GeoTIFF
r.contour # to make coastline and maximum elevation limiting contour lines
v.out.ogr # to make shapefiles of those two contour lines
help pages:
https://grass.osgeo.org/grass78/manuals/g.region.html
https://grass.osgeo.org/grass78/manuals/r.in.xyz.html
https://grass.osgeo.org/grass78/manuals/addons/r.surf.nnbathy.html
If working with multibeam bathy data see also MB-Systems. It uses GMT internally to do its gridding and interpolation and can also handle truly massive datasets with grace and ease.
regards,
Hamish
from oceanmesh2d.
ps - I wrote this for contour lines -> DEM not xyz -> DEM, but it gives some good examples of how various interpolation techniques compare to each other; if it may be of interest.
https://grasswiki.osgeo.org/wiki/Contour_lines_to_DEM
from oceanmesh2d.
Hi @huyquangt
There is no formal way to use xyz data with the "interp" function.
It is very easy to interpolate xyz points to the mesh though:
- scatteredInterpolant:
F = scatteredInterpolant(x,y,z,'method'); % see help for method options
m.b = F(m.p); - Inverse distance weighting (with fixed radius 'rad')
m.b = IDW(x,y,z,m.p(:,1),m.p(:,2),-2,'fr',rad); %set IDW function attached
IDW.m.txt
Cheers!
from oceanmesh2d.
Hi Williams, thanks for a prompt reply π
Yes, I use scatterIterpolant quite often, but here during mesh generation I want to put constraints dt (timestep, CFL max,min) which require to have bathymetry data read by geodata(varargin)/ParseDEM(obj,varargin)/[xvn, yvn, zvn] = getdemvarnames(fname)...
I could convert scatter points into DEM data and write in a netcdf file, but the file would be very large as I need very a high resolution, so it is impractical for my case.
Is there another thought?
By the way, I still plan to play with your stuff, will keep you updated & stay safe!
Cheers
Huy
from oceanmesh2d.
Hey Huy,
If you want to do multiscale mesh generation around a localized area, the mesh size function can be nested with finer resolution boxes. See examples/Example_ECGC.
from oceanmesh2d.
Hi Keith,
Thanks for that π ... yes what I have been doing is similar to this.
As xyz scatter points cannot be handled in geodata at the present time, I end up with writting several bathymetry files with different resolutions.... so it is fine now..
Cheers,
Huy
from oceanmesh2d.
Hey Huy,
Just to clarify why we did not support xyz data from the beginning of the development of this tool is primarily because we do not want to build a mesh to build a mesh.
In the case of the unstructured xyz data, the only way to use this data for mesh generation is to form a TIN (triangulated irregular network) which is often a Delaunay triangulation. There are several downsides to doing this:
- Storage of the TIN is memory expensive
- Query time is significantly slower than a structured grid.
- Algorithmic complexity is more complex with a TIN. For example, the meshgen/private/smooth_outer.m relies on the topology of the structured grid to do the smoothing of nested sizing functions quickly.
and another point that we considered:
- Most available data are already DEMs placed on structured grids.
In my experience, survey data (xyz) tend to be less reliable.
And you point out, in your area(s) of interest you could create a structured grid and naively interpolate the xyz to the structured grid creating a DEM in a NETCDF file format. This could be done at several length scales to avoid the memory bottleneck that is inherent to structured grids. And finally, this (memory bottleneck w/ structured grids) is exactly why we developed the mutliscale meshing technique that allows nesting of several sizing function and largely disparate horizontal length scales.
from oceanmesh2d.
Awesome, Keith! Thank for a detailed explanation.. so I got several netcdf-DEM files with different resolutions to serve my multiscale meshes.
However, a "tidy" problem has arisen: when I specify two different regions for 2 different mesh scales, I often see a hole in the overlapping region as attached.
have you seen this before?
from oceanmesh2d.
Hey Huy,
yes, I've seen this before but I've never figured out why exactly it happens, to be honest. One thing that I've suspected in the past was that it was related to msh.clean(). If you could repeat the generation of the mesh without applying cleaning (set cleanup to 0 when calling mshgen) that could help us nail down the source of the bug.
from oceanmesh2d.
Hello Keith,
After playing with grid sizes, I found this issue often occurs when the grid size between two regions (scales) are large.. so my approach is to reduce the different in the grid size between two regions... so the unexpected holes could disappear! Do you want me to close this issue? Have a great weekend, mates!
from oceanmesh2d.
Huy,
That's interesting but did you try turning off the cleaning step? I suspect the sharp mesh size gradient between the nests leads to a poor quality element that's removed for some reason while performing the cleaning step.
Could you just test your examples if you haven't already without cleanup enabled and see what happens (even if you have a steep size gradient between nests)? Thanks and have a great weekend as well.
from oceanmesh2d.
Hi Keith,
what do you mean by turning off the cleaning step? sorry I missed your previous reply :))
does it mean not clear all in the script?
Cheers,
Huy
from oceanmesh2d.
Turn off mesh topology cleaning and error checking by setting the name value argument cleanup --> 0.
mshopts = meshgen('ef',fh,'bou',gdat,'cleanup',0);
from oceanmesh2d.
Thank you Keith,
Yes.. using cleanup = 0, the hole also disappeared!
from oceanmesh2d.
And this was with the original setup that produced the hole?
Could you please send the mesh when you did not apply the cleanup? I'd like to run some tests with it.
from oceanmesh2d.
Hi Keith,
Unfortunately, I can't share files to run my case as there are the licensed bathymetry data for our project attached to it in order to run the mesh. However, as I have seen this issue somewhere before, so I will revisit some meshes I have done which can be shared with you. I will email you when it ready.... Also I could also and some files in examples very soon... Stay safe! Cheers,
from oceanmesh2d.
from oceanmesh2d.
Hey Huy,
Just to clarify why we did not support xyz data from the beginning of the development of this tool is primarily because we do not want to build a mesh to build a mesh.
In the case of the unstructured xyz data, the only way to use this data for mesh generation is to form a TIN (triangulated irregular network) which is often a Delaunay triangulation. There are several downsides to doing this:
- Storage of the TIN is memory expensive
- Query time is significantly slower than a structured grid.
- Algorithmic complexity is more complex with a TIN. For example, the meshgen/private/smooth_outer.m relies on the topology of the structured grid to do the smoothing of nested sizing functions quickly.
and another point that we considered:
- Most available data are already DEMs placed on structured grids.
In my experience, survey data (xyz) tend to be less reliable.
And you point out, in your area(s) of interest you could create a structured grid and naively interpolate the xyz to the structured grid creating a DEM in a NETCDF file format. This could be done at several length scales to avoid the memory bottleneck that is inherent to structured grids. And finally, this (memory bottleneck w/ structured grids) is exactly why we developed the mutliscale meshing technique that allows nesting of several sizing function and largely disparate horizontal length scales.
Hi @@krober10nd and @huyquangt
Thank you very much for the discussion above, and it provided me with a good idea to solve my problem.
I am trying to build my own mesh with the Oceanmesh2d. I have the same problem as Huy, the bathymetry data I have obtained is also in the form of xyz scatter points. According to Roberts' suggestion, I should creat a structured grid and then interpolate the xyz to the grid creating a DEM in a NETCDF file format. However, there are various software or codes to do this work, as the following website shows: http://www.robertschneiders.de/meshgeneration/software.html#automesh2d. I have no idea to choose.
I want to know which tool can quickly and efficiently generate structured grids, so that I can continue to complete the interpolation and finally use it for the generation of unstructured grids with Oceanmesh2d. Can you recommend it for me? I will appreciate it very much.
Best wishes
Jiangchao
from oceanmesh2d.
So the way I've done in the past is to use grass with a weighted interpolation. See the section about sparse interpolation here https://grasswiki.osgeo.org/wiki/Interpolation then I export to a raster in netcdf format.
Maybe @HamishB can help out as he is one of the programmers of modules in GRASS.
from oceanmesh2d.
thanks very much, I have heard of this software, but have not used it. Let me have a try.
from oceanmesh2d.
Related Issues (20)
- Thalweg data format HOT 1
- Error setup.sh link m_map HOT 1
- Get stuck in using Cal_IT_Fric. HOT 13
- 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?
- Number of nodes and element change HOT 2
- Mesh dense changes significantly HOT 3
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.