Just a quick note to announce that the makeGlobcolourField and isin.convert functions have been added to the sinkr package. In addition, the makeGlobcolourField function now used the ncdf4 package to read the .nc files. Both functions are only set up to deal with the higher resolution 4 km data based on the ISIN grid ("L3b").
The following script is an example of extracting data for the Philippines, and produces a map of mean Chl1 values:
Example script:
Showing posts with label netcdf. Show all posts
Showing posts with label netcdf. Show all posts
Wednesday, February 17, 2016
Working with Globcolour data (Part 2)
Labels:
chlorophyll,
map,
map projection,
netcdf,
ocean color,
R,
remote sensing,
sinkr,
sparse data,
spatial
Saturday, January 25, 2014
Importing bathymetry and coastline data in R
I've also discovered the bathymetry / topography data from GEBCO. Again, very easy to import into R from the netCDF files.
The above map of the Galapagos Archipelago illustrates the quality of both datasets. It also shows the comparison of coastline accuracy between World Vector Shoreline (1:250,000), world (map package), and worldHires (mapdata package) datasets. Obviously, the low-resolution world data only makes sense for quick plotting at large scales, but the high-resolution data is as much as 1/10° off in some locations. I noticed these errors for the first time when trying to map some data for smaller coastal bays. It drove me crazy trying to figure out where the errors were - in my data locations or the map itself. Bathymetry used in the map was 30 arc-second resolution GEBCO data.
[EDIT: The comparison of coastline data now includes the high resolution data from the rworldmap package.]
A more detailed description export settings:
- Coastline data (from 'Coastline Extractor') :
- Coastline database: World Vector Shoreline (1:250,000)
- Compression method for extracted ASCII data: None
- Coast Format options: Matlab
- Coast Preview options: GMT Plot
- Bathymetry / topography data [link]:
- General Bathymetric Chart of the Oceans (GEBCO) : GEBCO_08 Grid (30 arc-second resolution)
For both maps, I took inspiration for the color palettes from GMT. The rgb color levels of these palettes have got to be documented somwhere, but I gave up looking after a while and managed to hack their levels from color scales contained in .png files [link].
Below is the R code to reproduce the figures.
Friday, November 8, 2013
Working with hdf files in R - Example: Pathfinder SST data
Following a question that I posted on stackoverflow.com, I recieved the great advice to use the Bioconductor rhdf5 package to work with HDF5 files. The package is not located on CRAN, but can be sourced from the Bioconductor website:
source("http://bioconductor.org/biocLite.R") biocLite("rhdf5")
As an example, I use the package to extract Pathfinder sea surface temperature (SST) data, available in netCDF-4 format (the features of netCDF-4 are a subset of the features of HDF5). This type of file is not readable by the netCDF package ncdf.The result is the above plot of a subarea from one of the daily data sets.
To reproduce the figure, you will need the image.scale and val2col functions found on this blog.
To reproduce example:
Labels:
climate science,
hdf5,
imaging,
map,
netcdf,
R,
remote sensing
Monday, April 2, 2012
Working with Globcolour data
The Globcolour project (http://www.globcolour.info/)
provides relatively easy access to ocean color remote sensing data. Data is
provided at http://hermes.acri.fr/
and the following parameters are available:
· Chlorophyll-a (CHL1 and CHL2)
· Fully normalised water leaving radiances at 412, 443, 490,
510, 531, 550-565, 620, 665-
670, 681 and 709 nm (Lxxx)
· Coloured dissolved and detrital organic materials
absorption coefficient (CDM)
· Diffuse attenuation coefficient (Kd(490))
· Particulate back-scattering coefficient (bbp)
· Total Suspended Matter (TSM)
· Relative excess of radiance at 555 nm (EL555)
· Photosynthetic Available Radiation (PAR)
· Heated layer depth (ZHL)
· Secchi disk depth (ZSD)
· Primary production (PP)
· Aerosol optical thickness over water (T865)
· Cloud Fraction (CF)
Of particular interest to ecologists are the estimates of Chlorophyll a (chla) , which combines data from several satellites for better coverage - SeaWiFS (NASA), MODIS (NASA), MERIS (ESA). Data is available
at several temporal (daily, 8-days, and monthly averages) and spatial (4.63 km,
0.25°, and 1°) resolutions for the global domain. Several merged products are available: simple averaging (AV), weighted averaging (AVW), and Garver, Siegel, Maritorena Model (GSM) [for more information see the Product User Guide].
Due to the gappy nature of the data (e.g. due to land and clouds), many of the data products only provide values at grids where estimation was possible. For high resolution data, such as in 4.63 km resolution daily estimates, grids with values are often far fewer than the total number of ISIN grids (n=23,761,676) used by the product. This saves space in the files for download, but you may need to reconstruct the field (with NaN's included for grids without observations) for some analyses.
Due to the gappy nature of the data (e.g. due to land and clouds), many of the data products only provide values at grids where estimation was possible. For high resolution data, such as in 4.63 km resolution daily estimates, grids with values are often far fewer than the total number of ISIN grids (n=23,761,676) used by the product. This saves space in the files for download, but you may need to reconstruct the field (with NaN's included for grids without observations) for some analyses.
The following example shows how to retrieve Globcolour data
and process it using R. Global data is available, but I have provided
instructions for processing a smaller area of 4.63 km resolution chla data from
the Galapagos archipelago. One can define lat/lon limits for the desired area on the http://hermes.acri.fr/ interface. An ftp address will be sent via Email as to the location of the data when finished.
Labels:
chlorophyll,
climate science,
gappy data,
map,
map projection,
netcdf,
ocean color,
phytoplankton,
R,
remote sensing,
sparse data,
spatial
Sunday, March 25, 2012
Canonical Correlation Analysis for finding patterns in coupled fields
![]() |
| First CCA pattern of Sea Level Pressure (SLP) and Sea Surface Temperature (SST) monthly anomalies for the region between -180 °W to -70 °W and +30 °N to -30 °S. |
This particular method was illustrated by Barnett and Preisendorfer (1997) - it constructs a CCA model based on a truncated subset of EOF coefficients (i.e. "principle components") instead of using the original field (as with MCA). This truncation has several benefits for the fitting of the model - First, one reduces the amount of noise in the problem by eliminating the higher EOF modes, which represent poorly organized, small-scale features of the fields. Second, by using orthogonal functions, the algebra of the problem is simplified (see von Storch and Zweiers 1999 for details). Bretherton etal. (1992) reviewed several techniques for diagnosing coupled patterns and found the Barnett and Preisendorfer method (hereafter "BPCCA") and MCA to be the most robust.
Labels:
CCA,
climate science,
correlation,
EOF,
gappy data,
map,
map projection,
MCA,
netcdf,
PCA,
pseudoinverse,
R,
sparse data,
spatial,
SVD
Monday, September 12, 2011
Converting values to color levels
Adding color to a plot is helpful in many situations for visualizing an additional dimension of the data. Again, I wrote the below function "val2col" in R after having coded this manually over and over in the past. It uses similar arguments as the image function in that one defines the colors to be used as well as optional break points or z-limits by which the data is binned into those colors. The typical situation where I use the function is with the mapping of climate data, yet the addition of color to an XY plot can often be easier on the eyes than adding an additional z-axis spatial dimension. In combination with the image.scale function, that I previously posted, the data can be quickly interpretted.
As an example, gridded sea level pressure is plotted above as projected polygons using the packages maps and mapproj. Values were converted to colors with the val2col function and the image.scale function plotted a corresponding scale. For those interested in using netcdf files, the example also uses the ncdf package for reading the data files into R.
Subscribe to:
Posts (Atom)






