Description Usage Arguments Value Author(s) References See Also Examples
The data are downloaded with utils::download.file()
pointed to links inferred by tracing a NOAA website (ref 1) through a series
of links down to a THREDDS server and finally to an HTTPServer. At the
moment, there is no choice on which version of the database is used: it is
WOA13 for all variables except salinity and temperature, and in these latter
two, it is WOA13V2, which is said to be an improvement over the initial
release (ref 2).
1 2 3 4 5 6 7 8 9 10 11 12 |
database |
String indicating the name of the database. This must be
|
version |
String indicating the version of the atlas. This is ignored in this version, but a future version could allow specification of either the original or the version-2 data. |
time |
String indicating the time. This is ignored in this version, but a future version could allow division into months for some fields and decades for others. |
resolution |
Number indicating the resolution, in degrees of longitude and latitude. The permitted values are 0.25, 1 and 5. The downloaded files are of typical size 634 Mb, 177 Mb and 4.1 Mb, respectively. The 1-deg resolution is a good choice for global-scale applications. |
field |
String indicating the variable. This must be one of
the following: |
destdir |
character value indicating the directory in which to store
downloaded files. The default value of |
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 |
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 |
String indicating the full pathname to the downloaded file.
Dan Kelley (2017-09-22)
The work is done with dc()
.
Other functions that download ocean-related data:
dc.coastline()
,
dc.g1sst()
,
dc.hydrography()
,
dc.met()
,
dc.topo()
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 | library(dc)
## Not run:
## Example 1: download and plot 1-deg grid (177 Mb file)
## Download Levitus 2013 (Version 2) temperature on a 1-degree grid,
## in netcdf format, then read the data, and finally, plot sea-surface
## temperature using oce::imagep() to get an image with a palette.
T1f <- dc.woa(field="temperature", destdir="~/data/woa")
library(ncdf4)
T1nc <- nc_open(T1f) # or nc_open("woa13_decav_t00_01v2.nc")
lon1 <- ncvar_get(T1nc, "lon")
lat1 <- ncvar_get(T1nc, "lat")
T1 <- ncvar_get(T1nc, "t_an")
library(oce)
imagep(lon1, lat1, T1[,,1])
## Example 2: download and plot 5-deg grid (4.1 Mb file)
## Note that the variable 't_an' used above must be switched
## to 't_mn' here. Also, a point of confusion: the metadata
## in the downloaded file say that t_an is 4D, with the
## extra dimension being time, but the time vector in the file
## is of unit length, so ncdf4 appraently demotes it to 3D.
T5f <- dc.woa(field="temperature", resolution=5, destdir="~/data/woa")
T5nc <- nc_open(T5f)
lon5 <- ncvar_get(T5nc, "lon")
lat5 <- ncvar_get(T5nc, "lat")
T5 <- ncvar_get(T5nc, "t_mn")
library(oce)
imagep(lon5, lat5, T5[,,1])
## Example 3: download all fields on default 1-deg grid
for (field in c("temperature", "salinity", "oxygen", "silicate",
"phosphate", "nitrate", "density"))
dc.woa(field=field)
## End(Not run)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.