Chapter 5 Matchup satellite and buoy data

notebook filename | 06-sstbuoy.Rmd
history | converted to R notebook from SSTandBuoy.R

In this exercise you will extract buoy data from ERDDAP tabular data and then extract satellite data that is coincident with the buoy data.

The exercise demonstrates the following techniques:

  • Use the tabledap function to extract tabular data from ERDDAP
  • Using xtracto to extract satellite data coincident with the buoy data
  • Using rxtracto_3D to extract satellite data for a rectangular area
  • Using rerddap to retrieve information about a dataset from ERDDAP
  • Producing xy scatter plots
  • Generating linear regressions
  • Producing satellite maps and overlaying buoy data

5.2 Extract buoy data from ERDDAP

Extract data using the tabledap function

  • For every day in August 2018
  • In the region bounded by 30.86 to 41.75 north latitude and -128 to -116 east longitude
  • request the station, latitude, longitude, time, and water temperature parameters
  • put the data into a data frame

Isolate the unique stations

Select buoy data closest in time to satellite data

  • Buoy data is hourly, but there is only one satellite value per day.
  • So subset buoy data to that taken as 22h00 GMT (2pm local + 8), which corresponds to when the satellite passes overhead.

5.3 Extract SST satellite data for matchups to buoy data.

Examine the metadata for the VIIRS monthly dataset (ID = erdVHsstaWS3day)
The script below:

  • Gathers metadata by using the rerddap::info function
  • Display the information
## <ERDDAP info> erdVHsstaWS3day 
##  Base URL: https://upwell.pfeg.noaa.gov/erddap/ 
##  Dimensions (range):  
##      time: (2014-11-02T12:00:00Z, 2020-04-03T12:00:00Z) 
##      altitude: (0.0, 0.0) 
##      latitude: (30.860437023511412, 41.753893186176605) 
##      longitude: (-128.2508393601582, -114.7491606398418) 
##  Variables:  
##      nobs: 
##      sst: 
##          Units: degree_C

Extact the matchup data using rxtracto

  • Use the variable name in dataInfo for the parameter argument
  • Use the longitude, latitude, and time coordinates from dailybuoy to set xcoord, ycoord, and tcoord
  • This dataset has a altitude dimension, so add a vector of zeros, one for each matchup
  • Run rxtracto

Get subset of data where there is a satellite value was found

  • Not all matchup will yield data, for example due to cloud cover.

5.4 Compare results for satellite and buoy

  • Plot the VIIRS satellite verses the buoy data to visualize how well the two datasets track each other.

Run a linear regression of VIIRS satellite verses the buoy data. * The R squared in close to 1 (0.9807) * The slope is near 1 (0.950711)

## 
## Call:
## lm(formula = viirs ~ sst, data = goodbuoy)
## 
## Residuals:
##     Min      1Q  Median      3Q     Max 
## -2.9591 -0.4528  0.0073  0.4375  4.0311 
## 
## Coefficients:
##             Estimate Std. Error t value Pr(>|t|)    
## (Intercept)  0.96058    0.07524   12.77   <2e-16 ***
## sst          0.94728    0.00392  241.65   <2e-16 ***
## ---
## Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
## 
## Residual standard error: 0.751 on 1391 degrees of freedom
## Multiple R-squared:  0.9767, Adjusted R-squared:  0.9767 
## F-statistic: 5.84e+04 on 1 and 1391 DF,  p-value: < 2.2e-16

5.5 Create a satellite map and overlay buoy data

Extract VIIRS chlorophyll data for the month of August 2018

Create the map frame for the satellite data and buoy SST overlay

Create the map

## Warning in f(...): Raster pixels are placed at uneven vertical intervals and
## will be shifted. Consider using geom_tile() instead.

logo