Closed Aariq closed 1 year ago
I agree that the functionality of robustly
isn't specific to data.atmosphere
, but am less enthusiastic about moving it for a few reasons:
PEcAn.utils
is full of very-rarely-used functions and I think it generally needs to get smaller rather than larger. If we want to use robustly
in multiple PEcAn packages then PEcAn.utils
is the right place for it, but if it's currently only used in one package I favor waiting for a demonstrated need in another package rather than moving it preemptively.httr::RETRY
)On @infotroph second and 3rd points, I'm fairly confident that this function exists in data.atm because of API calls. I'm not familiar with RETRY, but taking a quick look I don't think it's equivalent (e.g. one of the example applications is opening a remote netCDF file via nc_open). That said, the other usage in data.atm is a httr::GET call that does look like it could be replaced by RETRY. I suspect that robustly isn't used in more packages more because people don't know about it than a lack of demand.
PEcAn.data.atmosphere::robustly()
andPEcAn.utils::retry.func()
do almost the same thing.robustly()
is an adverb that returns a function (similar topurrr::safely()
), whileretry.func()
returns the output of an expression (more liketry()
)robustly()
seems like it would be widely useful and should go inPEcAn.utils
along side or replacingretry.func()