Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Guard against haunted netCDF4/HDF5 combo #119

Merged
merged 1 commit into from
Sep 13, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
5 changes: 5 additions & 0 deletions src/tristan/command_line/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import argparse
import glob
import re
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/apply_flat_field.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import argparse
import pathlib
import shutil
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys
from pathlib import Path

Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/gated_images_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys

import h5py
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/multiple_images_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys

import h5py
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/multiple_sequences_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys
from contextlib import ExitStack
from pathlib import Path
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/pump_probe_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys

import h5py
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/command_line/images/single_image_cli.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import sys
from operator import mul

Expand Down
5 changes: 5 additions & 0 deletions src/tristan/diagnostics/check_valid_events.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import argparse
import logging
import multiprocessing as mp
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/diagnostics/find_trigger_intervals.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import argparse
import logging
import multiprocessing as mp
Expand Down
5 changes: 5 additions & 0 deletions src/tristan/diagnostics/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,11 @@

from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
import netCDF4 # noqa F401

import glob
import logging
from enum import Enum
Expand Down
4 changes: 2 additions & 2 deletions tests/conftest.py
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
from __future__ import annotations

# Some platforms seem to raise OSError: [Errno -101] NetCDF: HDF error:
# '/tmp/pytest-of-vsts/pytest-0/dummy_data1/dummy_000001.h5'
# '/path/to/HDF5/file.h5'
# Importing netCDF4 before h5py here seems to fix it. ¯\_(ツ)_/¯
from netCDF4 import Dataset # noqa F401
import netCDF4 # noqa F401

import os
from contextlib import contextmanager
Expand Down