Learn R Programming

apsimx (version 2.2)

get_power_apsim_met: Get NASA-POWER data for an APSIM met file

Description

Uses get_power from the nasapower package to download data to create an APSIM met file.

Usage

get_power_apsim_met(lonlat, dates, wrt.dir = ".", filename = NULL)

Arguments

lonlat

Longitude and latitude vector

dates

date ranges

wrt.dir

write directory

filename

file name for writing out to disk

Value

returns an object of class ‘met’ and writes a file to disk when filename is supplied.

Details

This function requires the nasapower package version 4.0.0.

If the filename is not provided it will not write the file to disk, but it will return an object of class ‘met’. This is useful in case manipulation is required before writing to disk.

Examples

Run this code
# NOT RUN {
require(nasapower)
## This will not write a file to disk
pwr <- get_power_apsim_met(lonlat = c(-93,42), dates = c("2012-01-01","2012-12-31"))
## Let's insert a missing value
pwr[100, "radn"] <- NA
summary(pwr)
## Check the met file 
check_apsim_met(pwr)
## Impute using linear interpolation
pwr.imptd <- impute_apsim_met(pwr, verbose = TRUE)
summary(pwr.imptd)
check_apsim_met(pwr.imptd)
# }
# NOT RUN {
# }

Run the code above in your browser using DataLab