Skip to content

Conversation

@stefan-voelk
Copy link
Collaborator

Before you get started

  • 🙋‍♀️ Create an issue to discuss what you are going to do!

Description

The new module calc_h2.py module is added to the framework. The work is based on Floris Gunter Master Thesis The Climate Impact of Hydrogen Leakage in Aviation - A Machine Learning Approach to Long-Term Scenario Forecasting
https://resolver.tudelft.nl/uuid:67633521-cd00-4565-a5d6-5536d497acb9

The module calculates the climate response of (global) hydrogen fugitive emissions. Output are RF changes and species concentration changes. The module runs "stand-alone" with minimum interfaces to the overall OpenAirClim framework.

Special dependencies have to be met, in order to be able to install the module. Therefore, it is recommended to run the functions of this module in a separate conda environment, e.g. oac_h2 as described in the provided workflow documentation. Additional environment files have been added to facilitate the installation process.

Note: During the refactoring of this module, it was discovered that the general OpenAirClim framework (not the calc_h2 module) works without restricting the environment to a particular python version. Therefore, an additional change not related to this module was performed and this restriction was released in the environment files environment_dev.yaml and environment_minimal.yaml.

Type of change

  • Bug fix (non-breaking change which fixes an issue)
  • New feature (non-breaking change which adds functionality)
  • Breaking change (fix or feature that would cause existing functionality to not work as expected)
  • Documentation change

How has this been tested?

There have been added unit tests for following functions:

  • calculate_hydrogen_adoption_fraction()
  • prepare_data

Test configuration:

  • Operating system: MS Windows 11 Enterprise, 64-Bit
  • Other relevant information: The test module calc_h2_test.py queries if the keras package is available. Otherwise, the tests are not executed. Thus, the tests run only in a conda environment meeting the special requirements of this module. The existing GitHub workflow Install and run tests should omit these tests.

Checklist

  • My code follows the style guidelines of this project
  • I have performed a self-review of my code
  • I have commented my code, particularly in hard-to-understand areas
  • I have made corresponding changes to the documentation
  • My changes generate no new warnings
  • I have added tests that prove my fix is effective or that my feature works
  • New and existing unit tests pass locally with my changes
  • Any changed dependencies have been added or removed correctly
  • main branch: I have updated the CHANGELOG
  • main branch: I have updated the version numbering in __about__.py according to the semantic versioning scheme

fagunter and others added 24 commits November 7, 2024 10:19
Uncommented ROOT_DIR from __init__.py
- Added TensorFlow to development and minimal environment files.
- Updated .gitignore to exclude the new repository/h2 directory.
- Added new fuel consumption scenario CSV files for BAU and CurTec.
- Updated CHANGELOG with a fix for `PermissionError` when example input directory does not exist.
- Incremented version number to 0.11.1 in __about__.py.
- Introduced multiple new Keras model files for surrogate models in the h2 and o3 directories.
- Added new fuel consumption scenario CSV files for BAU and CurTec.
- Updated .gitignore to exclude specific files related to the new models.
The calc_h2.py module depends on the python package tensorflow. For Windows systems, special requirements have to be met for the installation of tensorflow. The environment files create dedicated conda environments for the execution of calc_h2.py commands. Installation instructions are added to the documentation in hydrogen.md.
calc_h2.py automatically reformatted with black formatter, module added to init imports.
Environment file environment_h2.yaml changed to support python version 3.12, documentation hydrogen.md updated and Getting started added (Where to download background SSP scenarios).
Renaming of function run_case() to run_h2_case() to be more specific and avoiding misunderstandings when used system-wide.
Usage section added
Reference Gunter (2024) added.
calc_h2 module will not be imported automatically with oac package anymore since this would throw an error if the oac package was loaded with "normal" oac conda environment (without tensorflow package). Instead calc_h2 module should be loaded separately. Function name changed back to run_case() since this would be called together with the module, e.g. calc_h2.run_case(). Documentation hydrogen.md and sphinx updated.
Module docstrings revised, Floris added as __author__
Refactor code, correct pylint errors, move hard-coded variables to CONSTANTS section in the beginning of the module, add stubs packages to environment files
import keras instead of tensorflow. Note: tensorflow package must be still installed. keras is a subpackage of tensorflow.
Replace functions load_o3 and load_lstm by unified function load_surrogate_model
load_lstm and load_o3 functions removed due to previous refactoring. The two functions have been merged to function load_surrogate_model. Renaming of very short variable names in order to be more descriptive. Reference added to header section.
Unit tests for module calc_h2.py. These tests are disabled if not run in an environment with tensorflow and keras packages installed.
Update header, revisions done by Stefan
Ignore netCDF files in repository/h2/SSP_scenarios rather than the folder itself.
Otherwise the empty directory would not be recognized by git/GitHub.
Ignore configuration files from the continue extension.
@stefan-voelk stefan-voelk requested a review from liammegill July 21, 2025 16:01
@stefan-voelk stefan-voelk self-assigned this Jul 21, 2025
@stefan-voelk stefan-voelk added the module: calc_h2 Related to the calc_h2 module label Jul 21, 2025
@stefan-voelk stefan-voelk marked this pull request as draft August 1, 2025 11:51
Fix load_surrogate_model: usage of return_fn get_fn arguments.
BAU2040 is a fixed consumption scenario with fuel usage as for BAU scenario at year 2040.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

module: calc_h2 Related to the calc_h2 module

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add Fugitive H2 Emissions Check hard-coded parameters. Review style of H2 module.

3 participants