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

Sort mesh indices before saving culled global ocean meshes #657

Merged
merged 1 commit into from
Aug 9, 2023
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 11 additions & 2 deletions compass/ocean/mesh/cull.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@
from mpas_tools.io import write_netcdf
from mpas_tools.logging import LoggingContext, check_call
from mpas_tools.mesh.conversion import cull
from mpas_tools.mesh.creation.sort_mesh import sort_mesh
from mpas_tools.mesh.mask import compute_mpas_flood_fill_mask
from mpas_tools.ocean import inject_bathymetry
from mpas_tools.ocean.coastline_alteration import (
Expand All @@ -19,6 +20,7 @@
)
from mpas_tools.viz.paraview_extractor import extract_vtk

from compass.model import make_graph_file
from compass.step import Step


Expand Down Expand Up @@ -365,11 +367,18 @@ def _cull_mesh_with_logging(logger, with_cavities, with_critical_passages,
logger=logger)

# cull the mesh a second time using a flood fill from the seed points
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask,
graphInfoFileName='culled_graph.info', logger=logger,
dsCulledMesh = cull(dsCulledMesh, dsInverse=dsSeedMask, logger=logger,
dir='.')

# sort the cell, edge and vertex indices for better performances
dsCulledMesh = sort_mesh(dsCulledMesh)

write_netcdf(dsCulledMesh, 'culled_mesh.nc')

# we need to make the graph file after sorting
make_graph_file(mesh_filename='culled_mesh.nc',
graph_filename='culled_graph.info')

if critical_passages:
# make a new version of the critical passages mask on the culled mesh
fcCritPassages.to_geojson('critical_passages.geojson')
Expand Down