【问题标题】:How to regrid the resolution of data with netcdf format in R如何在 R 中使用 netcdf 格式重新网格化数据的分辨率
【发布时间】:2017-09-04 23:22:13
【问题描述】:

我从https://www.esrl.noaa.gov/psd/data/gridded/data.cmap.html 下载了一个名为“precip.mon.mean.nc”的 netcdf 文件。月平均降水量数据集,分辨率为2.5x2.5。

我想知道如何使用 Kriging 或反距离加权 (IDW) 等插值方法将降水数据分别重新划分为 1x1 和 3x3 分辨率。谢谢您的帮助。

require(ncdf4)

Precipitation = nc_open(filename = "precip.mon.mean.nc")
Pre=ncvar_get(Precipitation,varid = "precip")
Pre[Pre=-9.96920996838687e+36]=NA
lon=ncvar_get(Precipitation,varid = "lon")
aa=which(lon==181.25)
lon[aa:length(lon)]=lon[aa:length(lon)]-360
lat=ncvar_get(Precipitation,varid = "lat")
Date=ncvar_get(Precipitation,varid = "time")
nc_close(Precipitation)
Time=as.Date(Date/24,origin="1800-01-01")

【问题讨论】:

  • 在这里看看我的回答:stackoverflow.com/questions/43006045/…你也可以直接使用raster::aggregateraster::disaggregate
  • @StatnMap 非常感谢您的回复,但我还是有点困惑,不知道您能否举一个使用我帖子中数据的示例?感谢您的宝贵时间。

标签: r datagrid spatial netcdf4


【解决方案1】:

对于使用 R 的一般插值解决方案,check out this post

另外,我自己没用过,but the package idpw seems to have an option for inverse distance weighting。另外this postthis page可能会有帮助。

但是,如果您是一个非常简单的单线,您可以通过简单地使用系统命令调用 CDO 来对 netcdf 文件进行反距离加权重映射。您需要的选项是remapdis,如果文件是全局文件,您可以简单地使用常规网格说明符指定分辨率,例如使用 1x1 度网格:

cdo remapdist,r360x180 precip.mon.mean.nc regridded.nc

as I say, you can call this from R using the system function。有关重新网格化方法和潜在陷阱的更多信息,请参阅我的online youtube video guide

【讨论】:

    猜你喜欢
    • 2016-09-10
    • 1970-01-01
    • 2016-05-21
    • 2014-02-04
    • 2023-03-26
    • 2018-10-03
    • 1970-01-01
    • 2014-12-06
    • 1970-01-01
    相关资源
    最近更新 更多