Example #1
0
def _export_roff_discrete(self,
                          pfile,
                          name,
                          append=False,
                          last=True,
                          binary=True):

    carray = _gridprop_lowlevel.update_carray(self, undef=-999)

    ptr_idum = _cxtgeo.new_intpointer()
    ptr_ddum = _cxtgeo.new_doublepointer()

    # codes:
    ptr_codes = _cxtgeo.new_intarray(256)
    ncodes = self.ncodes
    codenames = ""
    logger.info("Keys: %s", self.codes.keys())
    for inum, ckey in enumerate(sorted(self.codes.keys())):
        if ckey is not None:
            codenames += str(self.codes[ckey])
            codenames += "|"
            _cxtgeo.intarray_setitem(ptr_codes, inum, int(ckey))
        else:
            logger.warning("For some odd reason, None is a key. Check!")

    mode = 0
    if not binary:
        mode = 1

    if not append:
        _cxtgeo.grd3d_export_roff_pstart(mode, self._ncol, self._nrow,
                                         self._nlay, pfile, XTGDEBUG)

    nsub = 0
    isub_to_export = 0
    _cxtgeo.grd3d_export_roff_prop(
        mode,
        self._ncol,
        self._nrow,
        self._nlay,
        nsub,
        isub_to_export,
        ptr_idum,
        name,
        "int",
        carray,
        ptr_ddum,
        ncodes,
        codenames,
        ptr_codes,
        pfile,
        XTGDEBUG,
    )

    if last:
        _cxtgeo.grd3d_export_roff_end(mode, pfile, XTGDEBUG)

    _gridprop_lowlevel.delete_carray(self, carray)
Example #2
0
def _export_roff_continuous(self,
                            pfile,
                            name,
                            append=False,
                            last=True,
                            binary=True):

    carray = _gridprop_lowlevel.update_carray(self, undef=-999.0)

    ptr_idum = _cxtgeo.new_intpointer()

    mode = 0
    if not binary:
        mode = 1

    if not append:
        _cxtgeo.grd3d_export_roff_pstart(mode, self._ncol, self._nrow,
                                         self._nlay, pfile, XTGDEBUG)

    # now the actual data
    nsub = 0
    isub_to_export = 0

    _cxtgeo.grd3d_export_roff_prop(
        mode,
        self._ncol,
        self._nrow,
        self._nlay,
        nsub,
        isub_to_export,
        ptr_idum,
        name,
        "double",
        ptr_idum,
        carray,
        0,
        "",
        ptr_idum,
        pfile,
        XTGDEBUG,
    )

    if last:
        _cxtgeo.grd3d_export_roff_end(mode, pfile, XTGDEBUG)

    _gridprop_lowlevel.delete_carray(self, carray)