Tools to help prepare data for the DisruptSC model.
Project description
What is it?
This repository contains tools to facilitate the data preparation for the DisruptSC model https://github.com/ccolon/disruptsc. The data preparation is done in Python.
Installation
To install the package, run the following command:
pip install disruptsc-dataprep
It is advised to install the package in a virtual environment, especially if you have other packages that might conflict with the dependencies of this package (e.g, geopandas)
Usage
Submodule admin_boundaries contains functions to download and prepare administrative boundaries data.
There are two functions.
search_country_by_keyword(keyword: str)
- This is a wrapper of the
pycountry.countries.search_fuzzy
function. - It returns a list of countries that match the keyword.
get_country_admin_boundaries(country_name: str, ad_level: int)
- This is a wrapper of the
gadm.GADMDownloader
class. - It returns a geopandas.DataFrame of the administrative boundaries of the country specified by the country_name at the administrative level specified.
- The search_country_by_keyword function can be used to check the country name beforehand
- It can then be saved to a file using the
to_file
method of the geopandas.DataFrame, - ex.
gdf.to_file('path/to/file.geojson', driver="GeoJSON", index=False)
.
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
File details
Details for the file disruptsc_dataprep-1.0.0.tar.gz
.
File metadata
- Download URL: disruptsc_dataprep-1.0.0.tar.gz
- Upload date:
- Size: 2.3 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 46c2e3de14d3d337db49fddc388ca96a45170b1479fd821f9e206a635a057713 |
|
MD5 | a6ce8bd3576c29c7fbb708dfdbf0e86e |
|
BLAKE2b-256 | 4c3c47ec1952955aced58406227e802ca5d6401294df0b5c5b089ebd5870d685 |
File details
Details for the file disruptsc_dataprep-1.0.0-py3-none-any.whl
.
File metadata
- Download URL: disruptsc_dataprep-1.0.0-py3-none-any.whl
- Upload date:
- Size: 2.7 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: twine/5.1.1 CPython/3.13.0
File hashes
Algorithm | Hash digest | |
---|---|---|
SHA256 | 39984ab28ab41cff1cfeb5b184dcd3cf5001754f7f192af33afad2dc990dbe66 |
|
MD5 | a0569b0551539ad3b13db88e0da47536 |
|
BLAKE2b-256 | dc763faab8f66a1b7712f23583f04c976a30cdc9f05059716bd111bf762ce984 |