MODISoptions.Rd 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. % Generated by roxygen2: do not edit by hand
  2. % Please edit documentation in R/MODISoptions.R
  3. \name{MODISoptions}
  4. \alias{MODISoptions}
  5. \title{Set or Retrieve Permanent MODIS Package Options}
  6. \usage{
  7. MODISoptions(localArcPath, outDirPath, pixelSize, outProj, resamplingType,
  8. dataFormat, gdalPath, MODISserverOrder, dlmethod, stubbornness, wait, quiet,
  9. systemwide = FALSE, save = TRUE, checkTools = TRUE)
  10. }
  11. \arguments{
  12. \item{localArcPath}{\code{character}, defaults to
  13. \code{file.path(tempdir(), "MODIS_ARC")}. Target folder for downloaded MODIS
  14. HDF files.}
  15. \item{outDirPath}{\code{character}, defaults to
  16. \code{file.path(tempdir(), "MODIS_ARC/PROCESSED")}. Target folder for results
  17. of \code{\link{runGdal}} and \code{\link{runMrt}}.}
  18. \item{pixelSize}{Output pixel size (in target reference system units) passed
  19. to \code{\link{runGdal}} and \code{\link{runMrt}}, defaults to \code{"asIn"}.}
  20. \item{outProj}{Target reference system passed to \code{\link{runGdal}} and
  21. \code{\link{runMrt}}. \code{\link{runGdal}} requires a valid
  22. \code{\link{CRS}}. As for \code{\link{runMrt}}, please consult the MRT manual.
  23. Since the two pocessing methods do not have common methods, it is suggested
  24. to stick with the default settings (see Details).}
  25. \item{resamplingType}{Defaults to \code{"NN"} (Nearest Neightbour). MRT and
  26. GDAL both support \code{c('NN', 'CC', 'BIL')}. In addition, GDAL supports
  27. \code{cubicspline} and \code{lanczos} and, from \code{GDAL >= 1.10.0} onwards,
  28. also \code{mode} and \code{average}.}
  29. \item{dataFormat}{\code{character}, defaults to \code{"GTiff"}. One of
  30. \code{getOption("MODIS_gdalOutDriver")} (column 'name').}
  31. \item{gdalPath}{\code{character}. Path to gdal bin directory and more
  32. relevant for Windows users. Use \code{MODIS:::checkTools("GDAL")} to try to
  33. detect it automatically.}
  34. \item{MODISserverOrder}{\code{character}. Possible options are \code{"LAADS"}
  35. (default) and \code{"LPDAAC"} (see 'dlmethod' and 'Details'). If only one
  36. server is selected, all efforts to download data from the second server
  37. available are inhibited.}
  38. \item{dlmethod}{\code{character}, defaults to \code{auto}. See 'method' in
  39. \code{\link{download.file}}. On Unix (also Mac?), it is suggested to use
  40. \code{"wget"} or, if installed, \code{"aria2"}. In order to download MODIS
  41. files from LPDAAC, please note that either wget (default) or curl must be
  42. installed and made available through the PATH environmental variable.}
  43. \item{stubbornness}{\code{numeric}. The number of retries after the target
  44. server has refused a connection. Higher values increase the chance of getting
  45. the file, but also lead to hanging functions if the server is down.}
  46. \item{wait}{\code{numeric} waiting time (in seconds) inserted after each
  47. internal online download call via \code{\link{download.file}} or
  48. \code{\link{getURL}}. Reduces the chance of FTP connection errors that
  49. frequently occur after many requests.}
  50. \item{quiet}{\code{logical} passed eg to \code{\link{download.file}} which is
  51. called from inside \code{\link{getHdf}}.}
  52. \item{systemwide}{A \code{logical} determining whether changes made to
  53. \code{\link{MODISoptions}} are to be applied system or user-wide (default),
  54. see 'Details'.}
  55. \item{save}{\code{logical}. If \code{TRUE} (default), settings are permanent.}
  56. \item{checkTools}{\code{logical}, defaults to \code{TRUE}. Check if external
  57. tools (i.e., GDAL and MRT) are installed and reachable through R.}
  58. }
  59. \value{
  60. An invisible \code{list} of \strong{MODIS} options. In addition, the most
  61. relevant of these options are printed to the console. Use
  62. \code{\link{capture.output}} to prevent this behavior.
  63. }
  64. \description{
  65. Set or retrieve persistant \strong{MODIS} package options (per user or
  66. systemwide). Changes here will persist through sessions and updates.
  67. }
  68. \details{
  69. These settings are easy to change and take effect immediately! However,
  70. please mind that the \href{https://cran.r-project.org/web/packages/policies.html}{CRAN Repository Policy}
  71. does not permit automated write access to the user's file system exempt for
  72. \code{\link{tempdir}}. Therefore, changes made to \code{\link{MODISoptions}}
  73. remain temporally limited to the current \strong{\code{R}} session unless write
  74. access is explicitly granted by the user in interactive mode, in which case a
  75. permanent settings file is created in \code{file.path("~/.MODIS_Opts.R")}
  76. (user-wide) or \code{file.path(R.home(component = "etc"), '.MODIS_Opts.R')}
  77. (system-wide, write access provided).
  78. Due to similar reasons, 'localArcPath' and 'outDirPath' default to
  79. \strong{\code{R}}'s \code{\link{tempdir}} and should be changed immediately
  80. after loading the package in order to make downloaded files permanently
  81. available. You may also specify a shared network drive if you have a central
  82. MODIS data server.
  83. If you change default values, consider that your settings have to be valid
  84. for any MODIS product, layer and area!
  85. It is not recommended to use
  86. \itemize{
  87. \item{a coordinate reference system that is not applicable globally as
  88. default for 'outProj',}
  89. \item{or a fixed 'pixelSize' for different products,}
  90. \item{or a 'resamplingType' that is not \code{"NN"}.}
  91. }
  92. On Windows, you have to set 'gdalPath' to the location of GDAL executables
  93. (i.e., the '.../GDAL../bin' directory). On Unix-alikes, this should not be
  94. required unless you want to specify a non-default GDAL installation.
  95. On an unixoid OS, it is suggested to use \code{dlmethod = 'wget'} because it
  96. is a reliable tool and, after the change of the 'LP DAAC' datapool from FTP
  97. to HTTP (May 2013), \code{dlmethod = 'auto'} seems not to work properly. On
  98. Windows, on the other hand, \code{dlmethod = 'auto'} seems to work fine.
  99. Please note that in order to download MODIS files from LPDAAC, you are
  100. required to register for an Earthdata Login Profile
  101. (\url{https://urs.earthdata.nasa.gov/users/new}) and create a read-only
  102. .netrc file in your home directory containing the Earthdata server address as
  103. well as your login credentials. An automated solution for the creation of a
  104. workable .netrc file is provided through \code{\link{lpdaacLogin}}.
  105. }
  106. \examples{
  107. \dontrun{
  108. ## get options
  109. MODISoptions()
  110. ## set options
  111. lap = "/another/path/to/MODIS_ARC" # 'localArcPath'
  112. odp = file.path(lap, "PROCESSED") # 'outDirPath'
  113. MODISoptions(localArcPath = lap, outDirPath = odp)
  114. }
  115. }
  116. \author{
  117. Matteo Mattiuzzi, Steven Mosher and Florian Detsch
  118. }