[ncl-talk] Fatal error of "NclVar.c":1390
azizul haque
haque.azizul320 at yahoo.com
Thu Sep 11 02:19:17 MDT 2014
Hi Rick,
Thanks. I did accordingly. Its work. However, the page(x11 windows, PDF or png) is empty. I mean reading is ok but I cannot see any visualization. I really do not know the problem is going on.
Please guide me.
Regards
Azizul
On Wednesday, September 10, 2014 9:16 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
Hi Azizul,
I see the problem now. The error is coming from the do-loop:
do i=0,9
...
end do
Previously in the script, you created variables named "a" through "j" as file-variables. Thus by the time the do-loop is encountered, a file-variable named "i" already exists, and thus can't be reassigned as an integer. Make sense?
HTH
Rick
On Wed, Sep 10, 2014 at 4:38 AM, azizul haque <haque.azizul320 at yahoo.com> wrote:
Hi Rick,
>Thanks for your reply. I am still having same problem in runing following script and getting error include
>***fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
>fatal:["Execute.c":8567]:Execute: Error occurred at or near line 199 in file cmipdaily5sa.ncl****
>
>
>Script is follows for you kind looking up
>
>
>;::::Load Libraries::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>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"
>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>begin
> ; modi1=”GPCP”
> ; modi2="CNRM-CM5"
> ; modi3="CESM1-BGC"
> ;modi4="CCSM4"
> ; timi=”1850-2005”
> ; region="South Asia"
> ;::::Open file and read data
> ; dir = "/Desktop/CMIP5/RCP85/"
> ;filename = "GPCP_1DD_v1.2_199610-201312.nc"
> ; a = addfile(dir+filename,"r")
> ;a=addfile("/Users/ahaque/Desktop/CMIP5/RCP85/GPCP_1DD_v1.2_199610-201312.nc","r")
>
>
> ;prec = a->PREC ; dimensions and size ; 6301x180x360 ; timexlatxlon
> a =addfile("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/HadGEM2-ES/r1i1p1/pr_day_HadGEM2-ES_historical_r1i1p1_18591201-200511_sa.nc","r")
> pr0= a->pr ;dimensions and size; 105120x43x55 ;time xlatxlon
> b=addfile("/Users/ahaque/Desktop/CMIP5//historical/Daily/historical/CNRM-CM5/r1i1p1/pr_day_CNRM-CM5_historical_r1i1p1_18500101-20051231_sa.nc","r")
> pr1= b->pr ;dimensions and size;56978x43x55 ;timexlatxlon
> c=addfile("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/CESM1-BGC/r1i1p1/pr_day_CESM1-BGC_historical_r1i1p1_18500101-20051231_sa.nc", "r")
> pr2= c->pr ;dimensions and size;56940x43x55 ;time xlatxlon
> d=addfile ("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/NorESM1-M/r1i1p1/pr_day_NorESM1-M_historical_r1i1p1_18500101-20051231_sa.nc", "r")
> pr3= d->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> e=addfile ("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/GFDL-ESM2M/r1i1p1/pr_day_GFDL-ESM2M_historical_r1i1p1_18610101-20051231_sa.nc", "r")
> pr4= e->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> f=addfile ("//Users/ahaque/Desktop/CMIP5/historical/Daily/historical/GFDL-ESM2G/pr_day_GFDL-ESM2G_historical_r1i1p1_18610101-20051231_sa.nc", "r")
> pr5= f->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> g=addfile ("//Users/ahaque/Desktop/CMIP5/historical/Daily/historical/MIROC-ESM/r1i1p1/pr_day_MIROC-ESM_historical_r1i1p1_18500101-20051231_sa.nc", "r")
> pr6= g->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> h=addfile ("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/MPI-ESM1-LR/r1i1p1/pr_day_MPI-ESM-LR_historical_r1i1p1_18500101-20051231_sa.nc", "r")
> pr7= h->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> i=addfile ("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/bcc-csm1-1-m/r1i1p1/pr_day_bcc-csm1-1-m_historical_r1i1p1_18500101-20121231_sa.nc", "r")
> pr8= i->pr;dimensions and size; 56940x43x55 ;time xlatxlon
> j=addfile ("/Users/ahaque/Desktop/CMIP5/historical/Daily/historical/GPCP_1DD_v1.2_199610-201312_sa.nc", "r")
> pr9= j->PREC;dimensions and size; 56940x43x55 ;time xlatxlon
>;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>mod_names = (/"HadGEM2-ES","CNRM-CM5","CESM1-BGC","NorESM1-M","GFDL-ESM2M","GFDL-ESM2G","MIROC-ESM","MPI-ESM-LR","bcc-csm1-1-m","GPCP"/)
>pre_mm= (/"pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day","pr(mm/day"/)
>;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>;:::: Convert units kg/(m2-s) to mm/day;
> ;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> pr0=pr0*86400.
> pr0 at units= "mm/day" ;to mm/day;
> printVarSummary(pr0)
> printMinMax(pr0,1)
>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
> pr1 = pr1*86400.
> pr1 at units = "mm/day"
> printVarSummary(pr1)
> printMinMax(pr1,1)
>
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr2 = pr2*86400.
> pr2 at units = "mm/day"
> printVarSummary(pr2)
> printMinMax(pr2,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr3 = pr3*86400.
> pr3 at units = "mm/day"
> printVarSummary(pr3)
> printMinMax(pr3,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr4 = pr4*86400.
> pr4 at units = "mm/day"
> printVarSummary(pr4)
> printMinMax(pr4,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr5 = pr5*86400.
> pr5 at units = "mm/day"
> printVarSummary(pr5)
> printMinMax(pr5,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr6 = pr6*86400.
> pr6 at units = "mm/day"
> printVarSummary(pr6)
> printMinMax(pr6,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr7 = pr7*86400.
> pr7 at units = "mm/day"
> printVarSummary(pr7)
> printMinMax(pr7,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr8 = pr8*86400.
> pr8 at units = "mm/day"
> printVarSummary(pr8)
> printMinMax(pr8,1)
>;::::Convert units kg/(m2-s) ;to mm/day;
> pr9 = pr9*1.
> pr9 at units = "mm/day"
> printVarSummary(pr9)
> printMinMax(pr9,1)
>;::::Compute daily long term mean
> pr0Dayavg=dim_avg_n_Wrap(pr0,0); daily mean
> printVarSummary(pr0Dayavg)
> printMinMax(pr0Dayavg,1)
>;::::Compute daily long term mean
> pr1Dayavg=dim_avg_n_Wrap(pr1,0); daily mean
> printVarSummary(pr1Dayavg)
> printMinMax(pr1Dayavg,1)
>;::::Compute daily long term mean
> pr2Dayavg=dim_avg_n_Wrap(pr2,0); daily mean
> printVarSummary(pr2Dayavg)
> printMinMax(pr2Dayavg,1)
>;::::Compute daily long term mean
> pr3Dayavg=dim_avg_n_Wrap(pr3,0); daily mean
> printVarSummary(pr3Dayavg)
> printMinMax(pr3Dayavg,1)
>;::::Compute daily long term mean
> pr4Dayavg=dim_avg_n_Wrap(pr4,0); daily mean
> printVarSummary(pr4Dayavg)
> printMinMax(pr4Dayavg,1)
>;::::Compute daily long term mean
> pr5Dayavg=dim_avg_n_Wrap(pr5,0); daily mean
> printVarSummary(pr5Dayavg)
> printMinMax(pr5Dayavg,1)
>;::::Compute daily long term mean
> pr6Dayavg=dim_avg_n_Wrap(pr6,0); daily mean
> printVarSummary(pr6Dayavg)
> printMinMax(pr6Dayavg,1)
>;::::Compute daily long term mean
> pr7Dayavg=dim_avg_n_Wrap(pr7,0); daily mean
> printVarSummary(pr7Dayavg)
> printMinMax(pr7Dayavg,1)
>;::::Compute daily long term mean
> pr8Dayavg=dim_avg_n_Wrap(pr8,0); daily mean
> printVarSummary(pr8Dayavg)
> printMinMax(pr8Dayavg,1)
>;::::Compute daily long term mean
> pr9Dayavg=dim_avg_n_Wrap(pr9,0); daily mean
> printVarSummary(pr9Dayavg)
> printMinMax(pr9Dayavg,1)
>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>
>
>;:::Setting resources for Plotting
>wks = gsn_open_wks("x11","Smalllat1")
>gsn_define_colormap(wks,"rainbow")
>
>
>res1 = True ; Variable to hold plot options
>
>
>res1 at gsnMaximize = True ; Maximize plot in frame.
>res1 at gsnSpreadColors = True ; Span full color map
>res1 at gsnLeftString = ""
>res1 at gsnRightString = ""
>;res1 at gsnMajorLonSpacing = 10 ;labeling lat and lon spacing on the map
>;res1 at gsnMajorLatSpacing = 10
>res1 at gsnAddCyclic = False
>res1 at gsnDraw = False ; do not draw the plot
>res1 at gsnFrame = False ; do not advance the frame
>
>
>
>
>res1 at cnLinesOn = False ; turn off contour line color
>res1 at cnLineLabelsOn = False
>res1 at cnFillOn = True ; Contour fill on
>;res1 at cnLevelSelectionMode = "ManualLevels" ; manual contour levels
>;res1 at cnMinLevelValF = 5.0 ; min level
>;res1 at cnMaxLevelValF = 100.0 ; max level
>;res1 at cnLevelSpacingF = 5 ; interval
>;res1 at cnLevelSelectionMode = "ExplicitLevels"
>;res1 at cnLevels = (/0.1,1,2.5,5,10,15,20,25,50,75/) ; "mm/day"
>
>
>;res1 at lbOrientation = "Vertical" ; Move labelbar to side
>;res1 at lbLableBarFontHeightF=0.01
>;res1 at lbLableBarOrthogonalposF=-0.030
>res1 at lbLabelBarOn = False ; added procedure to do a single label bar for the panel
>
>
>res1 at mpLimitMode = "LatLon"
>res1 at mpMinLatF = 20 ;min(lat2d)
>res1 at mpMaxLatF = 35 ;max(lat2d)
>res1 at mpMinLonF = 70 ;min(lon2d)
>res1 at mpMaxLonF = 90 ;max(lon2d)
>;res1 at mpProjection = "LambertConformal"
>;res1 at mpLambertMeridianF = 0.5*res1 at mpMinLonF + 0.5*res1 at mpMaxLonF
>;res1 at mpLambertParallel1F = 0.7*res1 at mpMinLatF + 0.3*res1 at mpMaxLatF
>;res1 at mpLambertParallel2F = 0.3*res1 at mpMinLatF + 0.7*res1 at mpMaxLatF
>;res1 at mpOutlineDrawOrder = "postdraw" ; predraw, draw, postdraw
>;res1 at mpUSStateLineDashPattern = 4
>;res1 at mpOutlineBoundarySets = "GeophysicalAndUSStates" ;turn on state boundaries
>;res1 at mpLabelsOn = True
>
>
>res1 at pmTickMarkDisplayMode = "Always" ; turn on tick marks
>;res1 at tmXBLabelsOnF = True ; do not draw bottom labels
>;res1 at tmYRLabelsOn = False ; no right labels
>;res1 at tmYLLabelsOnF = True ; yes left labels
>;res1 at tmXBOnF = True ; yes bottom tickmarks
>;res1 at tmXTOn = False
>;res1 at tmYLOnF = True
>;res1 at tmYROnF = True
>
>;res1 at vpWidthF = 1.80 ; plot width
>;res1 at vpHeightF= 0.50 ; plot height
>;::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>;plotting procedure
> plot = new(10,graphic)
> do i=0,9
>
>
> res1 at gsnCenterString = mod_names(i)+" "+pre_mm(i)
> res1 at gsnCenterStringFontHeightF = 0.022
>
>
> plot(i) = gsn_csm_contour_map(wks,t(i,:,:),res1)
>end do
>
>
>
>
> ;res1 at gsnLeftString = "HadGEM2-ES: Pr: ("+pr0Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr0Dayavg at units+")"
> ;res1 at gsnLeftStringFontHeightF = 0.010
> ;res1 at gsnRightStringFontHeightF = 0.010
> ;plot(0) = gsn_csm_contour_map(wks,pr0Dayavg,res1)
>
> ;res1 at gsnLeftString = "CNRM-CM5: Pr: ("+pr1Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr1Dayavg at units+")"
> ;res1 at gsnLeftStringFontHeightF = 0.015
> ;res1 at gsnRightStringFontHeightF = 0.015
> ;plot(1) = gsn_csm_contour_map(wks,pr1Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "CESM1-BGC: Pr: ("+pr2Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr2Dayavg at units+")"
> ;res1 at gsnLeftStringFontHeightF = 0.015
> ;res1 at gsnRightStringFontHeightF = 0.015
> ;plot(2) = gsn_csm_contour_map(wks,pr2Dayavg,res1)
>
> ;res1 at gsnLeftString = "NorESM1-M: Pr: ("+pr3Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr3Dayavg at units+")"
> ;plot(3) = gsn_csm_contour_map(wks,pr3Dayavg,res1)
>
> ;res1 at gsnLeftString = "GFDL-ESM2M: Pr: ("+pr4Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr4Dayavg at units+")"
> ;plot(4) = gsn_csm_contour_map(wks,pr4Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "GFDL-ESM2G: Pr: ("+pr5Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr5Dayavg at units+")"
> ;plot(5) = gsn_csm_contour_map(wks,pr5Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "MIROC-ESM: Pr: ("+pr6Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr6Dayavg at units+")"
> ;plot(6) = gsn_csm_contour_map(wks,pr6Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "MPI-ESM1-LR: Pr: ("+pr7Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr7Dayavg at units+")"
> ;plot(7) = gsn_csm_contour_map(wks,pr7Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "bcc-csm1-1-m: Pr: ("+pr8Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr8Dayavg at units+")"
> ;plot(8) = gsn_csm_contour_map(wks,pr8Dayavg,res1)
>
>
> ;res1 at gsnLeftString = "GPCP: Pr: ("+pr9Dayavg at units+")"
> ;res1 at gsnRightString = "Daily Mean:("+pr9Dayavg at units+")"
> ;plot(9) = gsn_csm_contour_map(wks,pr9Dayavg,res1)
> ;end do
>;:::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::::
>; panelling
>
> resP = True
> resP at txString = "Daily Mean Precipitation by Historical in South Asia from CMIP 5 Models"
> resP at gsnFrame= True
> resP at txFontHeightF = 0.0125
> resP at gsnPanelLabelBar = True ; add common colorbar
> resP at lbOrientation = "Vertical" ; Move labelbar to side
> resP at gsnMaximize = True ; maximize plots
> resP at lbTitleString = "mm/d"
> ;resP at lbTitleFontHeightF = 0.15
> ;resP at lbTitleOffsetF = 0.08
> resP at lbLabelAutoStride = True
> resP at lbLabelFontHeightF = 0.015
> resP at lbBoxLinesOn = False
> ;resP at lbBoxMinorExtentF = 0.7
> ;resP at pmLabelBarWidthF = 0.5
> ;resP at pmLabelBarOrthogonalPosF = -0.05
> ;resP at pmLabelBarParallelPosF = 0.6,5/),resP) ; not draw as one plot
>
>
> txres =True
> txres at gsnFrame= False ; do not advance the frame
> txres at txFontHeightF = 0.0321
> gsn_text_ndc(wks,"Source: Azizul Haque, NOAA ESRL",087,024, txres)
> frame(wks)
>end
>
>
>
>On Tuesday, September 9, 2014 6:25 AM, Rick Brownrigg <brownrig at ucar.edu> wrote:
>
>
>
>Hi,
>
>Its almost impossible to say with certainty, as we have no idea what line 199 corresponds to in your script fragment. However as a general comment, you have a do-loop and within that are explicitly making the same 10 plots on each iteration. I can't recall offhand if one can re-assign a plot variable without first deleting its previous value.
>
>Rick
>
>
>
>
>On Tue, Sep 9, 2014 at 1:42 AM, azizul haque <haque.azizul320 at yahoo.com> wrote:
>
>Hi All,
>>I am plotting 10 plots from CMIP5(5/2). dat reading is fine and during visualization it shows following error message.
>>****fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be coerced to type of left hand side
>>fatal:["Execute.c":8567]:Execute: Error occurred at or near line 199 in file cmipdaily5sa.ncl************
>>You can find a parts of the script at the line 199
>>;plotting procedure
>> plot = new(10,graphic)
>> do i=0,9
>> res1 at gsnLeftString = "HadGEM2-ES: Pr: ("+pr0Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr0Dayavg at units+")"
>> res1 at gsnLeftStringFontHeightF = 0.010
>> res1 at gsnRightStringFontHeightF = 0.010
>> plot(0) = gsn_csm_contour_map(wks,pr0Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "CNRM-CM5: Pr: ("+pr1Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr1Dayavg at units+")"
>> ;res1 at gsnLeftStringFontHeightF = 0.015
>> ;res1 at gsnRightStringFontHeightF = 0.015
>> plot(1) = gsn_csm_contour_map(wks,pr1Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "CESM1-BGC: Pr: ("+pr2Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr2Dayavg at units+")"
>> ;res1 at gsnLeftStringFontHeightF = 0.015
>> ;res1 at gsnRightStringFontHeightF = 0.015
>> plot(2) = gsn_csm_contour_map(wks,pr2Dayavg,res1)
>>res1 at gsnLeftString = "NorESM1-M: Pr: ("+pr3Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr3Dayavg at units+")"
>> plot(3) = gsn_csm_contour_map(wks,pr3Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "GFDL-ESM2M: Pr: ("+pr4Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr4Dayavg at units+")"
>> plot(4) = gsn_csm_contour_map(wks,pr4Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "GFDL-ESM2G: Pr: ("+pr5Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr5Dayavg at units+")"
>> plot(5) = gsn_csm_contour_map(wks,pr5Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "MIROC-ESM: Pr: ("+pr6Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr6Dayavg at units+")"
>> plot(6) = gsn_csm_contour_map(wks,pr6Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "MPI-ESM1-LR: Pr: ("+pr7Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr7Dayavg at units+")"
>> plot(7) = gsn_csm_contour_map(wks,pr7Dayavg,res1)
>>
>>
>> res1 at gsnLeftString = "bcc-csm1-1-m: Pr: ("+pr8Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr8Dayavg at units+")"
>> plot(8) = gsn_csm_contour_map(wks,pr8Dayavg,res1)
>>
>> res1 at gsnLeftString = "GPCP: Pr: ("+pr9Dayavg at units+")"
>> res1 at gsnRightString = "Daily Mean:("+pr9Dayavg at units+")"
>> plot(9) = gsn_csm_contour_map(wks,pr9Dayavg,res1)
>> end do
>>
>>
>>Your suggestion are highly appreciated.
>>Regards
>>azizul
>>
>>
>>
>>
>>_______________________________________________
>>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/20140911/02d0b9a8/attachment-0001.html
More information about the ncl-talk
mailing list