mHM_extrapolNetCDF: Simple extrapolation of netCDF in invalid/border locations.

Description Usage Arguments Details Value Author(s) See Also Examples

Description

mHM_extrapolNetCDF uses mHM_extrapolMat to extrapolate its matrix values in invalid and border location, e.g. originating from meteorological input fields for mHM (netCDF format).

Usage

1

Arguments

netCDF

netCDF file name (full path).

var

character, name of variable to extrapolate.

ext

integer, radius (number of grid cells) within grid cells are extended, starting from border grid cells.

return

boolean, should extrapolated array be returned in console? default=FALSE

Details

Runing mHM the first time for some netCDF products (e.g. Spain02, E-OBS) the warning no meteorological input available for whole simulation domain will be printed. This function extrapolates grids in invalid locations within a radius (number of grid cells) given by ext. Extrapolation is performed by a mean value of the surrounding cells of the invalid location.

Caution: netCDF input file will be overwritten, backup original file before use.

Value

netCDF file

Author(s)

Johannes Brenner johannes.brenner@ufz.de

See Also

mHM_extrapolMat

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
# read netcdf file minimum air temperature for JĂșcar domain
 pkg_path <- path.package("mHMr")
 tmin_netcdf <- file.path(pkg_path, "data", "tmin.nc")

# open connection to netCDF
 tmin_op <-  RNetCDF::open.nc(tmin_netcdf)
# retrieve min. air temp  
 tmin <- RNetCDF::var.get.nc(tmin_op,"tmin")
# visualise original field
 image(tmin[,,1], zlim = c(2.5,4.5))

# extrapolate (radius: 1 grid cell)
 tmin_ext <- mHM_tmin_netcdf(netCDF = tmin_netcdf, vat = "tmin", ext = 1)
# visualise extrapolated field
 image(tmin_ext[,,1], zlim = c(2.5,4.5))

JBrenn/mHMr documentation built on May 7, 2019, 7:39 a.m.