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

Subset mesh #65

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open

Subset mesh #65

wants to merge 4 commits into from

Conversation

tomas19
Copy link

@tomas19 tomas19 commented May 29, 2023

I added a new Python script, oceanmesh/subset_mesh.py. It contains 11 functions, but for doing the subset of a mesh (fort.14) you only need to call subsetMesh. This last function calls the rest. I didn't provide a conda yml file, but the versions of the main packages are:

  • Pandas version: 1.4.3
  • Numpy version: 1.24.3
  • Rtree version: 1.0.1
  • Matplotlib version: 3.7.1
  • Geopandas version: 0.13.0
  • Shapely version: 2.0.1

The workflow follows the next steps:

  • Reads the original fort.14 nodes as a dataframe with readNodes
  • Reads the mask shapefile as a geopandas GeoDataFrame with readSubDomain (polygon covering the area we want to remove)
  • Removes the elements with centroid inside the mask and renumber the nodes with subsetMeshGdf
  • Reads the boundary conditions of the original fort.14 file with readOrgBC
  • Renumber the ocean boundary nodes with renumOceanBC
  • Renumber the closed land boundary (islands) nodes with renumClosedBCs
  • Renumber the mainland boundary nodes with renumMainlandBC
  • Writes the new fort.14 with writeFort14

Thanks, Tomas

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant