Skip to main content

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_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


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

disruptsc_dataprep-1.0.1.tar.gz (2.3 kB view details)

Uploaded Source

Built Distribution

disruptsc_dataprep-1.0.1-py3-none-any.whl (2.6 kB view details)

Uploaded Python 3

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

Hashes for disruptsc_dataprep-1.0.1.tar.gz
Algorithm Hash digest
SHA256 26197286d8a48d09d1563dfee782c1f0475c02bbdac7f0435cbfe54673969bb1
MD5 fe96c9fdfaa4bb29819a0cc48521de71
BLAKE2b-256 a03e320f836b8c45604c5b130efdd81f995dff4115fade0ae09412abc162c667

See more details on using hashes here.

File details

Details for the file disruptsc_dataprep-1.0.1-py3-none-any.whl.

File metadata

File hashes

Hashes for disruptsc_dataprep-1.0.1-py3-none-any.whl
Algorithm Hash digest
SHA256 5a31ff4cd6ab3b92fee7dbd5dd5dfce0a737e05c429619998f6379b6b0ac79cd
MD5 065034bf90fec8cd0d7c40ba80bcd900
BLAKE2b-256 4016f104ed97b9cfb1d09f6c7e808f4373ec0ce5f1af720b33ae2b55b187ae59

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page