# [ncl-talk] Stability profile

Dennis Shea shea at ucar.edu
Mon Jun 25 07:42:05 MDT 2018

```[1] s(3,:,:,{70})

Presumably, s(time,level,lat,lon)

*3*  =>  fourth time step [NCL indices are 0-based]

*:,:* => all levels, all latitudes

*{*70*}  *=> 70 longitude

===
[2]
re:  Plot=*gsn_csm_pres_hgt_vector*(wks,s(3,:,:,{70}),u(3,:,:,{70}),v
(3,:,:,{70}),res)
Is this averaging vertical column at 70E?

No. This is a plot function, it is plotting level x latitude. You can
do:

*printVarSummary*( u(3,:,:,{70}) )

Also, see:

http://www.ncl.ucar.edu/Applications/height_lat.shtml#ex7

===
[3]
re: Secondly, if I want to plot 4 time steps in a panel (1x4) then how to
change the above lines?

u=*short2flt*(in->t(15:18,:,::-1,20:80))
*printVarSummary*(t)                              ; what do you see?

dimu = *dimsizes*(u)
ntim = dimu(0)

Generate one plot for each time step

There are many panel examples at: http://www.ncl.ucar.edu/
Applications/panel.shtml

plot = *new*(ntim,"graphic")
do *nt*=0,ntim-1
plot(nt) = *gsn_csm_pres_hgt_vector*(wks,s(*nt*,:,:,{70}),u(*nt*
,:,:,{70}),v(*nt*,:,:,{70}),res)
end do
===============================

Please spend some time learning NCL:  A good source is:
http://www.ncl.ucar.edu/Document/Manuals/NCL_User_Guide/

On Sun, Jun 24, 2018 at 1:33 AM, Soma Roy <somaroy892 at gmail.com> wrote:

> Thank you!
>
> It worked. I want to know two things in this case.
>
> What this line suggests;
> Plot=gsn_csm_pres_hgt_vector(wks,s(3,:,:,{70}),v(3,:,:,{70}),u
> (3,:,:,{70}),res)
>
> And if it is like below then what it says?
>
> Plot=gsn_csm_pres_hgt_vector(wks,s(3,:,:,{70}),u(3,:,:,{70}),v
> (3,:,:,{70}),res)
>
> Is this averaging vertical column at 70E?
>
> Secondly, if I want to plot 4 time steps in a panel (1x4) then how to
> change the above lines?
>
> For that case my input is like below,
>
> t=short2flt(in->t(15:18,:,::-1,20:80))
> u=short2flt(in->u(15:18,:,::-1,20:80))
> v=short2flt(in->v(15:18,:,::-1,20:80))
>
> Thanks,
> Soma
>
> On Sun, Jun 24, 2018, 02:04 Dennis Shea <shea at ucar.edu> wrote:
>
>> The following indicates that you do not have enough memory on yor machine.
>>
>> fatal:*NclMalloc *Failed:[errno=12]
>> Segmentation fault (core dumped)
>> ============================
>> Total Size: *209943360 bytes*
>>             52485840 values
>> Number of Dimensions: 4
>> Dimensions and sizes:   [time | 120] x [level | 22] x [latitude | 141] x
>> [longitude | 141]
>>
>> Each variable is ~210MB
>> ===========================
>> W
>> For testing the code, try with a smaller time sample
>>
>> tStrt = 0
>> tLast = 9
>>
>> ;---Read needed variables from file
>>    t = short2flt(in->t(tStrt:tLast,:,:,:))              ; select variable
>>    v = short2flt(in->v(tStrt:tLast,:,:,:))
>>    u = short2flt(in->u(tStrt:tLast,:,:,:)))
>>
>> ;---Better and more efficient to reorder *after *input
>>
>>   t  = t(:,:,::-1,:)    ; reorder South-to-North
>>   u = u(:,:,::-1,:)
>>   v = v(:,:,::-1,:)
>>
>> ===========
>> Within 'pot_vort_isobaric', other variables of size 210MB are calculated
>>
>> pv  = -G*(vr + con*(dvdp*dtdx-dudp*dtdy))*dthdp
>>
>> EG:
>>
>>   S           = static_stability(p,t,npr,1)   ; variable of type list
>>
>>   s           = S[0]    ; [...] is list syntax
>>   theta     = S[1]
>>   dthdp    = S[2]
>>
>>
>>   dudp
>>   dvdp
>>   dtdx
>>   dtdy
>>
>> vorticity
>>
>>   vr   [vorticity]
>>
>> On Sat, Jun 23, 2018 at 8:54 AM, Soma Roy <somaroy892 at gmail.com> wrote:
>>
>>> Hello,
>>>
>>> I am trying to calculate static stability and potential temperature in
>>> vertical profile using ERA-Interim pressure level data.
>>>
>>> Summary of the input data used in this process is like below;
>>>
>>> Variable: pnew
>>> Type: double
>>> Total Size: 176 bytes
>>>             22 values
>>> Number of Dimensions: 1
>>> Dimensions and sizes:   [level | 22]
>>> Coordinates:
>>>             level: [ 100..1000]
>>> Number Of Attributes: 5
>>>   standard_name :       air_pressure
>>>   long_name :   pressure_level
>>>   units :       Pa
>>>   positive :    down
>>>   axis :        Z
>>>
>>> Variable: t
>>> Type: float
>>> Total Size: 209943360 bytes
>>>             52485840 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes:   [time | 120] x [level | 22] x [latitude | 141] x
>>> [longitude | 141]
>>> Coordinates:
>>>             time: [994176..994890]
>>>             level: [ 100..1000]
>>>             latitude: [ 5..40]
>>>             longitude: [65..100]
>>> Number Of Attributes: 7
>>>   standard_name :       air_temperature
>>>   long_name :   Temperature
>>>   units :       K
>>>   _FillValue_original : -32767
>>>   _FillValue :  -32767
>>>   missing_value_original :      -32767
>>>   missing_value :       -32767
>>>
>>> Variable: u
>>> Type: float
>>> Total Size: 209943360 bytes
>>>             52485840 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes:   [time | 120] x [level | 22] x [latitude | 141] x
>>> [longitude | 141]
>>> Coordinates:
>>>             time: [994176..994890]
>>>             level: [ 100..1000]
>>>             latitude: [ 5..40]
>>>             longitude: [65..100]
>>> Number Of Attributes: 7
>>>   standard_name :       eastward_wind
>>>   long_name :   U component of wind
>>>   units :       m s**-1
>>>   _FillValue_original : -32767
>>>   _FillValue :  -32767
>>>   missing_value_original :      -32767
>>>   missing_value :       -32767
>>>
>>> Variable: v
>>> Type: float
>>> Total Size: 209943360 bytes
>>>             52485840 values
>>> Number of Dimensions: 4
>>> Dimensions and sizes:   [time | 120] x [level | 22] x [latitude | 141] x
>>> [longitude | 141]
>>> Coordinates:
>>>             time: [994176..994890]
>>>             level: [ 100..1000]
>>>             latitude: [ 5..40]
>>>             longitude: [65..100]
>>> Number Of Attributes: 7
>>>   standard_name :       northward_wind
>>>   long_name :   V component of wind
>>>   units :       m s**-1
>>>   _FillValue_original : -32767
>>>   _FillValue :  -32767
>>>   missing_value_original :      -32767
>>>   missing_value :       -32767
>>>
>>> My code for this is attached below.
>>>
>>> At run time it shows the following;
>>>
>>> fatal:NclMalloc Failed:[errno=12]
>>> Segmentation fault (core dumped)
>>>
>>>
>>> Please inform me how to resolve the issue.
>>>
>>> Thanks,
>>> Soma
>>>
>>> _______________________________________________
>>> 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/20180625/0ac52c5e/attachment.html>
```