[ncl-talk] Error for missing value

Karin Meier-Fleischer meier-fleischer at dkrz.de
Sun Sep 21 23:04:41 MDT 2014


Hi Azizul, 

the error message tells you that you use a string instead a float value. Take a look at the 
ges at gsnYRefLine where you set a string, but per definition:

gsnYRefLine
Draws a horizontal line at the given Y value in the gsn_csm_xy function.
Default: None

Bye Karin

> Am 21.09.2014 um 19:27 schrieb azizul haque <haque.azizul320 at yahoo.com>:
> 
> Hi NCL Users,
> I am computing daily annual cycle for CMIP5 model with rcp85 and getting following error meaages
> 
> **warning:tofloat: A bad value was passed to (string) tofloat, input strings must contain numeric digits, replacing with missing value
> warning:tofloat: A bad value was passed to (string) tofloat, input strings must contain numeric digits, replacing with missing value
> fatal:fspan: Missing value detected in input, can't continue
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 5371 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
> 
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 5482 in file $NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl
> 
> fatal:["Execute.c":8567]:Execute: Error occurred at or near line 105 in file cmip5_dac_10m.ncl***
> 
> Please find the script herewith this mail below
> 
> Regards
> Azizul
> %%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%%
> 
> 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"
> ;**************************************************************
> ; User Input
> ;***************************************************************
>    begin
>    lat1     = 20.0    ; Region
>    lat2     = 35.0
>    lon1     = 70.0   
>    lon2     = 90.0   
> ;***************************************************************
> ; End User Input
> ;***************************************************************
>    a          =addfile("/Volumes/BOULDER/Projects/CMIP5/Daily/RCP85/CCSM4/r2i1p1/pr_day_CCSM4_rcp85_r2i1p1_20800101-21001231_sa.nc","r")
>  time0     = a->time
>  pr0       = a->pr(:,{lat1:lat2},{lon1:lon2}) ; (time,lat,lon)  (0,1,2)
> ;Convert kg to mm
>  pr0       = pr0*86400.
>  pr0 at units = "mm/day"
>  printVarSummary(pr0)
>  printMinMax(pr0,1)
>  clat0      = latRegWgt(pr0&lat, typeof(pr0), 0) ; create lat weights
>  pr0Area    = wgt_areaave_Wrap(pr0, clat0, 1, 0)  ; weighted area avg
>  ymdStrt0   = 20800101 ; start yyyymmdd
>  ymdLast0   = 21001231       ;last
>  yrStrt     = ymdStrt0/10000
>  yrLast     = ymdLast0/10000
>  nhar           = 4  ; no of fourier comp
>  var                     = "pr"
>   TIME0     = cd_calendar(time0,0)   ; type of float
>   year0    = floattointeger( TIME0(:,0) )
>   month0    = floattointeger( TIME0(:,1) )
>   day0      = floattointeger( TIME0(:,2) )
>   ddd0        = day_of_year(year0, month0, day0)
>   yyyyddd0  = year0*1000 + ddd0
>   nday0     = 365
>   pday0    = new ( nday0, typeof(pr0), getFillValue(pr0))
>  
>    do nd0  =0,nday0-2
>      iday0      = ind(ddd0.eq.(nd0+1))
>      pday0(nd0)         = avg(pr0Area(iday0))
>      delete(iday0)                       ; may change next irruption
>    end do
>   pday0(nday0-1)        = 0.5*(pday0(0)+pday0(nday0-2))
>   pr0AvgRegion  = avg(pr0Area)                    ; regional avg
>  
> ;************************************************
> ; Create smooth annual cycle
> ;************************************************                       
>    cf0       = ezfftf(pday0)
>    cf0(:,3 ) = 0.75*cf0(:,3)                        ; arbitrary wgts
>    cf0(:,4 ) = 0.50*cf0(:,4)
>    cf0(:,5 ) = 0.25*cf0(:,5)
>    cf0(:,6:) = 0.0                                 ; no contribution
>    pday0_smth= ezfftb (cf0, cf0 at xbar)                ; reconstruct
>  
> ;************************************************
> ; Create plot
> ;************************************************
>    ntim0                       = dimsizes(time0)
>  
>    PDAY0       = new( (/2,nday0/), typeof(pday0), "No_FillValue")
>    PDAY0(0,:)  = pday0
>    PDAY0(1,:)  = pday0_smth
>  
> wks         = gsn_open_wks("png", "Annual_Cycle_21C")
>  
>  
> res                   = True        ; plot mods desired
>    res at gsnDraw           = False
>    res at gsnFrame          = False
>  
>    res at trXMinF           = 0           ; max value on x-axis
>    res at trXMaxF           = nday0+1      ; max value on x-axis
>  
>    res at vpHeightF                                    = 0.4                     ; resize          
>    res at vpWidthF                                      = 0.8                
>    res at tmXBMode                                     = "Explicit"
>    res at trXMinF           =  1
>    res at trXMaxF           = 360
>      
>    res at xyLineThicknesses = (/2.5, 2.5/)              ; make 2nd lines thicker
>    res at xyLineColors      = (/"NavyBlue","yellow"/)          ; change line color
>    res at xyMonoDashPattern = True                      ; all solid
>  
>    res at xyLineThicknesses = (/2.5 , 2.5/)
>    res at xyLineColors      = (/"NavyBlue","yellow"/)  ; change line color
>    res at xyMonoDashPattern = True
>    res at tiXAxisString     = "day of year"     ;
>  
>  
> ; Plotting procedure
>   plot= new(2,graphic)
>  
>   res at gsnLeftString                          = "CCSM4"
>   res at gsnYRefLine                            = "pr0AvgRegion"           ; create a reference line      
>   ;res at tiYAxisString             = "pr0 (mm/day)"    ; y-axis label   
>   res at tiXAxisString                                       = "day of year"     ; x     
>   res at gsnRightString                        = "Areal Mean="+sprintf("%4.2f", pr0AvgRegion)+" mm/day"      
>   res at gsnCenterString                     = "regName"
>   res at gsnLeftStringFontHeightF                 = 0.010
>   res at gsnRightStringFontHeightF   = 0.010
>   res at gsnCenterStringFontHeightF            = 0.010
>   plot(0)                                              = gsn_csm_y(wks, PDAY0, res)
>  
> ; Paneling the resources
>   resP                   = True
>   resP at txString          = "Daily Annual Cycle for Precipitation of 10 CMIP5 Models for 21 Century with RCP85"
>   resP at gsnFrame          = False
>   resP at txFontHeightF      = 0.0110
>   resP at gsnMaximize        = True                ; maximize
>   resP at gsnPanelFigureStrings=(/"a)","b)","c)","d)","e)","f)","g)","h)","i)","j)"/)
>   resP at gsnPanelFigureStringsFontHeightF=0.006
>   resP at txFontHeightF=0.01
>   gsn_panel(wks, plot,(/5,2/),resP) ; not draw as one plot
> end
> _______________________________________________
> ncl-talk mailing list
> 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/20140922/1c629f1d/attachment.html 


More information about the ncl-talk mailing list