"""
q2netcdf - Manipulate Rockland Scientific's Q-files.

Provides tools to read, parse, and convert Q-files generated by
Rockland Scientific's ISDP data logger to NetCDF format.

Main classes:
- QFile: Read Q-files with context manager
- QHeader: Parse Q-file headers
- QData, QRecord: Handle data records
- QVersion: Q-file version enumeration
- QHexCodes: Identifier to name mapping

Usage:
    For record-by-record access to Q-file data, use QFile:

        >>> from q2netcdf import QFile
        >>> with QFile("data.q") as qf:
        ...     header = qf.header()
        ...     for record in qf.data():
        ...         process(record)

    For direct conversion to an xarray Dataset, use loadQfiles (batch) or
    loadQfile (single file):

        >>> from q2netcdf import loadQfiles
        >>> ds = loadQfiles(["file1.q", "file2.q"])

        >>> from q2netcdf import loadQfile
        >>> ds = loadQfile("data.q")

    QFile gives low-level, memory-efficient streaming access to individual
    records. loadQfiles uses bulk numpy parsing for ~10-20x faster batch
    conversion. loadQfile processes a single file into an xarray Dataset.
"""

from importlib.metadata import version, PackageNotFoundError

try:
    __version__ = version("q2netcdf")
except PackageNotFoundError:
    # Fallback for development installations
    __version__ = "0.0.0+unknown"

__author__ = "Pat Welch"
__email__ = "pat@mousebrains.com"

from .QFile import QFile
from .QHeader import QHeader
from .QData import QData, QRecord
from .QVersion import QVersion
from .QHexCodes import QHexCodes
from .QConfig import QConfig
from .q2netcdf import loadQfile, loadQfiles, mergeDatasets

__all__ = [
    "QFile",
    "QHeader",
    "QData",
    "QRecord",
    "QVersion",
    "QHexCodes",
    "QConfig",
    "loadQfile",
    "loadQfiles",
    "mergeDatasets",
]
