dc.amsr: Download and Cache an AMSR File

Description Usage Arguments Value References Examples

View source: R/amsr.R

Description

Download and Cache an AMSR File

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
dc.amsr(
  year,
  month,
  day,
  server = "http://data.remss.com/amsr2/bmaps",
  version = "v08",
  destdir = ".",
  destfile,
  force = FALSE,
  dryrun = FALSE,
  debug = getOption("dcDebug", 0)
)

Arguments

year, month, day

numerical values of the year, month, and day of the desired dataset. Note that one file is archived per day, so these three values uniquely identify a dataset. If day and month are not provided but day is, then the time is provided in a relative sense, based on the present date, with day indicating the number of days in the past. Owing to issues with timezones and the time when the data are uploaded to the server, day=3 may yield the most recent available data. For this reason, there is a third option, which is to leave day unspecified, which works as though day=3 had been given.

server

character value giving the base name of the server, used in the construction of URL queries. Since servers tend to change over time, this is a good argument to check, when debugging code that once worked but now fails.

version

character string indicating the 'version' name in the files.

destdir

character value indicating the directory in which to store downloaded files. The default value of "." means to store the downloaded file in the present working directory. Set destdir=NULL if destfile is a filename with full path information. File clutter is reduced by creating a top-level directory called data, with subdirectories for various file types; see “Examples”.

destfile

character value indicating the name of the file. If not supplied, then the file name is constructed from the other parameters of the function call, so that subsequent calls with the same parameters will yield the same result; this is useful for caching.

force

A logical value that indicates whether to force the download, even if the pathname constructed from destdir and destfile already exists.

dryrun

A logical value that indicates whether to return the constructed web query, without attempting to download the file. This can be helpful in designing responses to changing URLs.

debug

an integer specifying whether debugging information is to be printed during processing. The printing is done by a call to dcDebug(). Setting debug=0 turns off this form of debugging, while higher values yield more information. If one dc function calls another, it passes the value of debug but decreased by 1, which means that the value of debug controls not just the breadth of debugging, but also the depth.

Value

String indicating the full pathname to the downloaded file.

References

http://images.remss.com/amsr/amsr2_data_daily.html provides daily images going back to 2012. Three-day, monthly, and monthly composites are also provided on that site.

Examples

1
2
3
4
5
6
7
8
9
## Not run: 
## The download takes several seconds.
f <- dc.amsr(2017, 1, 14, destdir="~/data/amsr") # Jan 14, 2017
library(oce)
d <- read.amsr(f)
plot(d)
mtext(d[["filename"]], side=3, line=0, adj=0)

## End(Not run)

dankelley/dac documentation built on June 4, 2020, 11:45 p.m.