Skip to content

Commit

Permalink
Merge pull request #64 from IMMM-SFA/dev
Browse files Browse the repository at this point in the history
JOSS Review:  Generalization and Bug Fix
  • Loading branch information
crvernon authored Aug 25, 2021
2 parents 05a6467 + d4616cd commit 96ff44c
Show file tree
Hide file tree
Showing 37 changed files with 1,071 additions and 938 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ cerf/data/*.xml
cerf/data/*.sdat
cerf/data/*.sgrd
cerf/data/*.img
cerf/data/*.npy

# ignore docs build
docs/build/
Expand Down
6 changes: 3 additions & 3 deletions CITATION.cff
Original file line number Diff line number Diff line change
Expand Up @@ -25,8 +25,8 @@ authors:
- family-names: "Binsted"
given-names: "Matthew"
orcid: "https://orcid.org/0000-0002-5177-7253"
title: "cerf v2.0.2: an open-source geospatial Python package for evaluating and analyzing future electricity technology capacity expansion feasibility."
version: 2.0.2
title: "cerf v2.0.4: an open-source geospatial Python package for evaluating and analyzing future electricity technology capacity expansion feasibility."
version: 2.0.4
doi: 10.5281/zenodo.5140077
date-released: 2021-08-16
date-released: 2021-08-24
url: "https://github.com/IMMM-SFA/cerf"
2 changes: 0 additions & 2 deletions MANIFEST.in
Original file line number Diff line number Diff line change
@@ -1,3 +1 @@
include cerf/data/README.md
include tests/data/*
include tests/data/comp_data/*
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,8 @@

### Install `cerf`

**NOTE**: `cerf` is not officially supported for Ubuntu 18 users due to a system dependency (`GLIBC_2.29`) required by the `whitebox` package which `cerf` uses to conduct spatial analysis. Ubuntu 18 natively includes `GLIBC_2.27`. It may be possible for Ubuntu 18 users to upgrade to `GLIBC_2.29` but this should be done with careful consideration. Instead, we officially support `cerf` use for Ubuntu users for versions 20.04.2 LTS and greater.

```bash
pip install cerf
```
Expand Down
2 changes: 1 addition & 1 deletion cerf/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,4 +8,4 @@
from .install_supplement import install_package_data


__version__ = "2.0.3"
__version__ = "2.0.4"
14 changes: 7 additions & 7 deletions cerf/compete.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ class Competition:
"""

def __init__(self,
target_state_name,
target_region_name,
settings_dict,
technology_dict,
technology_order,
Expand All @@ -65,8 +65,8 @@ def __init__(self,
seed_value=0,
verbose=False):

# target state
self.target_state_name = target_state_name
# target region
self.target_region_name = target_region_name

# project level settings dictionary
self.settings_dict = settings_dict
Expand All @@ -92,10 +92,10 @@ def __init__(self,
# lmp zones array
self.zones_flat_arr = zones_arr

# flat array of full grid indices value for the target state
# flat array of full grid indices value for the target region
self.indices_flat = indices_flat

# net locational costs with suitability mask for the target state
# net locational costs with suitability mask for the target region
self.nlc_mask = nlc_mask
self.nlc_mask_shape = self.nlc_mask.shape

Expand Down Expand Up @@ -146,7 +146,7 @@ def log_outcome(self):
remaining_sites = self.expansion_dict[k]['n_sites']

if remaining_sites > 0:
logging.warning(f"Unable to achieve full siting for `{tech_name}` in `{self.target_state_name}`: {remaining_sites} unsited.")
logging.warning(f"Unable to achieve full siting for `{tech_name}` in `{self.target_region_name}`: {remaining_sites} unsited.")

def compete(self):

Expand Down Expand Up @@ -189,7 +189,7 @@ def compete(self):
target_ix = np.random.choice(tech_nlc_cheap)

# add selected index to sited dictionary
self.sited_dict['state_name'].append(self.target_state_name)
self.sited_dict['region_name'].append(self.target_region_name)
self.sited_dict['tech_id'].append(tech_id)
self.sited_dict['tech_name'].append(self.technology_dict[tech_id]['tech_name'])
self.sited_dict['unit_size_mw'].append(self.technology_dict[tech_id]['unit_size'])
Expand Down
File renamed without changes.
7 changes: 4 additions & 3 deletions cerf/install_supplement.py
Original file line number Diff line number Diff line change
@@ -1,14 +1,15 @@
import os
import tempfile
import zipfile
import pkg_resources
import shutil

import requests

from pkg_resources import get_distribution
from io import BytesIO as BytesIO

import cerf.package_data as pkg


class InstallSupplement:
"""Download and unpack example data supplement from Zenodo that matches the current installed
Expand All @@ -21,14 +22,14 @@ class InstallSupplement:
'2.0.1': 'https://zenodo.org/record/5218436/files/cerf_package_data.zip?download=1',
'2.0.2': 'https://zenodo.org/record/5218436/files/cerf_package_data.zip?download=1',
'2.0.3': 'https://zenodo.org/record/5218436/files/cerf_package_data.zip?download=1',
'2.0.4': 'https://zenodo.org/record/5218436/files/cerf_package_data.zip?download=1'}
'2.0.4': 'https://zenodo.org/record/5247690/files/cerf_package_data.zip?download=1'}

def fetch_zenodo(self):
"""Download and unpack the Zenodo example data supplement for the
current cerf distribution."""

# full path to the cerf root directory where the example dir will be stored
data_directory = pkg_resources.resource_filename('cerf', 'data')
data_directory = pkg.get_data_directory()

# get the current version of cerf that is installed
current_version = get_distribution('cerf').version
Expand Down
Loading

0 comments on commit 96ff44c

Please sign in to comment.