Re: significance in correlation plots

From: Noelia otero <noeli1680_at_nyahnyahspammersnyahnyah>
Date: Fri Jul 11 2014 - 09:51:14 MDT

Hi

Thanks for the suggestion. Actually, I realized comparing with another plot
in grads that the dimensions could be changed (it seems to me that the
latitude need to be change). I did the same plot by using R and I had to
reverse the latitude (increasing) to get the same plot that in grads, so my
guess is that the difference could come from that.
Is there any way to change that in ncl? I know that I can reorder them or
transpose them..but my worries is that I will have the same problem with
the coordinates).

Thanks in advance,

Cheers


2014-07-10 23:53 GMT+02:00 Mary Haley <haley@ucar.edu>:

> Hi,
>
> I don't think you are calling ShadeLtContour correctly, as it expects five
> input arguments and not three. Is this just a typo, or did you get any
> errors when you ran your script?
>
> I suggest using gsn_contour_shade in place of ShadeLtContour, which has
> been deprecated. Your code would look like this:
>
> opt = True
> opt@gsnShadeFillType = "pattern" ; pattern fill
> opt@gsnShadeLow = 2 ; use pattern #2
> plot2 = gsn_contour_shade(wks,0.05,0.75,opt)
>
> The plots should look the same regardless of which function you use, but
> gsn_contour_shade is a bit more versatile.
>
> The two numeric arguments to gsn_contour_shade are the "low" and "high"
> values that you want to shade based on. In the example above, then, you
> could specify shading below 0.05, between 0.05 and 0.75, and/or above 0.75,
> using the gsnShadeLow, gsnShadeMid, and gsnShadeHigh options. If you only
> use the Low or High options, then the corresponding high or low value will
> just be ignored.
>
> The important thing to note about ShadeLtContour and gsn_contour_shade is
> that if you indicate a shade value that falls *between* the contour levels
> of your plot, then these routines will only shade below the next closest
> contour level that is less than this value. This may be the difference
> that you are seeing between the grads and NCL plots?
>
> If you continue to have problems, it would help to see a sample image.
>
> Thanks,
>
> --Mary
>
>
> On Thu, Jul 10, 2014 at 9:46 AM, Noelia otero <noeli1680@gmail.com> wrote:
>
>> Hi,
>>
>> I was trying to plot the correlations and adding a contour effect in the
>> 95% significant areas. I follow some examples but I am not confident with
>> my result. This why I would like to know if I am in the right way to do
>> that:
>>
>> 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/contributed.ncl"
>> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
>>
>> begin
>>
>> a =
>> addfile("/home/nof/pruebas/ensem_means/pr_Amon_CanCM4_historical_ensmean_t42_westA_meanJAS.nc","r")
>> b =
>> addfile("/home/nof/pruebas/WAMI_CEOF/WAMI_Amon_CanCM4_historical_ensmean.nc","r")
>>
>>
>> pr =a->pr
>> wami =b->WAMI(:,0,0,0)
>> lat = a->lat
>> lon = a->lonlat@units="degrees_north"
>>
>> correl=escorc(wami,pr(lat|:,lon|:,time|:))
>> correl!0="lat"
>> correl!1="lon"
>> correl&lat=lat
>> correl&lon=lon
>>
>> ;***significant values
>> sig = 0.05
>> um = rtest(correl(lat|:,lon|:),45,0)
>> um!0="lat"
>> um!1="lon"
>> um&lat=lat
>> um&lon=lon
>>
>> wks = gsn_open_wks("pdf","example")
>>
>> res = True
>> res@gsnAddCyclic = False
>> res@cnFillOn = True
>> res@cnLinesOn = True
>> res@mpMinLong = min(correl&lon)
>> res@mpMinLatF = min(correl&lat)
>> res@mpMaxLonF = max(correl&lon)
>> res@mpMaxLatF = max(correl&lat)
>> ;plotting first
>> plot = gsn_csm_contour_map_ce(wks,correl,res)
>>
>> res2 = True ; res2 probability plots
>> res2@gsnAddCyclic = False
>>
>> 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 = False ; turn off info label
>>
>> res2@cnLinesOn = False ; do not draw contour
>> lines
>> res2@cnLineLabelsOn = False ; do not draw contour
>> labels
>>
>> res2@cnFillScaleF = 0.6 ; add extra density
>> map_ce(wks,correl,res)
>> plot2 = gsn_csm_contour(wks,um, res2) ;
>> plot2 = ShadeLtContour(plot2, 0.05, 2) ; plotting significant
>> areas
>>
>> overlay (plot, plot2)
>>
>> draw (plot)
>> frame(wks)
>>
>>
>> end
>>
>> My doubts come from plot2 = ShadeLtContour(plot2, 0.05, 2) , would it
>> be OK to show the 95% significance?? because I did the same plot in grads
>> (just defining a threshold based on t-student), but the plots looks like a
>> little bit different..
>>
>> Thanks in advance!
>>
>> Cheers
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>>
>>
>

Received on Fri Jul 11 03:51:16 2014

This archive was generated by hypermail 2.1.8 : Wed Jul 23 2014 - 15:33:47 MDT