nasapower

Adam H Sparks

Introduction

nasapower aims to make it quick and easy to automate downloading NASA POWER global meteorology and surface solar energy climatology data data in your R session as a tidy data frame for analysis and use in modelling or other purposes, get_power(). POWER (Prediction Of Worldwide Energy Resource) data are freely available for download through a web interface at a resolution of 0.5 arc degree longitude by 0.5 arc degree latitude. Two other functions are provided to quickly and easily generate weather.met files from the POWER data for use in the Agricultural Production Systems sIMulator (APSIM), create_met() and ICASA format text files for use in Decision Support System for Agrotechnology Transfer (DSSAT) modelling, create_met().

Using get_power

The get_power() function has five arguments as seen in this example and returns a data frame with a metadata header in the current R session.

Example fetching daily data for a single point

Fetch daily “AG” community temperature, relative humidity and precipitation for January 1985 for Kingsthorpe, Queensland, Australia.

Example fetching daily data for an area

Fetch daily “AG” community relative humidity and temperature for south east Queensland region.

Example fetching interannual data for an area

Fetch interannual solar cooking parameters for south east Queensland region.

Example fetching climatology data

Fetch global AG climatology for temperature.

Note the associated metadata are not saved if the data are exported to a file format other than an R data format, e.g., .Rdata, .rda or .rds.

Description of parameters for get_power

Using create_met

The create_met() function wraps get_power(), prepareMet() and writeMet() from the APSIM package to simplify creating .met files from POWER data for use in the APSIM modelling framework.

Four arguments are passed to this function, lonlat, dates, dsn and file_out.

Get POWER values for a single point, Kingsthorpe, Queensland for 1985 and create an APSIM weather.met object suitable for use in APSIM for crop modelling and save it to local disk for use in APSIM modelling.

create_met(lonlat = c(151.81, -27.48),
           dates = c("1985-01-01", "1985-12-31"),
           dsn = tempdir(),
           file_out = "Kingsthorpe.met")

Using create_icasa

The create_icasa() simplifies a get_power() query to create an ICASA file for use in DSSAT modelling.

Four arguments are passed to this function, lonlat, dates, dsn and file_out.

Get POWER values for a single point, Kingsthorpe, Queensland for 1985 and create an ICASA text file suitable for use in DSSAT for crop modelling and save it to local disk.

create_icasa(lonlat = c(151.81, -27.48),
             dates = c("1985-01-01", "1985-12-31"),
             dsn = tempdir(),
             file_out = "Kingsthorpe_ICASA.txt")

Creating Spatial Objects from get_power

If you require spatial objects to work with, it is rather simple to convert the resulting tidy data frame from get_power() to a spatial object in R using raster::rasterFromXYZ().

Converting Regional Data to a raster Object

Using lapply and split it is easy to create stacks of raster objects from a regional query.

Plot all the items in the stack.

Converting Global Climatology to a raster Object

Converting global climatology to a raster::brick is as simple as querying and then converting the resulting tibble to a raster object. Illustrated here using the climatology_ag object previously created.

Plot the annual values from the resulting RasterBrick() objects.

References

https://power.larc.nasa.gov

https://power.larc.nasa.gov/documents/POWER_Data_v8_methodology.pdf