<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 using center finite difference method in log pressure coordinate as follows. Note that we need zonal mean of dθ/dp 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"> 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 </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)) (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-> '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: 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"> 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: 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"> 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: 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-> define ptheta=(cdiff(ttheta,z)/cdiff(lev,z)) </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"> Error from CDIFF: Specified dimension non varying </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"> Operation Error: 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_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"> Error ocurred at column 2 </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"> DEFINE error: Invalid expression. </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>