[ncl-talk] reshape error

Sunmin Park mireiyue at gmail.com
Thu Jul 24 11:26:23 MDT 2014


Dear all nil users	

I am trying to get plots from each month and year. One file contains all 7 years and 12 months values. So, I used reshape but I got a problem. I try to follow the reshape example in the website but it is not working. How can I fix it?

Thank you for any help
Sun-

This is what I got 

fatal:Argument type mismatch on argument (0) of (reshape) can not coerce
fatal:["Execute.c":7743]:Execute: Error occurred at or near line 53 in file CMIP5_ec.ncl


; ==============================================================
; Open the file:
; ==============================================================
  fili    = "ec550aer_aero_NorESM1-M_historicalExt_"+version(ii)+"i1p1_200601-201212.nc"
  varname = "ec550aer” 
 filenc       = addfile (diri+fili+".nc", "r")      ; entire file
;  print (varname)
;  print (filenc)

  data   = filenc->$varname$                          ; (time, ver, lat, lon)
;  print (dimsizes(data))
  time =filenc->time
  lev =filenc->lev
  lat =filenc->lat
  lon =filenc->lon
  data at _FillValue= 0

;  printVarSummary(data)
;  print(dimsizes(time))
;  return

  ntim = dimsizes(time)
  nlev = dimsizes(lev)
  nlat = dimsizes(lat)
  nlon = dimsizes(lon)
  nyears = ntim/12

;  printVarSummary(ntim)
;  printVarSummary(nyears)
;  print(ntim)
;  print(nyears)

  ecreshape = reshape(varname,(/nyears,12,nlev,nlat,nlon/))
;  reec550nm = reshape(ecreshape(:,0:2,:,:,:),(/nyears*12,nlev,nlat,nlon/))
  printVarSummary(ecreshape)
;  printVarSummary(ec550nm)
  return


-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140724/e1f25c8e/attachment.html 


More information about the ncl-talk mailing list