Skip to content

Commit

Permalink
Merge pull request #103 from JannisHoch/dev
Browse files Browse the repository at this point in the history
v0.0.6
  • Loading branch information
JannisHoch committed Nov 26, 2020
2 parents dcb174e + 4ce9420 commit cbaee08
Show file tree
Hide file tree
Showing 45 changed files with 1,443 additions and 2,752 deletions.
1 change: 1 addition & 0 deletions .travis.yml
Expand Up @@ -2,6 +2,7 @@

language: python
python:
# - 3.8
- 3.7
- 3.6

Expand Down
35 changes: 35 additions & 0 deletions CITATION.cff
@@ -0,0 +1,35 @@
# YAML 1.2
---
cff-version: "1.1.0"
message: "If you use this software, please cite it using these metadata."
title: CoPro
version: "v0.0.6b-joss"
authors:
-
affiliation: "Utrecht University"
family-names: Hoch
given-names: Jannis
orcid: "https://orcid.org/0000-0003-3570-6436"
-
affiliation: "PBL Netherlands Environmental Assessment Agency"
family-names: "de Bruine"
given-names: Sophie
orcid: "https://orcid.org/0000-0003-3429-349X"
-
affiliation: "Utrecht University"
family-names: Wanders
given-names: Niko
orcid: "https://orcid.org/0000-0002-7102-5454"
date-released: 2020-11-17
doi: "10.5281/zenodo.4264684"
license: MIT
repository-code: "https://github.com/JannisHoch/copro"
keywords:
- conflict
- "machine learning"
- "climate change"
- water
- scenarios
- projections
- "climate security"
...
12 changes: 8 additions & 4 deletions README.rst
Expand Up @@ -7,8 +7,8 @@ CoPro

Welcome to CoPro, a machine-learning tool for conflict risk projections based on climate, environmental, and societal drivers.

.. image:: https://travis-ci.com/JannisHoch/conflict_model.svg?branch=dev
:target: https://travis-ci.com/JannisHoch/conflict_model
.. image:: https://travis-ci.com/JannisHoch/copro.svg?branch=dev
:target: https://travis-ci.com/JannisHoch/copro

.. image:: https://img.shields.io/badge/License-MIT-blue.svg
:target: https://github.com/JannisHoch/copro/blob/dev/LICENSE
Expand All @@ -17,7 +17,7 @@ Welcome to CoPro, a machine-learning tool for conflict risk projections based on
:target: https://copro.readthedocs.io/en/latest/?badge=latest

.. image:: https://img.shields.io/github/v/release/JannisHoch/copro
:target: https://github.com/JannisHoch/copro/releases/tag/v0.0.5-pre
:target: https://github.com/JannisHoch/copro/releases/tag/v0.0.6

.. image:: https://zenodo.org/badge/254407279.svg
:target: https://zenodo.org/badge/latestdoi/254407279
Expand Down Expand Up @@ -67,12 +67,16 @@ Runner script
To run the model from command line, a command line script is provided.
All data and settings are retrieved from the settings-file which needs to be provided as inline argument.

There are two settings-files, one for evaluating the model for the reference situation, and another one for additionally making projections.
To make a projection, both files need to be specified with the latter requiring the -proj flag.

.. code-block:: console
$ cd path/to/copro/scripts
$ python runner.py ../example/example_settings.cfg
$ python runner.py ../example/example_settings.cfg -proj ../example/example_settings_proj.cfg
By default, output is stored to the output directory specified in the settings-file.
By default, output is stored to the output directory specified in the specific settings-file.

Documentation
---------------
Expand Down
234 changes: 0 additions & 234 deletions conflict_model/plots.py

This file was deleted.

4 changes: 2 additions & 2 deletions copro/__init__.py
Expand Up @@ -11,6 +11,6 @@
from . import models
from . import plots

__author__ = """Jannis M. Hoch, Niko Wanders, Sophie de Bruin"""
__author__ = """Jannis M. Hoch, Sophie de Bruin, Niko Wanders"""
__email__ = 'j.m.hoch@uu.nl'
__version__ = '0.0.5'
__version__ = '0.0.6'
8 changes: 4 additions & 4 deletions copro/conflict.py
@@ -1,7 +1,6 @@
import geopandas as gpd
import pandas as pd
import numpy as np
import matplotlib.pyplot as plt
import os, sys

def conflict_in_year_bool(conflict_gdf, extent_gdf, config, sim_year):
Expand All @@ -10,7 +9,7 @@ def conflict_in_year_bool(conflict_gdf, extent_gdf, config, sim_year):
Args:
conflict_gdf (geodataframe): geo-dataframe containing georeferenced information of conflict (tested with PRIO/UCDP data)
extent_gdf (geodataframe): geo-dataframe containing one or more polygons with geometry information for which values are extracted
config (config): parsed configuration settings of run
config (ConfigParser-object): object containing the parsed configuration-settings of the model.
sim_year (int): year for which data is extracted
Raises:
Expand Down Expand Up @@ -80,11 +79,12 @@ def get_poly_ID(extent_gdf):

return list_ID

def get_poly_geometry(extent_gdf):
def get_poly_geometry(extent_gdf, config):
"""Extracts geometry information for each polygon from geodataframe and saves to list. The geometry column in geodataframe must be named 'geometry'.
Args:
extent_gdf (geo-dataframe): geo-dataframe containing one or more polygons with geometry information.
config (ConfigParser-object): object containing the parsed configuration-settings of the model.
Raises:
AssertionError: error raised if length of output list does not match length of input geo-dataframe.
Expand All @@ -93,7 +93,7 @@ def get_poly_geometry(extent_gdf):
list: list containing the geometry information extracted from geo-dataframe for each polygon used in the model.
"""

print('listing the geometry of all geographical units')
if config.getboolean('general', 'verbose'): print('DEBUG: getting the geometry of all geographical units')

# initiatie empty list
list_geometry = []
Expand Down

0 comments on commit cbaee08

Please sign in to comment.