@staticmethod
    def decode_fortran_descriptor(fd):
        # strip off any quotes around format string
        fd = fd.replace("'", "")
        fd = fd.replace('"', '')
        # strip off '(' and ')'
        fd = fd.strip()[1:-1]
        if str('FREE') in str(fd.upper()):
            return 'free', None, None, None
        elif str('BINARY') in str(fd.upper()):
            return 'binary', None, None, None
        if str('.') in str(fd):
            raw = fd.split('.')
            decimal = int(raw[1])
        else:
            raw = [fd]
            decimal = None
        fmts = ['I', 'G', 'E', 'F']
        raw = raw[0].upper()
        for fmt in fmts:
            if fmt in raw:
                raw = raw.split(fmt)
                # '(F9.0)' will return raw = ['', '9']
                #  try and except will catch this
                try:
                    npl = int(raw[0])
                    width = int(raw[1])
                except:
                    npl = 1
                    width = int(raw[1])
                if fmt == 'G':
                    fmt = 'E'
                return npl, fmt, width, decimal
        raise Exception('Unrecognized format type: ' +
                        str(fd) + ' looking for: ' + str(fmts))
Decode fortran descriptor
dataset/ETHPy150Open modflowpy/flopy/flopy/utils/util_array.py/ArrayFormat.decode_fortran_descriptor