<html><head></head><body><div class="ydp3e008f98yahoo-style-wrap" style="font-family:bookman old style, new york, times, serif;font-size:16px;"><div dir="ltr" data-setdir="false">Hi,<br>I hope you're doing great.</div><div dir="ltr" data-setdir="false">I have some difficulties and I'll be thankful if I could have your help.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false">1- Why -0.5 is written 0 (not -1) while -1.5 is written -2, with <font face="courier new, courier, monaco, monospace, sans-serif" size="2">"%4.0f"</font> in the following lines? It seems reals round to even numbers.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><span><font size="2" face="courier new, courier, monaco, monospace, sans-serif" style="background-color: inherit;">a := (/-0.5D0, 0.5D0, -1.5D0, 1.5D0, -2.5D0, 2.5D0, -3.5D0, 3.5D0/)</font></span></div><div dir="ltr" data-setdir="false"><span><font size="2" style="background-color: inherit;"><span><font face="courier new, courier, monaco, monospace, sans-serif" style="background-color: inherit;"> print(sprintf("%4.0f", a))</font></span><br></font></span></div><div dir="ltr" data-setdir="false"><span><span><font size="3" style="background-color: inherit;"><br></font></span></span></div><div dir="ltr" data-setdir="false"><span><span><font size="3" style="background-color: inherit;">output:</font></span></span></div><div dir="ltr" data-setdir="false"><span><div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(0) -0</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(1) 0</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(2) -2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(3) 2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(4) -2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(5) 2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(6) -4</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(7) 4</font></div><div dir="ltr" data-setdir="false">However, this is same for gfortran.</div></div><div dir="ltr" data-setdir="false">fortran code:</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">implicit none</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">real*8 :: a(8)</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">a = (/-0.5D0, 0.5D0, -1.5D0, 1.5D0, -2.5D0, 2.5D0, -3.5D0, 3.5D0/)</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">print"(f4.0)", a</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">end</font></div></div><font size="3"><div dir="ltr" data-setdir="false"><font size="3"><br></font></div>output:</font></div><div dir="ltr" data-setdir="false"><div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> -0.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> 0.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> -2.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> 2.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> -2.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> 2.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> -4.</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif"> 4.</font></div><div><br></div></div><span><span style="color: rgb(0, 0, 0);"><div dir="ltr" data-setdir="false" style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><span><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;">But for PGI compiler I see the other (expected) result:</span></span></div><div dir="ltr" data-setdir="false" style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><span><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;">output:</span></span></div><div dir="ltr" data-setdir="false"><div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> -1.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> 1.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> -2.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> 2.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> -3.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> 3.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> -4.</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> 4.</font></div><div style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><br></div></div></div><div dir="ltr" data-setdir="false" style="font-size: 16px; font-family: bookman old style, new york, times, serif;">I confused what happened? Back to NCL, should I use round function, as below, to write output, always?<br></div></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0);"><font face="courier new, courier, monaco, monospace, sans-serif" style="background-color: inherit;" size="2">b = round(a,0)<br></font></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0);"><font face="courier new, courier, monaco, monospace, sans-serif" style="background-color: inherit;" size="2">print(sprintf("%4.0f", b))</font><br></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><span><span><br></span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><span><span>output:</span></span></span></span></div><div dir="ltr" data-setdir="false"><span><span style="color: rgb(0, 0, 0);"><div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(0) -1</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(1) 1</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(2) -2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(3) 2</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(4) -3</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(5) 3</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(6) -4</font></div><div><font size="2" face="courier new, courier, monaco, monospace, sans-serif">(7) 4</font></div><div style="font-family: bookman old style, new york, times, serif; font-size: 16px;"><br></div><div style="font-family: bookman old style, new york, times, serif; font-size: 16px;" dir="ltr" data-setdir="false">2- How could I select (or delete) unordered subscription from a multidimensional array? For example, if there is an array (a) with following dimensions:</div><div style="font-family: bookman old style, new york, times, serif; font-size: 16px;" dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><font face="courier new, courier, monaco, monospace, sans-serif" size="2">[lev | 34] x [lat | 361] x [lon | 720]</font><br></div><div style="font-family: bookman old style, new york, times, serif; font-size: 16px;" dir="ltr" data-setdir="false"><br></div><div style="font-family: bookman old style, new york, times, serif; font-size: 16px;" dir="ltr" data-setdir="false">and I want to make other array like a, exclude a(0,:,:), a(7,:,:) and a(10,:,:), what way is better than the following line?</div><div dir="ltr" data-setdir="false"><div><div dir="ltr" data-setdir="false"> <font face="courier new, courier, monaco, monospace, sans-serif" size="2">b := a((/1,2,3,4,5,6,8,9,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33/),:,:)</font></div><div style="font-size: 16px; font-family: bookman old style, new york, times, serif;"><br></div></div>3- How could I compute difference between two successive levels, instead of using following loop:</div><div dir="ltr" data-setdir="false"><span style="font-family: courier new, courier, monaco, monospace, sans-serif; font-size: small;">FL = u@lev</span><br></div><div dir="ltr" data-setdir="false"><div><div dir="ltr" data-setdir="false"><font face="courier new, courier, monaco, monospace, sans-serif" size="2"><div><div dir="ltr" data-setdir="false" style="color: rgb(0, 0, 0); font-family: bookman old style, new york, times, serif; font-size: 16px;"><font face="courier new, courier, monaco, monospace, sans-serif" size="2">ws(0,:,:) = 0.0<br></font></div><div>do i = 1, dimsizes(FL)-1<br></div></div></font></div><div dir="ltr" data-setdir="false"><font face="courier new, courier, monaco, monospace, sans-serif" size="2"> ws(i,:,:) = sqrt((u(i,:,:)-u(i-1,:,:))^2+(v(i,:,:)-v(i-1,:,:))^2)</font></div><div><font face="courier new, courier, monaco, monospace, sans-serif" size="2">end do</font></div><div dir="ltr" data-setdir="false">As you know above lines compute wind shear.</div></div><div dir="ltr" data-setdir="false"><br></div></div><div dir="ltr" data-setdir="false">Pardon me to ask different questions in one email.</div><div dir="ltr" data-setdir="false">I'll be thankful for any help.</div><div dir="ltr" data-setdir="false"><br></div><div dir="ltr" data-setdir="false"><i><font size="2">Sincerely</font></i></div><div dir="ltr" data-setdir="false"><i><font size="2">Ehsan</font></i></div><div dir="ltr" data-setdir="false"><i><font size="2">PhD student of Meteorology,</font></i></div><div dir="ltr" data-setdir="false"><i><font size="2">Institute of Geophysics, University of Tehran, Tehran, Iran</font></i></div></div></span></span></div></span></div></div></body></html>