Skip to content

Feature: Add feedstock_dir option for the EIA Natural Gas functionality#801

Merged
johnjasa merged 11 commits into
NatLabRockies:developfrom
RHammond2:feature/eia-feedstock-dir
Jul 8, 2026
Merged

Feature: Add feedstock_dir option for the EIA Natural Gas functionality#801
johnjasa merged 11 commits into
NatLabRockies:developfrom
RHammond2:feature/eia-feedstock-dir

Conversation

@RHammond2

Copy link
Copy Markdown
Collaborator

Add feedstock_dir option for the EIA Natural Gas functionality

This PR adds the feedstock_dir input option for the EIA natural gas downloading and configuration in place of just the filename using a complete file path. This change ensures the feedstocks and resources use similar APIs. In this case the FEEDSTOCK_DEFAULT_DIR / "natural_gas" will always be used as a default when a filename is provided.

Section 1: Type of Contribution

  • Feature Enhancement
    • Framework
    • New Model
    • Updated Model
    • Tools/Utilities
    • Other (please describe):
  • Bug Fix
  • Documentation Update
  • CI Changes
  • Other (please describe):

Section 2: Draft PR Checklist

N/A

Section 3: General PR Checklist

  • PR description thoroughly describes the new feature, bug fix, etc.
  • Added tests for new functionality or bug fixes -- updated, no new tests
  • Tests pass (If not, and this is expected, please elaborate in the Section 6: Test Results)
  • Documentation
    • Docstrings are up-to-date
    • Related docs/ files are up-to-date, or added when necessary
    • Documentation has been rebuilt successfully
    • Examples have been updated (if applicable)
  • CHANGELOG.md
    • At least one complete sentence has been provided to describe the changes made in this PR
    • After the above, a hyperlink has been provided to the PR using the following format:
      "A complete thought. [PR XYZ]((https://github.com/NatLabRockies/H2Integrate/pull/XYZ)", where
      XYZ should be replaced with the actual number.

Section 4: Related Issues

N/A

Section 5: Impacted Areas of the Software

Section 5.1: New Files

N/A

Section 5.2: Modified Files

  • h2integrate/core/utils/file_utils.py
    • check_data_dir: Calls to Path.mkdir() now include parents=True to enable the creation of a nonexistent series of "feedstock" and "natural_gas" subdirectories when required.
  • h2integrate/preprocess/eia.py
    • get_eia_ng_data: adds feedstock_dir, which if unprovided will default to h2integrate.FEEDSTOCK_DEFAULT_DIR / "natural_gas"
  • h2integrate/feedstocks/eia_ng_price.py
    • EIANaturalGasFeedstockConfig: adds feedstock_dir, which if unprovided will default to h2integrate.FEEDSTOCK_DEFAULT_DIR / "natural_gas"

Section 6: Additional Supporting Information

Originally these changes were slated for #777, but the PR was merged prior to this addition following #791.

Section 7: Test Results, if applicable

Tests pass

Section 8 (Optional): New Model Checklist

N/A

@RHammond2 RHammond2 requested a review from elenya-grant July 7, 2026 18:48
@RHammond2 RHammond2 changed the base branch from main to develop July 7, 2026 18:49

@johnjasa johnjasa left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

Thanks Rob! I like these changes and appreciate your patience as I merge in PRs at varied paces.

@johnjasa johnjasa marked this pull request as draft July 8, 2026 18:44
@johnjasa johnjasa marked this pull request as ready for review July 8, 2026 18:44
@johnjasa johnjasa enabled auto-merge (squash) July 8, 2026 18:47
@johnjasa johnjasa merged commit d336ecf into NatLabRockies:develop Jul 8, 2026
17 of 22 checks passed
@RHammond2 RHammond2 deleted the feature/eia-feedstock-dir branch July 8, 2026 23:29
Comment on lines +351 to +357
filename (str | Path | None): File name where the EIA data can either be loaded from
or should be saved to. If None, then data will be queried and returned with saving
left to the user.
left to the user. Should be used in conjunction with :py:attr:`feedstock_dir` or the
file will be expected in :py:attr:`h2integrate.FEEDSTOCK_DEFAULT_DIR` / "natural_gas"
feedstock_dir (str | Path | None): File path for where the the data should be saved to or
retrieved from. If None, and :py:attr:`filename` is used, then
":py:attr:`h2integrate.FEEDSTOCK_DEFAULT_DIR` / "natural_gas" will be used.

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

I saw this just got merged but wanted to comment this anyway:

Is my understanding of the logic correct:

  • if filename is a full filepath and feedstock_dir is None, then it loads or saves data to filename
  • if filename is a file name (string) and feedstock_dir is None, then it loads or saves data to FEEDSTOCK_DEFAULT_DIR/"natural_gas"/filename?
  • if filename is None, data is pulled from the API (its not loaded from pre-existing data and not saved to a file)
  • if feedstock_dir is a full folder path and filename is a string, it saves the data to feedstock_dir/filename

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.

3 participants