<div dir="ltr"><div><div><div><div>Dear Mr. Meier <br><br></div>I follow what Mr. Alan said, so I already change my function;<br><b><br>sprintf</b>(<font color="#009900"><b>&quot;%4.1f&quot;</b></font>,dir0)<br><br></div>And I get output 34.9 but it same in all hour simulation. Does it OK?<br><br></div>By the way, Thank you very much for help.<br><br></div>Soares<br></div><div class="gmail_extra"><br><div class="gmail_quote">On Mon, Sep 21, 2015 at 4:40 PM, Karin Meier-Fleischer <span dir="ltr">&lt;<a href="mailto:meier-fleischer@dkrz.de" target="_blank">meier-fleischer@dkrz.de</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
  
    
  
  <div bgcolor="#FFFFFF" text="#000000">
    Hi Soares,<br>
    <br>
    Alan guessed that your format in the sprintf function is wrong. <br>
    You do a <b>sprintf( <font color="#cc0000">&quot;%dir0&quot;</font>, dir0)</b>
    but it should be something like <br>
    <b>sprintf(<font color="#009900">&quot;%4.1f&quot;</font>, dir0)</b> for
    float. See the example below<br>
    <br>
    ncl 3&gt; dir0 = 2.345678<br>
    ncl 4&gt; print(sprintf(<b><font color="#cc0000">&quot;%dir0&quot;</font></b>,dir0))<br>
    (0)     <b>0ir0                                           </b><i>;
      &lt;-- is that what you mean with strange output?</i><br>
    ncl 5&gt; print(sprintf(<font color="#009900"><b>&quot;%4.3f&quot;</b></font>,dir0))
    <br>
    (0)      <b>2.346</b><br>
    <br>
    Take a look at
    <a href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml</a><br>
    to get more information on sprintf formats.<br>
    <br>
    Bye,<br>
    Karin<br>
    <br>
    <div>Am 21.09.15 um 06:53 schrieb isakhar
      sakhar isakhar:<br>
    </div><div><div class="h5">
    <blockquote type="cite">
      <div dir="ltr">Dear Mr.Alan and all<br>
        <br>
        If I float only dir0 then I can get wind direction 214.9 degree
        same at all time in one day simulation, but if I float both dir
        and dir0 then I will get error;<br>
        <br>
        fatal:Number of dimensions on right hand side do not match
        number of dimension in left hand side<br>
        <br>
        So now, I prefer not to float dir but only dir0. My question is
        Does it strange or not if I get wind direction same at all the
        time in day simulation?<br>
        <br>
        <br>
        Thank you,<br>
        Soares<br>
      </div>
      <div class="gmail_extra"><br>
        <div class="gmail_quote">On Mon, Sep 21, 2015 at 4:04 AM, Alan
          Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</span>
          wrote:<br>
          <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
            <div dir="ltr">
              <div class="gmail_default" style="font-family:verdana,sans-serif">&quot;<span style="color:rgb(0,0,0);font-size:13px;font-family:arial,sans-serif"> </span><span style="color:rgb(0,0,0);font-size:13px;font-family:arial,sans-serif">the
                  error.&quot;   What error? </span></div>
              <span>
                <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-size:13px;font-family:arial,sans-serif"><br>
                  </span></div>
                <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"> 
                    +sprintf(&quot;%dir0&quot;, dir0) +&quot;  &quot; \</span></div>
              </span>
              <div class="gmail_default"><font color="#000000">^^ This
                  isn&#39;t going to work. </font></div>
              <div class="gmail_default"><font color="#000000"><br>
                </font></div>
              <div class="gmail_default"><font color="#000000">Like all
                  your other lines you probably want something like
                  (assuming dir and thus dir0 are floats).</font></div>
              <div class="gmail_default"><font color="#000000"><br>
                </font></div>
              <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"> 
                  +sprintf(&quot;%4.1f&quot;, dir0) +&quot;  &quot; \</span><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br>
                </span></div>
              <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br>
                </span></div>
              <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br>
                </span></div>
              <div class="gmail_default" style="font-family:verdana,sans-serif"><span style="color:rgb(0,0,0);font-family:arial,sans-serif;font-size:13px"><br>
                </span></div>
            </div>
            <div>
              <div>
                <div class="gmail_extra"><br>
                  <div class="gmail_quote">On Sat, Sep 19, 2015 at 1:31
                    AM, isakhar sakhar isakhar <span dir="ltr">&lt;<a href="mailto:isakhar.inside13@gmail.com" target="_blank"></a><a href="mailto:isakhar.inside13@gmail.com" target="_blank">isakhar.inside13@gmail.com</a>&gt;</span>
                    wrote:<br>
                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                      <div dir="ltr">
                        <div>
                          <div>
                            <div>
                              <div>Dear Mr.Alan and all<br>
                                <br>
                              </div>
                              <div>I just follow your link but I still
                                get the error.<br>
                                I use the script below inside my
                                ncl_script;<br>
                              </div>
                              <br>
                                            ; Wind direction at 10
                              Meters<br>
                                             r2d = 45.0/atan(1.0)      
                                         <br>
                                             dir =
                              atan2(u_plane,v_plane) * r2d + 180<br>
                                             dir0 = dir(x,y)<br>
                              <br>
                            </div>
                            And to print out I use the variable below
                            but I get a strange output;<br>
                            <br>
                                         +sprintf(&quot;%dir0&quot;, dir0) +&quot;  &quot; \<br>
                            <br>
                            <br>
                          </div>
                          I will appreciate for any help or suggestion<br>
                          <br>
                        </div>
                        Soares<br>
                        <div>
                          <div>
                            <div><br>
                            </div>
                          </div>
                        </div>
                      </div>
                      <div>
                        <div>
                          <div class="gmail_extra"><br>
                            <div class="gmail_quote">On Sat, Sep 19,
                              2015 at 12:23 AM, Alan Brammer <span dir="ltr">&lt;<a href="mailto:abrammer@albany.edu" target="_blank">abrammer@albany.edu</a>&gt;</span>
                              wrote:<br>
                              <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                <div dir="ltr">
                                  <div class="gmail_default" style="font-family:verdana,sans-serif">This
                                    isn&#39;t really an NCL question.  The
                                    answer depends entirely on your
                                    dataset. </div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif"><br>
                                  </div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif">If
                                    you need to calc meteorological wind
                                    direction:</div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif"><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml" target="_blank"></a><a href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml" target="_blank">https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml</a><br>
                                  </div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif"><br>
                                  </div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif"><br>
                                  </div>
                                  <div class="gmail_default" style="font-family:verdana,sans-serif">Alan. </div>
                                </div>
                                <div class="gmail_extra"><br>
                                  <div class="gmail_quote">
                                    <div>
                                      <div>On Fri, Sep 18, 2015 at 4:52
                                        AM, isakhar sakhar isakhar <span dir="ltr">&lt;<a href="mailto:isakhar.inside13@gmail.com" target="_blank"></a><a href="mailto:isakhar.inside13@gmail.com" target="_blank">isakhar.inside13@gmail.com</a>&gt;</span>
                                        wrote:<br>
                                      </div>
                                    </div>
                                    <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
                                      <div>
                                        <div>
                                          <div dir="ltr">
                                            <div>
                                              <div>
                                                <div>
                                                  <div>Dear All<br>
                                                    <br>
                                                  </div>
                                                  So far I use a ncl
                                                  script to print out
                                                  variable for
                                                  temperature,pressure,
                                                  humidity and wind
                                                  speed in ASCII file.<br>
                                                  <br>
                                                    print
                                                  (sprintf(&quot;%5.0f&quot;,it)   
                                                  +&quot; &quot; \<br>
                                                    +sprintf(&quot;%21.2f&quot;,
                                                  T0(it)) +&quot;  &quot; \       
                                                          ; for
                                                  temperature<br>
                                                    +sprintf(&quot;%19.2f&quot;,
                                                  P(it)) +&quot;  &quot; \       
                                                            ; for
                                                  pressure  <br>
                                                    +sprintf(&quot;%31.2f&quot;,
                                                  rh0(it)) +&quot;  &quot; \     
                                                           ; for
                                                  humidity<br>
                                                    +sprintf(&quot;%23.2f&quot;,
                                                  windspd0(it)) +&quot;  &quot;
                                                  )      ; for wind
                                                  speed<br>
                                                  <br>
                                                </div>
                                                <br>
                                                What variable should I
                                                use or add above to
                                                print out output for
                                                wind direction ?<br>
                                                <br>
                                              </div>
                                              Thank you in advance,<br>
                                            </div>
                                            <br>
                                            Soares<br>
                                          </div>
                                          <br>
                                        </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" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
                                      <br>
                                    </blockquote>
                                  </div>
                                  <br>
                                </div>
                              </blockquote>
                            </div>
                            <br>
                          </div>
                        </div>
                      </div>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
          </blockquote>
        </div>
      </div>
    </blockquote>
  </div></div></div>

<br>_______________________________________________<br>
ncl-talk mailing list<br>
<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a><br>
List instructions, subscriber options, unsubscribe:<br>
<a href="http://mailman.ucar.edu/mailman/listinfo/ncl-talk" rel="noreferrer" target="_blank">http://mailman.ucar.edu/mailman/listinfo/ncl-talk</a><br>
<br></blockquote></div><br></div>