% Generated by roxygen2: do not edit by hand
% Please edit documentation in R/calculate_column.R
\name{calculate_column}
\alias{calculate_column}
\title{Calculate column concentration of trace gases form WRF-Chem}
\usage{
calculate_column(
  file = file.choose(),
  name,
  met,
  DU,
  flip_v = FALSE,
  flip_h = FALSE,
  verbose = TRUE,
  ...
)
}
\arguments{
\item{file}{WRF output file, see notes}

\item{name}{trace gas name to be integrated}

\item{met}{(optional) WRF output file for meteorological variables, see notes}

\item{DU}{true to change the output units from 'molecules cm-1' to 'DU'}

\item{flip_v}{passed to wrf_rast, see notes}

\item{flip_h}{passed to wrf_rast, see notes}

\item{verbose}{display additional information}

\item{...}{extra arguments passed to eva3dm::wrf_rast or eva3dm::wrf_sds}
}
\value{
SpatRaster object (from terra package).
}
\description{
Read output from WRF model and calculate the column of trace gases.
The column concentration \eqn{ C_{\mathrm{column}}} is computed as:

\deqn{ C_{\mathrm{column}} = \frac{N_{A}}{R} \int_{\text{surface}}^{\text{model\_top}} C \frac{P}{T} \, dz }

where \eqn{C} is the pollutant concentration, \eqn{N_{A}} is Avogadro's number, \eqn{R} is the universal gas constant, \eqn{P} is the pressure [Pa], \eqn{T} is the temperature [K], and \eqn{dz} is the layer thickness [m].
}
\note{
files in file should contain Times, XLAT, XLONG variables in addition to the concentration to be integrated, the variable should include at least 3 dimensions including vertical.

met is a optional file, it should have containing PHB, PH, PB, P, and T variables with the same dimension of the concentration integrated.

post processing can affect the orientation of the variables, the arguments flip_v and flip_h and other arguments from eva3dm::wrf_rast and eva3dm::wrf_sds can be used to take effect into account.
}
\examples{
file <- paste0(system.file("extdata",package="eva3dm"),"/wrf_column_o3_Boston.nc")
O3_column <- calculate_column(file,'o3', verbose = TRUE)

}
