Skip to content
Snippets Groups Projects
OGS6_h5.Rd 6.2 KiB
Newer Older
% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/ogs6_h5.R
\name{OGS6_h5}
\alias{OGS6_h5}
\title{wrapper for rhdf5::h5read()}
\description{
Small class to wrap \code{h5} data into the \code{r2ogs6} workflow.
}
\details{
OGS6_h5

NOTE: This is a beta-version and is only guaranteed to work
 with the current three existing [benchmarks](https://doxygen.opengeosys.org/d9/d28/ogs_file_param__prj__time_loop__output__hdf.html)
that contain *.h5 files. More complicated files can always be handled
with the method \code{$get_h5} and may refer to the package \code{rhdf5}.
}
\examples{

## ------------------------------------------------
## Method `OGS6_h5$new`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)

## ------------------------------------------------
## Method `OGS6_h5$print`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
ogs6_h5
\dontrun{ogs6_obj$h5s}

## ------------------------------------------------
## Method `OGS6_h5$get_h5`
## ------------------------------------------------

\dontrun{h5_list <- ogs6_obj$h5s[[1]]$get_h5("/times")}

## ------------------------------------------------
## Method `OGS6_h5$get_df`
## ------------------------------------------------

h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                       package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
df <- ogs6_h5$get_df("/t_0", "pressure")
\dontrun{df <- ogs6_obj$h5s[[1]]$get_df("/t_0", "pressure")}
}
\section{Active bindings}{
\if{html}{\out{<div class="r6-active-bindings">}}
\describe{
\item{\code{h5_path}}{Getter/setter for private parameter `.h5_path`}
}
\if{html}{\out{</div>}}
}
\section{Methods}{
\subsection{Public methods}{
\itemize{
\item \href{#method-new}{\code{OGS6_h5$new()}}
\item \href{#method-print}{\code{OGS6_h5$print()}}
\item \href{#method-get_h5}{\code{OGS6_h5$get_h5()}}
\item \href{#method-get_df}{\code{OGS6_h5$get_df()}}
\item \href{#method-clone}{\code{OGS6_h5$clone()}}
}
}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-new"></a>}}
\if{latex}{\out{\hypertarget{method-new}{}}}
\subsection{Method \code{new()}}{
This function will be called automatically after a
simulation is run to give an overview of the \code{h5} output data.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{OGS6_h5$new(h5_path)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{h5_path}}{path to \code{*.h5} file.}
}
\if{html}{\out{</div>}}
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-print"></a>}}
\if{latex}{\out{\hypertarget{method-print}{}}}
\subsection{Method \code{print()}}{
Overrides the default print method
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{OGS6_h5$print()}\if{html}{\out{</div>}}
}

\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                        package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
ogs6_h5
\dontrun{ogs6_obj$h5s}
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-get_h5"></a>}}
\if{latex}{\out{\hypertarget{method-get_h5}{}}}
\subsection{Method \code{get_h5()}}{
return a h5 object for further processing with the
\code{rhdf5} package.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{OGS6_h5$get_h5(name = "/", ...)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{name}}{Optional: *character* that indicates the element of the h5
file to access. Default *"/"* will return the entire file as a list.}

\item{\code{...}}{Optional: Further arguments to be passed to the function
\code{h5read}.}
}
\if{html}{\out{</div>}}
}
\subsection{Returns}{
A list of data elements or the element accessed with
\code{name}
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{\dontrun{h5_list <- ogs6_obj$h5s[[1]]$get_h5("/times")}
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-get_df"></a>}}
\if{latex}{\out{\hypertarget{method-get_df}{}}}
\subsection{Method \code{get_df()}}{
Method to retrieve \code{HDF5} output as a \code{tibble}
assuming a standardized structure of \code{OGS6 HDF5} output.
times and geometry are added by default.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{OGS6_h5$get_df(group, names = "geometry")}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{group}}{*character*}

\item{\code{names}}{*character* names for a hdf5 element such as displayed
when printing the OGS5_h5 object, without the leading "/".}
}
\if{html}{\out{</div>}}
}
\subsection{Examples}{
\if{html}{\out{<div class="r example copy">}}
\preformatted{h5_path <- system.file("/extdata/benchmarks/EllipticPETSc",
                       "cube_1e3_np3.h5",
                       package = "r2ogs6")
ogs6_h5 <- OGS6_h5$new(h5_path)
df <- ogs6_h5$get_df("/t_0", "pressure")
\dontrun{df <- ogs6_obj$h5s[[1]]$get_df("/t_0", "pressure")}
}
\if{html}{\out{</div>}}

}

}
\if{html}{\out{<hr>}}
\if{html}{\out{<a id="method-clone"></a>}}
\if{latex}{\out{\hypertarget{method-clone}{}}}
\subsection{Method \code{clone()}}{
The objects of this class are cloneable with this method.
\subsection{Usage}{
\if{html}{\out{<div class="r">}}\preformatted{OGS6_h5$clone(deep = FALSE)}\if{html}{\out{</div>}}
}

\subsection{Arguments}{
\if{html}{\out{<div class="arguments">}}
\describe{
\item{\code{deep}}{Whether to make a deep clone.}
}
\if{html}{\out{</div>}}
}
}
}