NASA POWER API Client

Client for 'NASA' 'POWER' global meteorology, surface solar energy and climatology data 'API'. 'POWER' (Prediction Of Worldwide Energy Resource) data are freely available global meteorology and surface solar energy climatology data for download with a resolution of 1/2 by 1/2 arc degree longitude and latitude and are funded through the 'NASA' Earth Science Directorate Applied Science Program. For more on the data themselves, a web-based data viewer and web access, please see < https://power.larc.nasa.gov/>.


CircleCI Buildstatus DOI Project Status: Active – The project has reached a stable, usablestate and is being activelydeveloped. DOI CRAN

nasapower aims to make it quick and easy to automate downloading NASA-POWER global meteorology, surface solar energy and climatology data in your R session as a tidy data frame tibble object for analysis and use in modelling or other purposes. POWER (Prediction Of Worldwide Energy Resource) data are freely available for download at a resolution of 1/2 arc degree longitude by 1/2 arc degree latitude.

nasapower offers further functionality to quickly and easily generate an APSIM package metFile format text file from POWER data for use in the Agricultural Production Systems sIMulator (APSIM) or an ICASA format text files for use in Decision Support System for Agrotechnology Transfer (DSSAT).

Please see https://power.larc.nasa.gov/ for more on the data and other ways to access it and other forms of data available, e.g., your web browser or an ESRI REST API.

Quick start

nasapower can easily be installed using the following code.

From CRAN

The stable version is available through CRAN.

install.packages("nasapower")

From GitHub for the version in-development

A development version that may have new features or bug fixes is available through GitHub.

if (!require(remotes)) {
  install.packages("remotes")
}
 
remotes::install_github("ropensci/nasapower",
                       build_vignettes = TRUE)

Example

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

library(nasapower)
daily_ag <- get_power(community = "AG",
                      lonlat = c(151.81, -27.48),
                      pars = c("RH2M", "T2M", "PRECTOT"),
                      dates = "1985-01-01",
                      temporal_average = "DAILY"
                      )
                    
daily_ag
#> NASA/POWER SRB/FLASHFlux/MERRA2/GEOS 5.12.4 (FP-IT) 0.5 x 0.5 Degree Daily Averaged Data  
#>  Dates (month/day/year): 01/01/1985 through 01/01/1985  
#>  Location: Latitude  -27.48   Longitude 151.81  
#>  Elevation from MERRA-2: Average for 1/2x1/2 degree lat/lon region = 434.55 meters   Site = na  
#>  Climate zone: na (reference Briggs et al: http://www.energycodes.gov)  
#>  Value for missing model data cannot be computed or out of model availability range: -99  
#>  
#>  Parameters: 
#>  PRECTOT MERRA2 1/2x1/2 Precipitation (mm day-1) ;
#>  RH2M MERRA2 1/2x1/2 Relative Humidity at 2 Meters (%) ;
#>  T2M MERRA2 1/2x1/2 Temperature at 2 Meters (C)  
#>  
#> # A tibble: 1 x 10
#>     LON   LAT  YEAR    MM    DD   DOY YYYYMMDD    RH2M   T2M PRECTOT
#>   <dbl> <dbl> <dbl> <int> <int> <int> <date>     <dbl> <dbl>   <dbl>
#> 1  152. -27.5  1985     1     1     1 1985-01-01  48.9  25.1    1.07

Documentation

More documentation is available in the vignette in your R session, vignette("nasapower") or available online, https://ropensci.github.io/nasapower/articles/nasapower.html.

Use of POWER Data

While nasapower does not redistribute the data or provide it in any way, we encourage users to follow the requests of the POWER Project Team.

following acknowledgement be included: “These data were obtained from the NASA Langley Research Center POWER Project funded through the NASA Earth Science Directorate Applied Science Program.”

Meta

  • Please report any issues or bugs.

  • License: MIT

  • Get citation information for nasapower in R by typing citation(package = "nasapower").

  • Please note that the nasapower project is released with a Contributor Code of Conduct. By participating in the nasapower project you agree to abide by its terms.

  • The U.S. Earth System Research Laboratory, Physical Science Division of the National Atmospheric & Oceanic Administration (NOAA) maintains a list of gridded climate data sets that provide different data and different resolutions https://www.esrl.noaa.gov/psd/data/gridded/.

References

https://power.larc.nasa.gov

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

ropensci_footer

News

nasapower 1.1.1

Bug fixes

  • Fix issues reported at https://cloud.r-project.org//web/checks/check_results_nasapower.html with failing tests. These tests should be skipped on CRAN but were not.

  • Fixes bug where missing values in POWER data were not properly replaced with NA in tibble and metFile outputs

  • Fixes bug in documentation for create_icasa() where the parameter for file_out was misidentified as just file

Minor changes

  • Users are now notified if creating a .met file that has any missing values through a console message and .csv file being written to disk to accompany the resulting .met file describing which values are missing

nasapower 1.1.0

Bug fixes

  • Fixes bug where .met files were not created properly including where "radn" and "rain" col headers were reversed

  • Fix Warning: Must pass a scalar integer as 'nrow' argument to 'new_tibble()'.

  • Fixes bug where "CLIMATE" could not be requested for a single point

Major changes

  • Change how GLOBAL values are requested. This is now specified in lonlat in conjunction with temporal_average = CLIMATOLOGY.

Minor changes

  • Adds example of fetching climate for a single point

  • Refactor code to split internal functions by functionality and add more complete test coverage

nasapower 1.0.7

Minor changes

  • Removes internal check for data - community agreement, as all data is available for all communities, only the units change

  • Update links to latest documentation provided by the POWER team

nasapower 1.0.6

Minor changes

  • Adds support for WS2M_MIN, WS2M_MAX and WS2M_RANGE in AG community

Bug fixes

  • Fixes bug where previous release did not support WS2M from AG community due to a local typo

nasapower 1.0.5

Minor changes

  • "Fixes" Issue 32 where WS2M is not available through nasapower until the POWER team can properly address how pre-query validation should be performed

nasapower 1.0.4

Minor changes

  • Corrects an instance where vignette example executed on CRAN but should not

  • Adds link to POWER website in error message when query fails

  • Documentation .Rd files are now more readable with better formatting

nasapower 1.0.3

Minor changes

Documentation changes

  • Flesh out examples using naspower data with raster to create spatial objects for systems with low-RAM where the functionality may not work as expected

  • Standardise formatting of vignette subheadings

  • Spell check vignette

Bug fixes

  • Fixes tests to not run on CRAN so that errors aren't reported when API is unavailable

nasapower 1.0.2

Minor changes

  • Updates documentation examples

  • Provides nicer method of printing data in R console

  • Updates tests for better coverage and removes non-functional tests

  • Removes dplyr as an Import

Bug fixes

  • Corrects issue where if() was called with a vector of length 2 or more

  • Corrects logical operators && and || where they should be & or |

  • Removes extra code in create_icasa() and create_met() that performed a duplicated check of latlon values

  • Removes unnecessary checks for latlon in get_power()


nasapower 1.0.1

Minor changes

  • Provides corrections to documentation formatting as per CRAN volunteers' requests

  • Provides edits and clarifications in DESCRIPTION's Description and Title about the package's uses and capabilities


nasapower 1.0.0 (unreleased)

Major changes

  • nasapower is now a part of rOpenSci after peer-review of the code!

  • Provides access to all three communities, AG, SSE and and SB, not just AG

  • Uses new 'POWER' 'API' to download new 1/2 x 1/2 degree data

  • Adds function get_power() to get weather data and optionally metadata as well

  • Adds function create_met() to create 'APSIM' met objects from 'POWER' data

  • Adsd function create_icasa() to create a text file of weather data for use in 'DSSAT' crop modelling

  • Internally, replaces httr package with crul

Deprecated functions

  • The get_cell and get_region functions are deprecated in favour of get_power(). The new POWER interface allows for the specification of single points or regional areas. Global coverage may be queried for Climatology. See the help for ?get_power() for more details.

nasapower 0.1.4

Bug Fixes

  • Fixes bug related to date columns where MONTH, DAY and YYYY-MM-DD were incorrectly reported in final data frame. This did not affect the weather data, YEAR or DOY columns.

nasapower 0.1.3

Bug fixes

  • Fix bug where lon/lat values were improperly assigned internally due to row names not being ordered correctly in get_region()

  • Fix bug reports link in DESCRIPTION file

  • Correct vignette where it had said, "both of which will which will download"

  • Correct documentation for get_region(), which incorrectly stated that it downloaded data for a 1 x 1 degree cell

Minor improvements

  • Optimise arguments used in utils::read.table() to ingest weather data in the get_cell() and get_region() functions more quickly

  • NEWS now formatted more nicely for easier reading

  • Add statement about possible performance and memory usage when using get_region() in the vignette

  • Add an example of converting the data frame to a spatial object using raster to create a raster::brick()

  • Specify in documentation that a range of days to years can be specified for download

Minor changes

  • get_region() and get_cell() now default to download all weather vars

  • Add a check to see if POWER website is responding before making request for data. If not, stop and return error message to user.


nasapower 0.1.2

Bug fixes

Minor improvements

  • Enhanced documentation

  • Superfluous function, .onLoad(), removed from zzz.R

  • Tidied up startup message

  • Clean up vignette

  • Build vignette faster

  • Remove DATE from DESCRIPTION


nasapower 0.1.1

Minor improvements

  • Fix issues in documentation, typos, incorrect links, etc.

nasapower 0.1.0

New features

Minor improvements

  • Better documentation

nasapower 0.0.2

New features

  • Added citation file

nasapower 0.0.1

  • Added a NEWS.md file to track changes to the package.

  • First release, no changes to report yet

Reference manual

It appears you don't have a PDF plugin for this browser. You can click here to download the reference manual.

install.packages("nasapower")

1.1.2 by Adam H. Sparks, 8 days ago


https://docs.ropensci.org/nasapower/


Report a bug at https://github.com/ropensci/nasapower/issues


Browse source code at https://github.com/cran/nasapower


Authors: Adam H. Sparks [aut, cre] , Scott Chamberlain [rev] , Hazel Kavili [rev] , Alison Boyer [rev]


Documentation:   PDF Manual  


Task views: Hydrological Data and Modeling


MIT + file LICENSE license


Imports APSIM, crul, curl, lubridate, jsonlite, readr, tibble, utils

Suggests covr, ggplot2, knitr, pkgdown, raster, rmarkdown, testthat


Imported by ClimMobTools.


See at CRAN