Get POWER values for a single point or region and create an APSIM met file suitable for use in APSIM for crop modelling; saving it to local disk.
create_met(lonlat, dates, dsn, file_out)
lonlat | A numeric vector of geographic coordinates for a cell or region entered as x, y coordinates. See argument details for more. |
---|---|
dates | A character vector of start and end dates in that order, |
dsn | A file path where the resulting text file should be stored. |
file_out | A file name for the resulting text file, e.g. "Kingsthorpe.met". A ".met" extension will be appended if given or otherwise specified by user. |
A text file in met format saved to local disk for use in APSIM crop modelling.
This function is essentially a wrapper for get_power
prepareMet
and writeMetFile
that
simplifies the querying of the POWER API and writes the
met to local disk.
The weather values from POWER for temperature are 2 metre max and min temperatures, T2M_MAX and T2M_MIN; radiation, ALLSKY_SFC_SW_DWN; and rain, PRECTOT from the POWER AG community on a daily time-step.
Further details for each of the arguments are provided in their respective sections following below.
lonlat
To get a specific cell, 1/2 x 1/2 degree, supply
a length-2 numeric vector giving the decimal degree longitude and latitude
in that order for data to download,
e.g., lonlat = c(151.81, -27.48)
.
To get a region, supply a length-4 numeric
vector as lower left (lon, lat) and upper right (lon, lat) coordinates,
e.g., lonlat = c(xmin, ymin, xmax, ymax)
in that order for a given
region, e.g., a bounding box for the southwestern corner of Australia:
lonlat = c(112.5, -55.5, 115.5, -50.5)
. Max bounding box is 10 x 10
degrees of 1/2 x 1/2 degree data, i.e., 100 points maximum in total.
dates
If dates
is unspecified, defaults to
a start date of 1983-01-01 (the earliest available data) and an end date of
current date according to the system.
If one date only is provided, it will be treated as both the start date and the end date and only a single day's values will be returned.
create_icasa
Create a DSSAT ICASA
File from NASA POWER Data
# Create a met file for Kingsthorpe, Qld from 1985-01-01 to 1985-06-30 and # save it in the current R session \code{\link{tempdir()}} as # "APSIM_example.met".create_met(lonlat = c(151.81, -27.48), dates = c("1985-01-01", "1985-12-31"), dsn = tempdir(), file = "APSIM_example.met" )#> [1] "Required column name check:" #> [1] "maxt" "mint" "radn" "rain" "year" "day" #> [1] TRUE TRUE TRUE TRUE TRUE TRUE