; Script for regridding from WRF curvelinear grid to rectlinear grid of gpm data load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl" load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl" begin ;---Read the source and destination lat/lon grids srcFileName = "wrf.nc" dstFileName = "precip.nc" sfile = addfile(srcFileName,"r") dfile = addfile(dstFileName,"r") src_lat = sfile->XLAT(8,:,:) src_lon = sfile->XLONG(8,:,:) dst_lat = dfile->lat dst_lon = dfile->lon ;---Read the data you want to regrid r1 = sfile->RAINNC r2 = sfile->RAINC rain = r1 + r2 ;---Options for regridding Opt = True ;---source grid information Opt@SrcRegional = True Opt@SrcGridLat = src_lat Opt@SrcGridLon = src_lon ;---destination grid information Opt@DstRegional = True Opt@DstGridLat = dst_lat Opt@DstGridLon = dst_lon Opt@ForceOverwrite = True Opt@CopyVarCoords = True ; Whether to copy coordinate information ; to regridded variable Opt@InterpMethod = "bilinear" ; (default) "patch" or "conserve" raingrid = ESMF_regrid(rain,Opt) ; Regrid "rain" to new grid end