<div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Thanks Toni. I switched the lines, but it still show error at </div><div> fileattdef( fout, fAtt ) </div><div>and odes not create netcdf file. I think the problem comes from this line : </div><div>fAtt@creation_date = systemfunc ("date")</div><div>Do I have to define date before ?</div><div>Debasish<br></div></div></div></div><br><div class="gmail_quote"><div dir="ltr">On Fri, Nov 30, 2018 at 12:55 PM Toni Klemm <<a href="mailto:toni-klemm@tamu.edu">toni-klemm@tamu.edu</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div style="word-wrap:break-word;line-break:after-white-space">Hi Debasish,<div><br></div><div>That’s because you create the variable fAtt *after* you assign it the creation date. You need to create it *before* you assign any attributes to it. Just switch these two lines:</div><div><br></div><div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>fAtt@creation_date = systemfunc ("date")</div></div></div></div></blockquote></div><div><div>
<div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;text-decoration:none;word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="color:rgb(0,0,0);letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px;word-wrap:break-word;line-break:after-white-space"><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>fAtt = True</div></div></div></div></blockquote><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div>to this</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><div><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div><div><div><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>fAtt = True</div></div></div></div></blockquote><div><div dir="ltr"><div dir="ltr"><div dir="ltr"></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><blockquote type="cite"><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>fAtt@creation_date = systemfunc ("date")</div></div></div></div></blockquote></div><div><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div dir="auto" style="word-wrap:break-word;line-break:after-white-space"><div><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div><br></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">and it should work.</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Best of luck,</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Toni</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><br><font face="Calibri"><br></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><b>Toni Klemm, Ph.D.<br></b>Postdoctoral Research Associate</font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Department of Ecosystem Science and Management</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">College of Agriculture and Life Sciences</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px">Texas A&M University, College Station, TX</div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri">Contributor to the <a href="http://www.eccforum.org" target="_blank">Early Career Climate Forum</a><br><a href="http://www.toni-klemm.de" target="_blank">www.toni-klemm.de</a> | <a href="http://twitter.com/toniklemm" target="_blank">@toniklemm</a></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div><div style="color:rgb(0,0,0);font-variant-caps:normal;letter-spacing:normal;text-align:start;text-indent:0px;text-transform:none;white-space:normal;word-spacing:0px"><font face="Calibri"><br></font></div></div></div><br class="m_799958867727905807Apple-interchange-newline"></div><br class="m_799958867727905807Apple-interchange-newline"></div><br class="m_799958867727905807Apple-interchange-newline"></div><br class="m_799958867727905807Apple-interchange-newline"><br class="m_799958867727905807Apple-interchange-newline">
</div>
<div><br><blockquote type="cite"><div>On Nov 30, 2018, at 11:47 AM, Debasish Hazra <<a href="mailto:debasish.hazra5@gmail.com" target="_blank">debasish.hazra5@gmail.com</a>> wrote:</div><br class="m_799958867727905807Apple-interchange-newline"><div><div dir="ltr"><div dir="ltr"><div dir="ltr"><div>Hi,</div><div>I am regridding data and trying to write that in netcdf file but getting error :</div><div><br></div><div> data_regrid = ESMF_regrid(data2,opt)<br> printVarSummary(data_regrid)<br> printMinMax(data_regrid,0)</div><div> ; write netCDF the 'simple' way<br> start_write_time = get_cpu_time()<br> fout = addfile ("./2016/Regrid/<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__GPM-5F3IMERGDL-5F05-5FprecipitationCal.20160601.nc&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=m6TpKEa7O0Cj3dUZmxrnPvld1cZSrJU2iAFWlhkU_3c&s=s9u-rRMRy_zB-nNalwPJbIwsn969qj_oSze9O9jJcWE&e=" target="_blank">GPM_3IMERGDL_05_precipitationCal.20160601.nc</a>", "c")<br> fAtt@creation_date = systemfunc ("date")<br> fAtt = True<br> fAtt@Conventions = "None"<br> fAtt@title = "Regrid: 0.1 to 0.25 grid via ESMF interpolation"<br> fAtt@source_file = "<a href="https://urldefense.proofpoint.com/v2/url?u=http-3A__g4.subsetted.GPM-5F3IMERGDL-5F05-5FprecipitationCal.20160601.180W-5F90S-5F180E-5F90N.nc&d=DwMFaQ&c=ODFT-G5SujMiGrKuoJJjVg&r=WsLJ5ywbW3XnTzqo_ETV62H6s1a5bcGgnrpl7xPRfic&m=m6TpKEa7O0Cj3dUZmxrnPvld1cZSrJU2iAFWlhkU_3c&s=_wD-kFpaARvGRdB7kAc3f76mIpQWtI5rrl7v1_kGXzI&e=" target="_blank">g4.subsetted.GPM_3IMERGDL_05_precipitationCal.20160601.180W_90S_180E_90N.nc</a>"<br> fileattdef( fout, fAtt )<br> fout->data_regrid = precip<br> end_write_time = get_cpu_time()</div><div><br></div><div>But geting the following error : fatal:Variable (fAtt) is undefined, can not assign attribute (creation_date).Any help on how to fix fAtt error ?</div><div><br></div><div>Thanks</div><div>Debasish</div></div></div></div>
_______________________________________________<br>ncl-talk mailing list<br><a href="mailto:ncl-talk@ucar.edu" target="_blank">ncl-talk@ucar.edu</a><br>List instructions, subscriber options, unsubscribe:<br><a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br></div></blockquote></div><br></div></div></blockquote></div>