def __init__(self, filename, mode='rb', endian='>',
                 diaginfo_file='', tracerinfo_file='', eager=False,
                 use_mmap=False, dask_delayed=False):
        """ Load a BPCHFile

        Parameters
        ----------
        filename : str
            Path to the bpch file on disk
        mode : str
            Mode string to pass to the file opener; this is currently fixed to
            "rb" and all other values will be rejected
        endian : str {">", "<", ":"}
            Endian-ness of the Fortran output file
        {tracerinfo, diaginfo}_file : str
            Path to the tracerinfo.dat and diaginfo.dat files containing
            metadata pertaining to the output in the bpch file being read.
        eager : bool
            Flag to immediately read variable data; if "False", then nothing
            will be read from the file and you'll need to do so manually
        use_mmap : bool
            Use memory-mapping to read data from file
        dask_delayed : bool
            Use dask to create delayed references to the data-reading functions
        """

        self.mode = mode
        if not mode.startswith('r'):
            raise ValueError("Currently only know how to 'r(b)'ead bpch files.")

        self.filename = filename
        self.fsize = os.path.getsize(self.filename)
        self.endian = endian

        # Open a pointer to the file
        self.fp = FortranFile(self.filename, self.mode, self.endian)

        dir_path = os.path.abspath(os.path.dirname(filename))
        if not dir_path:
            dir_path = os.getcwd()
        if not tracerinfo_file:
            tracerinfo_file = os.path.join(dir_path, "tracerinfo.dat")
            if not os.path.exists(tracerinfo_file):
                tracerinfo_file = ''
        self.tracerinfo_file = tracerinfo_file
        if not diaginfo_file:
            diaginfo_file = os.path.join(dir_path, "diaginfo.dat")
            if not os.path.exists(diaginfo_file):
                diaginfo_file = ''
        self.diaginfo_file = diaginfo_file

        # Container to record file metadata
        self._attributes = OrderedDict()

        # Don't necessarily need to save diag/tracer_dict yet
        self.diaginfo_df, _ = get_diaginfo(self.diaginfo_file)
        self.tracerinfo_df, _ = get_tracerinfo(self.tracerinfo_file)

        # Container for bundles contained in the output file.
        self.var_data = {}
        self.var_attrs = {}

        # Critical information for accessing file contents
        self._header_pos = None

        # Data loading strategy
        self.use_mmap = use_mmap
        self.dask_delayed = dask_delayed

        # Control eager versus deferring reading
        self.eager = eager
        if (mode.startswith('r') and self.eager):
            self._read()
def __init__ ( self , filename , mode = 'rb' , endian = '>' , diaginfo_file = '' , tracerinfo_file = '' , eager = False , use_mmap = False , dask_delayed = False ) : self . mode = mode if not mode . startswith ( 'r' ) : raise ValueError ( "Currently only know how to 'r(b)'ead bpch files." ) self . filename = filename self . fsize = os . path . getsize ( self . filename ) self . endian = endian self . fp = FortranFile ( self . filename , self . mode , self . endian ) dir_path = os . path . abspath ( os . path . dirname ( filename ) ) if not dir_path : dir_path = os . getcwd ( ) if not tracerinfo_file : tracerinfo_file = os . path . join ( dir_path , "tracerinfo.dat" ) if not os . path . exists ( tracerinfo_file ) : tracerinfo_file = '' self . tracerinfo_file = tracerinfo_file if not diaginfo_file : diaginfo_file = os . path . join ( dir_path , "diaginfo.dat" ) if not os . path . exists ( diaginfo_file ) : diaginfo_file = '' self . diaginfo_file = diaginfo_file self . _attributes = OrderedDict ( ) self . diaginfo_df , _ = get_diaginfo ( self . diaginfo_file ) self . tracerinfo_df , _ = get_tracerinfo ( self . tracerinfo_file ) self . var_data = { } self . var_attrs = { } self . _header_pos = None self . use_mmap = use_mmap self . dask_delayed = dask_delayed self . eager = eager if ( mode . startswith ( 'r' ) and self . eager ) : self . _read ( )
Load a BPCHFile

        Parameters
        ----------
        filename : str
            Path to the bpch file on disk
        mode : str
            Mode string to pass to the file opener; this is currently fixed to
            "rb" and all other values will be rejected
        endian : str {">", "<", ":"}
            Endian-ness of the Fortran output file
        {tracerinfo, diaginfo}_file : str
            Path to the tracerinfo.dat and diaginfo.dat files containing
            metadata pertaining to the output in the bpch file being read.
        eager : bool
            Flag to immediately read variable data; if "False", then nothing
            will be read from the file and you'll need to do so manually
        use_mmap : bool
            Use memory-mapping to read data from file
        dask_delayed : bool
            Use dask to create delayed references to the data-reading functions