Comments (2)
to replicate :
# Note: global_stereo.shp has been generated using global_tag in pyposeidon
# https://github.com/ec-jrc/pyPoseidon/blob/9cfd3bbf5598c810004def83b1f43dc5149addd0/pyposeidon/boundary.py#L452
fname = os.path.join(os.path.dirname(__file__), "global", "global_latlon.shp")
fname2 = os.path.join(os.path.dirname(__file__), "global", "global_stereo.shp")
fnameDEM = os.path.join(os.path.dirname(__file__), "global", "dem.nc")
# it is necessary to define all the coastlines at once:
# the Shoreline class will the detect the biggest coastline (antartica and define it
# as the outside boundary)
EPSG = 4326 # EPSG:4326 or WGS84
bbox = (-180.00, 180.00, -89.00, 90.00)
extent = om.Region(extent=bbox, crs=4326)
min_edge_length = 0.5 # minimum mesh size in domain in meters
max_edge_length = 2 # maximum mesh size in domain in meters
shoreline = om.Shoreline(fname, extent.bbox, min_edge_length)
sdf = om.signed_distance_function(shoreline)
edge_length0 = om.distance_sizing_function(shoreline, rate=0.11)
edge_length1 = om.feature_sizing_function(
shoreline,
sdf,
min_edge_length=min_edge_length,
max_edge_length=max_edge_length,
crs=EPSG,
)
dem = om.DEM(fnameDEM, bbox=extent)
edge_length2 = om.wavelength_sizing_function(
dem,
wl=100,
period=12.42 * 3600,
min_edgelength=min_edge_length,
max_edge_length=max_edge_length,
crs=EPSG,
) # use the M2-tide period (in seconds)
edge_length3 = om.bathymetric_gradient_sizing_function(
dem,
slope_parameter=30.0,
min_edge_length=min_edge_length,
max_edge_length=max_edge_length,
crs=EPSG,
)
edge_length = om.compute_minimum(
[edge_length0, edge_length1, edge_length2, edge_length3]
)
edge_length = om.enforce_mesh_gradation(edge_length, gradation=0.11, stereo=True)
# once the size functions have been defined, wed need to mesh inside domain in
# stereographic projections. This is way we use another coastline which is
# already translated in a sterographic projection
shoreline_stereo = om.Shoreline(fname2, extent.bbox, min_edge_length, stereo=True)
domain = om.signed_distance_function(shoreline_stereo)
points, cells = om.generate_mesh(domain, edge_length, stereo=True, max_iter=100)
# remove degenerate mesh faces and other common problems in the mesh
points, cells = om.make_mesh_boundaries_traversable(points, cells)
points, cells = om.delete_faces_connected_to_one_face(points, cells)
# apply a Laplacian smoother
points, cells = om.laplacian2(points, cells, max_iter=100)
# plot
fig, ax, _ = edge_length.plot(
holding=True,
plot_colorbar=True,
stereo=True,
vmax=max_edge_length,
)
ax.triplot(points[:, 0], points[:, 1], cells, color="gray", linewidth=0.5)
shoreline_stereo.plot(ax=ax)
with dem.nc
obtained from the data
folder:
curl -L url https://www.dropbox.com/sh/nd2b012wrpt6qnq/AAAD7aA_qXztUhlT39YK2yBua?dl=1 > data.zip
then unzip as
unzip data.zip -d data/
from pyposeidon's Tutorial page
from oceanmesh.
this has been fixed with #71
from oceanmesh.
Related Issues (20)
- Update CI system
- implement geolayer
- Slack link no longer active HOT 1
- remove low valency elements
- Wavelength_sizing_function Error HOT 3
- Fix Mesh: Too many values to unpack
- Mesh resolution expanding from a point
- Support for reading in xy files HOT 1
- Question: How the meshgen works HOT 4
- Issue with DEM() HOT 4
- River meshing HOT 5
- Fix CI build system
- Problem with distance_sizing_function
- Implement CFL condition based on group velocity
- ESPG=4326 is not recognised HOT 3
- stereographic distortion close to the poles HOT 8
- black version update makes CI fail HOT 1
- CI fails - numpy version too high HOT 1
- Inquiry About Full Implementation of Matlab-Based Functions in Python Version of OceanMesh
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 oceanmesh.