[ncl-talk] Eady Growth trate

Sri Nandini snandini at marum.de
Thu Aug 23 00:28:59 MDT 2018


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)    -----------------------------------------



-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180823/47b6f156/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: Eady_850.pdf
Type: application/pdf
Size: 150380 bytes
Desc: not available
URL: <http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20180823/47b6f156/attachment.pdf>


More information about the ncl-talk mailing list