Skip to content

Commit

Permalink
Close #220
Browse files Browse the repository at this point in the history
Update Travis to Python 3.6-3.8: Dropped support for Python 3.5.
  • Loading branch information
ardeliam authored and jtlangevin committed Dec 19, 2019
1 parent 61fb4a6 commit 15f164c
Show file tree
Hide file tree
Showing 3 changed files with 14 additions and 18 deletions.
13 changes: 3 additions & 10 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,9 @@

language: python
python:
- "3.5"
- "3.6"

# Enable 3.7 without globally enabling sudo and dist: xenial for other build jobs
# This configuration is described in https://github.com/travis-ci/travis-ci/issues/9815#issue-336465122
matrix:
include:
- python: 3.7
dist: xenial
sudo: true
- "3.7"
- "3.8"

# Download and set up anaconda
before_install:
Expand All @@ -34,7 +27,7 @@ before_install:

# Install packages
install:
- conda create --yes -n testenv python=$TRAVIS_PYTHON_VERSION numpy=1.15 scipy flake8 requests
- conda create --yes -n testenv python=$TRAVIS_PYTHON_VERSION numpy>=1.16 scipy flake8 requests
- source activate testenv

# Run test(s)
Expand Down
11 changes: 7 additions & 4 deletions com_mseg.py
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
#!/usr/bin/env python3

import numpy as np
import numpy.lib.recfunctions as recfn
import re
import csv
import json
Expand Down Expand Up @@ -357,10 +358,12 @@ def sd_mseg_percent(sd_array, sel, yrs):
entries = filtered[filtered['Description'] == name]

# Calculate the sum of all year columns and write it to the
# appropriate row in the tval array (note that the .view()
# function converts the structured array into a standard
# numpy array, which allows the use of the .sum() function)
tval[idx, ] = np.sum(entries[yrs].view(('<f8', len(yrs))), axis=0)
# appropriate row in the tval array (note that the recfn module
# introduces the structured_to_unstructured function to
# convert the structured array into a standard numpy array,
# which allows the use of the .sum() function)
tval[idx, ] = np.sum(recfn.structured_to_unstructured(
entries[yrs], dtype='<f8'), axis=0)

# If at least one entry in tval is non-zero (tval.any() == True),
# suppress any divide by zero warnings and calculate the percentage
Expand Down
8 changes: 4 additions & 4 deletions com_mseg_tech.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
import com_mseg as cm

import numpy as np
import numpy.lib.recfunctions as recfn
import re
import warnings
import json
Expand Down Expand Up @@ -46,7 +47,6 @@ class UsefulVars(object):
eu_map (dict): Mapping between end use names in cost conversion JSON
and end use numbers in EIA raw technology cose data.
cconv (dict): Factors for converting from unit costs to $/ft^2.
"""

def __init__(self):
Expand Down Expand Up @@ -84,7 +84,7 @@ def __init__(self):


class UsefulDicts(object):
"""Set up class for dicts to relate diferent data file formats.
"""Set up class for dicts to relate different data file formats.
Attributes:
kprem_endusedict (dict): Keys are the strings found in the time
Expand Down Expand Up @@ -214,8 +214,8 @@ def sd_data_selector(sd_data, sel, years):
# appropriate row in the sd array (note that the .view()
# function converts the structured array into a standard
# numpy array, which allows the use of the .sum() function)
sd[idx, ] = np.sum(
entries[list(map(str, years))].view(('<f8', len(years))), axis=0)
sd[idx, ] = np.sum(recfn.structured_to_unstructured(
entries[list(map(str, years))], dtype='<f8'), axis=0)

# Note that each row in sd corresponds to a single performance
# level for a single technology and the rows are in the same order
Expand Down

0 comments on commit 15f164c

Please sign in to comment.