noaa-ocs-modeling / OCSMesh

OCSMesh is a mesh preparation tool for coastal ocean modeling applications.
https://noaa-ocs-modeling.github.io/OCSMesh/
Creative Commons Zero v1.0 Universal
12 stars 8 forks source link

Artifacts appear when decreasing expansion_rate #156

Open pierrechabert opened 3 months ago

pierrechabert commented 3 months ago

Hi @SorooshMani-NOAA,

Trying to develop a mesh from a GEBCO DEM (the DEM file is "gebco_2023_n47.0_s40.0_w-72.0_e-63.0.tif", from https://download.gebco.net/), some artifacts (on a zonal direction as shown on the image below) appear when I decrease the expansion rate (from 0.1 to 0.001) of the add_contour function (below is some meshing scripts). Is there any recommendations on how to get the artifacts removed and properly following the coastlines?

Thank you so much for any help !

Best, Pierre

target_size_min, target_size_max = 500, 10000  

hfun = ocsmesh.Hfun(
    deepcopy(rasters),
    hmin=target_size_min,
    hmax=target_size_max,
    base_shape=base_shape,
    base_shape_crs=domain_crs,
)

hfun.add_contour(
    level=0,
    target_size=target_size_min,
    expansion_rate=0.001,
)

hfun.add_constant_value(
    value=target_size_min,
    lower_bound=0,
)

driver = ocsmesh.JigsawDriver(geom, hfun, initial_mesh=False)
mesh = driver.run()

plot_mesh_edge(mesh.msh_t, lw=0.2)

Screenshot 2024-06-17 at 3 01 11 PM

SorooshMani-NOAA commented 3 months ago

Also

Concerning the error when trying to lower the libraries version, I found that the GEOS one needs a recent version

mesh = driver.run()

Results in

UnsupportedGEOSVersionError: The "iso" option requires at least GEOS 3.10.0
SorooshMani-NOAA commented 3 months ago

My suggestion is trying a version of matplotlib and python that is compatible with newer version of GEOS. But I haven't recently installed so I'm not sure which version aligns with which other

felicio93 commented 3 months ago

Hi @pierrechabert and @SorooshMani-NOAA.

Here is a conda env package list that works: matplotlib 3.8.4 pypi_0 pypi geos 3.12.1 h1537add_0 conda-forge python 3.9.19 h4de0772_0_cpython conda-forge

sorry, I checked and this is the actual list: matplotlib 3.5.2 py39haa95532_0 geos 3.11.1 h1537add_0 conda-forge python 3.9.0 h7840368_5_cpython conda-forge

Also, I am at this moment working on the contour line problem (which seems to be caused by the collections attribute deprecation in version > 3.8). @pierrechabert I will make sure I keep you in the loop once we have a permanent solution.

felicio93 commented 3 months ago

Permanent solution added to the latest OCSMesh version (v1.5.6).

Please updated OCSMesh with the latest version

pierrechabert commented 3 months ago

The artifacts no longer appear, thank you so much !