简体   繁体   English

如何在 r 中使用双线性插值重新网格化 netCDF 文件

[英]How to regrid a netCDF file using bilinear interpolation in r

I am trying to regrid a Netcdf file using a specified list of longitude and latitudes.我正在尝试使用指定的经度和纬度列表重新网格化 Netcdf 文件。 I want to use bilinear interpolation and although I have seen that CDO and NCO are helpful I want to implement this in r.我想使用双线性插值,虽然我已经看到CDONCO很有帮助,但我想在 r 中实现它。 I have seen that there is an akima package with a bilinear.grid function in but it only uses break length or number of coordinates rather than specific ones.我已经看到有一个akima package 和一个bilinear.grid function 但它只使用中断长度或坐标数而不是特定的。

My target longitude and latitude are below我的目标经度和纬度在下面

lon <- c(0.000, 1.875, 3.750, 5.625, 7.500, 9.375, 11.250, 13.125, 15.000, 16.875, 18.750, 20.625, 22.500   24.375, 26.250, 28.125, 30.000, 31.875, 33.750, 35.625, 37.500, 39.375, 41.250, 43.125, 45.000, 46.875 , 48.750, 50.625, 52.500, 54.375, 56.250, 58.125, 60.000, 61.875, 63.750, 65.625, 67.500, 69.375, 71.250  , 73.125, 75.000, 76.875, 78.750, 80.625, 82.500, 84.375, 86.250, 88.125, 90.000, 91.875, 93.750, 95.625  , 97.500, 99.375, 101.250, 103.125, 105.000, 106.875, 108.750, 110.625, 112.500, 114.375, 116.250, 118.125  , 120.000, 121.875, 123.750, 125.625, 127.500, 129.375, 131.250, 133.125, 135.000, 136.875, 138.750 , 140.625, 142.500, 144.375, 146.250, 148.125, 150.000, 151.875, 153.750, 155.625, 157.500, 159.375  , 161.250, 163.125, 165.000, 166.875, 168.750, 170.625, 172.500, 174.375, 176.250, 178.125, 180.000, -178.125, -176.250, -174.375, -172.500, -170.625, -168.750, -166.875, -165.000, -163.125, -161.250, -159.375, -157.500, -155.625, -153.750, -151.875, -150.000, -148.125, -146.250, -144.375, -142.500, -140.625, -138.750, -136.875, -135.000, -133.125, -131.250, -129.375, -127.500, -125.625, -123.750, -121.875, -120.000, -118.125, -116.250, -114.375, -112.500, -110.625, -108.750, -106.875, -105.000, -103.125, -101.250,  -99.375,  -97.500,  -95.625,  -93.750,  -91.875, -90.000,  -88.125,  -86.250,  -84.375,  -82.500,  -80.625,  -78.750,  -76.875,  -75.000,  -73.125,  -71.250,  -69.375, -67.500,  -65.625,  -63.750,  -61.875,  -60.000,  -58.125,  -56.250,  -54.375 , -52.500,  -50.625,  -48.750,  -46.875, -45.000,  -43.125,  -41.250,  -39.375,  -37.500,  -35.625,  -33.750,  -31.875,  -30.000,  -28.125,  -26.250,  -24.375, -22.500,  -20.625,  -18.750,  -16.875,  -15.000,  -13.125,  -11.250,   -9.375,   -7.500,   -5.625,   -3.750,   -1.875)

lat <- c(-89.25, -87.75, -86.25, -84.75, -83.25, -81.75, -80.25, -78.75, -77.25, -75.75, -74.25, -72.75, -71.25, -69.75, -68.25, -66.75, -65.25, -63.75, -62.25, -60.75, -59.25, -57.75, -56.25, -54.75, -53.25, -51.75, -50.25, -48.75, -47.25, -45.75, -44.25, -42.75, -41.25, -39.75, -38.25, -36.75, -35.25, -33.75, -32.25, -30.75, -29.25, -27.75, -26.25, -24.75, -23.25, -21.75, -20.25, -18.75, -17.25, -15.75, -14.25, -12.75, -11.25,  -9.75,  -8.25,  -6.75,  -5.25,  -3.75,  -2.25,  -0.75,   0.75,   2.25,   3.75,   5.25,
6.75,   8.25,   9.75,  11.25,  12.75,  14.25,  15.75,  17.25,  18.75,  20.25,  21.75,  23.25,  24.75,  26.25,  27.75,  29.25, 30.75,  32.25,  33.75,  35.25,  36.75,  38.25,  39.75,  41.25,  42.75,  44.25,  45.75,  47.25,  48.75,  50.25,  51.75,  53.25, 54.75,  56.25,  57.75,  59.25,  60.75,  62.25,  63.75,  65.25,  66.75,  68.25,  69.75,  71.25,  72.75,  74.25,  75.75,  77.25, 78.75,  80.25,  81.75,  83.25,  84.75,  86.25,  87.75,  89.25)

Input data:输入数据:

The grid I attempting to regrid is the first time step of the netcdf file found here: https://esgf-node.llnl.gov/search/cmip6/ named: CMIP6.PMIP.CAS.FGOALS-f3-L.lig127k.r1i1p1f1.Amon.tas.gr我试图重新网格化的网格是 netcdf 文件的第一步,在这里找到: https://esgf-node.llnl.gov/search/cmip6/命名为:CMIP6.PMIP.CAS.FGOALS-f3-L.lig127k。 r1i1p1f1.Amon.tas.gr

  • OPeNDAP access开放式接入点访问
https://esgf3.dkrz.de/thredds/dodsC/cmip6/PMIP/CAS/FGOALS-f3-L/lig127k/r1i1p1f1/Amon/tas/gr/v20191025/tas_Amon_FGOALS-f3-L_lig127k_r1i1p1f1_gr_070001-119912.nc
  • download (1.2GB) 下载(1.2GB)

  • Grid of input data (1-d coordinate variables lat and lon ):输入数据网格(一维坐标变量latlon ):

    • lat from -89.5 to 89.5 every 1.0 (180 latitudes) lat从 -89.5 到 89.5 每 1.0(180 个纬度)
    • lon from 0.625 to 359.375 every 1.25 (288 longitudes) lon从 0.625 到 359.375 每 1.25(288 个经度)
    • (main data array also has unlimited time dimension) (主数据数组也有无限的time维度)

Thanks in advance提前致谢

I used CDO to regrid my NetCDF file after that I used my outputs in R.There might reasons for you to use in R only.If you still think of regridding using CDO .我使用 CDO 重新网格化我的 NetCDF 文件,之后我在 R 中使用了我的输出。您可能有理由只在R中使用。如果您仍然想使用CDO重新网格化。 Here is the code for bilinear interpolation to (say) Gaussian N32.这是(比如说)高斯 N32 的双线性插值代码。

cdo remapbil,n32 infile.nc outfile.nc

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

相关问题 如何使用 R 中的双线性插值降低 netCDF 的分辨率(Regrid)? - How to reduce the resolution (Regrid) of netCDF using bi-linear interpolation in R? 使用 CDO 在 R 中重新排列多个 netcdf 文件 - Regrid multiple netcdf files in R by using CDO 如何在 R 中使用 netcdf 格式重新网格数据的分辨率 - How to regrid the resolution of data with netcdf format in R 使用akima双线性函数进行插值 - Using the akima bilinear function for interpolation R:填充R中的空位的双线性插值 - R: Bilinear interpolation to fill gaps in R R-在具有不同像元大小的“双线性插值”中,重采样到底如何工作? - R - How exactly does resampling work with “bilinear interpolation” with different cell sizes? 如何在Windows 7上使用NCO或R将每月TRMM netCDF文件连接成一个netCDF文件? - How to concatenate monthly TRMM netCDF files into a single netCDF file using NCO or R on windows 7? 如何使用R在维度变量中使用字符条目编写netCDF文件 - How to write netCDF file with character entries in dimension variable using R 如何使用 R 将区域从 shapefile 传输到 netcdf 文件? - How to transfer regions from a shapefile to a netcdf file using R? 如何更改 R 中的分辨率(或重新网格)数据 - How to change the resolution (or regrid) data in R
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM