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.
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).
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
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file disruptsc_dataprep-1.0.1.tar.gz.
File metadata
- Download URL: disruptsc_dataprep-1.0.1.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 |
26197286d8a48d09d1563dfee782c1f0475c02bbdac7f0435cbfe54673969bb1
|
|
| MD5 |
fe96c9fdfaa4bb29819a0cc48521de71
|
|
| BLAKE2b-256 |
a03e320f836b8c45604c5b130efdd81f995dff4115fade0ae09412abc162c667
|
File details
Details for the file disruptsc_dataprep-1.0.1-py3-none-any.whl.
File metadata
- Download URL: disruptsc_dataprep-1.0.1-py3-none-any.whl
- Upload date:
- Size: 2.6 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 |
5a31ff4cd6ab3b92fee7dbd5dd5dfce0a737e05c429619998f6379b6b0ac79cd
|
|
| MD5 |
065034bf90fec8cd0d7c40ba80bcd900
|
|
| BLAKE2b-256 |
4016f104ed97b9cfb1d09f6c7e808f4373ec0ce5f1af720b33ae2b55b187ae59
|