简体   繁体   English

如何使用 R 中的双线性插值降低 netCDF 的分辨率(Regrid)?

[英]How to reduce the resolution (Regrid) of netCDF using bi-linear interpolation in R?

I have netCDF files downloaded from here .我从这里下载了 netCDF 文件。 They are at 0.5*0.5 resolution.它们的分辨率为 0.5*0.5。 I want to re-grid these files at a coarser resolution of 1*1.我想以更粗的 1*1 分辨率重新网格这些文件。 I found some links.我找到了一些链接。 First link talks about re-grid in R, but without using bi-linear interpolation. 第一个链接讨论 R 中的重新网格,但不使用双线性插值。 The second link deals with bi-linear interpolation, but using climate data operator (to which I am not very much familiar). 第二个链接处理双线性插值,但使用气候数据运算符(我不太熟悉)。 Then I came across an R package HiClimR .然后我遇到了一个 R 包HiClimR In this package, a command coarseR reduces the resolution of data.在这个包中,一个命令coarseR降低了数据的分辨率。 I converted netCDF file into an excel file and used coarseR .我将 netCDF 文件转换为 excel 文件并使用coarseR But after getting results I found that this command actually skipped longitude latitude in some way and reduced the resolution to 1*1.但是得到结果后我发现这个命令实际上以某种方式跳过了经纬度并将分辨率降低到1 * 1。 In nut shell, my problems are简而言之,我的问题是

(1) Is it right to use coarseR for reducing resolution? (1) 使用coarseR来降低分辨率是否正确? (2) How can bi-linear transformation be used for my specific problem in R? (2) 如何将双线性变换用于我在 R 中的特定问题?

Many thanks in advance.提前谢谢了。

This solution is not in R but just to point out that CDO has some very nice regridding functions built in. For example to regrid to 1x1 regular grid using bilinear interpolation as you ask you can simply do:这个解决方案不在 R 中,只是为了指出 CDO 内置了一些非常好的重新网格化功能。例如,按照您的要求使用双线性插值重新网格化为 1x1 规则网格,您可以简单地执行以下操作:

cdo remapbil,r720x360 in.nc out.nc

However, if you are converting to a coarser grid then it may be advisable to use a conservative remapping technique, otherwise you can miss points out during the remapping.但是,如果您要转换为较粗的网格,则建议使用保守的重新映射技术,否则您可能会在重新映射期间遗漏点。 This is especially important for highly heterogeneous fields such as precipitation.这对于高度不均匀的领域(例如降水)尤其重要。 In this case, CDO offers both first and second order conservative remapping techniques.在这种情况下,CDO 提供一阶和二阶保守重映射技术。 To use the first order technique使用一阶技术

cdo remapcon,r720x360 in.nc out.nc

(Note that occasionally you may find CDO throwing a wobbly due to loss of precision during the conversion and in this case it will suggest you use the option "-b32" or "-b64". You don't want to do this unless forced to as it increases the file size.) (请注意,有时您可能会发现 CDO 由于转换过程中的精度损失而导致抖动,在这种情况下,它会建议您使用选项“-b32”或“-b64”。除非被迫,否则您不想这样做以增加文件大小。)

Common regridding options to consider are:要考虑的常见重新网格选项有:

  • remapbil: Bilinear interpolation remapbil:双线性插值
  • remapnn: Nearest neighbour interpolation (ie takes value from closest cell) remapnn:最近邻插值(即从最近的单元格取值)
  • remapcon: First order conservative remapping remapcon:一阶保守重映射
  • remapcon2: Second order conservative remapping remapcon2:二阶保守重映射

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM