nasapower : A NASA POWER Global Meteorology , Surface Solar Energy and Climatology Data Client for R

nasapower is an R (R Core Team, 2018) package providing functionality to interface with the NASA POWER API (Stackhouse et al., 2018) for reproducible data retrieval using R. Three functions, get_power(), create_met() and create_icasa() are provided. The get_power() function provides complete access to all functionality that the POWER API provides, which includes three user communities, AG (agroclimatology), SSE (Surface meteorology and Solar Energy) and SB (Sustainable Buildings); three temporal averages, Daily, Interannual and Climatology; three geographic options, single point, regional and global for the appropriate parameters offered. nasapower uses lubridate (Grolemund & Wickham, 2011) internally to format and parse dates which are passed along to the the query constructed using crul (Chamberlain, 2018) to interface with the POWER API. The query returns a json response, which is parsed by jsonlite (Ooms, 2014) to obtain the url of the .csv file that has been requested. The .csv file is downloaded to local disk using curl (Ooms, 2018) and read into R using readr (Wickham, Hester, & Francois, 2017). Data are returned in a tidy data frame (Wickham, 2014) as a tibble (Müller & Wickham, 2018) with a custom header, which provides POWER metadata. Two other functions provide functionality to generate weather input files for agricultural crop modelling. The create_met() function is a wrapper for the get_power() function coupled with the prepareMet() and writeMet() functions from APSIM (Fainges, 2017) to simplify the process of querying the data and creating text files in the .met format for use in Agricultural Production Systems sIMulator (APSIM). While the create_icasa() function wraps the get_power() into a function that generates and locally saves a text file in the International Consortium for Agricultural Systems Applications (ICASA) format for use in the Decision Support System for Agrotechnology Transfer (DSSAT) framework (G. Hoogenboom et al., 2017; J. W. Jones et al., 2003). Extended documentation is provided with examples of converting it to spatial objects using raster (Hijmans, 2017).


Summary and Statement of Need
nasapower is an R (R Core Team, 2018) package providing functionality to interface with the NASA POWER API (Stackhouse et al., 2018) for reproducible data retrieval using R. Three functions, get_power(), create_met() and create_icasa() are provided.The get_power() function provides complete access to all functionality that the POWER API provides, which includes three user communities, AG (agroclimatology), SSE (Surface meteorology and Solar Energy) and SB (Sustainable Buildings); three temporal averages, Daily, Interannual and Climatology; three geographic options, single point, regional and global for the appropriate parameters offered.nasapower uses lubridate (Grolemund & Wickham, 2011) internally to format and parse dates which are passed along to the the query constructed using crul (Chamberlain, 2018) to interface with the POWER API.The query returns a json response, which is parsed by jsonlite (Ooms, 2014) to obtain the url of the .csvfile that has been requested.The .csv file is downloaded to local disk using curl (Ooms, 2018) and read into R using readr (Wickham, Hester, & Francois, 2017).Data are returned in a tidy data frame (Wickham, 2014) as a tibble (Müller & Wickham, 2018) with a custom header, which provides POWER metadata.Two other functions provide functionality to generate weather input files for agricultural crop modelling.The create_met() function is a wrapper for the get_power() function coupled with the prepareMet() and writeMet() functions from APSIM (Fainges, 2017) to simplify the process of querying the data and creating text files in the .metformat for use in Agricultural Production Systems sIMulator (APSIM).While the create_icasa() function wraps the get_power() into a function that generates and locally saves a text file in the International Consortium for Agricultural Systems Applications (ICASA) format for use in the Decision Support System for Agrotechnology Transfer (DSSAT) framework (G.Hoogenboom et al., 2017;J. W. Jones et al., 2003).Extended documentation is provided with examples of converting it to spatial objects using raster (Hijmans, 2017).
Integrating this data retrieval and formatting in R will streamline processes with models such as APSIM (Keating et al., 2003), DSSAT (J.W. Jones et al., 2003;J. Jones et al., 1998) and EPIRICE (Savary, Nelson, Willocquet, Pangga, & Aunario, 2012) that can be linked to or are implemented fully in the R programming language.

About POWER Data
NASA's POWER (Prediction Of Worldwide Energy Resource) data (Stackhouse et al., 2018) are freely available for download via a web interface at a grid resolution of one-half arc degree longitude by one-half arc degree latitude.Funded through the NASA Earth Science Directorate Applied Science Program, the data provide daily global coverage from 1983 until near present for all parameters except precipitation, which is provided for January 1997 to near present with a several month delay.The data are widely used in agricultural modelling for modelling crop yields (Bai et al., 2010;van Wart, Grassini, & Cassman, 2013;van Wart et al., 2015), other crop simulation exercises (Ojeda, Volenec, Brouder, Caviglia, & Agnusdei, 2017), plant disease modelling (Savary et al., 2012).
While nasapower does not redistribute any of the NASA POWER data, users are encouraged to please refer to the acknowledgement guidelines available at, https://power.larc.nasa.gov/#contact and properly acknowledge the data as requested.
When POWER data products are used in a publication, we request the following acknowledgment be included: "These data were obtained from the NASA Langley Research Center POWER Project funded through the NASA Earth Science Directorate Applied Science Program."