;;diri ="/work/uo0122/u241310/regrid/" diri ="./" sfile= "chathu.nc" f = addfile(diri+sfile,"r") NJJ = 220 NII = 256 tauvo_ssp = f->tauvo(:,:,1:NII-2) printVarSummary(tauvo_ssp) printMinMax(tauvo_ssp,0) print("---------------") nZero = num(tauvo_ssp.eq.0.0) ; count the number of exact 0.0 values if (nZero.gt.0) then print("nZero="+nZero+": should be none") exit end if tauvo_ssp@lat2d = f->lat(:,1:NII-2) tauvo_ssp@lon2d = f->lon(:,1:NII-2) ;---Create destination lat/lon arrays NLAT = 360 ; 180 MLON = 720 ; 360 LATS = latGlobeFo(NLAT, "Lat", "latitude" , "degrees_north") LONS = lonGlobeFo(MLON, "Lon", "longitude", "degrees_east" ) outGrid = "1deg";"3x3" methods = (/"bilinear"/) Opt = True Opt@InterpMethod = methods(0) Opt@ForceOverwrite = True ;Opt@DstGridType = outGrid ; Destination grid Opt@DstTitle = "World grid "+outGrid+" degree resolution" Opt@DstGridLat = LATS Opt@DstGridLon = LONS Opt@SrcMask2D= where(.not.ismissing(tauvo_ssp(0,:,:)),1,0) his_rgd = ESMF_regrid(tauvo_ssp,Opt) plots=new(2,graphic) wks=gsn_open_wks("png","test_Chathu_Data") res = True res@mpFillOn = False res@gsnDraw = False res@gsnFrame = False res@tmXBMajorOutwardLengthF = 0.0 res@tmYLMajorOutwardLengthF = 0.0 res@tmXBMinorOutwardLengthF = 0.0 res@tmYLMinorOutwardLengthF = 0.0 res@tmXBLabelFontHeightF = 0.015 res@tmYLLabelFontHeightF = 0.015 res@cnFillOn = True res@cnLinesOn = False res@lbLabelBarOn = False res@cnLineLabelsOn = False ;res@cnMissingValFillColor= "grey" res@cnFillPalette = "BlRe" res@tiMainFontHeightF = 0.015 res@cnLevelSelectionMode = "ExplicitLevels" res@cnLevels = fspan(min(tauvo_ssp(0,:,:)),max(tauvo_ssp(0,:,:)),20) ;res@gsnAddCyclic = False res@tiMainString = "Original" plots(0) = gsn_csm_contour_map(wks,tauvo_ssp(0,:,:), res ) res@tiMainString = "Regrid: ("+NLAT+","+MLON+")" plots(1) = gsn_csm_contour_map(wks,his_rgd(0,:,:), res ) resP = True resP@gsnFrame = False resP@gsnPanelLabelBar = True gsn_panel(wks,plots,(/2,1/),resP) frame(wks)