# Path: pygchem/diagnostics.py
# class CTMDiagnosticInfo(object):
#     """
#     Define all the diagnostics (and its metadata) that one can archive
#     with GEOS-Chem.
# 
#     An instance of this class is commonly related to a couple
#     of diaginfo.dat and tracerinfo.dat files. The class provides methods to
#     read/write information from/to these files.
# 
#     Parameters
#     ----------
#     diaginfo_file : string or None
#         path to the 'diaginfo.dat' file.
#         If None, no file read (no category added)
#         If empty string, the instance is created using a default
#         diaginfo.dat file - located in the data folder of the module
#         installation path)
#     tracerinfo_file : string or None
#         path to the 'tracerinfo.dat' file (or None or empty string).
# 
#     """
#     def __init__(self, diaginfo_file='', tracerinfo_file=''):
# 
#         self.categories = RecordList([], key_attr='name',
#                                      ref_classes=CTMCategory)
#         self.diagnostics = RecordList([], key_attr='number',
#                                       ref_classes=CTMDiagnostic)
# 
#         if diaginfo_file is not None:
#             if not diaginfo_file:
#                 diaginfo_file = os.path.join(config.PACKAGE_DATA_PATH,
#                                              "diaginfo.dat")
#             self.load_diaginfo(diaginfo_file)
# 
#         if tracerinfo_file is not None:
#             if not tracerinfo_file:
#                 tracerinfo_file = os.path.join(config.PACKAGE_DATA_PATH,
#                                                "tracerinfo.dat")
#             self.load_tracerinfo(tracerinfo_file)
# 
#     def load_diaginfo(self, filename, clear=True):
#         """
#         load diagnostic categories metadata from the 'diaginfo.dat' file given
#         by `filename`. If `clear` is True, all existing categories are removed.
#         """
#         data = diaginfo.read_diaginfo(filename)
#         if clear:
#             del self.categories[:]
#         self.categories.extend(CTMCategory(**d) for d in data)
# 
#     def load_tracerinfo(self, filename, clear=True):
#         """
#         Read diagnostics from the 'tracerinfo.dat'-file with given `filename`.
#         If `clear` is True, all existing diagnostics are removed.
#         """
#         data = diaginfo.read_tracerinfo(filename)
#         if clear:
#             del self.diagnostics[:]
#         for d in data:
#             if d['carbon_weight'] != 1:
#                 d['hydrocarbon'] = True
#                 d['molecular_weight'] = config.C_MOLECULAR_WEIGHT
#             else:
#                 d['hydrocarbon'] = False
#             d['chemical'] = bool(d['molecular_weight'])
# 
#         self.diagnostics.extend(CTMDiagnostic(**d) for d in data)
# 
#     def save_diaginfo(self, filename):
#         """
#         TODO:
#         """
#         raise NotYetImplementedError()
# 
#     def save_tracerinfo(self, filename):
#         """
#         TODO:
#         """
#         raise NotYetImplementedError()
# 
# Path: pygchem/tools/timeutil.py
# CTM_TIME_UNIT_STR = 'hours since 1985-01-01 00:00:00'
# CTM_TIME_REF_DT = datetime.datetime(1985, 1, 1)
# def iter_dates(start, end, step=1):
# def tau2time(tau, reference=CTM_TIME_REF_DT):
# def time2tau(time, reference=CTM_TIME_REF_DT):
# def strp_relativedelta(delta_t):
#     def __init__(self, years, months, days, hours):
#     def _change_timespan(self, freq, interval, check_short_timespan=True):
#     def _parse_fmt(cls, fmt):
#     def from_string(cls, fmt):
#     def to_string(self):
#     def __iter__(self):
#     def __str__(self):
#     def __repr__(self):
# def strp_datetimeslicer(fmt):
# class DatetimeSlicer(object):
# 
# Path: pygchem/utils/uff.py
# _FIX_ERROR = ("Pre- and suffix of line do not match. This can happen, if the"
#               " `endian` is incorrect.")
# class FortranFile(file):
#     def __init__(self, filename, mode='rb', endian='>'):
#     def _fix(self, fmt='i'):
#     def readline(self, fmt=None):
#     def readlines(self):
#     def skipline(self):
#     def writeline(self, fmt, *args):
#     def writelines(self, lines, fmt):
#     def __iter__(self):
#     def next(self, fmt=None):
# def _replace_star(fmt, size):
# 
# Path: pygchem/utils/exceptions.py
# class PyGChemError(Exception):
# class NotYetImplementedError(PyGChemError):
# class NotPermittedError(PyGChemError):
# class SelectionMismatchError(PyGChemError):
# def warnings_stdout(message, category, filename, lineno, file=None):


import os
import numpy as np
from pygchem.diagnostics import CTMDiagnosticInfo
from pygchem.tools import timeutil
from pygchem.utils import uff, exceptions
                         'tracerinfo': diag_attr,
                         'diaginfo': cat_attr}
            datablocks.append(datablock)

    return filetype, filetitle, datablocks


def create_bpch(filename, title=DEFAULT_TITLE, filetype=FILETYPE02, **kwargs):
    """
    Create a new empty bpch file.

    Parameters
    ----------
    filename : string
        name or path to the bpch file.
    title : string
        a title line to write in the file's header.
    filetype : string
        bpch file type identifier (either :attr:`bpch.FILETYPE02` or
        :attr:`bpch.FILETYPE4D`).
    **kwargs
        extra parameters passed to :class:`pygchem.utils.uff.FortranFile`
        (e.g., `endian`).

    Returns
    -------
    bpch_file
        the open file instance (:class:`pygchem.utils.uff.FortranFile` object).

    """

# Path: pygchem/diagnostics.py
# class CTMDiagnosticInfo(object):
#     """
#     Define all the diagnostics (and its metadata) that one can archive
#     with GEOS-Chem.
# 
#     An instance of this class is commonly related to a couple
#     of diaginfo.dat and tracerinfo.dat files. The class provides methods to
#     read/write information from/to these files.
# 
#     Parameters
#     ----------
#     diaginfo_file : string or None
#         path to the 'diaginfo.dat' file.
#         If None, no file read (no category added)
#         If empty string, the instance is created using a default
#         diaginfo.dat file - located in the data folder of the module
#         installation path)
#     tracerinfo_file : string or None
#         path to the 'tracerinfo.dat' file (or None or empty string).
# 
#     """
#     def __init__(self, diaginfo_file='', tracerinfo_file=''):
# 
#         self.categories = RecordList([], key_attr='name',
#                                      ref_classes=CTMCategory)
#         self.diagnostics = RecordList([], key_attr='number',
#                                       ref_classes=CTMDiagnostic)
# 
#         if diaginfo_file is not None:
#             if not diaginfo_file:
#                 diaginfo_file = os.path.join(config.PACKAGE_DATA_PATH,
#                                              "diaginfo.dat")
#             self.load_diaginfo(diaginfo_file)
# 
#         if tracerinfo_file is not None:
#             if not tracerinfo_file:
#                 tracerinfo_file = os.path.join(config.PACKAGE_DATA_PATH,
#                                                "tracerinfo.dat")
#             self.load_tracerinfo(tracerinfo_file)
# 
#     def load_diaginfo(self, filename, clear=True):
#         """
#         load diagnostic categories metadata from the 'diaginfo.dat' file given
#         by `filename`. If `clear` is True, all existing categories are removed.
#         """
#         data = diaginfo.read_diaginfo(filename)
#         if clear:
#             del self.categories[:]
#         self.categories.extend(CTMCategory(**d) for d in data)
# 
#     def load_tracerinfo(self, filename, clear=True):
#         """
#         Read diagnostics from the 'tracerinfo.dat'-file with given `filename`.
#         If `clear` is True, all existing diagnostics are removed.
#         """
#         data = diaginfo.read_tracerinfo(filename)
#         if clear:
#             del self.diagnostics[:]
#         for d in data:
#             if d['carbon_weight'] != 1:
#                 d['hydrocarbon'] = True
#                 d['molecular_weight'] = config.C_MOLECULAR_WEIGHT
#             else:
#                 d['hydrocarbon'] = False
#             d['chemical'] = bool(d['molecular_weight'])
# 
#         self.diagnostics.extend(CTMDiagnostic(**d) for d in data)
# 
#     def save_diaginfo(self, filename):
#         """
#         TODO:
#         """
#         raise NotYetImplementedError()
# 
#     def save_tracerinfo(self, filename):
#         """
#         TODO:
#         """
#         raise NotYetImplementedError()
# 
# Path: pygchem/tools/timeutil.py
# CTM_TIME_UNIT_STR = 'hours since 1985-01-01 00:00:00'
# CTM_TIME_REF_DT = datetime.datetime(1985, 1, 1)
# def iter_dates(start, end, step=1):
# def tau2time(tau, reference=CTM_TIME_REF_DT):
# def time2tau(time, reference=CTM_TIME_REF_DT):
# def strp_relativedelta(delta_t):
#     def __init__(self, years, months, days, hours):
#     def _change_timespan(self, freq, interval, check_short_timespan=True):
#     def _parse_fmt(cls, fmt):
#     def from_string(cls, fmt):
#     def to_string(self):
#     def __iter__(self):
#     def __str__(self):
#     def __repr__(self):
# def strp_datetimeslicer(fmt):
# class DatetimeSlicer(object):
# 
# Path: pygchem/utils/uff.py
# _FIX_ERROR = ("Pre- and suffix of line do not match. This can happen, if the"
#               " `endian` is incorrect.")
# class FortranFile(file):
#     def __init__(self, filename, mode='rb', endian='>'):
#     def _fix(self, fmt='i'):
#     def readline(self, fmt=None):
#     def readlines(self):
#     def skipline(self):
#     def writeline(self, fmt, *args):
#     def writelines(self, lines, fmt):
#     def __iter__(self):
#     def next(self, fmt=None):
# def _replace_star(fmt, size):
# 
# Path: pygchem/utils/exceptions.py
# class PyGChemError(Exception):
# class NotYetImplementedError(PyGChemError):
# class NotPermittedError(PyGChemError):
# class SelectionMismatchError(PyGChemError):
# def warnings_stdout(message, category, filename, lineno, file=None):


# Path: pygchem/io/bpch.py
import os
import numpy as np
from pygchem.diagnostics import CTMDiagnosticInfo
from pygchem.tools import timeutil
from pygchem.utils import uff, exceptions

                         'tracerinfo': diag_attr,
                         'diaginfo': cat_attr}
            datablocks.append(datablock)

    return filetype, filetitle, datablocks


def create_bpch(filename, title=DEFAULT_TITLE, filetype=FILETYPE02, **kwargs):
    """
    Create a new empty bpch file.

    Parameters
    ----------
    filename : string
        name or path to the bpch file.
    title : string
        a title line to write in the file's header.
    filetype : string
        bpch file type identifier (either :attr:`bpch.FILETYPE02` or
        :attr:`bpch.FILETYPE4D`).
    **kwargs
        extra parameters passed to :class:`pygchem.utils.uff.FortranFile`
        (e.g., `endian`).

    Returns
    -------
    bpch_file
        the open file instance (:class:`pygchem.utils.uff.FortranFile` object).

    """

    bpch_file = uff.FortranFile(filename, 'wb', **kwargs)