<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_1_1497487962811_28572">Dear experts,</div><div id="yui_3_16_0_1_1497487962811_28572"><br></div><div id="yui_3_16_0_1_1497487962811_28572">I try to write equation below in grads. However, the grads come out error.</div><div id="yui_3_16_0_1_1497487962811_28572"><br></div><div id="yui_3_16_0_1_1497487962811_28572">Here the equation that I try to use:</div><div id="yui_3_16_0_1_1497487962811_28572"><br></div><div style="margin-bottom: 0.11in; direction: ltr; font-family: "Times New Roman"; font-size: medium;" id="yui_3_16_0_1_1497487962811_28653">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 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 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-bottom: 0.11in; direction: ltr; font-family: "Times New Roman"; font-size: medium;" id="yui_3_16_0_1_1497487962811_28654">θp=dθ/dp = 1/p * dθ/d(log(p))</div><div style="margin-bottom: 0.11in; direction: ltr; font-family: "Times New Roman"; font-size: medium;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655">= 1/p * (θ(n+1)-θ(n-1))/(logp(n+1)-lodp(n-1)) (2)</div><div style="margin-bottom: 0.11in; direction: ltr; font-family: "Times New Roman"; font-size: medium;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655">And this is the way I wrote above equation in grads:</div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_28736">ga-> sdfopen E:\IMPORTANT\temp_uv_nlev.nc</font><br></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655"><font face="Times New Roman" size="3">ga-> define ttheta=ave(t,lon=60,lon=90,-b)/pow(lev/1000,0.286)<br></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_28793">ga-> define dtheta=cdiff(ttheta,lev)/cdiff(lev,lev)<br></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30499"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30500">Error from CDIFF: Invalid dimension argument</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30501"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30502"> 2nd argument must be X, Y, Z, T or E</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30503"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30504">Operation Error: Error from cdiff function</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30505"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30506"> Error ocurred at column 1</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_28655"><font face="Times New Roman" size="3"></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30507"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30508">DEFINE error: Invalid expression.</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30507"><span style="font-family: "Times New Roman"; font-size: medium;" id="yui_3_16_0_1_1497487962811_30513">ga-> define dtheta=1/lev(cdiff(ttheta,log(lev))/cdiff(log(lev),log(lev)))'</span><font face="Times New Roman" size="3"><br></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30594"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30595">Error from CDIFF: Invalid dimension argument</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30596"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30597"> 2nd argument must be X, Y, Z, T or E</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30598"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30599">Operation Error: Error from cdiff function</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30600"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30601"> Error ocurred at column 1</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30507"></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30603">DEFINE error: Invalid expression.</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3"><br></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3" id="yui_3_16_0_1_1497487962811_30638">Can anyone help me. How the correct way to write the cdiff?</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3">Thank you in advance.</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3"><br></font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3">Regards,</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3">Atiqah</font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3">Postgraduate student </font></div><div style="margin-bottom: 0.11in; direction: ltr;" dir="ltr" id="yui_3_16_0_1_1497487962811_30602"><font face="Times New Roman" size="3">University Malaya</font></div></div></body></html>