Skip to content

Conversation

@softwareengineerprogrammer
Copy link
Owner

@softwareengineerprogrammer softwareengineerprogrammer commented Jan 26, 2026

Description

Addresses NatLabRockies#444 (comment)

Demonstrations of backfill calculations:

  1. https://gist.github.com/softwareengineerprogrammer/64bffe886046ccf70b2871369dcb14e9#file-sam-em-mcy-levelized-metrics_2026-01-26-2_separate-backfilled-rows-csv-L112: image

  2. https://gist.github.com/softwareengineerprogrammer/6e54cdf9cc9456790b01695027353855#file-sam-em-mcy-levelized-metrics_2026-01-26-2_native-backfilled-rows-csv-L112

TODO

  1. Sync SAM-EM MCY documentation
  2. LPPA
  3. Update LCOE extraction logic

Testing & Verification

  1. Unit tests added: Describe new unit tests added, if any.
  2. Unit tests updated: Describe existing unit tests that were updated, if any.
  3. Manual testing: Describe any additional manual testing steps that were performed, such as running the change on a pre-existing data set you own.

Change Checklist:

Observe the following checklist items if your change includes a new version (see versioning notes and version management docs).

Before merging:

  1. Add a CHANGELOG entry (example). RST Template:
M.m.P: `TITLE <https://github.com/NREL/GEOPHIRES-X/pull/PR-NUMBER>`__ | `release <https://github.com/NREL/GEOPHIRES-X/releases/tag/vM.m.P>`__

After merging:

  1. Push tag(s) to GitHub: git push origin refs/tags/vM.m.P
  2. Post a change announcement to the GEOPHIRES Change Announcements Discussion (example). Markdown template:
M.m.p: [TITLE](https://github.com/NREL/GEOPHIRES-X/pull/PR-NUMBER) | [release](https://github.com/NREL/GEOPHIRES-X/releases/tag/vM.m.P)

Additional metadata such as TODO items or link to your initial self-review (PR into your own fork created prior to submission)


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.
Copy link
Owner Author

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

Comment on lines -326 to +359
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)
Copy link
Owner Author

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

@softwareengineerprogrammer softwareengineerprogrammer changed the title SAM-EM MCY Levelized Metrics Update [WIP] SAM-EM MCY Levelized Metrics Update Jan 26, 2026
Comment on lines -1140 to -1150

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
Copy link
Owner Author

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

Comment on lines +127 to 138
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
Copy link
Owner Author

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:
Copy link
Owner Author

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

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