Skip to content

Feature: optional loading of an EPOCH input deck#93

Merged
JoelLucaAdams merged 37 commits intoepochpic:mainfrom
Dartrisen:feature/adding-deck-handler
Feb 6, 2026
Merged

Feature: optional loading of an EPOCH input deck#93
JoelLucaAdams merged 37 commits intoepochpic:mainfrom
Dartrisen:feature/adding-deck-handler

Conversation

@Dartrisen
Copy link
Contributor

@Dartrisen Dartrisen commented Jan 12, 2026

Now you can get access to the input.deck file by simply doing this:

import sdf_xarray as sdf
import xarray as xr
import epydeck

TEST_FILES_DIR = sdf.download.fetch_dataset("test_files_1D")
ds = xr.open_dataset(TEST_FILES_DIR / "0000.sdf", load_deck=True)
ds.attrs["deck"]

The package epydeck should be installed in your virtual environment to use this. The default value of load_deck is False.

Resolves #91

@JoelLucaAdams JoelLucaAdams self-requested a review January 12, 2026 11:36
@JoelLucaAdams
Copy link
Collaborator

Hi @Dartrisen, thank you very much for implementing the new feature!

This is a great first start although it would be nice to also allow for this parameter would accept bool | str | Path with the default being False. If the user passes in a str | Path then it would first check if the path specified is a full file path using Path.is_absolute(), otherwise if the path is relative then look for it in the same directory as the SDF file being opened.

On top of adding this feature could you also add some additional documentation to highlight how this works? Probably a small section after this https://sdf-xarray.readthedocs.io/en/latest/key_functionality.html#loading-specific-variables or potentially a new page if you prefer.

@JoelLucaAdams
Copy link
Collaborator

FYI, you might want to additionally pull in branch #89 so that it works with datatrees as well

Copy link
Collaborator

@JoelLucaAdams JoelLucaAdams left a comment

Choose a reason for hiding this comment

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

Thank you for the feature implementation! There are a few things that need ironing out that I have listed below.

On top of those changes you also need to add some tests please

@JoelLucaAdams JoelLucaAdams mentioned this pull request Feb 3, 2026
Copy link
Collaborator

@JoelLucaAdams JoelLucaAdams left a comment

Choose a reason for hiding this comment

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

Looks great now, nice job!

Copy link
Collaborator

@LiamPattinson LiamPattinson left a comment

Choose a reason for hiding this comment

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

Hi, this pretty much all looks good to me. I just have a few comments, but two of them would require a fairly major overhaul of the branch, so it would be understandable if you would rather merge now and consider coming back to it later. Setting epydeck as an optional dependency would be pretty easy though.

@JoelLucaAdams
Copy link
Collaborator

There are lots of duplicate tests in here, for now we can ignore this problem as it will be resolved when someone tackles #100

Copy link
Collaborator

@LiamPattinson LiamPattinson left a comment

Choose a reason for hiding this comment

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

Nice, this is looking a lot better! Just a few minor issues from here, one of which was an existing issue in the code that may as well be fixed while we're at it.

@JoelLucaAdams
Copy link
Collaborator

@Dartrisen can you also add your info to the authors section in the pyproject.toml and to the end of the CITATION.cff file please?

@Dartrisen
Copy link
Contributor Author

are we good to merge? @LiamPattinson @JoelLucaAdams

Copy link
Collaborator

@LiamPattinson LiamPattinson left a comment

Choose a reason for hiding this comment

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

Looks good to me, sorry that we got a bit lost in the minutiae there!

@JoelLucaAdams JoelLucaAdams merged commit 845628f into epochpic:main Feb 6, 2026
6 checks passed
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.

Optionally load EPOCH input.deck file

3 participants