首页 > 解决方案 > 如何根据特定的经纬度提取历史天气数据?

问题描述

我需要根据欧洲的特定位置(所有位置都在海中),从 2001 年到 2018 年每月提取历史天气数据。我将经度和纬度存储在单独的列中:

longitude    latitude

55.2000       6.8500
52.6450       1.7870
53.1350       1.1470
55.3430       10.95580

我查看了 R 中的 RNCEP 包,它存储了天气数据。但要提取它,我必须插入纬度和经度的间隔(例如从 0 到 60),它以 2.5 的增量获取纬度和经度的天气数据。如何提取它以获得我需要的精确纬度和经度?

这是以 2.5 增量提取天气数据的代码。

#Define limits for latitude and longitude
min_lat <- min(data$latitude, na.rm = TRUE)
max_lat <- max(data$latitude, na.rm = TRUE)

min_lon <- min(data$longitude, na.rm = TRUE)
max_lon <- max(data$longitude, na.rm = TRUE)

# define arguments for latitude and longitude
lat_range <- c(min_lat, max_lat)
lon_range <-c(min_lon, max_lon)

# get monthly air temperature between 2001 and 2018
weather <- NCEP.gather(variable = "air.sig995", level = "surface", months.minmax = c(1,12),
                       years.minmax = c(2001,2018), lat.southnorth =lat_range,
                       lon.westeast = lon_range)

# dimensions (obs. at time 00:00, 6:00, 12:00, 18:00 each day)
dim(weather) #creates 3 dimensions [lat, lon, time]

# extract date and time based on created weather dataset
date_time <- dimnames(weather)[[3]]
# format UTC date
date_time <- ymd_h(date_time)

# extract longitude & latitude based on created weather dataset
lat <- dimnames(weather)[[1]] # in increments of 2.5
lon <- dimnames(weather)[[2]] # in increments of 2.5

#Calculate the mean daily air temp. of the different times of day
w <- NCEP.aggregate(weather, YEARS = TRUE, MONTHS = TRUE, HOURS = FALSE, fxn='mean')

#Visualize temperature as heatmap for 1 day
NCEP.vis.area(w, layer = 1, show.pts = TRUE, draw.contours = TRUE, cols = heat.colors(64), transparency = 0.4)

我的结果只是提取了整个地区的历史天气数据,设置了经度和纬度的范围。但是我需要根据我所有年份(2001 年到 2018 年)每个月的经度和纬度列的精确位置的天气条件(例如当月的平均温度)。是否可以使用 RNCEP 包做到这一点?或者我可以尝试哪些其他选择?

最终结果应该与此类似:

longitude    latitude   month  year  temperature

55.2000       6.8500     1     2001    20
55.2000       6.8500     2     2001    20
55.2000       6.8500     3     2001    20

...

55.2000       6.8500     1     2018    20

...

52.6450       1.7870     2

...

我愿意接受任何可能更接近解决方案的建议,而不仅仅是问题的最终解决方案。谢谢。

标签: rweather

解决方案


使用RNCEP. 该模块正在从NCEP/NCAR 再分析再分析 2数据集进行查询,并通过这些站点进行挖掘,看起来您无法使用表面水平数据获得比 2.5 x 2.5 更细的粒度:再分析 2 /再分析

如果您过滤 NOAA 数据集的温度,并选择属性视图,那么您可能会使用一些其他数据集。有些有不同的时间粒度,有些跟不上现在。我将根据我的需要尝试这个GHCNCAMS数据集,因为它的粒度为 0.5x0.5 度。要直接访问数据(您需要通过ftp访问 NOAA ,然后阅读有关netCDF文件格式/工具的信息。NOAA网站上也有很多链接/页面

还可以查看这个opendata.stackexchange 答案,了解其他可以找到这些数据的地方。


推荐阅读