
Extract Weather Data From the NASA POWER API Using Australian GPS Coordinates
Source:R/extract_power.R
      extract_power.RdExtracts satellite and modelled weather data from the NASA
POWER API at the GPS points provided.  This is a wrapper
for nasapower::get_power() that will only work with Australian locations.
Usage
extract_power(
  x,
  start_date,
  end_date,
  pars,
  community,
  temporal_api = NULL,
  site_elevation = NULL,
  wind_elevation = NULL,
  wind_surface = NULL,
  temporal_average = NULL,
  time_standard = "LST"
)Arguments
- x
 List. An object with names containingvectorpairings of longitude and latitude values expressed as decimal degree values in that order, each individualvectors' items should be named "x" (longitude) and "y" (latitude), respectively. Thelistitem names should be descriptive of the individualvectorsand will be included in a "location" column of the output.- start_date
 Integer. A string representing the start date of the query in the format 'yyyymmdd' (ISO-8601). Not used whentemporal_apiis set to “climatology”. See argument details for more.- end_date
 Integer. A string representing the end date of the query in the format 'yyyymmdd' (ISO-8601). Not used whentemporal_apiis set to “climatology”. See argument details for more.- pars
 A character vector of solar, meteorological or climatology parameters to download. When requesting a single point of x, y coordinates, a maximum of twenty (20)
parscan be specified at one time, for “daily”, “monthly” and “climatology”temporal_apis. If thetemporal_apiis specified as “hourly” only 15parscan be specified in a single query. Seetemporal_apifor more.- community
 A character vector providing community name: “ag”, “re” or “sb”. See argument details for more.
- temporal_api
 Temporal API end-point for data being queried, supported values are “hourly”, “daily”, “monthly” or “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.
- wind_elevation
 A user-supplied value for elevation at a single point in metres. Wind Elevation values in Meters are required to be between 10m and 300m. If this parameter is provided, the
wind-surfaceparameter is required with the request, see https://power.larc.nasa.gov/docs/methodology/meteorology/wind/.- wind_surface
 A user-supplied wind surface for which the corrected wind-speed is to be supplied. See
wind-surfacesection for more detail.- temporal_average
 Deprecated. This argument has been superseded by
temporal_apito align with the new POWER API terminology.- time_standard
 POWER provides two different time standards:
Universal Time Coordinated (UTC): is the standard time measure that used by the world.
Local Solar Time (LST): a 15 Degrees swath that represents solar noon at the middle longitude of the swath. Defaults to
LST.
Value
A data.table::data.table with data from the POWER API.
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 temporal_api
    There are four valid values.
- hourly
 The hourly average of
parsby hour, day, month and year, the time zone is LST by default.- daily
 The daily average of
parsby day, month and year.- monthly
 The monthly average of
parsby 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 x
- 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).
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_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.
Argument details for 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
See also
Other weather data:
extract_data_drill(),
extract_patched_point()
Author
Adam H. Sparks, adamhsparks@gmail.com
Examples
if (FALSE) { # interactive()
locs <- list(
  "Merredin" = c(x = 118.28, y = -31.48),
  "Corrigin" = c(x = 117.87, y = -32.33),
  "Tamworth" = c(x = 150.84, y = -31.07)
  )
extract_power(
  x = locs,
  start_date = "19850101",
  end_date = "19850101",
  community = "ag",
  pars = c("RH2M", "T2M", "PRECTOTCORR"),
  temporal_api = "daily"
)
}