mikejohnson51 / climateR

An R 📦 for getting point and gridded climate data by AOI
https://mikejohnson51.github.io/climateR/
MIT License
165 stars 40 forks source link

getTerraClim returns error for 2021 data but data is available through December 2021 #62

Closed rsmiller74 closed 1 year ago

rsmiller74 commented 1 year ago

getTerraClim returns error for 2021 data but data is available through December 2021.

When I modify the getTerraClim function to allow data from 2021 it correctly downloads the data.

Should be as easy as changing the if statement on line 22 to allow data from 2021.

if(endDateYear > 2021 | startDateYear < 1958){ stop("TerraClim data only avaliable between 1958 and 2021")}

See url below for current listing of available data by parameter. All are through 2021. http://thredds.northwestknowledge.net:8080/thredds/catalog/TERRACLIMATE_ALL/data/catalog.html

mikejohnson51 commented 1 year ago

With the new catalog form of this package, start and end dates will no longer be hard coded allowing less maintenance and issues like these to go away. Coming soon!

mikejohnson51 commented 1 year ago

The correct duration is now archived in the data catalog and will work with the getTerraClim function without hardcoded values. Thanks!!

library(climateR); library(dplyr)

filter(params, 
              id == 'terraclim',
              variable == "ppt") |> 
  select(id, varname, units, model, scenario, duration) 
#>          id varname units model scenario              duration
#> 1 terraclim     ppt    mm  <NA>    total 1958-01-01/2021-12-01

Created on 2023-02-16 by the reprex package (v2.0.1)