[ncl-talk] gsnContourNeIgLineDashPattern is not a valid resource

WIND 954051157 at qq.com
Wed Sep 28 21:02:00 MDT 2016


Hi, Dennis
Thanks for helping. I have solved the problem. There is one more little question. 
Why the gsnContourNeIgLineDashPattern is not a valid resource in my Script?
I follow this: http://www.ncl.ucar.edu/Applications/Scripts/coneff_3.ncl
Here is my script:
wks  = gsn_open_wks("eps" ,"1222") 
res                  = True      
res at cnLevelSelectionMode = "ManualLevels"
res at cnMinLevelValF       = -4
res at cnMaxLevelValF       =  4
res at cnLevelSpacingF      = 1
res at gsnContourNeIgLineDashPattern = 1.    
res at gsnContourZeroLineThicknessF = 2.	 
res at tmXBMode      = "Explicit"   
res at tmXBValues    = ispan(0,11,1)
res at tmXBLabels    = (/"J","J","A","S","O","N","D","J","F","M","A","M"/)
plot = gsn_csm_contour(wks,datareverse,res)  

Could you please help me figure this out?
Thanks!
Wind
------------------ 原始邮件 ------------------
发件人: "Dennis Shea";<shea at ucar.edu>;
发送时间: 2016年9月27日(星期二) 晚上9:52
收件人: "WIND"<954051157 at qq.com>; 
抄送: "ncl-talk"<ncl-talk at ucar.edu>; 
主题: Re: [ncl-talk] irregular coordinate array sfXArray non-monotonic:defaulting sfXArray



When posting to ncl-talk, it is best to always include a printVarSummary(...) of pertinent variables. EG:


printVarSummary(data)

printVarSummary(datareverse)

--

This is wrong:
    data&month=(/6,7,8,9,10,11,12,1,2,3,4,5/)


The & means a "coordinate variable" (CV). By definition, a CV is monotonic. Your assignment is not monotonic.


Given the way you have done things, I think the following should work

   data!0="index"
   data&index=ispan(1,12,1)

   datareverse = data(la|:,index|:)

--

Why are you manually specifying the years?

year1=(/1980,1981,1982,1983,1984,1985,1986,1987,1988,1989,1990,1991,1992,1993,1994,1995,1996,1997,1998,1999,2000/)


Use the ispan function



year1 = ispan(1980, 2000,1)


or, better programming practice


yrStrt = 1980

yrLast = 2000
year1 = ispan(yrStrt,yrLast,1)

===

Use a function to make your code cleaner. 
Use _n and _n_Wrap, if possible.


undef("rc_month")

function rc_month(file_name[1]:string, var_name[1]:string, yrStrt[1]:integer, yrLast[1]:yrLast)

local f, t, year, t1new, rc

begin

   f      = addfile(file_name,"r")
   t      = short2flt( f1->$var_name$ )
   year = ispan(yrStrt, yrLast,1)



   tZon = dim_avg_n_Wrap(t,2)
   rc     = regCoef_n(year, tZon, 0, 0)

   return(rc)

end


then use


rc1 = rc_month("JanTmon.nc", "t", yrStrt, yrLast)

rc2 = rc_month("FebTmon.nc", "t", yrStrt, yrLast)


Please read the NCL manuals about procedures and functions.

http://www.ncl.ucar.edu/Document/Manuals/


In particular, the DKRZ tutorials



_______________________________________________
 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/20160929/402d00da/attachment.html 


More information about the ncl-talk mailing list