<html><head></head><body><div style="color:#000; background-color:#fff; font-family:verdana, helvetica, sans-serif;font-size:13px"><div id="yui_3_16_0_ym19_1_1497592445684_2831">Dear expert,</div><div id="yui_3_16_0_ym19_1_1497592445684_2831"><br></div><div id="yui_3_16_0_ym19_1_1497592445684_2831">I'm trying to write the below formula into grads window using cdiff function and its error:</div><div id="yui_3_16_0_ym19_1_1497592445684_2831"><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4594"><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4594">Now we calculate dθ/dp&nbsp;&nbsp;using center finite difference method in log pressure coordinate as follows. Note that we need zonal mean of dθ/dp&nbsp;&nbsp;to calculate the vertical component of</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4594">&nbsp;EP flux and it does not matter whether we first calculate zonal mean of θ and the differentiate of differential first and then calculate zonal mean because the differentiation is&nbsp;</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4594">linear and the divisor p is same for all longitudes. So to avoid large computation it is advisable to first calculate zonal mean of theta and then do the following step for equation (2)</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4595"><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_4595">θp=dθ/dp = 1/p * dθ/d(log(p))</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596">= 1/p * (θ(n+1)-θ(n-1))/(logp(n+1)-lodp(n-1))&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;(2)</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596"><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px; font-size: 11pt; font-family: Calibri, sans-serif;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596">In grads:</div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_4647"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_4648">ga-&gt; 'define ptheta=cdiff(ttheta,lev)/cdiff(lev,lev)'</span></font><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596"><span style="font-size: 14.6667px; font-family: Calibri, sans-serif;" id="yui_3_16_0_ym19_1_1497592445684_6413">Error from CDIFF: &nbsp;Invalid dimension argument</span><br></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6401"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_6402"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_6403">&nbsp; 2nd argument must be X, Y, Z, T or E</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6404"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_6405"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_6406">Operation Error: &nbsp;Error from cdiff function</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6407"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_6408"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_6409">&nbsp; Error ocurred at column 1</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_4596"></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_6411"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_6412">DEFINE error: &nbsp;Invalid expression.</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;"><br></span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;">I'm also try another way but still error:</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8178"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8177">ga-&gt; define ptheta=(cdiff(ttheta,z)/cdiff(lev,z)) &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8182"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8181">&nbsp;Error from CDIFF: &nbsp;Specified dimension non varying &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8192"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8191">&nbsp;Operation Error: &nbsp;Error from cdiff function &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;&nbsp;</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8195"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8194">&nbsp;Error ocurred at column 2 &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp; &nbsp;</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8198"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8197">&nbsp;DEFINE error: &nbsp;Invalid expression. &nbsp; &nbsp; &nbsp; &nbsp;</span><br></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;"><br></span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;"><br></span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8232"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8231">Anyone can help me?</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;"><br></span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8230"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8229">Thank you and really appreciate it</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;"><br></span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8234"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8233">Regards,</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif" id="yui_3_16_0_ym19_1_1497592445684_8236"><span style="font-size: 14.6667px;" id="yui_3_16_0_ym19_1_1497592445684_8235">Atiqah</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;">Postgraduate University Malaya,</span></font></div><div style="margin: 0cm 0cm 8pt; line-height: 15.6933px;" dir="ltr" id="yui_3_16_0_ym19_1_1497592445684_6410"><font face="Calibri, sans-serif"><span style="font-size: 14.6667px;">Malaysia</span></font></div></div></body></html>