NOAA API: can there be offshore sites with sea level depth greater than 0?

73 views Asked by At

I have a feeling there's a quick and easy answer to this but, not being an expert on this sort of thing, I thought it worth asking. I am trying to retrieve sea level depth data using the marmap package in R, which is a wrapper for the NOAA API. I have retrieved data for ~90 sites. For some of these sites, I have values of sea depth which is above zero (about 5 out of 90 sites). Is this a glitch, or am I not understanding how sea level works?

Does this mean that, to properly understand how much sea water there is between the sea surface and the bottom of the sea floor at a particular location, I would need to know what the elevation is at a particular site on land?

Thanks for any help! I don't know if this is a code dependent question, but I will leave my code in R below for reference, just in case.

library(marmap)
retrieve_average_sea_depth <- function(longitude, latitude)
{
  #Get the bathymetry data
  longitude1 = longitude - 0.25
  longitude2 = longitude + 0.25
  latitude1 = latitude - 0.25
  latitude2 = latitude + 0.25
  bath_data = marmap::getNOAA.bathy(lon1 = longitude1, lon2 = longitude2, lat1 = latitude1, lat2 = latitude2)
  #Get the average from the transect
  #Notice the difference in the order of coordinates
  transect_to_keep = get.transect(bath_data, x1 = longitude1+0.05, y1 = latitude1+0.05, x2 = longitude2-0.05, y2 = latitude2-0.05)
  average_depth = mean(transect_to_keep$depth)
  #This is the thing to keep 
  return(average_depth)
  
}
##Returns positive values in a small minority of cases. 
1

There are 1 answers

0
Benoit On BEST ANSWER

I think it all depends on the resolution of the bathymetric grid you're using. By default, getNOAA.bathy() uses res = 4 (i.e. a grid with 4 minutes cells in both latitude and longitude). You can increase that resolution up to 15 arcseconds by specifying res = 0.25. This should help significantly (but will increase download times). You should also use keep = TRUE to save local copies of the data you're downloading from NOAA's servers, avoid downloading multiple times the same data, and hence increase the speed of your code.

Finally, you should take a look here: https://stackoverflow.com/a/69538585/3507379. I believe this question is also related to your problem.