首页 > 解决方案 > 如何在 R 中处理 netCDF 数据,以便从月度数据中找到年平均温度?

问题描述

我正在尝试处理一些气候数据。我有一个 .nc 文件,其中包含从 01-850 到 12-1049 的每个月的纬度、经度、时间和表面温度的数据。我需要将这些月度数据转换为年度数据,并找到每个纬度、经度的年平均温度。

ncin <- nc_open("tas_Amon_MIROC-ES2L_past1000_r1i1p1f2_gn_085001-104912.nc")

lon <- ncvar_get(ncin,"lon")
lon <- ifelse(lon > 180, -(360 - lon), lon)

lat <- ncvar_get(ncin, "lat")

time <- format(as.Date(time, origin = ("850-1-1"), tz = "UTC"),"%Y-%m" )

tas.array <- ncvar_get(ncin,"tas")
tas.array <- tas.array - 273.15

标签: rnetcdfncdf4

解决方案


推荐阅读