Exemple #1
0
    def to_file(self, wfile, fformat="rms_ascii"):
        """
        Export well to file

        Args:
            wfile (str): Name of file
            fformat (str): File format

        Example::

            >>> x = Well()

        """

        xtgeosys.check_folder(wfile, raiseerror=OSError)

        self._ensure_consistency()

        if fformat is None or fformat == "rms_ascii":
            _well_io.export_rms_ascii(self, wfile)

        elif fformat == "hdf5":
            with pd.HDFStore(wfile, "a", complevel=9, complib="zlib") as store:
                logger.info("export to HDF5 %s", wfile)
                store[self._wname] = self._df
                meta = dict()
                meta["name"] = self._wname
                store.get_storer(self._wname).attrs["metadata"] = meta
Exemple #2
0
    def to_file(self, sfile, fformat="segy", pristine=False, engine="xtgeo"):
        """Export cube data to file.

        Args:
            sfile (str): Filename
            fformat (str, optional): file format 'segy' (default) or
                'rms_regular'
            pristine (bool): If True, make SEGY from scratch.
            engine (str): Which "engine" to use.

        Example::
            >>> zz = Cube('some.segy')
            >>> zz.to_file('some.rmsreg')
        """

        xtgeosys.check_folder(sfile, raiseerror=OSError)

        if fformat == "segy":
            _cube_export.export_segy(self,
                                     sfile,
                                     pristine=pristine,
                                     engine=engine)
        elif fformat == "rms_regular":
            _cube_export.export_rmsreg(self, sfile)
        else:
            logger.error("Invalid file format")
def to_file(self, pfile, fformat="roff", name=None, append=False, dtype=None):
    """Export the grid property to file."""
    logger.debug("Export property to file %s", pfile)

    xtgeosys.check_folder(pfile, raiseerror=OSError)

    if "roff" in fformat:
        if name is None:
            name = self.name

        binary = True
        if "asc" in fformat:
            binary = False

        # for later usage
        append = False
        last = True

        export_roff(self, pfile, name, append=append, last=last, binary=binary)

    elif fformat == "grdecl":
        export_grdecl(self,
                      pfile,
                      name,
                      append=append,
                      binary=False,
                      dtype=dtype)

    elif fformat == "bgrdecl":
        export_grdecl(self,
                      pfile,
                      name,
                      append=append,
                      binary=True,
                      dtype=dtype)
Exemple #4
0
    def to_file(
        self,
        pfile,
        fformat="xyz",
        attributes=False,
        pfilter=None,
        filter=None,  # deprecated, not in use (only signature)
        wcolumn=None,
        hcolumn=None,
        mdcolumn="M_MDEPTH",
    ):  # pylint: disable=redefined-builtin
        """Export XYZ (Points/Polygons) to file.

        Args:
            pfile (str): Name of file
            fformat (str): File format xyz/poi/pol / rms_attr /rms_wellpicks
            attributes (bool or list): List of extra columns to export (some formats)
                or True for all attributes present
            pfilter (dict): Filter on e.g. top name(s) with keys TopName
                or ZoneName as {'TopName': ['Top1', 'Top2']}
            wcolumn (str): Name of well column (rms_wellpicks format only)
            hcolumn (str): Name of horizons column (rms_wellpicks format only)
            mdcolumn (str): Name of MD column (rms_wellpicks format only)

        Returns:
            Number of points exported

        Note that the rms_wellpicks will try to output to:

        * HorizonName, WellName, MD  if a MD (mdcolumn) is present,
        * HorizonName, WellName, X, Y, Z  otherwise

        Raises:
            KeyError if pfilter is set and key(s) are invalid

        """
        xtgeosys.check_folder(pfile, raiseerror=OSError)

        if self.dataframe is None:
            ncount = 0
            logger.warning("Nothing to export!")
            return ncount

        if fformat is None or fformat in ["xyz", "poi", "pol"]:
            # NB! reuse export_rms_attr function, but no attributes
            # are possible
            ncount = _xyz_io.export_rms_attr(self,
                                             pfile,
                                             attributes=False,
                                             pfilter=pfilter)

        elif fformat == "rms_attr":
            ncount = _xyz_io.export_rms_attr(self,
                                             pfile,
                                             attributes=attributes,
                                             pfilter=pfilter)
        elif fformat == "rms_wellpicks":
            ncount = _xyz_io.export_rms_wpicks(self,
                                               pfile,
                                               hcolumn,
                                               wcolumn,
                                               mdcolumn=mdcolumn)

        if ncount is None:
            ncount = 0

        if ncount == 0:
            logger.warning("Nothing to export!")

        return ncount