weather: Creates weather data file for crop model

Description Usage Arguments Details Value Examples

View source: R/weather.R

Description

Creates certain key inputs for crop model weather data files and write them to appropriate format

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
weather(
  xy,
  elev,
  srad,
  tmax,
  tmin,
  prec,
  wind = NULL,
  ea = NULL,
  rh = NULL,
  tmu = NULL,
  sh = NULL,
  pres = NULL,
  tdew = NULL,
  sdate,
  edate,
  name,
  outdir,
  model = "DSSAT"
)

Arguments

xy

vector giving longitude then latitude (degrees)

srad

Solar radiation (mj/m^2/day)

tmax

Maximum temperature (deg C)

tmin

Minimum temperature (deg C)

prec

Daily rainfall (mm)

ea

Vapor pressure (mb, optional)

rh

Relative humidity (%, optional)

tmu

Average temperature (deg C, optional)

sh

Specific humidity (kg/kg, optional)

pres

Surface pressure (mb, optional)

tdew

Dewpoint temperature (deg C, optional)

sdate

Start date for range in WTH file

edate

End date for range in WTH file

name

Name prefix for output weather data file

outdir

Output directory for weather file

model

Crop model type, default = "DSSAT"

Details

This is currently only works for the DSSAT model, but is intended to be expanded to other models (e.g. APSIM). Note that this function assumes that daily data given to it will be the same date as UTC. This might be problematic in Australasia.

Value

An output crop model weather file for a single location

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
sdate <- "19790701" 
edate <- "20100630"
xy <- c("y" = -16.2783358, "x" = 27.4738917) 
load("data/sp-clim-dat.rda")
elev <- 1120
srad <- swv
name <- "ZASP"
outdir <- "external/ext_data"
weather(xy, elev, srad, tmax, tmin, prec, wind = wind, sh = sh, 
        pres = pres, sdate = sdate, edate = edate, name = name, 
        outdir = outdir)

ldemaz/rcropmod documentation built on Feb. 29, 2020, 10:17 p.m.