将站点数据插值到格点上

利用NCL将站点txt数据插值到格点上

  • 观测数据是分散且不规则分布的,不在网格点上,而给定的低分辨率数据为均匀网格。NCL中有多个插值函数,如双线性插值等,本次插值使用了使用Cressman插值方法,即能保留元数据的obj_anal_ic_Wrap函数,影响半径选择为rscan = (/10,5,3/),剔除距离远处站点数值的影响,只考虑区域附近站点气象要素值,保证插值效果。
;首先读入站点数据和被插值的网格数据
  dem_lo_res  = addfile("./station_to_lowgrid/DemLoRes.nc", "r")
    lon_lr = dem_lo_res->lon ;dlon = 0.5
    lat_lr = dem_lo_res->lat ;dlat = 0.5
   
  tem_origin = asciiread("./station_to_lowgrid/20200808tem.txt", (/699,8/),"float")
    lon_tem = tem_origin(:,2)
    lat_tem = tem_origin(:,1)
    tem = tem_origin(:,7)
   
  ;搞清楚想要的格点经纬度信息
   olon = fspan(88.25, 111.75, 48)
   olat = fspan(20.25, 35.75, 32)
   grid_tem = new((/32,48/),float) ;creat a frame to store the interpolated variables
   
     olon!0 = "lon"
     olon@long_name = "lon"
     olon@units = "degrees-east"
     olon&lon = olon
     olat!0 = "lat"
     olat@long_name = "lat"
     olat@units = "degrees_north"
     olat&lat = olat
     
     ;最重要的一步是插值,rscan选择影响半径
      tem@_FillValue = 9.96921e+36  
      rscan = (/10,5,3/)  ;A one-dimensional array of length K specifying the successive radii of influence.
                          ;rscam must be expressed in degrees of latitude and should be monotonically decreasing
      grid_tem = obj_anal_ic_Wrap(lon_tem,lat_tem,tem,olon,olat,rscan, False) ;Creanm
       grid_tem@units = "degC"
       grid_tem@long_name = "Daily Mean Temperature"
       grid_tem@_FillValue   = 9.96921e+36
       grid_tem@missing_value = 9.96921e+36
       grid_tem@time = time

   system("rm -f ./station_to_lowgrid/LiKeXin_LoRes.nc")
    fout = addfile("./station_to_lowgrid/LiKeXin_LoRes.nc","c")
    fout@title = "NetCDF of Daily Mean Temperature in 2020.08.08"
    fout->temperature = grid_tem
end

附:NCL官网上关于Cressman插值函数的介绍

你可能感兴趣的:(NCL,数据分析)