Learn R Programming

oce (version 0.9-21)

download.amsr: Download and Cache an amsr File

Description

If the file is already present in destdir, then it is not downloaded again. The default destdir is the present directory, but it probably makes more sense to use something like "~/data/amsr" to make it easy for scripts in other directories to use the cached data. The file is downloaded with download.file.

Usage

download.amsr(year, month, day, destdir = ".",
  server = "http://data.remss.com/amsr2/bmaps_v07.2")

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.

destdir

A string naming the directory in which to cache the downloaded file. The default is to store in the present directory, but many users find it more helpful to use something like "~/data/amsr" for this, to collect all downloaded amsr files in one place.

server

A string naming the server from which data are to be acquired. See “History”.

Value

A character value indicating the filename of the result; if there is a problem of any kind, the result will be the empty string.

History

Until 25 March 2017, the default server was "ftp.ssmi.com/amsr2/bmaps_v07.2", but this was changed when the author discovered that this FTP site had been changed to require users to create accounts to register for downloads. The default was changed to "http://data.remss.com/amsr2/bmaps_v07.2" on the named date. This site was found by a web search, but it seems to provide proper data. It is assumed that users will do some checking on the best source.

Warning

All of the download.* functions are subject to change through the year 2017. The plan is to create individual functions as needs arise in everyday work, thereby discovering patterns of arguments that might make sense more generally. Therefore, it is likely that argument order (and even name) may change up until approximately December 2016. Users are advised to refer to arguments by name, i.e. not to rely on their order, and they are asked for patience, because argument names and defaults may vary through the early development.

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.

See Also

Other functions that download files: download.coastline, download.met, download.topo

Other things related to amsr data: [[<-,amsr-method, amsr-class, composite,amsr-method, plot,amsr-method, read.amsr, subset,amsr-method, summary,amsr-method

Examples

Run this code
# NOT RUN {
## The download takes several seconds.
f <- download.amsr(2017, 1, 14) # Jan 14, 2017
d <- read.amsr(f)
plot(d)
mtext(d[["filename"]], side=3, line=0, adj=0)
# }

Run the code above in your browser using DataLab