Hi Mike,
NCL requires that your latitude/longitude coordinate variables have
units attributes set. You will get that type of error message when (in
your case) prob&lat@units/prob&lon@units isn't set, or also when there
are no coordinate variables set at all.
In this case I think prob has no coordinate variables associated with
it, because I don't think ttest returns any coordinate variable
information to the left hand side of the equal sign. So you probably
want to put:
prob = xAve
prob = (/ ttest(xAve,xVar,xN, yAve,yVar,yN, iflag, False) /)
This will set up prob to have coordinate variable information and it
won't be overwritten by ttest thanks to the (/ /) syntax.
Finally, if you are trying to show that the 2090-2099 precip is
significantly different from the 2000-2009 precip, you will want to have
the time coordinate variable on the right hand side of the utmp/vtmp
arrays, as dim_variance, dim_avg, and equiv_sample_size all operate on
the rightmost dimension. wgt_areaave on the other hand expects the
lat,lon to be the last two dimensions of the input arrays.. By the looks
of your code I am not sure that you have things set up this way, as for
instance the reordering of the u/v arrays seem to be commented out with a ;
Adam
brownmc@uci.edu wrote:
> Hi all,
> I am having trouble making a ttest plot to show where my precipitation
> data is statitically significant. With the script below I recieve error
> messages that say: (0) check_for_y_lat_coord: Warning: Data either
> does not contain a valid latitude coordinate array or doesn't contain one
> at all. A valid latitude coordinate array should have a 'units' attribute
> equal
> to one of the following values:'degrees_north' 'degrees-north'
> 'degree_north' 'degrees north' 'degrees_N' 'Degrees_north' 'degree_N'
> 'degreeN' 'degreesN'
>
> It does this for longitude also. Any advice on how to make this work or
> comments on a better script would be greatly appreciated.Thanks
>
> Mike Brown
>
> Script:
> begin
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> a =
> addfile("/data/brownmc/sresa1b/atm/mo/tas/ncar_ccsm3_0/run1/sresa1b_ncar_ccsm3_0_200001_200912.nc","r")
> b =
> addfile("/data/brownmc/sresa1b/atm/mo/tas/ncar_ccsm3_0/run1/sresa1b_ncar_ccsm3_0_209001_209912.nc","r")
> u = a->pr(:,:,:)
> v = b->pr(:,:,:)
> siglvl = 0.05
> aveX = avg(u)
> aveY = avg(v)
> varX = variance (u)
> varY = variance (v)
> sX = dimsizes (u)
> sY = dimsizes (v)
> iflag = False
> dimXY = dimsizes(u)
> ntim = dimXY(0)
> mlon = dimXY(1)
> nlat = dimXY(2)
> xtmp = u;(lat|:,lon|:,time|:) ; reorder but do it only once
> [temporary]
> ytmp = v;(lat|:,lon|:,time|:)
> xAve = dim_avg (xtmp) ; calculate means at each grid point
> yAve = dim_avg (ytmp)
> xVar = dim_variance (xtmp) ; calculate variances
> yVar = dim_variance (ytmp)
> sigr = 0.05 ; critical sig lvl for r
> xEqv = equiv_sample_size (xtmp, sigr,0)
> yEqv = equiv_sample_size (ytmp, sigr,0)
> wgty = 1.
> xN = wgt_areaave (xEqv, wgty, 1., 0) ; wgty could be gaussian weights
> yN = wgt_areaave (yEqv, wgty, 1., 0)
> iflag= False ; population variance similar
> prob = ttest(xAve,xVar,xN, yAve,yVar,yN, iflag, False)
> wks = gsn_open_wks ("ps", "conOncon" )
> res2 = True ; res2 probability plots
> res2@gsnDraw = False ; Do not draw plot
> res2@gsnFrame = False ; Do not advance frome
> res2@cnLevelSelectionMode = "ManualLevels" ; set manual contour levels
> res2@cnMinLevelValF = 0.00 ; set min contour level
> res2@cnMaxLevelValF = 1.05 ; set max contour level
> res2@cnLevelSpacingF = 0.05 ; set contour spacing
> res2@cnInfoLabelOn = True ; turn off info label
> res2@cnLinesOn = False ; do not draw contour lines
> res2@cnLineLabelsOn = True ; do not draw contour labels
> res2@cnFillScaleF = 0.6 ; add extra density
> plot = gsn_csm_contour_map(wks,prob(:,:),res2)
> draw(plot)
> frame(wks)
> end
>
>
> _______________________________________________
> ncl-talk mailing list
> ncl-talk@ucar.edu
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
-- -------------------------------------------------------------- Adam Phillips asphilli@ucar.edu National Center for Atmospheric Research tel: (303) 497-1726 ESSL/CGD/CAS fax: (303) 497-1333 P.O. Box 3000 Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli _______________________________________________ ncl-talk mailing list ncl-talk@ucar.edu http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2b29 : Thu Sep 15 2005 - 09:56:48 MDT