[ncl-talk] Wind direction variable

isakhar sakhar isakhar isakhar.inside13 at gmail.com
Mon Sep 21 03:52:18 MDT 2015


Dear Mr. Meier

I follow what Mr. Alan said, so I already change my function;

*sprintf*(*"%4.1f"*,dir0)

And I get output 34.9 but it same in all hour simulation. Does it OK?

By the way, Thank you very much for help.

Soares

On Mon, Sep 21, 2015 at 4:40 PM, Karin Meier-Fleischer <
meier-fleischer at dkrz.de> wrote:

> Hi Soares,
>
> Alan guessed that your format in the sprintf function is wrong.
> You do a *sprintf( "%dir0", dir0)* but it should be something like
> *sprintf("%4.1f", dir0)* for float. See the example below
>
> ncl 3> dir0 = 2.345678
> ncl 4> print(sprintf(*"%dir0"*,dir0))
> (0)     *0ir0                                           **; <-- is that
> what you mean with strange output?*
> ncl 5> print(sprintf(*"%4.3f"*,dir0))
> (0)      *2.346*
>
> Take a look at
> https://www.ncl.ucar.edu/Document/Functions/Built-in/sprintf.shtml
> to get more information on sprintf formats.
>
> Bye,
> Karin
>
> Am 21.09.15 um 06:53 schrieb isakhar sakhar isakhar:
>
> Dear Mr.Alan and all
>
> 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;
>
> fatal:Number of dimensions on right hand side do not match number of
> dimension in left hand side
>
> 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?
>
>
> Thank you,
> Soares
>
> On Mon, Sep 21, 2015 at 4:04 AM, Alan Brammer <abrammer at albany.edu> wrote:
>
>> " the error."   What error?
>>
>>   +sprintf("%dir0", dir0) +"  " \
>> ^^ This isn't going to work.
>>
>> Like all your other lines you probably want something like (assuming dir
>> and thus dir0 are floats).
>>
>>   +sprintf("%4.1f", dir0) +"  " \
>>
>>
>>
>>
>> On Sat, Sep 19, 2015 at 1:31 AM, isakhar sakhar isakhar <
>> <isakhar.inside13 at gmail.com>isakhar.inside13 at gmail.com> wrote:
>>
>>> Dear Mr.Alan and all
>>>
>>> I just follow your link but I still get the error.
>>> I use the script below inside my ncl_script;
>>>
>>>               ; Wind direction at 10 Meters
>>>                r2d = 45.0/atan(1.0)
>>>                dir = atan2(u_plane,v_plane) * r2d + 180
>>>                dir0 = dir(x,y)
>>>
>>> And to print out I use the variable below but I get a strange output;
>>>
>>>              +sprintf("%dir0", dir0) +"  " \
>>>
>>>
>>> I will appreciate for any help or suggestion
>>>
>>> Soares
>>>
>>>
>>> On Sat, Sep 19, 2015 at 12:23 AM, Alan Brammer <abrammer at albany.edu>
>>> wrote:
>>>
>>>> This isn't really an NCL question.  The answer depends entirely on your
>>>> dataset.
>>>>
>>>> If you need to calc meteorological wind direction:
>>>>
>>>> <https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml>
>>>> https://www.ncl.ucar.edu/Document/Functions/Contributed/wind_direction.shtml
>>>>
>>>>
>>>> Alan.
>>>>
>>>> On Fri, Sep 18, 2015 at 4:52 AM, isakhar sakhar isakhar <
>>>> <isakhar.inside13 at gmail.com>isakhar.inside13 at gmail.com> wrote:
>>>>
>>>>> Dear All
>>>>>
>>>>> So far I use a ncl script to print out variable for
>>>>> temperature,pressure, humidity and wind speed in ASCII file.
>>>>>
>>>>>   print (sprintf("%5.0f",it)    +" " \
>>>>>   +sprintf("%21.2f", T0(it)) +"  " \                ; for temperature
>>>>>   +sprintf("%19.2f", P(it)) +"  " \                  ; for pressure
>>>>>   +sprintf("%31.2f", rh0(it)) +"  " \               ; for humidity
>>>>>   +sprintf("%23.2f", windspd0(it)) +"  " )      ; for wind speed
>>>>>
>>>>>
>>>>> What variable should I use or add above to print out output for wind
>>>>> direction ?
>>>>>
>>>>> Thank you in advance,
>>>>>
>>>>> Soares
>>>>>
>>>>> _______________________________________________
>>>>> ncl-talk mailing list
>>>>> ncl-talk at ucar.edu
>>>>> List instructions, subscriber options, unsubscribe:
>>>>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>>>>
>>>>>
>>>>
>>>
>>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk at ucar.edu
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20150921/87773a30/attachment.html 


More information about the ncl-talk mailing list