[ncl-talk] Eady Growth trate

Dennis Shea shea at ucar.edu
Thu Aug 23 16:13:06 MDT 2018


What to say?

[1] The Eady-Growth-Rate (EGR)  is a **non-linear** quantity. It should *not
*be applied to monthly mean data. It should be applied to (say) 00Z,06Z,...
values.

[2] If, for some reason, you want monthly mean values of EGR, then you
would compute the monthly means of the values computed in [1].

[3] That said: did you read the documentation?

[SNIP]
 The maximum Eady growth rate is a measure of baroclinic instability.

  eady_growth_rate = 0.3098*g**abs*
<http://test.www.ncl.ucar.edu/Document/Functions/Built-in/abs.shtml>(f)**abs*
<http://test.www.ncl.ucar.edu/Document/Functions/Built-in/abs.shtml>(du/dz)/*brunt_vaisala_atm*
<http://test.www.ncl.ucar.edu/Document/Functions/Contributed/brunt_vaisala_atm.shtml>

[SNIP]

Note the '(*du/dz*)'  *and* the *'brunt_vaisala_atm'. *The brunt-vaisala is
a measure of vertical bouyancy. Hence, *BOTH* require a vertical dimension.
The code you posted the following

T41    = f->Z3(:,{850},:,:)
   printVarSummary(T41)     ; [Time|12]x[ilev | 26] x [lat | 96] x [lon |
144]

This is *NOT* correct. It is very misleading. In fact, it is

   printVarSummary(T41)    ; ; [Time|12]x [lat | 96] x [lon | 144]

*You have eliminated the required vertical dimension.*

[4] The following makes no sense. You are overwriting latitudes with some
mean quantity? Why?

  XLAT = conform ( aveX2 , xlat , 0 )
   printVarSummary(XLAT)
   *XLAT=aveX2                    <==== WHAT???   This is wrong!*
   printVarSummary(XLAT)


[5] The geopotential height and the zonal wind are on mid-layer hybrid
levels. The potential temperature values are on intermediate levels. The
function expects all the values to be on the same levels. You would have to
interpolate.

============
Enough!!!!

Comment [1] is the one you should fully understand.

I suggest talking with an advisor of some sort.



On Thu, Aug 23, 2018 at 12:28 AM, Sri Nandini <snandini at marum.de> wrote:

> Hello
>
> My question is to anyone who has used the eady growth rate function before
> and can explain why my output had some nan values. I am interested in the
> baroclinicity at 85hPa.
> My code is below. The output is also below. The plot of the output is
> attached. There are no error messages, but i do have nan values. Im sure
> its to do with how im defining the FillValues but i just cant seem to get
> it right, even after i have changed it several times and done print to see
> outputs from all variables.
>
> All variables which are input for the eady growth function have data
> points. Its just after the function which gives nan. Could someone please
> explain how the NCL eady growth function actually works?
>
> Much appreciated.
>
>
> f= addfile("SLP_PHIS_Z3_PI.nc", "r") ;
>    T41    = f->Z3(:,{850},:,:)
>
>    printVarSummary(T41)     ; [Time|12]x[ilev | 26] x [lat | 96] x [lon |
> 144]
>
>    T41 at _FillValue = -9.96921e+36
>
>    aveX    = dim_avg_n_Wrap(T41,0)
>    printVarSummary(aveX)                      ; (lat,lon)
>    aveX at _FillValue =9.96921e+36
>    print(where(aveX.ne.0, aveX, aveX at _FillValue))
>
>    aveX = 1. / where(aveX.ne.0, aveX, aveX at _FillValue)
>
> ;==============================================================
>
>    f1= addfile("totalwinds_PI.nc", "r") ;
>    T411    = f1->U(:,{850},:,:)
>
>    printVarSummary(T411)       ; [Time|12]x[ilev | 26] x [lat | 96] x [lon
> | 144]
>    T411 at _FillValue = -9.96921e+36
>
>    aveX1    = dim_avg_n_Wrap(T411,0)
>    printVarSummary(aveX1)                                ; (lat,lon)
>
>    aveX1 at _FillValue = 9.96921e+36
>
>    aveX1 = 1. / where(aveX1.ne.0, aveX1, aveX1 at _FillValue)
> ;==============================================================
>    f2= addfile("th_PI.nc", "r") ;
>    T412    = f2->TH(:,{900},:,:)
>
>    printVarSummary(T412)       ; [Time|12]x[ilev | 27] x [lat | 96] x [lon
> | 144]
>    T412 at _FillValue = -9.96921e+36
>
>    aveX2    = dim_avg_n_Wrap(T412,0)
>    printVarSummary(aveX2)                                ; (lat,lon)
>
>    aveX2 at _FillValue = 9.96921e+36
>
>    aveX2 = 1. / where(aveX2.ne.0, aveX2, aveX2 at _FillValue)
>
> ;==============================================================
>
> ;    Read latitudes
> ;    The 'eady_growth_rate' function requires that 'lat' and 'th' agree
> ;    Use 'conform' the propogate the lat values
> ;==============================================================
>
>    xlat = f->lat                               ;  [lat | 96]
>    printVarSummary(xlat)
>
>    ;[Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]
>    ;    0           1          2             3           <== dimension
> numbers
>    ;XLAT = conform(T412, xlat, 2)     ; problem here
>
>
>    XLAT = conform ( aveX2 , xlat , 0 )
>    printVarSummary(XLAT)
>    XLAT=aveX2
>    printVarSummary(XLAT)
>
>    XLAT=lonFlip(XLAT)
>    printVarSummary(XLAT)
> ;==============================================================
>
>    egr = eady_growth_rate(aveX2, aveX1, aveX, XLAT, 0,  1)
>    printVarSummary(egr)
>
>    ;printMinMax(egr,0)
>
>    ;print(egr)
>    print("-----------------------------------------")
>
> ;==============================================================
>
>  wks = gsn_open_wks("pdf","Eady_850")              ; send graphics to PNG
> file
>
> ;---Set some basic plot options
>
>    res               = True
>    res at gsnMaximize   = True       ; maximize plot in frame
>    ;res at gsnAddCyclic  = False
>
>    res at cnFillOn      = True
>    res at cnLinesOn     = False
>    ;res at cnFillMode    = "RasterFill"                 ; slow here
>    ;res at cnFillMode    = "CellFill"                   ; faster
>
>    ;res at cnFillPalette        = "precip2_17lev"    ;BrRiEgr
>
>
>   res at mpMaxLatF                   = 80           ; choose a different
> subregion
>   res at mpMinLatF                   = 30
>   res at mpMaxLonF                   = 70
>   res at mpMinLonF                   = -40
>   res at mpFillOn      = False
>
>    res at lbBoxEndCapStyle  = "TriangleBothEnds"
>
> ;--- Eady growth rate (1/day)
>
>    egr        = egr*86400
>    egr at units  = "annual 1/day"
>
>    res at cnLevelSelectionMode = "ManualLevels"     ; set manual contour
> levels
>    res at cnMinLevelValF       =  -2               ; set min contour level
>    res at cnMaxLevelValF       =  2               ; set max contour level
>    res at cnLevelSpacingF      =  0.2              ; set contour spacing
>
>
>       res at gsnRightString  =  egr at units
>       contour = gsn_csm_contour_map(wks, egr(:,:),res)
>
>
>
> ;===========================================================
> ===========================
>
> Variable: T41
> Type: float
> Total Size: 663552 bytes
>             165888 values
> Number of Dimensions: 3
> Dimensions and sizes:    [time | 12] x [lat | 96] x [lon | 144]
> Coordinates:
>             time: [136358.5..136692.5]
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 5
>   lev :    867.1607600000013
>   mdims :    1
>   units :    m
>   long_name :    Geopotential Height (above sea level)
>   cell_methods :    time: mean time: mean
>
> Variable: aveX
> Type: float
> Total Size: 55296 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 7
>   _FillValue :    -9.96921e+36
>   lev :    867.1607600000013
>   mdims :    1
>   units :    m
>   long_name :    Geopotential Height (above sea level)
>   cell_methods :    time: mean time: mean
>   average_op_ncl :    dim_avg_n over dimension(s): time
>
> Variable: T411
> Type: float
> Total Size: 663552 bytes
>             165888 values
> Number of Dimensions: 3
> Dimensions and sizes:    [time | 12] x [lat | 96] x [lon | 144]
> Coordinates:
>             time: [136358.5..136692.5]
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 5
>   lev :    867.1607600000013
>   mdims :    1
>   units :    m/s
>   long_name :    Zonal wind
>   cell_methods :    time: mean time: mean
>
> Variable: aveX1
> Type: float
> Total Size: 55296 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 7
>   _FillValue :    -9.96921e+36
>   lev :    867.1607600000013
>   mdims :    1
>   units :    m/s
>   long_name :    Zonal wind
>   cell_methods :    time: mean time: mean
>   average_op_ncl :    dim_avg_n over dimension(s): time
>
> Variable: T412
> Type: float
> Total Size: 663552 bytes
>             165888 values
> Number of Dimensions: 3
> Dimensions and sizes:    [time | 12] x [lat | 96] x [lon | 144]
> Coordinates:
>             time: [136358.5..136692.5]
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 5
>   ilev :    903.3002900000016
>   mdims :    2
>   units :    K
>   long_name :    Potential Temperature
>   cell_methods :    time: mean time: mean
>
> Variable: aveX2
> Type: float
> Total Size: 55296 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 7
>   _FillValue :    -9.96921e+36
>   ilev :    903.3002900000016
>   mdims :    2
>   units :    K
>   long_name :    Potential Temperature
>   cell_methods :    time: mean time: mean
>   average_op_ncl :    dim_avg_n over dimension(s): time
>
> Variable: xlat
> Type: double
> Total Size: 768 bytes
>             96 values
> Number of Dimensions: 1
> Dimensions and sizes:    [lat | 96]
> Coordinates:
>             lat: [ -90..  90]
> Number Of Attributes: 2
>   long_name :    latitude
>   units :    degrees_north
>
> Variable: XLAT
> Type: double
> Total Size: 110592 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [96] x [144]
> Coordinates:
>
> Variable: XLAT
> Type: double
> Total Size: 110592 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 7
>   average_op_ncl :    dim_avg_n over dimension(s): time
>   cell_methods :    time: mean time: mean
>   long_name :    Potential Temperature
>   units :    K
>   mdims :    2
>   ilev :    903.3002900000016
>   _FillValue :    9.969209968386869e+36
>
> Variable: XLAT
> Type: double
> Total Size: 110592 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [-180..177.5]
> Number Of Attributes: 8
>   lonFlip :    longitude coordinate variable has been reordered via lonFlip
>   ilev :    903.3002900000016
>   mdims :    2
>   units :    K
>   long_name :    Potential Temperature
>   cell_methods :    time: mean time: mean
>   average_op_ncl :    dim_avg_n over dimension(s): time
>   _FillValue :    9.969209968386869e+36
>
> Variable: egr
> Type: double
> Total Size: 110592 bytes
>             13824 values
> Number of Dimensions: 2
> Dimensions and sizes:    [lat | 96] x [lon | 144]
> Coordinates:
>             lat: [ -90..  90]
>             lon: [   0..357.5]
> Number Of Attributes: 3
>   _FillValue :    9.969209968386869e+36
>   long_name :    maximum eady growth rate
>   units :
> (0)    maximum eady growth rate : min=nan   max=nan
> (0)    -----------------------------------------
>
>
>
> _______________________________________________
> 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/20180823/ac5c08bd/attachment.html>


More information about the ncl-talk mailing list