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

Misha zonal statstistics and data download #4

Merged
merged 2 commits into from
May 26, 2021

Conversation

KleinMisha
Copy link

@aklilu

Added scripts for :

  1. Zonal statistics
  2. downloading files from webpage using Python

Please check the commit message(s) for more details.
Or just contact me if you have any questions :-)

MishaKlein added 2 commits May 23, 2021 13:14
1. zonal_statistics():
Input filenames for .shp and .tiff files + the column name that has the identifier (p-code, name or both) for every geometry in the .shp file.
This function will then mask the .tiff file with every given geometry + aggregate the values based on a (list of) user supplied function(s).
By default: [np.mean, np.max,np.sum] and the output dataframe will contain columns “value_1”, “value_2”, “value_3” corresponding to each of the supplied metrics.

2. download_files_url()
Standard Python libraries used to download (in this case a .zip) file from a given URL. Simple password + username authentication can be supplied.
Standard stuff, but still handy to have it archived once :-)

3. extract_zip_archive():
Again, self-explanatory name. Easy way to let Python extract a zip file.
Handy stuff I figured out while writing this code:
- The beautiful soup package has easy ways of parsing information on a webpage. I use this to obtain the correct download link for a given typhoon.

:
@aklilu aklilu merged commit 556bd90 into master May 26, 2021
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.

2 participants