Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Mjb/feat/x mission path #115

Closed
wants to merge 36 commits into from
Closed

Mjb/feat/x mission path #115

wants to merge 36 commits into from

Conversation

mikebannis
Copy link
Collaborator

No description provided.

@mikebannis mikebannis requested a review from MRossol May 27, 2021 19:12
@mikebannis mikebannis force-pushed the mjb/feat/x-mission-path branch 3 times, most recently from ecaa509 to d5848df Compare June 8, 2021 15:22
@mikebannis mikebannis force-pushed the mjb/feat/x-mission-path branch 3 times, most recently from cb2ff6b to 13a4b7f Compare June 17, 2021 20:42
@codecov-commenter
Copy link

codecov-commenter commented Jun 28, 2021

Codecov Report

Merging #115 (933f9b2) into main (c57e982) will decrease coverage by 2.05%.
The diff coverage is 42.72%.

Impacted file tree graph

@@            Coverage Diff             @@
##             main     #115      +/-   ##
==========================================
- Coverage   80.00%   77.94%   -2.06%     
==========================================
  Files          91       97       +6     
  Lines        9306     9852     +546     
==========================================
+ Hits         7445     7679     +234     
- Misses       1861     2173     +312     
Flag Coverage Δ
unittests 77.94% <42.72%> (-2.06%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Impacted Files Coverage Δ
reVX/x_mission_paths/path_finder.py 20.48% <20.48%> (ø)
reVX/x_mission_paths/file_handlers.py 20.53% <20.53%> (ø)
reVX/x_mission_paths/utilities.py 33.33% <33.33%> (ø)
reVX/x_mission_paths/multipliers.py 68.50% <68.50%> (ø)
tests/test_x_mission_costs.py 92.68% <92.68%> (ø)
reVX/x_mission_paths/config/__init__.py 100.00% <100.00%> (ø)
reVX/handlers/database.py 0.00% <0.00%> (ø)
... and 5 more

Copy link
Collaborator

@MRossol MRossol left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

just a start...

meta = src.meta
for feat in src:
feats.append(feat)
print(f'Loaded {len(feats)} features from {in_shp}')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use logging instead of print statements. The best practices for logging are:

  1. setup a logger at the module (file) level using the module name:
logger = logging.getLogger(__name__)
  1. Have the user configure the logger, the only exception here is in the CLI where we setup the loggers to either log to the stream or the stream + a file.

dst.writerecords(new_feats)


def main():
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Its frowned upon to have scripts inside a package. Turn this into a CLI if you need to execute it, other wise create the script elsewhere.

import sys


def update_substations(in_shp, out_shp, template):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why are we doing this before hand? Isn't this going to depend on the supply curve resolution? If so we should merge this functionality into the main class and have it run on the fly.

METERS_IN_MILE = 1609.344


def buildCostRasters(iso_regions_f, nlcd_f, slope_f, exclusions_f, template_f,
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This should be a class method of CostMultiplier not a stand alone function.

TODO

"""
print('Loading all files')
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

See above about print statements...

logger.debug('Determining voltages for substations, this will take '
'a while')
self.subs['temp_volts'] = self.subs.apply(self._get_volts, axis=1)
volts = self.subs.temp_volts.str.split('/', expand=True)
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I try to avoid the parameter notation in pandas/geopandas as it is confusing. Is temp_volts a method? Oh wait its a column. Lets just use column notation.

logger = logging.getLogger(__name__)


class BlockedTransFeature(Exception):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Serial process tie line costs for Supply Curve points

"""
def __init__(self, capacity_class='100MW', resolution=128, n=10):
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

capacity_class shouldn't be a kwarg

pass


class TransmissionCost:
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Whats the point of this class? It seems like its a glorified dictionary

@@ -0,0 +1,106 @@
import rasterio as rio
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Lets move this method to reVX/utilities/ sub-package

@MRossol
Copy link
Collaborator

MRossol commented Aug 13, 2021

Closing for refactor

@MRossol MRossol closed this Aug 13, 2021
@MRossol MRossol deleted the mjb/feat/x-mission-path branch August 13, 2021 15:07
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

3 participants