MazamaScience / AirFireModeling

Utilities to ease merging of USFS AirFire model output and monitoring data.
0 stars 0 forks source link

verify existing examples #41

Closed jonathancallahan closed 4 years ago

jonathancallahan commented 4 years ago

Every function in the package should have a working example. For instance, in R/bluesky_downloaded.R we see:

#' \dontrun{
#' library(AirFireModeling)
#' setModelDataDir('~/Data/BlueSky')
#'
#' filePath <- bluesky_download(model = "PNW-4km", modelRun = 2019100900)
#' bluesky_toCommonFormat(filePath)
#' bluesky_downloaded()
#' }

In RStudio, this can be highlighted and run by pressing CTRL-Return.

Every example should be runnable without any previous setup (besides the one time creation of ~/Data/BlueSky). This means that they should always begin with:

#' library(AirFireModeling)
#' setModelDataDir('~/Data/BlueSky')

Some thought should be given to the use of \donttest{...} and \dontrun{...}. If an example uses only internal data and runs quickly then neither of these should be used.

As I recently heard from CRAN: "\dontrun{} should only be used if the example really cannot be executed (e.g. because of missing additional software, missing API keys, ...) by the user. "

This means that the above example should probably be \donttest{...} rather than \dontrun{...}. This will allow us to automatically do a thorough test of the package by using MazamaCoreUtils::check_slow().

It is OK to have extended examples exploring the use of options where part is always run and part is within \donttest{...}. (Documented examples are good!)

This task is complete when every function has an example that can be run with RStudio.

As always, Check and Build the package before checking in changes.

tabrasel commented 4 years ago
tabrasel commented 4 years ago

I'm unsure how to proceed with the following functions:

cmaq_toCommonFormat.R I cannot get this function to actually work. The current example gives Error in R_nc4_def_dim: NetCDF: NC_UNLIMITED size already in use. Also, is this function used anywhere?

raster_coordinateTrace.R All functions commented out. Should I wait to write examples?

raster_loadNearestMonitor.R All functions commented out. Should I wait to write examples?

AirFireModeling.R Are examples necessary for short functions like getModelDataDir, getModelDataDir, and removeModelDataDir?

jonathancallahan commented 4 years ago

Those functions are leftovers/experimental and I'll move them all to local_jon/ before I push.

No examples needed for the ModelDataDir related functions.

Looks like you finished everything!