fatiando / rockhound

NOTICE: This library is no longer being developed. Use Ensaio instead (https://www.fatiando.org/ensaio). -- Download geophysical models/datasets and load them in Python
BSD 3-Clause "New" or "Revised" License
34 stars 15 forks source link

Add Slab2 model to Rockhound #62

Closed aguspesce closed 4 years ago

aguspesce commented 4 years ago

Add function to fetch and load data from Slab2: a geometry model of subduction zones, provided by the USGS. The model contains gridded data for 27 subduction zones describing the depth, thickness, dip and strike angles of the subducted slab. The data for each subduction zone is fetched and loaded into a xarray.Dataset. The depth and thickness are converted to meters and the coordinates renamed to "longitude" and "latitude". Add metadata to the Dataset like the datum and the doi of the model. Add netcdf4 as a requirement for Rockhound.

Fixes #61

Reminders

welcome[bot] commented 4 years ago

💖 Thanks for opening this pull request! 💖

Please make sure you read our Contributing Guide and abide by our Code of Conduct.

A few things to keep in mind:

aguspesce commented 4 years ago

@leouieda and @santisoler, I add in the registry file one by one the geometry files for each zone. I do that because the USGS allows to download a zip file for a given zone but the hash in its name change every time that I download this file.

Do you have other idea to improve this problem?

santisoler commented 4 years ago

Happy to see this PR, @aguspesce!

I think it would be ideal to have a single zip file for each region on Slab2 model, but if it's not possible to have a consistent zip file in time, I think it's better to just add a ton of files to the registry. I don't think this is a big issue. The registry file is not intended to be readable, so I don't see any problem with having a large number of files in it.

Ask for review whenever you are ready, or for help if you need it.

aguspesce commented 4 years ago

@santisoler and @leouieda, The function to fetch Slab2 model is almost finished but I need your help to do the testing functions.

santisoler commented 4 years ago

I've just pushed a commit that adds test functions for Slab2. They will probably fail due to some differences between the expected values of the DOI and the actual_range attributes of depth, thickness and depth_uncertainty (see my previous comments). Don't worry, after they are fixed, the tests should pass.

In case you like my suggestion of adding the actual zone argument to the zone attribute, one test function must be updated.

santisoler commented 4 years ago

This is looking awesome @aguspesce! Congratulations for the hard work! I've just shrinked the colorbar on the example just to improve how the plot looks. After the CIs pass I think this is ready to be merged.

welcome[bot] commented 4 years ago

🎉🎉🎉 Congrats on merging your first pull request and welcome to the team! 🎉🎉🎉

Please open a new pull request to add yourself to the AUTHORS.md file. We hope that this was a good experience for you. Let us know if there is any way that the contributing process could be improved.