Skip to content

Commit

Permalink
Merge pull request #25 from JGCRI/rename
Browse files Browse the repository at this point in the history
Rename to `gcamreader`
  • Loading branch information
crvernon authored Aug 10, 2021
2 parents b187c25 + 008c137 commit eea1c82
Show file tree
Hide file tree
Showing 30 changed files with 31 additions and 23 deletions.
2 changes: 2 additions & 0 deletions DISCLAIMER
Original file line number Diff line number Diff line change
@@ -1,3 +1,5 @@
gcamreader

Copyright (c) 2021, Battelle Memorial Institute

Open source under license BSD 2-Clause
Expand Down
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
gcam_reader
gcamreader

Copyright (c) 2021, Battelle Memorial Institute

Expand Down
18 changes: 9 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
[![build](https://github.com/JGCRI/gcam_reader/actions/workflows/build.yml/badge.svg)](https://github.com/JGCRI/gcam_reader/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/JGCRI/gcam_reader/branch/master/graph/badge.svg?token=Az2MWAQbwj)](https://codecov.io/gh/JGCRI/gcam_reader)
[![build](https://github.com/JGCRI/gcamreader/actions/workflows/build.yml/badge.svg)](https://github.com/JGCRI/gcamreader/actions/workflows/build.yml)
[![codecov](https://codecov.io/gh/JGCRI/gcamreader/branch/master/graph/badge.svg?token=Az2MWAQbwj)](https://codecov.io/gh/JGCRI/gcamreader)
[![DOI](https://zenodo.org/badge/100425913.svg)](https://zenodo.org/badge/latestdoi/100425913)

# gcam_reader: A python package for importing GCAM data
# gcamreader: A python package for importing GCAM data

#### `gcam_reader` provides functions for reading data from output databases produced by GCAM (https://github.com/JGCRI/gcam-core)
#### `gcamreader` provides functions for reading data from output databases produced by [GCAM](https://github.com/JGCRI/gcam-core)

### Purpose

`gcam_reader` was created to:
`gcamreader` was created to:

- Use XML queries to extract data into a Pandas DataFrame from a GCAM XML database
- Use XML queries to extract data into a Pandas DataFrame from a GCAM XML database

- Integrate GCAM with other Python packages
- Integrate GCAM with other Python packages

### Install `gcam_reader`
### Install `gcamreader`

```bash
pip install gcam_reader
pip install gcamreader
```
1 change: 0 additions & 1 deletion gcam_reader/ModelInterface/modelinterface
Submodule modelinterface deleted from c4c014
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion gcam_reader/__init__.py → gcamreader/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
Tools for handling GCAM output databases
"""

from gcam_reader.querymi import *
from gcamreader.querymi import *

__all__ = ['querymi']

2 changes: 1 addition & 1 deletion gcam_reader/querymi.py → gcamreader/querymi.py
Original file line number Diff line number Diff line change
Expand Up @@ -66,7 +66,7 @@ def parse_batch_query(filename):
### Default class path for the GCAM model interface
### On unix this should produce something like:
### /foo/bar/baz/jars/*:/foo/bar/baz/ModelInterface.jar
_mifiles_dir = pkg_resources.resource_filename('gcam_reader', 'ModelInterface')
_mifiles_dir = pkg_resources.resource_filename('gcamreader', 'ModelInterface')


_default_miclasspath = (
Expand Down
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
import pkg_resources
import unittest

import gcam_reader
import gcamreader

import pandas as pd

Expand All @@ -19,11 +19,11 @@ class QueryTests(unittest.TestCase):
"""Test configuration integrity."""

TEST_GCAM_DB = 'sample_basexdb'
TEST_GCAM_DB_PATH = pkg_resources.resource_filename('gcam_reader', 'tests/data')
TEST_LAND_QUERY = pkg_resources.resource_filename('gcam_reader', 'tests/data/queries/query_land_reg32_basin235_gcam5p0.xml')
TEST_GCAM_DB_PATH = pkg_resources.resource_filename('gcamreader', 'tests/data')
TEST_LAND_QUERY = pkg_resources.resource_filename('gcamreader', 'tests/data/queries/query_land_reg32_basin235_gcam5p0.xml')

# CSV file from existing land allocation query output
COMP_LAND_OUTPUT = pd.read_csv(pkg_resources.resource_filename('gcam_reader', 'tests/data/comp_outputs/land_query.csv'))
COMP_LAND_OUTPUT = pd.read_csv(pkg_resources.resource_filename('gcamreader', 'tests/data/comp_outputs/land_query.csv'))

def __init__(self, obj):

Expand All @@ -36,18 +36,18 @@ def __init__(self, obj):
@classmethod
def create_connection(cls):
"""Create database connection."""
return gcam_reader.LocalDBConn(cls.TEST_GCAM_DB_PATH, cls.TEST_GCAM_DB)
return gcamreader.LocalDBConn(cls.TEST_GCAM_DB_PATH, cls.TEST_GCAM_DB)

def test_connection(self):
"""Check the type output of the gcam_reader DB object."""
"""Check the type output of the gcamreader DB object."""

self.assertEqual(str(type(self.conn)), "<class 'gcam_reader.querymi.LocalDBConn'>")
self.assertEqual(str(type(self.conn)), "<class 'gcamreader.querymi.LocalDBConn'>")

def test_land_query(self):
"""Test for land output data frame equality from query."""

# get land allocation query
query = gcam_reader.parse_batch_query(QueryTests.TEST_LAND_QUERY)[0]
query = gcamreader.parse_batch_query(QueryTests.TEST_LAND_QUERY)[0]

# get run output for land
df = self.conn.runQuery(query)
Expand Down
File renamed without changes.
11 changes: 9 additions & 2 deletions setup.py
Original file line number Diff line number Diff line change
@@ -1,12 +1,19 @@
from setuptools import setup, find_packages


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

setup(
name="gcam_reader",
version="1.2.1",
name="gcamreader",
version="1.2.4",
python_requires=">=3.6",
packages=find_packages(),
description="Tools for importing GCAM output data",
long_description=readme(),
long_description_content_type="text/markdown",
url="https://github.com/JGCRI/gcam_reader",
license='BSD 2-Clause',
author="Robert Link",
Expand Down

0 comments on commit eea1c82

Please sign in to comment.