Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

v0.0.6 #103

Merged
merged 50 commits into from
Nov 26, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
50 commits
Select commit Hold shift + click to select a range
e9c5a85
updated writing of output files to folder; also in command line script
JannisHoch Nov 4, 2020
c2a1e05
fixing travisCI badge link
JannisHoch Nov 4, 2020
9a2f700
towards v0.0.6b for making future projections withtout observations
JannisHoch Nov 6, 2020
701febe
updated functions and added code to make predictions
JannisHoch Nov 6, 2020
a7a48ba
added py 3.8 to travisCI testing
JannisHoch Nov 6, 2020
71b489a
specified pyproj version
JannisHoch Nov 6, 2020
1528759
fixed travisCI build with py3.6 but py3.8 still having problems with …
JannisHoch Nov 6, 2020
68b5444
added explanation to notebook
JannisHoch Nov 6, 2020
382e03b
added nb04 to documentation
JannisHoch Nov 6, 2020
bdc5dfb
updated code to first fit clf based on ref period and then use this f…
JannisHoch Nov 6, 2020
a6d3727
updated notebooks
JannisHoch Nov 6, 2020
6e8d27b
added extra cfg-file for projections
JannisHoch Nov 6, 2020
3356cbe
changed cfg-file to make it as applicable for both ref and proj runs
JannisHoch Nov 6, 2020
9535067
added code to pickle clf if needed and load it later
JannisHoch Nov 6, 2020
d8ae69a
tested notebooks and updated to new workflow
JannisHoch Nov 6, 2020
4bf7293
updated tests
JannisHoch Nov 6, 2020
0857920
updated tests
JannisHoch Nov 6, 2020
84222c3
aligned command line script to changes in code
JannisHoch Nov 9, 2020
b9c50af
replaced print with echo.click and output to stderr
JannisHoch Nov 9, 2020
f0f87a4
added function to plot header at model start
JannisHoch Nov 9, 2020
3a3719d
smaller print updates
JannisHoch Nov 9, 2020
cd26a1e
added color to click.echo output and updated runner.py to make porjec…
JannisHoch Nov 9, 2020
5bee84e
final adjustments
JannisHoch Nov 9, 2020
212b637
mini changes
JannisHoch Nov 9, 2020
abbda04
updated docs
JannisHoch Nov 9, 2020
78e2494
updated model description
JannisHoch Nov 9, 2020
b6e6b46
more docs please!
JannisHoch Nov 9, 2020
bc73d80
Merge pull request #99 from JannisHoch/make_projections
JannisHoch Nov 9, 2020
a916f21
bugfixing
JannisHoch Nov 11, 2020
56aa3dd
extende debugging and saving X array to file too when doing projections
JannisHoch Nov 13, 2020
2594ea4
improved naming of evaluation columns
JannisHoch Nov 13, 2020
e2e0da9
removed unncessary writing to out.txt
JannisHoch Nov 13, 2020
abcdfaf
alligned changes in column names
JannisHoch Nov 13, 2020
33a51dd
changing names of output files
JannisHoch Nov 17, 2020
45a2ccd
added cff-file for more FAIR
JannisHoch Nov 17, 2020
e1a3d38
split up scripts for reference and reference+projections
JannisHoch Nov 17, 2020
45f12bf
outputting trps and aucs for ROC plot to csv
JannisHoch Nov 17, 2020
88c5bdc
updated cff-file
JannisHoch Nov 17, 2020
be01275
deleting all files in out_dir if already exists
JannisHoch Nov 17, 2020
8732145
not writing headers to file of ROC data
JannisHoch Nov 17, 2020
5f4ae71
added docstring
JannisHoch Nov 17, 2020
cc865b6
towards version 0.0.6b-joss
JannisHoch Nov 17, 2020
a660f97
updated documentation
JannisHoch Nov 17, 2020
921308f
small bugfix
JannisHoch Nov 17, 2020
ba8809a
bugfixes, eg plotting for linux envs
JannisHoch Nov 19, 2020
32eae54
script to make plots from polygon data
JannisHoch Nov 20, 2020
59e62f3
updated runner.py
JannisHoch Nov 26, 2020
2b7ad54
v0.0.6
JannisHoch Nov 26, 2020
5f81602
fixed dependency issues
JannisHoch Nov 26, 2020
4ce9420
updated readme.md
JannisHoch Nov 26, 2020
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
@@ -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
Original file line number Diff line number Diff line change
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
Original file line number Diff line number Diff line change
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__ = '[email protected]'
__version__ = '0.0.5'
__version__ = '0.0.6'
8 changes: 4 additions & 4 deletions copro/conflict.py
Original file line number Diff line number Diff line change
@@ -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
Loading