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.
from dataprep.admin_boundaries import search_country_by_keyword, get_country_admin_boundaries
There are two functions.
search_country_by_keyword(keyword: str)
- This is a wrapper of the
pycountry.countries.search_fuzzyfunction. - 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.GADMDownloaderclass. - 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_filemethod of the geopandas.DataFrame, - ex.
gdf.to_file('path/to/file.geojson', driver="GeoJSON", index=False).
Release files for disruptsc-dataprep 1.0.1
For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.
Source distribution (sdist)
| File | Size | Uploaded | |
|---|---|---|---|
| disruptsc_dataprep-1.0.1.tar.gz | 2.3 kB | Details |
Built distribution (wheel)
| File | Interpreter | ABI | Platform | Reset |
|---|---|---|---|---|
| disruptsc_dataprep-1.0.1-py3-none-any.whl | Python 3 | none | any | Details |
Total release size: 4.9 kB
Release files / disruptsc_dataprep-1.0.1.tar.gz
| Download URL | disruptsc_dataprep-1.0.1.tar.gz |
|---|---|
| Size | 2.3 kB |
| Tags | Source |
|
SHA-256 checksum How to use checksums |
26197286d8a48d09d1563dfee782c1f0475c02bbdac7f0435cbfe54673969bb1
|
|
BLAKE2b-256 checksum How to use checksums |
a03e320f836b8c45604c5b130efdd81f995dff4115fade0ae09412abc162c667
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|
Release files / disruptsc_dataprep-1.0.1-py3-none-any.whl
| Download URL | disruptsc_dataprep-1.0.1-py3-none-any.whl |
|---|---|
| Size | 2.6 kB |
| Tags | Python 3 |
|
SHA-256 checksum How to use checksums |
5a31ff4cd6ab3b92fee7dbd5dd5dfce0a737e05c429619998f6379b6b0ac79cd
|
|
BLAKE2b-256 checksum How to use checksums |
4016f104ed97b9cfb1d09f6c7e808f4373ec0ce5f1af720b33ae2b55b187ae59
|
| Upload date | |
|
Uploaded using Trusted Publishing? What is trusted publishing? |
No |
| Uploaded via |
twine/5.1.1 CPython/3.13.0
|