Learn R Programming

nasapower (version 4.0.0)

get_power: Get NASA POWER data from the POWER web API

Description

Get POWER global meteorology and surface solar energy climatology data and return a tidy data frame tibble::tibble() object. All options offered by the official POWER API are supported. Requests are formed to submit one request per point. There is no need to make synchronous requests for multiple parameters for a single point or regional request.

Usage

get_power(
  community,
  pars,
  temporal_api = NULL,
  lonlat,
  dates = NULL,
  site_elevation = NULL,
  wind_elevation = NULL,
  wind_surface = NULL,
  temporal_average = NULL
)

Value

A data frame as a POWER.Info class, an extension of the tibble::tibble, object of POWER data including location, dates (not including “climatology”) and requested parameters. A decorative header of metadata is included in this object.

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.

re

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 <code>temporal_api</code>

There are four valid values.

hourly

The hourly average of pars by hour, day, month and year.

daily

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

monthly

The monthly average of pars by month and year.

climatology

Provide parameters as 22-year climatologies (solar) and 30-year climatologies (meteorology); the period climatology and monthly average, maximum, and/or minimum values.

Argument details for <code>lonlat</code>

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(-179.5, -89.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_api.

Argument details for <code>dates</code>

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_api is set to “monthly”, use only two year values (YYYY), e.g. dates = c(1983, 2010). This argument should not be used when temporal_api is set to “climatology” and will be ignored if set.

wind-surface

There are 17 surfaces that may be used for corrected wind-speed values using the following equation: $$WSC_hgt = WS_10m\times(\frac{hgt}{WS_50m})^\alpha$$ Valid surface types are described here.

vegtype_1

35-m broadleaf-evergreen trees (70% coverage)

vegtype_2

20-m broadleaf-deciduous trees (75% coverage)

vegtype_3

20-m broadleaf and needleleaf trees (75% coverage)

vegtype_4

17-m needleleaf-evergreen trees (75% coverage)

vegtype_5

14-m needleleaf-deciduous trees (50% coverage)

vegtype_6

Savanna:18-m broadleaf trees (30%) & groundcover

vegtype_7

0.6-m perennial groundcover (100%)

vegtype_8

0.5-m broadleaf shrubs (variable %) & groundcover

vegtype_9

0.5-m broadleaf shrubs (10%) with bare soil

vegtype_10

Tundra: 0.6-m trees/shrubs (variable %) & groundcover

vegtype_11

Rough bare soil

vegtype_12

Crop: 20-m broadleaf-deciduous trees (10%) & wheat

vegtype_20

Rough glacial snow/ice

seaice

Smooth sea ice

openwater

Open water

airportice

Airport: flat ice/snow

airportgrass

Airport: flat rough grass

References

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

Examples

Run this code
# NOT RUN {
# Fetch daily "ag" community temperature, relative humidity and precipitation
# for January 1 1985 at Kingsthorpe, Queensland, Australia
ag_d <- get_power(
  community = "ag",
  lonlat = c(151.81, -27.48),
  pars = c("RH2M", "T2M", "PRECTOTCORR"),
  dates = "1985-01-01",
  temporal_api = "daily"
)

ag_d

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

ag_c_point

# Fetch global ag climatology for air temperature
ag_c_global <- get_power(
  community = "ag",
  pars = "T2M",
  lonlat = "global",
  temporal_api = "climatology"
)

ag_c_global

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

sse_i
# }

Run the code above in your browser using DataLab