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

Expand capability of geojson class #694

Open
wants to merge 4 commits into
base: develop
Choose a base branch
from
Open

Conversation

vtnate
Copy link
Contributor

@vtnate vtnate commented Jan 14, 2025

Any background context you want to provide?

The urbanopt-des repo has a geojson parsing class as well as the one in the GMT. Combining them should DRY up some code. Updating the uo-des version is accomplished in urbanopt/urbanopt-des#8.

What does this PR accomplish?

  • Add methods from the uo-des class that parses a geojson file
  • Separate the UrbanOptLoads class to its own file

How should this be manually tested?

CI is sufficient

@vtnate vtnate self-assigned this Jan 14, 2025
@vtnate vtnate marked this pull request as ready for review January 14, 2025 21:28
@vtnate vtnate requested a review from nllong January 14, 2025 21:28
pass


# TODO: Inherit from GeoJSON Feature class, move to its own file
Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'm now importing this class back into urbanopt_geojson, not inheriting. Is that the right pattern we should use?

@@ -47,6 +26,8 @@ def __init__(self, filename, building_ids=None, skip_validation=False):
:param building_ids: list[str | int] | None, optional, list of GeoJSON building
IDs to parse from the file. If None or an empty list, parse all buildings.
"""

self._filename = Path(filename).resolve()
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This came over from uo-des as well as the methods below.

@@ -122,3 +103,140 @@ def get_feature(self, jsonpath):

# otherwise return the list of values
return results

# TODO: test the following methods
Copy link
Contributor Author

Choose a reason for hiding this comment

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

We (I) should write some tests for these. Not sure if that should delay this PR or not.

pass


class UrbanOptLoad:
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is moved from urbanopt_geojson.py to its own file.

@@ -62,7 +62,7 @@ def __init__(self, system_parameters, template_dir):
}
# Get access to loop order output from ThermalNetwork package.
if "fifth_generation" in district_params and "ghe_parameters" in district_params["fifth_generation"]:
self.loop_order: list = load_loop_order(self.system_parameters.filename)
self.loop_order = load_loop_order(self.system_parameters.filename)
Copy link
Contributor Author

@vtnate vtnate Jan 15, 2025

Choose a reason for hiding this comment

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

Mypy said this was an unnecessary type hint, since the load_loop_order method is already hinted.

Copy link
Member

@nllong nllong left a comment

Choose a reason for hiding this comment

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

this looks good. I would like to run my UO DES post processing before we merge this. So stay tuned! Approving for now!

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