/Meshblocks2Graph

Primary LanguagePythonMIT LicenseMIT

Meshblock2Graph

This project generates a graph representation of spatial meshblocks based on distance or neighborhood.

Setup

  1. Create a .env file, insert an fill the following envirommental variables:

        ROOT_DATA= <path to save the data>
  2. Create a vitual enviroment and install all packages in requiments.txt.

        conda create --name <env> --file requirements.txt
  3. Install the project as package.

        pip install -e .

Usage

  1. Configure the parameters in the files:

    ├── data
        ├── parameters.json
        ├── switchers.json
  2. Run src/main.py

        python src/main.py

Parameters description

Description of the parameters needed to execute the code.

parameters.json

  • global: General parameters
    • region: The name of the region (Ex: Brazil)
    • org: The name of the federal agency
    • year: The election year
    • aggregation_level: Geographical level of data aggregation
  • meshblocks: parameters regarding the meshblock data
    • data_name The name of the data (Ex: meshblocks)
    • id_col The identification column
    • renamed_id_col: The new name of the identification column [Optional]
    • type_adj The type of graph (QUEEN or INVD)

switchers.json

  • meshblocls: switchers regarding the locations pipeline
    • raw: switch to run the raw process (0 or 1)
    • processed: switch to run the processed process (0 or 1)

⚠️ The switchers turn on and off the processes of the pipeline, by default let them all turned on (filled with 1), so the entire pipeline can be executed.

Final graph sample [adj_type = "QUEEN"]

Drag Racing

Project Organization

    ├── LICENSE
    ├── README.md          <- The top-level README for developers using this project.
    ├── requirements.txt   <- The requirements file for reproducing the analysis environment, e.g.
    │                         generated with `pip freeze > requirements.txt`
    │
    ├── setup.py           <- makes project pip installable (pip install -e .) so src can be imported
    ├── src                <- Source code for use in this project.
    │   ├── __init__.py    <- Makes src a Python module
    │   ├── data.py    <- Data abstract class
    │   ├── pipeline.py    <- Pipeline class
    │   ├── main.py    <- Main function
    │   │
    │   ├── meshblocks           <- Scripts to process meshblock data
    │   │   └── raw.py
    │   │   └── preocessed.py
    │   │
    ├────

Project based on the cookiecutter data science project template. #cookiecutterdatascience