Skip to content

Commit c0d3d41

Browse files
RHammond2Robjordanperrejsimley
authored
Merge develop into master - v2.0.1 (#109)
* create workaround for unknow zsh issue * update documentation and GH Actions workflows * removing geopandas installation from setup.py and moving import statement in AssetData class * modifying ENGIE project pathname in exmaples so auto data extract works * minor documentation updates * Unfreezing sphinx dependencies * undoing that change * updating changelog with version 2.0.0 and unreleased * replace geopandas with pyproj (#107) * replace `GeoPandas` with `pyproj` and `Shapely` * adding `pyproj` and `shapely` to `setup.py` and `requirements.txt` * Update `python-ci.yml`to include Windows tests * update software version to 2.0.1 Co-authored-by: Rob <robert.hammond@nrel.gov> * Update AssetData docstring Removed any lingering references to `GeoPandas`. * Remove GDAL/Windows comments * Update CHANGELOG.md * Update readme.md Co-authored-by: Rob <robert.hammond@nrel.gov> Co-authored-by: Jordan Perr-Sauer <jordan.perr-sauer@nrel.gov> Co-authored-by: ejsimley <eric.simley@nrel.gov> Co-authored-by: ejsimley <40040961+ejsimley@users.noreply.github.com>
1 parent bc781d1 commit c0d3d41

27 files changed

+48
-49
lines changed

.github/workflows/python-ci.yml

Lines changed: 8 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,11 @@ on:
99
jobs:
1010
build:
1111

12-
runs-on: ubuntu-latest
12+
runs-on: ${{ matrix.os }}
1313
strategy:
1414
matrix:
15-
python-version: [3.6, 3.7, 3.8]
15+
os: [ubuntu-latest, windows-latest]
16+
python-version: [3.6, 3.8]
1617

1718
steps:
1819
- uses: actions/checkout@v2
@@ -24,11 +25,14 @@ jobs:
2425
run: |
2526
python -m pip install --upgrade pip
2627
pip install -r requirements.txt
28+
shell: bash
2729
- name: Unzip example data
2830
run: |
29-
yes | unzip examples/data/la_haute_borne.zip -d examples/data/la_haute_borne/
31+
unzip examples/data/la_haute_borne.zip -d examples/data/la_haute_borne/
32+
shell: bash
3033
- name: Test with pytest
3134
run: |
32-
pytest -o python_files=test/*.py --cov=operational_analysis --cov-report=xml
35+
pytest --cov=operational_analysis --cov-report=xml
36+
shell: bash
3337
- name: Upload coverage to Codecov
3438
uses: codecov/codecov-action@v1

CHANGELOG.md

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,11 @@
11
# Changelog
22
All notable changes to this project will be documented in this file. If you make a notable change to the project, please add a line describing the change to the "unreleased" section. The maintainers will make an effort to keep the [Github Releases](https://github.com/NREL/OpenOA/releases) page up to date with this changelog. The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/).
33

4+
## [2.0.1 - 2020-10-13]
5+
- Replaced `GeoPandas` functionality with `pyproj` and `Shapely` for coordinate
6+
reference system conversion and distance measurements.
7+
- Moved and renamed tests and updated the documentation accordingly.
8+
49
## [2.0.0 - 2020-08-11]
510
- Switch to [semantic versioning](https://semver.org) from this release forward.
611
- Efficiency improvements in AEP calculation
@@ -31,4 +36,4 @@ All notable changes to this project will be documented in this file. If you make
3136
- Turbine / Scada level toolkits: Filtering, Imputing, Met, Pandas Plotting, Timeseries, Unit Conversion
3237
- Most toolkits and all methods are fully documented in Sphinx.
3338
- Two example notebooks: Operational AEP Analysis and Turbine Analysis
34-
- All toolkits except for Pandas Plotting have > 80% test coverage.
39+
- All toolkits except for Pandas Plotting have > 80% test coverage.

examples/00_toolkit_examples.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@
6060
}
6161
],
6262
"source": [
63-
"project = Project_Engie('./data/la_haute_borne/')\n",
63+
"project = Project_Engie('./data/la_haute_borne')\n",
6464
"project.prepare()"
6565
]
6666
},
@@ -493,4 +493,4 @@
493493
},
494494
"nbformat": 4,
495495
"nbformat_minor": 2
496-
}
496+
}

examples/02_plant_aep_analysis.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@
7676
"outputs": [],
7777
"source": [
7878
"# Load plant object\n",
79-
"project = Project_Engie('./data/la_haute_borne/')"
79+
"project = Project_Engie('./data/la_haute_borne')"
8080
]
8181
},
8282
{
@@ -1001,4 +1001,4 @@
10011001
},
10021002
"nbformat": 4,
10031003
"nbformat_minor": 2
1004-
}
1004+
}

examples/02b_augmented_plant_aep_analysis.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@
5858
"outputs": [],
5959
"source": [
6060
"# Load plant object\n",
61-
"project = Project_Engie('./data/la_haute_borne/')"
61+
"project = Project_Engie('./data/la_haute_borne')"
6262
]
6363
},
6464
{
@@ -1240,7 +1240,7 @@
12401240
"name": "python",
12411241
"nbconvert_exporter": "python",
12421242
"pygments_lexer": "ipython3",
1243-
"version": "3.7.7"
1243+
"version": "3.7.4"
12441244
},
12451245
"toc": {
12461246
"base_numbering": 1,
@@ -1258,4 +1258,4 @@
12581258
},
12591259
"nbformat": 4,
12601260
"nbformat_minor": 4
1261-
}
1261+
}

examples/03_turbine_ideal_energy.ipynb

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -62,7 +62,7 @@
6262
"outputs": [],
6363
"source": [
6464
"# Load plant object\n",
65-
"project = Project_Engie('./data/la_haute_borne/')"
65+
"project = Project_Engie('./data/la_haute_borne')"
6666
]
6767
},
6868
{
@@ -628,7 +628,7 @@
628628
"name": "python",
629629
"nbconvert_exporter": "python",
630630
"pygments_lexer": "ipython3",
631-
"version": "3.7.7"
631+
"version": "3.7.4"
632632
},
633633
"toc": {
634634
"base_numbering": 1,
@@ -646,4 +646,4 @@
646646
},
647647
"nbformat": 4,
648648
"nbformat_minor": 4
649-
}
649+
}

examples/04_electrical_losses.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@
7171
"outputs": [],
7272
"source": [
7373
"# Load wind farm object\n",
74-
"project = Project_Engie('./data/la_haute_borne/')"
74+
"project = Project_Engie('./data/la_haute_borne')"
7575
]
7676
},
7777
{
@@ -426,4 +426,4 @@
426426
},
427427
"nbformat": 4,
428428
"nbformat_minor": 2
429-
}
429+
}

examples/05_eya_gap_analysis.ipynb

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@
6767
],
6868
"source": [
6969
"# Load plant object and process plant data\n",
70-
"project = Project_Engie('./data/la_haute_borne/')\n",
70+
"project = Project_Engie('./data/la_haute_borne')\n",
7171
"project.prepare()"
7272
]
7373
},
@@ -252,4 +252,4 @@
252252
},
253253
"nbformat": 4,
254254
"nbformat_minor": 2
255-
}
255+
}

operational_analysis/__init__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
__version__ = "2.0.0"
1+
__version__ = "2.0.1"
22

33
import json
44
import logging

operational_analysis/types/asset.py

Lines changed: 9 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -1,17 +1,17 @@
11
import importlib
22
import itertools
33

4-
import geopandas as gp
54
import numpy as np
65
import pandas as pd
6+
from pyproj import Transformer
77
from shapely.geometry import Point
88

99

1010
class AssetData(object):
1111
"""
12-
This class wraps around a GeoPandas dataframe that contains
12+
This class wraps around a Pandas dataframe that contains
1313
metadata about the plant assets. It provides some useful functions
14-
to work with this data (e.g., calculating nearest neighbors, etc.)
14+
to work with this data (e.g., calculating nearest neighbors, etc.).
1515
"""
1616

1717
def __init__(self, engine="pandas"):
@@ -89,12 +89,10 @@ def parse_geometry(self, srs='epsg:4326', zone=None, longitude=None):
8989
longitude = self.df['longitude'].mean()
9090
zone = int(np.floor((180 + longitude) / 6.0)) + 1
9191

92-
self._asset = gp.GeoDataFrame(self._asset)
93-
self._asset['geometry'] = self._asset.apply(lambda x: Point(x['longitude'], x['latitude']), 1)
94-
self._asset.set_geometry('geometry')
95-
self._asset.crs = {'init': srs}
96-
self._asset = self._asset.to_crs(
97-
"+proj=utm +zone=" + str(zone) + " +ellps=WGS84 +datum=WGS84 +units=m +no_defs")
92+
to_crs = f"+proj=utm +zone={zone} +ellps=WGS84 +datum=WGS84 +units=m +no_defs"
93+
transformer = Transformer.from_crs(srs.upper(), to_crs)
94+
lats, lons = transformer.transform(self._asset["latitude"].values, self._asset["longitude"].values)
95+
self._asset["geometry"] = [Point(lat, lon) for lat, lon in zip (lats, lons)]
9896

9997
def calculate_nearest(self, active_turbine_ids, active_tower_ids):
10098
"""Create or overwrite a column called 'nearest_turbine_id' or 'nearest_tower_id' which contains the asset id
@@ -124,11 +122,11 @@ def calculate_nearest(self, active_turbine_ids, active_tower_ids):
124122

125123
def distance_matrix(self):
126124
ret = np.ones((self._asset.shape[0], self._asset.shape[0])) * -1
127-
for i, j in itertools.permutations(self._asset.index, 2):
125+
for i, j in itertools.combinations(self._asset.index, 2):
128126
point1 = self._asset.loc[i, 'geometry']
129127
point2 = self._asset.loc[j, 'geometry']
130128
distance = point1.distance(point2)
131-
ret[i][j] = distance
129+
ret[i, j] = ret[j, i] = distance
132130
return ret
133131

134132
def asset_ids(self):

pytest.ini

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,2 @@
1+
[pytest]
2+
python_files = test/*.py

readme.md

Lines changed: 3 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -31,19 +31,6 @@ conda create --name openoa-env python=3
3131
conda activate openoa-env
3232
```
3333

34-
#### Special Note for users of Microsoft Windows:
35-
36-
The Anaconda python distribution is *required* for users of Microsoft Windows. This is because the pip package of GDAL for Windows requires Visual Studio to compile some of the dependencies. While advanced users are welcome to explore this option, we find it is easier to install the following packages via Anaconda:
37-
38-
```
39-
conda install shapely
40-
conda install geos
41-
conda install fiona
42-
```
43-
44-
If errors about Visual Studio persist, you can try downloading the [Microsoft Visual Studio compiler for Python](https://www.microsoft.com/en-us/download/details.aspx?id=44266) and compiling GDAL yourself.
45-
46-
4734
### Installation:
4835

4936
Clone the repository and install the library and its dependencies using pip:
@@ -88,13 +75,13 @@ unzip examples/data/la_haute_borne.zip -d examples/data/la_haute_borne/
8875
Tests are written in the Python unittest framework and are runnable using pytest. To run all tests with code coverage reporting:
8976

9077
```
91-
pytest -o python_files=test/*.py --cov=operational_analysis
78+
pytest --cov=operational_analysis
9279
```
9380

9481
To run unit tests only:
9582

9683
```
97-
pytest -o python_files=test/test_*.py --cov=operational_analysis
84+
pytest --ignore=test/regression/ --cov=operational_analysis
9885
```
9986

10087
#### Documentation
@@ -117,6 +104,7 @@ Nathan Agarwal,
117104
Nicola Bodini,
118105
Anna Craig,
119106
Jason Fields,
107+
Rob Hammond,
120108
Travis Kemper,
121109
Joseph Lee,
122110
Monte Lunacek,

requirements.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
# Requirements for the OpenOA software package
22
eia-python>=1.22
3-
geopandas>=0.4.0
3+
pyproj>=2.6.1
4+
shapely>=1.7.1
45
numpy>=1.15.4
56
pandas>=0.23.4
67
pygam>=0.8.0

setup.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,12 +49,13 @@ def read_file(filename):
4949
"scipy",
5050
"pandas",
5151
"pygam",
52-
"geopandas",
5352
"tqdm",
5453
"statsmodels",
5554
"scikit_learn",
5655
"EIA-python",
57-
"requests"],
56+
"requests",
57+
"pyproj",
58+
"shapely"],
5859
tests_require=['pytest', 'pytest-cov'],
5960
python_requires='>=3.6'
6061
)

test/regression/__init__.py

Whitespace-only changes.

test/unit/__init__.py

Whitespace-only changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.

0 commit comments

Comments
 (0)