# Path: blimpy/h5diag.py
# def cmd_tool(args=None):
#     """ Command line tool h5diag """
#     parser = ArgumentParser(description="Command line utility for diagnosing HDF5 files.")
#     parser.add_argument("filename", type=str, help="Path of file to read")
#     if args is None:
#         args = sys.argv[1:]
#     parse_args = parser.parse_args(args)
# 
#     if not os.path.isfile(parse_args.filename):
#         oops("Not a file: {}".format(parse_args.filename))
#     if not h5py.is_hdf5(parse_args.filename):
#         oops("Not an HDF5 file: {}".format(parse_args.filename))
# 
#     examine(parse_args.filename)
#     print("\nNo errors detected")
# 
# Path: tests/data.py



from os.path import dirname
from blimpy.h5diag import cmd_tool
from tests.data import voyager_h5, voyager_fil
import numpy as np
import hdf5plugin
import h5py
import pytest


header = [
    ["fruit", "apple"],
    ["color", "red"],
    ["plant", "tree"]
    ]
DIR = dirname(voyager_fil)
TEST_H5 = DIR + "/test.h5"
TIME_INSTANCES = 8
FREQ_INSTANCES = 16
DATA_BYTESIZE = TIME_INSTANCES * FREQ_INSTANCES * 4


def my_writer(my_class):
    data_out = np.ndarray(shape=(TIME_INSTANCES, 1, FREQ_INSTANCES), dtype=float)
    for ii in range(TIME_INSTANCES):
        for jj in range(FREQ_INSTANCES):
            data_out[ii, 0, jj] = 42.0
    print("data_out shape:", data_out.shape)
    
    with h5py.File(TEST_H5, "w") as h5:

# Path: blimpy/h5diag.py
# def cmd_tool(args=None):
#     """ Command line tool h5diag """
#     parser = ArgumentParser(description="Command line utility for diagnosing HDF5 files.")
#     parser.add_argument("filename", type=str, help="Path of file to read")
#     if args is None:
#         args = sys.argv[1:]
#     parse_args = parser.parse_args(args)
# 
#     if not os.path.isfile(parse_args.filename):
#         oops("Not a file: {}".format(parse_args.filename))
#     if not h5py.is_hdf5(parse_args.filename):
#         oops("Not an HDF5 file: {}".format(parse_args.filename))
# 
#     examine(parse_args.filename)
#     print("\nNo errors detected")
# 
# Path: tests/data.py



# Path: tests/test_h5diag.py
from os.path import dirname
from blimpy.h5diag import cmd_tool
from tests.data import voyager_h5, voyager_fil
import numpy as np
import hdf5plugin
import h5py
import pytest



header = [
    ["fruit", "apple"],
    ["color", "red"],
    ["plant", "tree"]
    ]
DIR = dirname(voyager_fil)
TEST_H5 = DIR + "/test.h5"
TIME_INSTANCES = 8
FREQ_INSTANCES = 16
DATA_BYTESIZE = TIME_INSTANCES * FREQ_INSTANCES * 4


def my_writer(my_class):
    data_out = np.ndarray(shape=(TIME_INSTANCES, 1, FREQ_INSTANCES), dtype=float)
    for ii in range(TIME_INSTANCES):
        for jj in range(FREQ_INSTANCES):
            data_out[ii, 0, jj] = 42.0
    print("data_out shape:", data_out.shape)
    
    with h5py.File(TEST_H5, "w") as h5:

        h5.attrs["CLASS"]   = my_class