首页
学习
活动
专区
工具
TVP
发布
社区首页 >问答首页 >如何提取基于特定经度和纬度的历史天气数据?

如何提取基于特定经度和纬度的历史天气数据?
EN

Stack Overflow用户
提问于 2019-04-07 20:18:13
回答 1查看 1.4K关注 0票数 2

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

代码语言:javascript
复制
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为增量提取天气数据的代码。

代码语言:javascript
复制
#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包可以做到这一点吗?或者,我还可以尝试哪些其他选项?

最终结果应如下所示:

代码语言:javascript
复制
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

...

我对任何可能使问题更接近解决方案的建议持开放态度,而不仅仅是问题的最终解决方案。谢谢。

EN

回答 1

Stack Overflow用户

发布于 2019-06-01 12:51:45

使用RNCEP是不可能获得更细粒度的。该模块正在从NCEP/NCAR Reanalysisreanalysis 2数据集进行查询,并深入挖掘这些站点,您似乎无法获得比2.5x2.5更细粒度的表层数据:Reanalysis 2/Reanalysis

如果你使用filter the NOAA data sets for temperature, and select the attribute view,你可能会用到一些其他的数据集。有些具有不同的时间粒度,有些则不是最新的。我将根据需要尝试这个GHCNCAMS数据集,因为它的粒度为0.5x0.5度。要直接访问数据(,您需要通过ftp访问NOAA,然后阅读netCDF文件格式/工具。在美国国家海洋和大气局的site上也有很多链接/页面

此外,还可以查看this opendata.stackexchange answers中的其他一些地方,您可以找到这些数据。

票数 0
EN
页面原文内容由Stack Overflow提供。腾讯云小微IT领域专用引擎提供翻译支持
原文链接:

https://stackoverflow.com/questions/55558942

复制
相关文章

相似问题

领券
问题归档专栏文章快讯文章归档关键词归档开发者手册归档开发者手册 Section 归档