pvwatts

License

MIT + file LICENSE

Citation

Citing this package

Authors

  • Alejandro Hagan (author, maintainer)

License

MIT + file LICENSE

Citation

Citing this package

Authors

  • Alejandro Hagan (author, maintainer)

pvwatts

R interface to NREL’s PVWatts v8 API for solar production estimates.

Installation

pak::pak("git::https://codeberg.org/usrbinr/pvwatts")

Setup

Get a free API key at developer.nrel.gov/signup, then add to ~/.Renviron:

usethis::edit_r_environ()
# Add: NREL_API_KEY=your_key_here

Usage

library(pvwatts)

# Query solar yield for Austin, TX
result <- pvwatts(lat = 30.27, lon = -97.74)
#> i Querying PVWatts for (30.27, -97.74)...
#> v Yield: 1735 kWh/kWp (Austin, Texas)

# Access results (S7 object - use @)
result@annual$yield_kwh_per_kwp
#> [1] 1735

result@monthly$generation_factor
#>  [1] 0.058 0.056 0.078 0.093 0.101 0.110 0.114 0.112 0.088 0.077 0.057 0.055

# Use location presets
loc <- preset_location("phoenix_az")
pvwatts(lat = loc$lat, lon = loc$lon)@annual$yield_kwh_per_kwp
#> [1] 2087

Features

  • Query yield, irradiance, and monthly generation profiles
  • Compare array types (fixed, 1-axis, 2-axis tracking)
  • Bifacial module support
  • Location presets for major US solar markets
  • Built-in rate limiting and retry logic