CHLNDDEV / OceanMesh2D

A two-dimensional triangular mesh generator with pre- and post-processing utilities written in pure MATLAB (no toolboxes required) designed specifically to build models that solve shallow-water equations or wave equations in a coastal environment (ADCIRC, FVCOM, WaveWatch3, SWAN, SCHISM, Telemac, etc.).
https://github.com/sponsors/krober10nd
GNU General Public License v3.0
188 stars 68 forks source link

Add empty cell filter into Read_shapefile.m #315

Closed alexander0042 closed 5 months ago

alexander0042 commented 6 months ago

When shapefiles are edited in QGIS, empty indexes can sometimes be created, which crashes the script. This line adds a check to see if there are any empty cells and removes them.

krober10nd commented 6 months ago

Thanks, Alexander! Maybe also add a warning message to be output to the screen too?

krober10nd commented 6 months ago

Please also add the change to the changelog.

alexander0042 commented 6 months ago

Thanks for the quick reply! Added in a warning if applicable and edited the changelog to explain the change. I don't think this is a super common edge case, but it can definitely happen when shapefiles are modified in QGIS, so probably worth having the handling code.

Jiangchao3 commented 2 months ago

Hi @alexander0042 and @krober10nd,

I am trying to use the 'window'=20 to smooth the shoreline, but something is wrong like:

image

If I use the default 'window'=5, 6, 7, it works well. when larger than 8, the error occured.

I edited the shoreline in QGIS, I am not sure if the error here is same with what you met previously.

I also test it using the GSHHS_f_L1 shoreline with 'window'=20, no error occured.

I appreciate if you could give some suggestion.

Thanks.

Jiangchao

krober10nd commented 2 months ago

The window must be an odd integer since it’s a centered moving window.

Get Outlook for iOShttps://aka.ms/o0ukef


From: JiangchaoQiu @.> Sent: Wednesday, September 18, 2024 1:20:02 AM To: CHLNDDEV/OceanMesh2D @.> Cc: Keith Roberts @.>; Mention @.> Subject: Re: [CHLNDDEV/OceanMesh2D] Add empty cell filter into Read_shapefile.m (PR #315)

Hi @alexander0042https://github.com/alexander0042 and @krober10ndhttps://github.com/krober10nd,

I am trying to use the 'window'=20 to smooth the shoreline, but something is wrong like:

image.png (view on web)https://github.com/user-attachments/assets/58b056f6-0d25-47a6-a863-0d5216743fd7

If I use the default 'window'=5, it works well.

I edited the shoreline in QGIS, I am not sure if the error here is same with what you met previously.

I also test it using the GSHHS_f_L1 shoreline with 'window'=20, no error occured.

I appreciate if you could give some suggestion.

Thanks.

Jiangchao

— Reply to this email directly, view it on GitHubhttps://github.com/CHLNDDEV/OceanMesh2D/pull/315#issuecomment-2357165512, or unsubscribehttps://github.com/notifications/unsubscribe-auth/AEOBZ7GE2MUXEXW3NCBA5E3ZXC2KFAVCNFSM6AAAAABIQ5TUR2VHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDGNJXGE3DKNJRGI. You are receiving this because you were mentioned.Message ID: @.***>

Jiangchao3 commented 2 months ago

thanks @krober10nd