如何使用 R 中的 NASAPOWER get_power 函数解决 HTTP 422 错误

how to resolve the HTTP 422 error with the NASAPOWER get_power function in R

我在 R

中的 NASAPOWER 库的 get_power 函数(全球气象学和地表太阳能气候学数据)中收到错误:无法处理的实体 (HTTP 422)
library(nasapower)
ag_d <- get_power(
  community = "AG",
  lonlat = c(151.81, -27.48),
  pars = c("RH2M", "T2M", "PRECTOT"),
  dates = "1985-01-01",
  temporal_average = "DAILY"
)

有什么建议!

NASA Power API 版本 2 已发布。 nasapower R 包的维护者一直在更新代码。看看 github repo. You can find, for example, that PRECTOT was changed to PRECTOTCORR. You can also find the progress here.

他们推荐使用开发中的版本:

if (!require("remotes")) {
  install.packages("remotes")
}

remotes::install_github("ropensci/nasapower")

library("nasapower")

daily_ag <- get_power(community = "ag",
                      lonlat = c(151.81, -27.48),
                      pars = c("RH2M", "T2M", "PRECTOTCORR"),
                      dates = "1985-01-01",
                      temporal_api = "daily"
                      )
daily_ag

最佳