Skip to content

Conversation

@krober10nd
Copy link
Collaborator

@krober10nd krober10nd commented Jan 26, 2021

  • Elements/vertices can be trimmed inside polygons based on topobathymetry.
  • This is particularly useful when triming components of the floodplain that aren't likely to be flooded.
  • For example here I trim a region of the floodplain (> -1 m above the geoid) located in a polygon and remap all the attributes (nodal attributes and boundaries) back to the trimmed mesh.
polygon = [define polygon coordinates here]; 
[sub,ind]=extract_subdomain(m, polygon,1,0,-1,-1);
sub = map_mesh_properties(sub,ind);

Note this maps all nodal attributes to the subdomain. For example, if the parent mesh had a directional wind stress nodal attribute, now the subdomain does too.

plot(sub,'type','dir','proj','lamb');

* Elements/vertices can be trimmed inside polygons based on topobathymetry.
@krober10nd
Copy link
Collaborator Author

Perhaps the kwargs of extract_subdomain could be specified as name/value pairs instead of fixed position args.

@WPringle
Copy link
Collaborator

Yes I agree we should change the kwarg to name/value pairs. Also can you have threshold work both ways or as a range. Often I want to do it so only elements shallower than 250 m are kept, i.e., only continental shelf.

@krober10nd
Copy link
Collaborator Author

krober10nd commented Jan 26, 2021

Yes I agree we should change the kwarg to name/value pairs. Also can you have threshold work both ways or as a range. Often I want to do it so only elements shallower than 250 m are kept, i.e., only continental shelf.

Sure that's reasonable. Also, when you do the extraction, you might want to remove singly connected elements there.

Singly elements can be deleted using msh.clean

Copy link
Collaborator

@WPringle WPringle left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can the threshold parameter be a bit more clearer and also allow for options both ways?
How about change to two parameters, min_depth and max_depth which are easier to understand and also allows for doing a range

@WPringle
Copy link
Collaborator

Ok I'm still a little confused about the the description of min_depth and max_depth on the help and how it is actually implemented. I think the way it is implemented is correct; so that if depth is less than the max_depth and more than the min_depth and inside the polygon then it is trimmed. But help is saying max_depth is to keep parts that are sufficiently deep when it should be other way around. Keep the parts that are shallower than max_depth and deeper than min_depth right?

@WPringle
Copy link
Collaborator

and change the if statement to be max_depth ~= +9999 rather than negative

@WPringle
Copy link
Collaborator

WPringle commented Jan 29, 2021

Can change the max_depth to be sufficiently shallow and min_depth to be sufficiently deep on the help?

@krober10nd krober10nd merged commit 0de7043 into Projection Jan 29, 2021
@krober10nd krober10nd deleted the improve_extract_subdomain branch January 29, 2021 18:41
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.

3 participants