-
Notifications
You must be signed in to change notification settings - Fork 1
[WIP] SAM-EM MCY Levelized Metrics Update #130
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
base: user-provided-reservoir-output-profile-2
Are you sure you want to change the base?
[WIP] SAM-EM MCY Levelized Metrics Update #130
Conversation
…SAM+Economic+Models+do+not+calculate+carbon+revenue in SAM-EM Limitations section
…preparation to add backfilled PV/LCOE rows
|
|
||
| 1. Only Electricity end-use is supported | ||
| 2. Add-ons with electricity and heat are not currently supported. (Add-ons CAPEX, OPEX, and profit are supported.) | ||
| 3. Carbon Revenue is not currently supported, but will be in future releases. See [tracking issue](https://github.com/NatLabRockies/GEOPHIRES-X/issues/458?title=SAM+Economic+Models+do+not+calculate+carbon+revenue) for details. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this change, it's incorrectly shown as belonging to this PR due to cherry-picking
| with self.assertLogs(level='INFO') as logs: | ||
| _del_metadata( | ||
| GeophiresXClient().get_geophires_result( | ||
| GeophiresInputParameters( | ||
| from_file_path=self._get_test_file_path('../examples/example5b.txt'), | ||
| params={ | ||
| 'Reservoir Output Profile': ','.join( | ||
| [str(it) for it in [30 * v for v in [*([10] * 7), 9, 8, 7]]] | ||
| ) | ||
| }, | ||
| try: | ||
| with self.assertLogs(level='INFO') as logs: | ||
| _del_metadata( | ||
| GeophiresXClient().get_geophires_result( | ||
| GeophiresInputParameters( | ||
| from_file_path=self._get_test_file_path('../examples/example5b.txt'), | ||
| params={ | ||
| 'Reservoir Output Profile': ','.join( | ||
| [str(it) for it in [30 * v for v in [*([10] * 7), 9, 8, 7]]] | ||
| ) | ||
| }, | ||
| ) | ||
| ) | ||
| ) | ||
| ) | ||
|
|
||
| self.assertHasLogRecordWithMessage( | ||
| logs, 'Reservoir temperature extrapolation result', treat_substring_match_as_match=True | ||
| ) | ||
| self.assertHasLogRecordWithMessage( | ||
| logs, 'Reservoir temperature extrapolation result', treat_substring_match_as_match=True | ||
| ) | ||
|
|
||
| self.assertHasLogRecordWithMessage( | ||
| logs, | ||
| # TODO make this less hard-coded | ||
| '[207.73, 177.48, 147.23, 116.97, 86.72, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0]', | ||
| treat_substring_match_as_match=True, | ||
| ) | ||
| self.assertHasLogRecordWithMessage( | ||
| logs, | ||
| # TODO make this less hard-coded | ||
| '[207.73, 177.48, 147.23, 116.97, 86.72, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, 80.0, ' | ||
| '80.0, 80.0]', | ||
| treat_substring_match_as_match=True, | ||
| ) | ||
| except AssertionError as ae: | ||
| self._handle_assert_logs_failure(ae) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this change, it's incorrectly shown as belonging to this PR due to cherry-picking
|
|
||
| def _handle_assert_logs_failure(self, ae: AssertionError): | ||
| if sys.version_info[:2] == (3, 8) and self._is_github_actions(): | ||
| # FIXME - see | ||
| # https://github.com/softwareengineerprogrammer/GEOPHIRES/actions/runs/19646240874/job/56262028512#step:5:344 | ||
| _log.warning( | ||
| f'WARNING: Skipping logs assertion in GitHub Actions ' | ||
| f'for Python {sys.version_info.major}.{sys.version_info.minor}' | ||
| ) | ||
| else: | ||
| raise ae |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this change, it's incorrectly shown as belonging to this PR due to cherry-picking
| def _handle_assert_logs_failure(self, ae: AssertionError): | ||
| if sys.version_info[:2] == (3, 8) and self._is_github_actions(): | ||
| # FIXME - see | ||
| # https://github.com/softwareengineerprogrammer/GEOPHIRES/actions/runs/19646240874/job/56262028512#step:5:344 | ||
| print( | ||
| f'WARNING: Skipping logs assertion in GitHub Actions ' | ||
| f'for Python {sys.version_info.major}.{sys.version_info.minor}' | ||
| ) | ||
| else: | ||
| raise ae | ||
|
|
||
| @staticmethod |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this change, it's incorrectly shown as belonging to this PR due to cherry-picking
| self.assertIn(str(msg_type_error), '(you may have meant to pass percent=10)') | ||
|
|
||
| with self.assertLogs(level='INFO') as logs: | ||
| with self.assertLogs('tests.base_test_case', level='INFO') as logs: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ignore this change, it's incorrectly shown as belonging to this PR due to cherry-picking
Description
Addresses NatLabRockies#444 (comment)
Demonstrations of backfill calculations:
https://gist.github.com/softwareengineerprogrammer/64bffe886046ccf70b2871369dcb14e9#file-sam-em-mcy-levelized-metrics_2026-01-26-2_separate-backfilled-rows-csv-L112:
https://gist.github.com/softwareengineerprogrammer/6e54cdf9cc9456790b01695027353855#file-sam-em-mcy-levelized-metrics_2026-01-26-2_native-backfilled-rows-csv-L112
TODO
Testing & Verification
Change Checklist:
Observe the following checklist items if your change includes a new version (see versioning notes and version management docs).
Before merging:
After merging:
git push origin refs/tags/vM.m.PAdditional metadata such as TODO items or link to your initial self-review (PR into your own fork created prior to submission)