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

Getting gridded data #1

Closed
bjorkqvi opened this issue Feb 27, 2024 · 4 comments
Closed

Getting gridded data #1

bjorkqvi opened this issue Feb 27, 2024 · 4 comments

Comments

@bjorkqvi
Copy link

I have been needing a python friendly way to read in GEBCO bathymetry data, and this seems to be really close to what I need.

As I see it, this command ('https://api.odb.ntu.edu.tw/gebco?lon=4,6&lat=60.0,59.0&mode=row') gives me a NE-SW slice with 15-arcsec resolution. Is there a way to get the data gridded for that area with the same 15-arcsec resolution in both lon and lat direction?

I could trivially read a lot of slices, but then I need to specify the resolution, and it seems like a bit of a hack.

Thanks!

@cywhale
Copy link
Owner

cywhale commented Feb 28, 2024

Please try polygon mode that specified by GeoJSON in jsonsrc parameter

https://api.odb.ntu.edu.tw/gebco?mode=zonly&sample=1&jsonsrc={"type": "Polygon", "coordinates": [[ [4, 60.0], [6, 60.0], [6, 59.0], [4, 59.0], [4, 60.0]]]}

Here zonly in mode means output z data only, no pairwise distance, optional. In polygon mode, we would not output pairwise distance, so it should speedup processing. Add row in the parameter mode separated by comma if you need this format (i.e., ?mode=zonly,row)
The parameter sample for polygon mode is default 5, means down-sampling 5 times in both x, y direction. That's because the data output is quite huge. But if you just want the 15-arcseconds resolution, adjust sample to 1 in this polygon mode. Default sample is 1 in other normal modes.

Multiple features are allowed:

https://api.odb.ntu.edu.tw/gebco?mode=zonly&jsonsrc={"type": "FeatureCollection", "features": [{ "type": "Feature", "properties": {}, "geometry": { "type": "Polygon", "coordinates": [ [ [4, 60.0], [6, 60.0], [6, 59.0], [4, 59.0], [4, 60.0] ] ] } }]}

@bjorkqvi
Copy link
Author

Many thanks, this seems to work like a charm!

I'm thinking about including this as a part of a GEBCO reader in an upcoming version of a downscaling software we are working on (https://github.com/MET-OM/dnora). Is it ok to write our software to use that web address directly?

@cywhale
Copy link
Owner

cywhale commented Feb 29, 2024

Please. Just use it if it suits your work. Any feedbacks or features required are welcome.
DNORA looks promising. I just think recently I developed my tide API (use TPXO9_altas_v5 model, also in my github) and used one tide data from Norwegian Meteorological Institute to verify. I'm interested in surveying such forcasting tools more. I'm happy if the gebco API can help in this tool.

BTW, If you finally adopt this gebco API, and can give a credit to ODB somewhere in your documentation, please use

Ocean Data Bank, National Science and Technology Council, Taiwan. https://doi.org/10.5281/zenodo.7512112. Accessed from api.odb.ntu.edu.tw/gebco. v1.0.

Never mind if you would not write doc for using it.

@cywhale
Copy link
Owner

cywhale commented Mar 15, 2024

Add the polygon mode in README.md. Close it. Feel free to reopen it if any questions.

@cywhale cywhale closed this as completed Mar 15, 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

2 participants