NOAA API:是否可以存在海拔深度大于0的近海站点?

huangapple go评论61阅读模式
英文:

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

问题

我有一种感觉,这个问题可能有一个快速简单的答案,但由于我不是这方面的专家,所以我认为值得提问。我正在尝试使用R中的marmap包检索海平面深度数据,该包是NOAA API的包装器。我已经检索到了大约90个站点的数据。对于其中一些站点,我有海深值大于零的情况(约有90个站点中的5个)。这是一个故障吗,还是我对海平面工作原理的理解有问题?

这是否意味着,要正确理解特定位置海面和海底之间有多少海水,我需要知道该位置陆地上的海拔是多少?

感谢任何帮助!我不知道这是否与代码相关,但我会在下面留下我的R代码以供参考。

library(marmap)
retrieve_average_sea_depth <- function(longitude, latitude)
{
  #获取测深数据
  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)
  #从横截面获取平均值
  #请注意坐标顺序的差异
  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)
  #这是要返回的内容
  return(average_depth)
  
}
##在极少数情况下返回正值。

请注意,这是您提供的R代码的翻译。如果您有任何其他问题或需要进一步的帮助,请告诉我。

英文:

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 &lt;- 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

得分: 0

根据您使用的水深格网的分辨率而定。默认情况下,getNOAA.bathy() 使用 res = 4(即纬度和经度各为4分钟的格网)。您可以通过指定 res = 0.25 来增加分辨率,最高可达15角秒。这应该会显著提高效果(但会增加下载时间)。您还应该使用 keep = TRUE 来保存从NOAA服务器下载的数据的本地副本,避免多次下载相同的数据,从而提高代码的速度。

最后,您可以在这里查看:https://stackoverflow.com/a/69538585/3507379。我认为这个问题也与您的问题有关。

英文:

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.

huangapple
  • 本文由 发表于 2023年7月11日 00:34:45
  • 转载请务必保留本文链接:https://go.coder-hub.com/76655705.html
匿名

发表评论

匿名网友

:?: :razz: :sad: :evil: :!: :smile: :oops: :grin: :eek: :shock: :???: :cool: :lol: :mad: :twisted: :roll: :wink: :idea: :arrow: :neutral: :cry: :mrgreen:

确定