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

Gb/plexos agg #8

Merged
merged 29 commits into from
Oct 3, 2019
Merged

Gb/plexos agg #8

merged 29 commits into from
Oct 3, 2019

Conversation

grantbuster
Copy link
Member

Plexos aggregation complete. Just finished adding test files. No rush on this as it is not a FY2019 goal.

 - plexos single node agg
 - data cleaner tests
 - high level aggregation buildout integrated test
@@ -0,0 +1,102 @@
# -*- coding: utf-8 -*-
"""reX SQL Database handler.
Copy link
Collaborator

Choose a reason for hiding this comment

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

Ug database. Is there any way we can deprecate this and have the GDS team give us flat files or is this the crux of the reV -> ReEDS -> reV -> PLEXOS pipeline?

Copy link
Member Author

Choose a reason for hiding this comment

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

After discussion, our preferred method would be to have the DB handler (both retrieval and push) be in reVX, then have an optional DB push step in the reV pipeline that imports from reVX within a try except statement, so that it's not a hard dependency.

"""

self._root_dir = root_dir
self._sub_dirs = sub_dirs
Copy link
Collaborator

Choose a reason for hiding this comment

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

Would it be useful to have this be optional? I.e., if it's None than we would search the root_dir for all sub_dirs and ignore a pre-defined set (e.g., stdout or stderr)

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes thats a good idea, actions:

  1. add parse subdirs method
  2. remove subdirs from classmethod entry point
  3. input subdirs kwarg from job frac map

self._year = year
self._fpaths = self._get_all_fpaths()

def _get_sub_dir_fpath(self, sub_dir):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What happens if there are multiple .h5 files in the sub directory?

Copy link
Member Author

Choose a reason for hiding this comment

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

Better idea: make list of fpaths that fit the criteria, if more than one, raise.

"""

if not sub_dir.endswith('/'):
sub_dir += '/'
Copy link
Collaborator

Choose a reason for hiding this comment

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

why do you need the backsplash?

Copy link
Member Author

Choose a reason for hiding this comment

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

can remove.

fpaths.append(self._get_sub_dir_fpath(sub_dir))
return fpaths

def _merge_data(self, dset, job_frac_map):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Why do we merge data?

Copy link
Member Author

Choose a reason for hiding this comment

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

From different tilt/azimuth combinations. Added details in docstring.


return rev_sc, reeds_build

def _make_forecast_map(self):
Copy link
Collaborator

Choose a reason for hiding this comment

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

We shouldn't need this anymore

Copy link
Member Author

Choose a reason for hiding this comment

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

Future revision.

plexos_coord_labels = self._get_coord_labels(self._plexos_nodes)
sc_coord_labels = self._get_coord_labels(self._sc_build)
tree = cKDTree(self._plexos_nodes[plexos_coord_labels])
_, i = tree.query(self._sc_build[sc_coord_labels], k=k)
Copy link
Collaborator

Choose a reason for hiding this comment

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

Any concerns about plexos nodes and resource not being near each other?

Copy link
Member Author

Choose a reason for hiding this comment

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

Definitely copy in the logging info statement from dpv run.

self._ammend_plexos_meta(i, res_gids, gen_gids, res_built)

else:
for i, inode in enumerate(np.unique(self._node_map)):
Copy link
Collaborator

Choose a reason for hiding this comment

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

Add completion logging here too

Copy link
Member Author

Choose a reason for hiding this comment

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

Will add % complete logging into both parallel and serial.

profiles[:, i] = profile
self._ammend_plexos_meta(i, res_gids, gen_gids, res_built)

logger.info('Finished plexos node aggregation.')
Copy link
Collaborator

Choose a reason for hiding this comment

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

Remove after adding % complete to both parallel and serial profiles making


return meta, profiles

def merge_extent(self, new_meta, new_profiles):
Copy link
Collaborator

Choose a reason for hiding this comment

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

What does this do?

Copy link
Member Author

Choose a reason for hiding this comment

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

Merges different extents and technologies - pv urban/rural, can/con/mex.

@grantbuster
Copy link
Member Author

@MRossol, review comments resolved.

@grantbuster grantbuster merged commit 28e79e9 into master Oct 3, 2019
@grantbuster grantbuster deleted the gb/plexos_agg branch October 3, 2019 15:46
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.

2 participants