<html>
  <head>
    <meta content="text/html; charset=windows-1252"
      http-equiv="Content-Type">
  </head>
  <body 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">"%dir0"</font>, dir0)</b>
    but it should be something like <br>
    <b>sprintf(<font color="#009900">"%4.1f"</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">"%dir0"</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>"%4.3f"</b></font>,dir0))
    <br>
    (0)      <b>2.346</b><br>
    <br>
    Take a look at
    <a class="moz-txt-link-freetext" href="https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml">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 class="moz-cite-prefix">Am 21.09.15 um 06:53 schrieb isakhar
      sakhar isakhar:<br>
    </div>
    <blockquote
cite="mid:CADkLaxEu=9=jU2kR-1kbEDo_o3nFjYiAOo7EvxJ30iAZ7C1vDQ@mail.gmail.com"
      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 moz-do-not-send="true"
              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">"<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."   What error? </span></div>
              <span class="">
                <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("%dir0", dir0) +"  " \</span></div>
              </span>
              <div class="gmail_default"><font color="#000000">^^ This
                  isn'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("%4.1f", dir0) +"  " \</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 class="HOEnZb">
              <div class="h5">
                <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
                        moz-do-not-send="true"
                        href="mailto:isakhar.inside13@gmail.com"
                        target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:isakhar.inside13@gmail.com">isakhar.inside13@gmail.com</a></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("%dir0", dir0) +"  " \<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 moz-do-not-send="true"
                                  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'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
                                      moz-do-not-send="true"
href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml"
                                      target="_blank"><a class="moz-txt-link-freetext" href="https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml">https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml</a></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
                                            moz-do-not-send="true"
                                            href="mailto:isakhar.inside13@gmail.com"
                                            target="_blank"><a class="moz-txt-link-abbreviated" href="mailto:isakhar.inside13@gmail.com">isakhar.inside13@gmail.com</a></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("%5.0f",it)   
                                                  +" " \<br>
                                                    +sprintf("%21.2f",
                                                  T0(it)) +"  " \       
                                                          ; for
                                                  temperature<br>
                                                    +sprintf("%19.2f",
                                                  P(it)) +"  " \       
                                                            ; for
                                                  pressure  <br>
                                                    +sprintf("%31.2f",
                                                  rh0(it)) +"  " \     
                                                           ; for
                                                  humidity<br>
                                                    +sprintf("%23.2f",
                                                  windspd0(it)) +"  "
                                                  )      ; 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 moz-do-not-send="true"
                                        href="mailto:ncl-talk@ucar.edu"
                                        target="_blank">ncl-talk@ucar.edu</a><br>
                                      List instructions, subscriber
                                      options, unsubscribe:<br>
                                      <a moz-do-not-send="true"
                                        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>
  </body>
</html>