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

Polygon-Based Data Cropping #87

Open
AtiehAlipour-NOAA opened this issue Apr 4, 2024 · 6 comments
Open

Polygon-Based Data Cropping #87

AtiehAlipour-NOAA opened this issue Apr 4, 2024 · 6 comments

Comments

@AtiehAlipour-NOAA
Copy link

Hi, I have a question: do we need to adjust this part of the code to use a polygon like the one below for cropping the data? Thanks!

polygon = array ([[271.09419606, 30.29241252],
[270.80483714, 30.47217758],
[270.31435613, 30.35380055],
[269.89991289, 30.0740687 ],
[269.9734827 , 29.72115943],
[270.38302128, 29.34776829],
[270.5129946 , 28.86997287],
[270.96177041, 28.87641531],
[271.38357063, 29.16376929],
[271.45468811, 29.68281716],
[271.68765915, 29.83609834],
[271.65087425, 29.96790232],
[271.09419606, 30.29241252]])

@pmav99
Copy link
Collaborator

pmav99 commented Apr 4, 2024

You will need to update the implementation too. As it is it will only work with rectangular regions. For a polygon you will need to use some shapely method like https://shapely.readthedocs.io/en/stable/reference/shapely.contains.html or geopandas sjoin: https://geopandas.org/en/stable/docs/reference/api/geopandas.sjoin.html.

And you will need to check performance for large meshes. The pure numpy implementation we have here is probably faster than the alternatives. Nevertheless, try to get something working and if performance proves to be problematic you can investigate making it faster afterwards (e.g. leverage numba or something).

@josephzhang8
Copy link
Collaborator

I cannot find Searvey anymroe; anyone? Thx.

@AtiehAlipour-NOAA
Copy link
Author

You will need to update the implementation too. As it is it will only work with rectangular regions. For a polygon you will need to use some shapely method like https://shapely.readthedocs.io/en/stable/reference/shapely.contains.html or geopandas sjoin: https://geopandas.org/en/stable/docs/reference/api/geopandas.sjoin.html.

And you will need to check performance for large meshes. The pure numpy implementation we have here is probably faster than the alternatives. Nevertheless, try to get something working and if performance proves to be problematic you can investigate making it faster afterwards (e.g. leverage numba or something).

Thanks for the quick response and the detailed explanation. For now, I am using a rectangle region but I wanted to confirm if there's a possibility to switch to a polygon later on. Thanks once again.

@AtiehAlipour-NOAA
Copy link
Author

I cannot find Searvey anymroe; anyone? Thx.

Hi, please check here: https://github.com/oceanmodeling/searvey

@josephzhang8
Copy link
Collaborator

Thx, Atieh!

@pmav99
Copy link
Collaborator

pmav99 commented May 29, 2024

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

No branches or pull requests

3 participants