load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" MODEL = "PSY3V3R3" wgtFileDir = "./" wgtFileName = MODEL+"_bilinear.nc" wgtFilePath = wgtFileDir+wgtFileName ;---Read data off source file srcDirName = "./" ; source directory srcFileName = "PSY3V3R3_1dAV_20150105_20150106_gridT_R20150114.nc" ; source grid sfile = addfile(srcDirName+srcFileName,"r") x = sfile->votemper printVarSummary(x) ;---Do the regridding using an existing weights file x_regrid = ESMF_regrid_with_weights(x,wgtFilePath,False) printVarSummary(x_regrid) dimx_regrid = dimsizes(x_regrid) ntim = dimx_regrid(0) klev = dimx_regrid(1) nlat = dimx_regrid(2) mlon = dimx_regrid(3) ;---Start the graphics pltType = "x11" pltName = MODEL wks = gsn_open_wks(pltType, pltName) ;---Set some resources res = True res@gsnMaximize = True ;res@gsnSpreadColors = True res@cnFillOn = True ; Turn on contour fill res@cnLinesOn = True ; Turn off contour lines res@cnLineLabelsOn = True ; Turn off line labels ;res@lbLabelAutoStride = True res@trYReverse = True ; Reverse Y axis res@gsnYAxisIrregular2Linear = True ; converts irreg depth to linear res@tmXBTickSpacingF = 5 res@cnLabelBarEndStyle = "ExcludeOuterBoxes" ;---Area to do the cross-section across lat = x_regrid&lat ; convenience lon = x_regrid&lon latS = min(lat) ; min(x_regrid&lat) latN = max(lat) ; max(x_regrid&lat) lonW = 0.5*(min(lon)+max(lon)) ;---Get a subregion to plot nt = 0 x_depth_lat = x_regrid(nt,:,{latS:latN},{lonW}) printVarSummary(x_depth_lat) plot = gsn_csm_contour(wks,x_depth_lat,res)