[ncl-talk] fatal error: "Assignment not supported for left-hand type"

franz f.trotta at sincem.unibo.it
Thu Jul 24 15:51:28 MDT 2014


As you said, I have used 'mintempCstring' and 'mintempCstring' as local 
variable in the loop removing the line  17274 and  17275.
Now the code look like:

17274
17275    if(lplot_outModSurfC) then
17276
17277       if (lplot_outModSurfC_temp) then
17278
17279          print("")
17280          print("     ### Plot SURF-TEMP")
17281          system("cd " + path_exp_figure_comp+"/outNemo/temp ; rm 
temp*.png")
17282
17283          tempC_diff(0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) = 
\
17284                     
tempC(1,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) - \
17285                     
tempC(0,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1)
17286
17287          colorsMap = "rainbow"
17288          namefile  = "tempC_xy"
17289          titleplot = "Temperature"
17290          label     = " "
17291          ilev      = 0
17292          itime     = 0
17293          printVarSummary(LeftStringC)
17294          ;print(minmaxtempCstring)
17295          do imod=0,1
17296              print("imod="+imod)
17297              ;LeftStringC(imod) = 
"z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m  range=["+ \
17298              ;                    
sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+","+ \
17299              ;                    
sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+"]"
17300              mintempC = 
min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1))
17301              maxtempC = 
max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1))
17302              mintempCstring = sprintf("%0.2f",mintempC)
17303              maxtempCstring = sprintf("%0.2f",maxtempC)
17304              print(mintempCstring)
17305              print(maxtempCstring)
17306              LeftStringC(imod) = 
"z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m  range=["+ \
17307                                  
mintempCstring+","+maxtempCstring+"]"
17308          end do





but there is still the error "Assignment not supported for left-hand 
type" :
at the end of the loop:


Variable: LeftStringC
Type: string
Total Size: 16 bytes
             2 values
Number of Dimensions: 1
Dimensions and sizes:	[2]
Coordinates:
Number Of Attributes: 1
   _FillValue :	missing
fatal:Assignment not supported for left-hand type
fatal:["Execute.c":8128]:Execute: Error occurred at or near line 17308 
in file main.ncl




other suggestion?

thanks
Francesco


On 24-07-2014 22:12, Wei Huang wrote:
> Franz,
> 
>  Change:
> 
> 17274    mintempCstring = new(nmod,string,"")
>  17275    maxtempCstring = new(nmod,string,"")
> 
> to:
> 
> 17274    mintempCstring = new((/nmod/),string,"")
>  17275    maxtempCstring = new((/nmod/),string,"")
> 
>  Or just remove these two lines.
> Then remove (imod) from mintempCstring and maxtempCstring.
> So these two will be just local variable.
> 
> Wei 
> 
>  ================================================
> 1850 Table Mesa Dr.
> Boulder, CO 80307
> Phone: 303-497-8924
> 
> On Thu, Jul 24, 2014 at 1:53 PM, franz <f.trotta at sincem.unibo.it>
> wrote:
> 
>> I tried to change the code how you said, now this part of the code
>> look like:
>> 
>> 17271
>> 17272
>> 17273    print(nmod)
>> 17274    mintempCstring = new(nmod,string,"")
>> 17275    maxtempCstring = new(nmod,string,"")
>> 17276
>> 17277    if(lplot_outModSurfC) then
>> 17278
>> 17279       if (lplot_outModSurfC_temp) then
>> 17280
>> 17281          print("")
>> 17282          print("     ### Plot SURF-TEMP")
>> 17283          system("cd " +
>> path_exp_figure_comp+"/outNemo/temp ; rm temp*.png")
>> 17284
>> 17285        
>>  tempC_diff(0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) =
>> 17286                    
>> tempC(1,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) -
>> 17287                    
>> tempC(0,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1)
>> 17288
>> 17289          colorsMap = "rainbow"
>> 17290          namefile  = "tempC_xy"
>> 17291          titleplot = "Temperature"
>> 17292          label     = " "
>> 17293          ilev      = 0
>> 17294          itime     = 0
>> 17295          printVarSummary(LeftStringC)
>> 17296          print(mintempCstring)
>> 17297          print(maxtempCstring)
>> 17298          do imod=0,1
>> 17299              print("imod="+imod)
>> 17300              ;LeftStringC(imod) =
>> "z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m  range=["+
>> 17301              ;                  
>> 
>  sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+","+
>> 
>> 17302              ;                  
>> 
>  sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+"]"
>> 17303              mintempCstring(imod) =
>> 
> sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))
>> 17304              maxtempCstring(imod) =
>> 
> sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))
>> 17305              LeftStringC(imod) =
>> "z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m  range=["+
>> 17306                                
>>  mintempCstring(imod)+","+maxtempCstring(imod)+"]"
>> 17307          end do
>> 
>> but there is still the ERROR "Assignment not supported for
>> left-hand type"
>> this time al line 17274:
>> 
>> Variable: nmod
>> Type: integer
>> Total Size: 4 bytes
>> 
>>             1 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [1]
>> Coordinates:
>> (0)     2
>> 
>> fatal:Assignment not supported for left-hand type
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line
>> 17274 in file main.ncl
>> 
>> ./run_surf.sh: line 65: 78002 Segmentation fault: 11  ncl
>> 'CONFIG='"${CONFIG}" 'EXPERIM='"${EXPERIM}" 'DATE00='"${DATE00}"
>> 'path_base='"${BASE_DIR}" main.ncl
>> sincem29:experiments franz$
>> 
>> How can it be? Now I'm confuse.
>> 
>> If I remove the code line: 17298 - 17307 the program is ok.
>> 
>> thanks
>> Francesco
>> 
>> On 24-07-2014 19 [1]:20, Wei Huang wrote:
>> 
>> Franz,
>> 
>>  Try change your code line: 17299 - 17301 from:
>> 
>> LeftStringC(imod) = "z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m
>>  range=["+
>> 
> sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+","+
>> 
>> 
> sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+"]"
>> 
>> to:
>> 
>> mintempCstring =
>> 
> sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))
>>  maxtempCstring =
>> 
> sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))
>> LeftStringC(imod) = "z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m
>>  range=["+
>>                     mintempCstring+","+
>>                     maxtempCstring+"]"
>> 
>> and let us see if the error persist.
>> 
>>  Wei
>> 
>> ================================================
>> 1850 Table Mesa Dr.
>> Boulder, CO 80307
>> Phone: 303-497-8924 [2]
>> 
>> On Thu, Jul 24, 2014 at 11:05 AM, franz <f.trotta at sincem.unibo.it>
>> wrote:
>> 
>> Dear ncl-team
>>     I'm using the ncl 6.1.2 on imac Darwin 64bit
>>     I got this fatal error: "Assignment not supported for
>> left-hand type"
>>     and I don't understand the source of this error.
>> 
>>    Below there is part of my code (where I think NCL does not
>> like)
>>    (I putted printVarSummary(...) to shows the info of the
>> suspected
>> variables)
>> 
>> |
>> |
>> 228    nmod = 2
>> |
>> |
>> 1371    LeftStringC = new(2,string)
>> |
>> |
>> |
>> 1428    do imod=0,nmod-1
>> 1429
>> |
>> |
>> |
>> 16321
>> 16322    end do ;imod
>> 
>> |
>> |
>> |
>> 17276   if(lplot_outModSurfC) then
>> 17277
>> 17278       if (lplot_outModSurfC_temp) then
>> 17279
>> 17280          print("")
>> 17281          print("     ### Plot SURF-TEMP")
>> 17282          system("cd " +
>> path_exp_figure_comp+"/outNemo/temp ; rm
>> temp*.png")
>> 17283
>> 17284        
>>  tempC_diff(0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) =
>> 
>> 17285
>> tempC(1,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1) -
>> 17286
>> tempC(0,0:nt_max-1,0:nz_max-1,0:ny_max-1,0:nx_max-1)
>> 17287
>> 17288          colorsMap = "rainbow"
>> 17289          namefile  = "tempC_xy"
>> 17290          titleplot = "Temperature"
>> 17291          label     = " "
>> 17292          ilev      = 0
>> 17293          itime     = 0
>> 17294          printVarSummary(LeftStringC)
>> 17295          printVarSummary(depth1dtC_surf)
>> 17296          printVarSummary(tempC)
>> 17297          do imod=0,1
>> 17298              print("imod="+imod)
>> 17299              LeftStringC(imod) =
>> "z("+ilev+")="+depth1dtC_surf(imod,ilev)+"m  range=["+
>> 17300
>> 
>> 
> sprintf("%0.2f",min(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+","+
>> 
>> 17301
>> 
>> 
> sprintf("%0.2f",max(tempC(imod,itime,ilev,0:ny(imod)-1,0:nx(imod)-1)))+"]"
>> 17302          end do
>> 17303          minLevelVal  = minTemp
>> 17304          maxLevelVal  = maxTemp
>> 17305          levelSpacing = dTemp
>> 17306          diffLevVal(0) = minTemp_diff
>> 17307          diffLevVal(1) = maxTemp_diff
>> 17308          diffLevVal(2) = dTemp_diff
>> 17309          if(ltext) then print("     ### "+titleplot+"
>> "+label+"
>> ilev="+sprinti("%0.3i", ilev)) end if
>> 17310
>> 
>> 
> mplot_2Dfield_xy(namefile,typefile,inforun(0),colorsMap,titleplot,label,LeftStringC(0:1),
>> 
>> 17311                           nx(0:1),ny(0:1),
>> 17312                          
>> lon2dtC_surf(0:1,0:ny_max-1,0:nx_max-1),
>> 
>> 17313                          
>> lat2dtC_surf(0:1,0:ny_max-1,0:nx_max-1),
>> 
>> 17314
>> tempC(0:1,itime,ilev,0:ny_max-1,0:nx_max-1),
>> 17315
>> tempC_diff(itime,ilev,0:ny_max-1,0:nx_max-1),
>> 17316                          
>> minLatF,maxLatF,minLonF,maxLonF,
>> 17317                          
>> minLevelVal,maxLevelVal,levelSpacing,
>> 17318
>> diffLevVal(0),diffLevVal(1),diffLevVal(2))
>> 
>> |
>> |
>> |
>> 
>> end the ERROR message is:
>> 
>> (0)
>> (0)          ### Plot SURF-TEMP
>> rm: temp*.png: No such file or directory
>> 
>> Variable: LeftStringC
>> Type: string
>> Total Size: 16 bytes
>>              2 values
>> Number of Dimensions: 1
>> Dimensions and sizes:   [2]
>> Coordinates:
>> Number Of Attributes: 1
>>    _FillValue : missing
>> 
>> Variable: depth1dtC_surf
>> Type: float
>> Total Size: 800 bytes
>>              200 values
>> Number of Dimensions: 2
>> Dimensions and sizes:   [2] x [deptht | 100]
>> Coordinates:
>>              deptht: [0.5031146..1787.05]
>> Number Of Attributes: 8
>>    axis :       Z
>>    positive :   down
>>    standard_name :      depth
>>    long_name :  depth
>>    units :      m
>>    valid_min :  0.5031146
>>    valid_max :  1787.05
>>    _FillValue : 9.96921e+36
>> 
>> Variable: tempC
>> Type: float
>> Total Size: 892800000 bytes
>>              223200000 values
>> Number of Dimensions: 5
>> Dimensions and sizes:   [2] x [time_counter | 72] x [deptht | 100]
>> x [y |
>> 100] x [x | 155]
>> Coordinates:
>>              time_counter: [3600..259200]
>>              deptht: [0.5031146..1787.05]
>>              y: [41.5..43.5625]
>>              x: [9.35..12.55833]
>> Number Of Attributes: 8
>>    missing_value :      1e+20
>>    coordinates :        time depth lat lon
>>    units :      degC
>>    long_name :  temperature
>>    standard_name :      sea_water_potential_temperature
>>    valid_min :  8.159986
>>    valid_max :  14.30364
>>    _FillValue : 1e+20
>> fatal:Assignment not supported for left-hand type
>> fatal:["Execute.c":8128]:Execute: Error occurred at or near line
>> 17302
>> in file main.ncl
>> 
>> thanks
>> Francesco Trotta
>> 
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk [3] [1]
>> 
>> Links:
>> ------
>> [1] http://mailman.ucar.edu/mailman/listinfo/ncl-talk [3]
> 
> 
> 
> Links:
> ------
> [1] tel:24-07-2014%2019
> [2] tel:303-497-8924
> [3] http://mailman.ucar.edu/mailman/listinfo/ncl-talk


More information about the ncl-talk mailing list