Skip to content

Commit

Permalink
Merge pull request #5054 from neutrinoceros/parthenon/bug/missing_loa…
Browse files Browse the repository at this point in the history
…d_requirements

BUG: fix error message when trying to load a Parthenon dataset without h5py installed
  • Loading branch information
chrishavlin authored Nov 13, 2024
2 parents 35be588 + 43d6b12 commit 35a0297
Showing 1 changed file with 3 additions and 0 deletions.
3 changes: 3 additions & 0 deletions yt/frontends/parthenon/data_structures.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,7 @@ def _populate_grid_objects(self):


class ParthenonDataset(Dataset):
_load_requirements = ["h5py"]
_field_info_class = ParthenonFieldInfo
_dataset_type = "parthenon"
_index_class = ParthenonHierarchy
Expand Down Expand Up @@ -312,6 +313,8 @@ def _parse_parameter_file(self):

@classmethod
def _is_valid(cls, filename: str, *args, **kwargs) -> bool:
if cls._missing_load_requirements():
return False
return filename.endswith((".phdf", ".rhdf"))

@property
Expand Down

0 comments on commit 35a0297

Please sign in to comment.