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)

Arguments

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,
e.g., dates = c("1983-01-01", "2017-12-31"). See argument details for more.

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.

Value

A text file in met format saved to local disk for use in APSIM crop modelling.

Details

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.

Argument details for lonlat

For a single point

To get a specific cell, 1/2 x 1/2 degree, supply a length-two numeric vector giving the decimal degree longitude and latitude in that order for data to download,
e.g., lonlat = c(151.81, -27.48).

For regional coverage

To get a region, supply a length-four 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.

Argument details for 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.

See also

create_icasa Create a DSSAT ICASA File from NASA POWER Data

Examples

# Create a met file for Kingsthorpe, Qld # from 1985-01-01 to 1985-06-30 and # save it in the current R session # tempdir() as `APSIM_example.met` # \donttest{ create_met(lonlat = c(151.81, -27.48), dates = c("1985-01-01", "1985-12-31"), dsn = tempdir(), file_out = "APSIM_example.met" ) # }