Skip to content

Commit

Permalink
Merge pull request #27 from JGCRI/dev
Browse files Browse the repository at this point in the history
Install gcamreader from pip
  • Loading branch information
crvernon authored Aug 10, 2021
2 parents ef24935 + bc431be commit 5ad4340
Show file tree
Hide file tree
Showing 7 changed files with 28 additions and 20 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ jobs:
pip install pandas==1.2.4
pip install scipy==1.6.3
pip install requests==2.25.1
pip install git+https://github.com/JGCRI/gcam_reader.git
pip install git+https://github.com/JGCRI/gcamreader.git
- name: Test and generate coverage report
run: |
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ WORKDIR /code

# install dependencies
RUN pip install --upgrade pip \
&& pip install git+https://github.com/JGCRI/gcam_reader.git \
&& pip install gcamreader \
&& pip install --trusted-host pypi.python.org --requirement requirements.txt

# copy package
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,9 +8,9 @@ Demeter is an open source Python package that was built to disaggregate projecti

# Getting Started with Demeter
Set up Demeter using the following steps:
1. Install Demeter from GitHub using:
1. Install Demeter from GitHub:
```bash
python -m pip install git+https://github.com/JGCRI/demeter.git
python -m pip install git+http://github.com/JGCRI/demeter.git#egg=demeter
```
2. Download the example data using the following in a Python prompt:
```python
Expand Down
10 changes: 5 additions & 5 deletions demeter/demeter_io/reader.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@

import numpy as np
import pandas as pd
import gcam_reader
import gcamreader


class ValidationException(Exception):
Expand Down Expand Up @@ -207,17 +207,17 @@ def read_gcam_land(db_path, db_file, f_queries, d_basin_name, subreg, crop_water
"""

# instantiate GCAM db
conn = gcam_reader.LocalDBConn(db_path, db_file, suppress_gabble=False)
conn = gcamreader.LocalDBConn(db_path, db_file, suppress_gabble=False)

# get queries
q = gcam_reader.parse_batch_query(f_queries)
q = gcamreader.parse_batch_query(f_queries)

# assume target query is first in query list
land_alloc = conn.runQuery(q[0])

# split 'land-allocation' column into components
if subreg == 'AEZ':
raise ValueError("Using AEZs are no longer supported with `gcam_reader`")
raise ValueError("Using AEZs are no longer supported with `gcamreader`")

elif subreg == 'BASIN':
# expected format: landclass_basin-glu-name_USE_management
Expand Down Expand Up @@ -260,7 +260,7 @@ def read_gcam_file(gcam_data, gcam_landclasses, start_yr, end_yr, timestep, scen
"""
Read and process the GCAM land allocation output file.
:param gcam_data: GCAM land allocation file or data frame from gcam_reader
:param gcam_data: GCAM land allocation file or data frame from gcamreader
:param name_col: Field name of the column containing the region and either AEZ or basin number
:param metric: AEZ or Basin
:param start_yr: User-defined GCAM start year to process from configuration file
Expand Down
6 changes: 6 additions & 0 deletions requirements.txt
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
configobj~=5.0.6
numpy~=1.20.3
pandas~=1.2.4
scipy~=1.6.3
requests~=2.20.0
gcamreader~=1.2.4
2 changes: 2 additions & 0 deletions setup.cfg
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
[metadata]
description_file = README.md
22 changes: 11 additions & 11 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,28 +2,28 @@


def readme():
"""Return the contents of the project README file."""
with open('README.md') as f:
return f.read()


setup(
name='demeter',
version='1.2.0',
version='1.2.1',
python_requires=">=3.6",
packages=find_packages(),
url='https://github.com/IMMM-SFA/demeter',
url='https://github.com/JGCRI/demeter',
license='BSD 2-Clause',
author='Chris R. Vernon; Yannick le Page; Caleb Braun',
author='Chris R. Vernon',
author_email='chris.vernon@pnnl.gov',
description='A land use land cover disaggregation and land change analytic model',
description='A land use land cover change disaggregation model',
long_description=readme(),
long_description_content_type="text/markdown",
install_requires=['configobj==5.0.6',
'numpy==1.20.3',
'pandas==1.2.4',
'scipy==1.6.3',
'requests==2.25.1',
'gcam_reader==1.2.0'],
dependency_links=['git+https://github.com/JGCRI/gcam_reader@master#egg=gcam_reader-1.2.0'],
install_requires=['configobj~=5.0.6',
'numpy~=1.20.3',
'pandas~=1.2.4',
'scipy~=1.6.3',
'requests~=2.20.0',
'gcamreader~=1.2.4'],
include_package_data=True
)

0 comments on commit 5ad4340

Please sign in to comment.