get_power: Get NASA POWER data from the POWER web API

Description Usage Arguments Value Argument details for “community” Argument details for temporal_average Argument details for lonlat Argument details for dates Note Author(s) References Examples

View source: R/get_power.R

Description

Get POWER global meteorology and surface solar energy climatology data and return a tidy data frame tibble object. All options offered by the official POWER API are supported.

Usage

1
2
3
4
5
6
7
8
get_power(
  community,
  pars,
  temporal_average,
  lonlat,
  dates = NULL,
  site_elevation = NULL
)

Arguments

community

A character vector providing community name: “AG”, “SB” or “SSE”. See argument details for more.

pars

A character vector of solar, meteorological or climatology parameters to download. See parameters for a full list of valid values and definitions. If downloading “CLIMATOLOGY” a maximum of three pars can be specified at one time, for “DAILY” and “INTERANNUAL” a maximum of 20 can be specified at one time.

temporal_average

Temporal average for data being queried, supported values are “DAILY”, “INTERANNUAL” and “CLIMATOLOGY”. See argument details for more.

lonlat

A numeric vector of geographic coordinates for a cell or region entered as x, y coordinates or “GLOBAL” for global coverage (only used for “CLIMATOLOGY”). 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"). Not used when
temporal_average is set to “CLIMATOLOGY”. See argument details for more.

site_elevation

A user-supplied value for elevation at a single point in metres. If provided this will return a corrected atmospheric pressure value adjusted to the elevation provided. Only used with 'lonlat' as a single point of x, y coordinates, not for use with “GLOBAL” or with a regional request.

Value

A data frame of POWER data including location, dates (not including “CLIMATOLOGY”) and requested parameters. A header of metadata is included.

Argument details for “community”

There are three valid values, one must be supplied. This will affect the units of the parameter and the temporal display of time series data.

AG

Provides access to the Agroclimatology Archive, which contains industry-friendly parameters formatted for input to crop models.

SB

Provides access to the Sustainable Buildings Archive, which contains industry-friendly parameters for the buildings community to include parameters in multi-year monthly averages.

SSE

Provides access to the Renewable Energy Archive, which contains parameters specifically tailored to assist in the design of solar and wind powered renewable energy systems.

Argument details for temporal_average

There are three valid values.

DAILY

The daily average of pars by day, month and year.

INTERANNUAL

The monthly average of pars by year.

CLIMATOLOGY

The monthly average of pars at the surface of the earth for a given month, averaged for that month over the 30-year period (Jan. 1984 - Dec. 2013).

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(-89.5, -179.5).

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 south western corner of Australia: lonlat = c(112.5, -55.5, 115.5, -50.5). *Maximum area processed is 4.5 x 4.5 degrees (100 points).

For global coverage

To get global coverage for CLIMATOLOGY, supply “GLOBAL” while also specifying “CLIMATOLOGY” for the temporal_average.

Argument details for dates

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, e.g., dates = "1983-01-01". When temporal_average is set to “INTERANNUAL”, use only two year values (YYYY), e.g. dates = c(1983, 2010). This argument should not be used when temporal_average is set to “CLIMATOLOGY”.

The weather values from POWER for temperature are 2 metre max and min temperatures, “T2M_MAX” and “T2M_MIN”; radiation, “ALLSKY_SFC_SW_DWN”; rain, “PRECTOT”; relative humidity at 2 metres, “RH2M”; and wind at 2 metres “WS2M” from the POWER ‘AG’ community on a daily time-step.

If further parameters are desired, the user may pass them along.

Note

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

Author(s)

Sparks, A. H. adamhsparks@gmail.com

References

https://power.larc.nasa.gov/docs/methodology/ https://power.larc.nasa.gov

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
# Fetch daily "AG" community temperature, relative
# humidity and precipitation for January 1 1985
# for Kingsthorpe, Queensland, Australia
ag_d <- get_power(
  community = "AG",
  lonlat = c(151.81, -27.48),
  pars = c("RH2M", "T2M", "PRECTOT"),
  dates = "1985-01-01",
  temporal_average = "DAILY"
)

# Fetch single point climatology for air temperature
ag_c_point <- get_power(
  community = "AG",
  pars = "T2M",
  c(151.81, -27.48),
  temporal_average = "CLIMATOLOGY"
)

ag_c_point

# Fetch global AG climatology for air temperature
ag_c_global <- get_power(
  community = "AG",
  pars = "T2M",
  lonlat = "GLOBAL",
  temporal_average = "CLIMATOLOGY"
)

ag_c_global

# Fetch interannual solar cooking parameters
# for a given region
sse_i <- get_power(
  community = "SSE",
  lonlat = c(112.5, -55.5, 115.5, -50.5),
  dates = c("1984", "1985"),
  temporal_average = "INTERANNUAL",
  pars = c("CLRSKY_SFC_SW_DWN", "ALLSKY_SFC_SW_DWN")
)

sse_i

nasapower documentation built on Oct. 24, 2020, 9:08 a.m.