<html><head><style type='text/css'>p { margin: 0; }</style></head><body><div style='font-family: arial,helvetica,sans-serif; font-size: 12pt; color: #000000'><font face="arial, helvetica, sans-serif"><span style="font-size: 12pt;">Dear All,</span></font><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br></div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">I am working on temperature interpolation from 36km to 4km by ESMF_regrid, and want to write out the TEMP2 at new resolution,</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;">unfortunately the temp2 attribute didn't write out in netcdf file, I have tried to define TEMP2 attribute &nbsp;by:</div><div style="color: rgb(0, 0, 0); font-family: arial, helvetica, sans-serif; font-size: 12pt;"><br></div><div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2!0 = "time"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2!1 = "lay"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2!2 &nbsp;= "lat"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2!3 &nbsp;= "lon"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2@long_name &nbsp;= "TEMP2"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2@units &nbsp;= "k"</font></div><div><font face="arial, helvetica, sans-serif">&nbsp; &nbsp; temp2@var_desc = "temperature at 2 m"</font></div></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">and by function of filevarattdef. Both didn't work. &nbsp;</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Thanks very much for and help or suggestions!</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif">Here is the script I used:</font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><font face="arial, helvetica, sans-serif"><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/wrf/WRFUserARW.ncl"</div><div>load "$NCARG_ROOT/lib/ncarg/nclscripts/esmf/ESMF_regridding.ncl"</div><div><br></div><div>begin</div><div><br></div><div>&nbsp;diri_36 &nbsp;= "/data11/cluo/CMAQv5.0.1/scripts/mcip4.1/36km/201107/data/"</div><div>&nbsp;diri_4 &nbsp;= "/data12/cluo/smoke3.6.5/data/ge_dat/"</div><div>&nbsp;namei_36 = "GRIDCRO2D_148x112_20110701"</div><div>&nbsp;namei_4 = "geo_em.d01_1332x1008.nc"</div><div><br></div><div>&nbsp;f1 = addfile(diri_36+namei_36,"r")</div><div><br></div><div>;output lat/lon</div><div>&nbsp; lat2d_36km &nbsp; &nbsp; = f1-&gt;LAT(0,0,:,:) &nbsp; &nbsp; &nbsp; ; (TSTEP, LAY, ROW, COL) , 36km</div><div>&nbsp; lon2d_36km &nbsp; &nbsp; = f1-&gt;LON(0,0,:,:) &nbsp; &nbsp; &nbsp; ; (TSTEP, LAY, ROW, COL) , 36km</div><div><br></div><div>&nbsp; printVarSummary (lon2d_36km)</div><div>&nbsp; printMinMax(lon2d_36km,True)</div><div><br></div><div><br></div><div>&nbsp;f2 = addfile(diri_4+namei_4,"r")</div><div>;input lat/lon</div><div><br></div><div>&nbsp; lat2d_4km = f2-&gt;XLAT_M(0,:,:) &nbsp; &nbsp; &nbsp; ; 4km</div><div>&nbsp; lon2d_4km = f2-&gt;XLONG_M(0,:,:) &nbsp; &nbsp; &nbsp;; 4km</div><div><br></div><div>&nbsp; printVarSummary (lon2d_4km)</div><div>&nbsp; printMinMax(lon2d_4km,True)</div><div><br></div><div>&nbsp; name_in = "METCRO2D_148x112_20110701"</div><div><br></div><div>&nbsp; nlay = 1</div><div>&nbsp; ntime = 25</div><div><br></div><div>&nbsp; time = new((/ntime/),integer)</div><div>&nbsp; time = ispan(0,ntime-1,1)</div><div><br></div><div>&nbsp; f3 = addfile(diri_36+name_in,"r") temp2_36 = f3-&gt;TEMP2(:,:,:,:) &nbsp; &nbsp; &nbsp;;(TSTEP, LAY, ROW, COL)</div><div>&nbsp;TFLAG &nbsp;= f3-&gt;TFLAG(:,0,:)</div><div>&nbsp;temp2_36@_FillValue = 9.999e+36</div><div><br></div><div>&nbsp;printVarSummary (temp2_36)</div><div>&nbsp;printMinMax(temp2_36,True)</div><div><br></div><div>&nbsp; &nbsp;diro &nbsp; &nbsp;= "/data11/cluo/cmaq4.6/data/post/smk31_post/"</div><div>&nbsp; &nbsp; filo &nbsp; &nbsp;= "out.nc" &nbsp; &nbsp;; input file name</div><div>&nbsp; &nbsp; fl_nm_out = diro+filo</div><div>&nbsp; &nbsp; system ("/bin/rm -f "+fl_nm_out) ; Remove any pre-existing file</div><div>&nbsp; &nbsp; ncdf &nbsp; &nbsp; &nbsp;= addfile(fl_nm_out,"c")</div><div><br></div><div></div><div>;---Set up options for regridding</div><div>&nbsp; &nbsp; Opt &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= True</div><div>&nbsp;</div><div><div>&nbsp; &nbsp; Opt@SrcGridLat &nbsp; &nbsp; = lat2d_36km &nbsp; &nbsp; ; source grid</div><div>&nbsp; &nbsp; Opt@SrcGridLon &nbsp; &nbsp; = lon2d_36km</div><div>&nbsp; &nbsp; Opt@DstGridLat &nbsp; &nbsp; = lat2d_4km &nbsp; &nbsp; ; destination grid</div><div>&nbsp; &nbsp; Opt@DstGridLon &nbsp; &nbsp; = lon2d_4km</div><div><br></div><div>&nbsp; &nbsp; Opt@SrcRegional &nbsp; &nbsp;= True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; Necessary if grids</div><div>&nbsp; &nbsp; Opt@DstRegional &nbsp; &nbsp;= True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; are regional</div><div><br></div><div>&nbsp; &nbsp; Opt@InterpMethod &nbsp; = "bilinear" &nbsp; &nbsp;; "patch", "conserve"</div><div><br></div><div>&nbsp; &nbsp; Opt@ForceOverwrite = True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; Optional, but recommended.</div><div>&nbsp; &nbsp; Opt@PrintTimings &nbsp; = True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; Optional.</div><div>&nbsp; &nbsp; Opt@Debug &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;= True &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;; Optional</div></div><div><br></div><div><div>&nbsp; &nbsp; temp2 = ESMF_regrid(temp2_36,Opt) &nbsp; &nbsp; &nbsp;; Do the regridding</div><div><br></div><div>&nbsp; &nbsp; temp2!0 = "time"</div><div>&nbsp; &nbsp; temp2!1 = "lay"</div><div>&nbsp; &nbsp; temp2!2 &nbsp;= "lat"</div><div>&nbsp; &nbsp; temp2!3 &nbsp;= "lon"</div><div>&nbsp; &nbsp; temp2@long_name &nbsp;= "TEMP2"</div><div>&nbsp; &nbsp; temp2@units &nbsp;= "k"</div><div>&nbsp; &nbsp; temp2@var_desc = "temperature at 2 m"</div><div><br></div><div>&nbsp; &nbsp; printVarSummary (temp2)</div><div>&nbsp; &nbsp; printMinMax(temp2,True)</div><div><br></div><div>; &nbsp; filevarattdef(ncdf,"temp2",temp2)</div></div><div><div>&nbsp; &nbsp;&nbsp;</div><div>&nbsp; &nbsp; ncdf-&gt;TFLAG =TFLAG</div><div>&nbsp; &nbsp; ncdf-&gt;temp2 &nbsp; = &nbsp;(/temp2/)</div><div><br></div><div>&nbsp; end</div></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div><div><br></div></font></div><div><font face="arial, helvetica, sans-serif"><br></font></div><div><br></div></div></body></html>