knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)

Introduction

This vignette aims to introduce how to conveniently implement the maximum entropy production(MEP) model with RMEP package. The MEP model (developed by Wang et al., 2009) can calculate the surface heat fluxes with fewer inputs and ensure the surface energy balance compared to classical ET models. The RMEP package is designed to calculate actual evapotranspiration (ET), potential ET, sensible heat flux and ground heat flux, and realize the data pre-processing, statistical analysis of result as well as visualization operations at the same time. The RMEP package supports multiple data formats input in text or netCDF format. The calculating functions including: RMEP, RMEPPET, RMEP_nc, Shum and SShum. The plot functions including: RMEP_Plot_line, RMEP_plot_sca and RMEP_plot_spa. The RMEP_mice function is used for data pre-processing, and the RMEP_sta is used for statistical analysis.

Setting up the environment

Loading the RMEP package first,which contains data and functions used in this analysis. If the RMEP has not been installed, install RMEP package from the github repository.

library(RMEP)

Then we show the usage and description of each function below, and provide examples for specific demonstration.

Calculate evapotranspiration(ET) and heat fluxes

Three variables are required at least in theory for the maximum entropy production (MEP) model inputs, including the net radiation (Rn), specific humidity (qs) and surface temperature (Ts). Net long wave radiation (RnL) variable is also introducing in the RMEP for the case of Water-snow-ice surface in the MEP formulations. When calculate potential evapotranspiration (PET), only two variables (Rn and Ts) are needed.

Usage

RMEP(Rn,RnL,qs,Ts,type,I,z)

Example

The RMEP compute with inputs of simple vector:

RMEP(Rn=300,RnL=100,qs=0.004,Ts=25,I=800,z=2.5,type=1)

Usage

RMEPPET (Rn,RnL,qs,Ts,type,I,z)

RMEPPET(Rn=300,RnL=100,Ts=25,type=2)

Calculate the specific humidity

Usage

Shum (TA,PA,RH)

Example

Shum(TA=20,PA=101,RH=50)

Calculate the saturated specific humidity

Usage

SShum (TS)

Example

SShum(Ts=20)

Calculate the actual ET with Netcdf format input

Usage

RMEP_nc(Rn,RnL,qs,Ts,I,z,type)

Example

## Before calculating, load the variables with Netcdf format input
## We use the internal data of RMEP package for example
Rn <- Rn;RnL <- RnL;qs <- qs;Ts <- Ts; ## load the necessary inputs
sm <- sm  ## soil moisture data
z <- z ## parameter z is provided in the internal RMEP package
I <- sqrt(800^2+sm/100*1557^2)  ## calculate the thermal inertia (I)
type <- ifelse(z>4,2,1) ## define type
ETdemo <- RMEP_nc(Rn, RnL, qs, Ts, I, z, type) ## ET calculation  

## Show the spatial distribution of the calculated ET using the "RMEP_plot_spa" function 
## The RMEP_plot_spa will be introduced later.
lon <- lon;lat <- lat; ## longitude and lattitude 
RMEP_plot_spa(lon,lat,ETdemo,main = "MEP ET in 2000/01") 

Data pre-processing with the input data

Usage

RMEP_mice(data)

Example

## We use the built-in dataset "airquality" in R for example
airquality ## view the data with missing value

RMEP_mice(airquality) ## imputation with the default predictive mean matching ("pmm") method

Statistical analysis

Usage

RMEP_sta(MEP,obs)

Example

## We use the built-in dataset "datademo" in RMEP package for example.
## The "datademo" data contains 8 variables during 1-30, June 2016 with half-hourly time step. 
## Load example data first
data("datademo") 
head(datademo)  ## view the first 6 rows of data 
## Calculate the latent heat with the example data
Data <- datademo
qs <- Shum(TA <- Data$TA,PA <- Data$PA,RH <- Data$RH)  ## Calculate specific humidity
Rn <- Data$NETRAD;RnL <- Data$NETRAD  ## RnL is not used in type=1 so let it equals to Rn
Ts <- Data$TS  ## Surface temperature
output <- RMEP(Rn,RnL,qs,Ts,type=1) #The calculated results are obtained in the "output" list
## All the calculated variables can be analyzed, including ET and heat fluxes.
## The MEP calculated latent heat is evaluted foe example
MEP <- t(output$EMEP)[,1] ## MEP calculated latent heat flux
obs <- Data$LE ## Observations
RMEP_sta(MEP,obs) 

Visualization and plot

The RMEP package provides plot functions including: line plot (RMEP_plot_line), scatter plot (RMEP_plot_sca) and spatial map (RMEP_plot_spa).

Usage

RMEP_plot_line(timeseries)

Example

## We use the MEP and obs data obtained from the datademo in the previous example
time <- 1:length(Data$year)
timeseries <- data.frame(time,MEP,obs)
RMEP_plot_line(timeseries)  

Usage

RMEP_plot_sca(obs,MEP)

Example

RMEP_plot_sca(obs,MEP)

Usage

RMEP_plot_spa(lon,lat,MEP,main,legends)

Example

An example was given in the front using the "RMEP_nc" function with ETdemo data. At the same time, we put a built-in data of global land mean annual ET during years 1978-2018 in this package. The annual ET is shown below for example.

data("ETannual") ## load the data
annual <- ETannual ## global mean annual ET during 1978-2018
RMEP_plot_spa(lon,lat,annual,main="Global mean annual ET",legends="mm/yr")

The parameter z mentioned above is also provided in RMEP package for reference,as shown in the plot below.

RMEP_plot_spa(lon,lat,z,main="Z value for MEP",legends="meter")

Summary

As shown in the above, the RMEP package can basically realize the whole process from calculation to analysis, including data pre-processing, statistical evaluation and visualization. We add some built-in data for demonstration, including the "datademo", "z" value as well as other inputs for MEP model. The global land mean annual ET data is also available in the built-in data within the RMEP package. We hope that the developed RMEP package can help users to implement the MEP model conveniently.

Software details

This tutorial was built under:

sessionInfo()$platform
sessionInfo()$R.version$version.string 
paste("RMEP", sessionInfo()$otherPkgs$RMEP$Version)

References

[1] Wang,J., & Bras,R.L..(2009). A model of surface heat fluxes based on the theory of maximum entropy production. Water Resources Research, 45(11), 130-142.

[2] Yang, Y., Sun, H., and Wang, J. An R tool for Capturing Dynamics of Actual Evapotranspiration with MEP model and its application in Amazon, EGU General Assembly 2020, Online, 4–8 May 2020, EGU2020-1034, https://doi.org/10.5194/egusphere-egu2020-1034, 2019.

Version history



Yangyonghust/RMEP documentation built on Nov. 30, 2021, 11:20 a.m.