<html><head><meta http-equiv="Content-Type" content="text/html; charset=UTF-8"><title></title><style type="text/css">.felamimail-body-blockquote {margin: 5px 10px 0 3px;padding-left: 10px;border-left: 2px solid #000088;} </style></head><body><div>Hello</div><div><br></div><div>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.<br></div><div>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.</div><div><br></div><div>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?</div><div><br></div><div>Much appreciated. </div><div><br></div><div><br></div><div>f= addfile("SLP_PHIS_Z3_PI.nc", "r") ;<br> T41 = f->Z3(:,{850},:,:)<br><br> printVarSummary(T41) ; [Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]<br><br> T41@_FillValue = -9.96921e+36 <br> <br> aveX = dim_avg_n_Wrap(T41,0) <br> printVarSummary(aveX) ; (lat,lon)<br> aveX@_FillValue =9.96921e+36 <br> print(where(aveX.ne.0, aveX, aveX@_FillValue))<br><br> aveX = 1. / where(aveX.ne.0, aveX, aveX@_FillValue) <br><br>;==============================================================<br><br> f1= addfile("totalwinds_PI.nc", "r") ;<br> T411 = f1->U(:,{850},:,:)<br><br> printVarSummary(T411) ; [Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]<br> T411@_FillValue = -9.96921e+36 <br><br> aveX1 = dim_avg_n_Wrap(T411,0) <br> printVarSummary(aveX1) ; (lat,lon)<br><br> aveX1@_FillValue = 9.96921e+36 <br><br> aveX1 = 1. / where(aveX1.ne.0, aveX1, aveX1@_FillValue) <br>;==============================================================<br> f2= addfile("th_PI.nc", "r") ;<br> T412 = f2->TH(:,{900},:,:)<br><br> printVarSummary(T412) ; [Time|12]x[ilev | 27] x [lat | 96] x [lon | 144]<br> T412@_FillValue = -9.96921e+36 <br><br> aveX2 = dim_avg_n_Wrap(T412,0) <br> printVarSummary(aveX2) ; (lat,lon)<br><br> aveX2@_FillValue = 9.96921e+36 <br><br> aveX2 = 1. / where(aveX2.ne.0, aveX2, aveX2@_FillValue) <br><br>;==============================================================<br> <br>; Read latitudes <br>; The 'eady_growth_rate' function requires that 'lat' and 'th' agree<br>; Use 'conform' the propogate the lat values<br>;==============================================================<br><br> xlat = f->lat ; [lat | 96] <br> printVarSummary(xlat)<br><br> ;[Time|12]x[ilev | 26] x [lat | 96] x [lon | 144]<br> ; 0 1 2 3 <== dimension numbers<br> ;XLAT = conform(T412, xlat, 2) ; problem here <br><br><br> XLAT = conform ( aveX2 , xlat , 0 ) <br> printVarSummary(XLAT)<br> XLAT=aveX2<br> printVarSummary(XLAT)<br><br> XLAT=lonFlip(XLAT)<br> printVarSummary(XLAT)<br>;==============================================================<br><br> egr = eady_growth_rate(aveX2, aveX1, aveX, XLAT, 0, 1)<br> printVarSummary(egr)<br><br> ;printMinMax(egr,0)<br><br> ;print(egr)<br> print("-----------------------------------------")<br><br>;==============================================================<br><br> wks = gsn_open_wks("pdf","Eady_850") ; send graphics to PNG file<br><br>;---Set some basic plot options<br><br> res = True<br> res@gsnMaximize = True ; maximize plot in frame<br> ;res@gsnAddCyclic = False<br><br> res@cnFillOn = True <br> res@cnLinesOn = False<br> ;res@cnFillMode = "RasterFill" ; slow here<br> ;res@cnFillMode = "CellFill" ; faster<br><br> ;res@cnFillPalette = "precip2_17lev" ;BrRiEgr<br><br><br> res@mpMaxLatF = 80 ; choose a different subregion<br> res@mpMinLatF = 30<br> res@mpMaxLonF = 70<br> res@mpMinLonF = -40<br> res@mpFillOn = False<br><br> res@lbBoxEndCapStyle = "TriangleBothEnds" <br> <br>;--- Eady growth rate (1/day)<br><br> egr = egr*86400<br> egr@units = "annual 1/day"<br><br> res@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels<br> res@cnMinLevelValF = -2 ; set min contour level<br> res@cnMaxLevelValF = 2 ; set max contour level<br> res@cnLevelSpacingF = 0.2 ; set contour spacing<br><br><br> res@gsnRightString = egr@units<br> contour = gsn_csm_contour_map(wks, egr(:,:),res)<br><br><br><br></div><div>;======================================================================================</div><div><br>Variable: T41<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> lev : 867.1607600000013<br> mdims : 1<br> units : m<br> long_name : Geopotential Height (above sea level)<br> cell_methods : time: mean time: mean<br><br>Variable: aveX<br>Type: float<br>Total Size: 55296 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 7<br> _FillValue : -9.96921e+36<br> lev : 867.1607600000013<br> mdims : 1<br> units : m<br> long_name : Geopotential Height (above sea level)<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: T411<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> lev : 867.1607600000013<br> mdims : 1<br> units : m/s<br> long_name : Zonal wind<br> cell_methods : time: mean time: mean<br><br>Variable: aveX1<br>Type: float<br>Total Size: 55296 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 7<br> _FillValue : -9.96921e+36<br> lev : 867.1607600000013<br> mdims : 1<br> units : m/s<br> long_name : Zonal wind<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: T412<br>Type: float<br>Total Size: 663552 bytes<br> 165888 values<br>Number of Dimensions: 3<br>Dimensions and sizes: [time | 12] x [lat | 96] x [lon | 144]<br>Coordinates: <br> time: [136358.5..136692.5]<br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 5<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br><br>Variable: aveX2<br>Type: float<br>Total Size: 55296 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 7<br> _FillValue : -9.96921e+36<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br><br>Variable: xlat<br>Type: double<br>Total Size: 768 bytes<br> 96 values<br>Number of Dimensions: 1<br>Dimensions and sizes: [lat | 96]<br>Coordinates: <br> lat: [ -90.. 90]<br>Number Of Attributes: 2<br> long_name : latitude<br> units : degrees_north<br><br>Variable: XLAT<br>Type: double<br>Total Size: 110592 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [96] x [144]<br>Coordinates: <br><br>Variable: XLAT<br>Type: double<br>Total Size: 110592 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 7<br> average_op_ncl : dim_avg_n over dimension(s): time<br> cell_methods : time: mean time: mean<br> long_name : Potential Temperature<br> units : K<br> mdims : 2<br> ilev : 903.3002900000016<br> _FillValue : 9.969209968386869e+36<br><br>Variable: XLAT<br>Type: double<br>Total Size: 110592 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [-180..177.5]<br>Number Of Attributes: 8<br> lonFlip : longitude coordinate variable has been reordered via lonFlip<br> ilev : 903.3002900000016<br> mdims : 2<br> units : K<br> long_name : Potential Temperature<br> cell_methods : time: mean time: mean<br> average_op_ncl : dim_avg_n over dimension(s): time<br> _FillValue : 9.969209968386869e+36<br><br>Variable: egr<br>Type: double<br>Total Size: 110592 bytes<br> 13824 values<br>Number of Dimensions: 2<br>Dimensions and sizes: [lat | 96] x [lon | 144]<br>Coordinates: <br> lat: [ -90.. 90]<br> lon: [ 0..357.5]<br>Number Of Attributes: 3<br> _FillValue : 9.969209968386869e+36<br> long_name : maximum eady growth rate<br> units : <br>(0) maximum eady growth rate : min=nan max=nan<br>(0) -----------------------------------------<br><br></div><div><br></div></body></html>