[ncl-talk] sub: EOF issue

dale zuri dalezuri at gmail.com
Fri Mar 19 11:14:54 MDT 2021


Hi NCL user,

I would appreciate any help to fix this issue. Although the data dimension
looks okay, this error keeps coming.

Thanks
DZ

fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be
coerced to type of left hand side
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 81 in file
eof-ensemble.ncl

fatal:["NclVar.c":1390]:Assignment type mismatch, right hand side can't be
coerced to type of left hand side
fatal:["Execute.c":8637]:Execute: Error occurred at or near line 120 in
file eof-ensemble.ncl

Variable: xJA
Type: float
Total Size: 2246400 bytes
            561600 values
Number of Dimensions: 3
Dimensions and sizes: [time | 26] x [lat | 75] x [lon | 288]
Coordinates:
            time: [  31..9156]
            lat: [20.26178010471205..  90]
            lon: [   0..358.75]
Number Of Attributes: 1
  NMO : 0

*Code: *
xJA = month_to_season (Avg, "DJF")
printVarSummary(xJA)
  ;nyrs   = dimsizes(var&time)
  ;printVarSummary(var)

; =================================================================
; create weights:  sqrt(cos(lat))   [or sqrt(gw) ] for covariance
; =================================================================
  rad    = 4.0*atan(1.0)/180.0
  clat   = cos(rad*xJA&lat)
  clat   = where(clat.lt.0, 0.0, clat)  ; avoid a potential numerical issue
at pole
  clat   = sqrt( clat )  ; avoid a potential numerical issue at pole

; =================================================================
; weight all observations
; =================================================================
  wvar   = xJA                                  ; copy meta data
  printVarSummary(wvar)
  wvar   = xJA*conform(xJA, clat, 1) ; *line 81*
 ; wvar at long_name = "Wgt: "+wvar at long_name
; =================================================================
; EOF
; Reorder (lat,lon,time) the *weighted* input data
; Access the area of interest via coordinate subscripting
; =================================================================
  x      = wvar(lat|:,lon|:,time|:)

  eof    = eofunc_Wrap(x, neof, optEOF)
  eof_ts = eofunc_ts_Wrap (x, eof, optETS)
printVarSummary( eof )
  printVarSummary( eof_ts )
return
; =================================================================
; Perform varimax rotation
; =================================================================

  eof_rot = eofunc_varimax_Wrap( eof, 1 )
  printVarSummary( eof_rot )
  print("eof_rot: min="+min(eof_rot)+"   max="+max(eof_rot) )

; =================================================================
; put into descending order
; =================================================================

  eofunc_varimax_reorder( eof_rot )
  printVarSummary( eof_rot )

; =================================================================
; Normalize time series: Sum spatial weights over the area of used
; =================================================================

  dimx   = dimsizes( x )
  mln    = dimx(1)
  sumWgt = mln*sum( clat )
  printVarSummary( sumWgt )
print(sumWgt)
  eof_ts = eof_ts/sumWgt ; *line 120*
return
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://mailman.ucar.edu/pipermail/ncl-talk/attachments/20210319/dc828ad2/attachment.html>


More information about the ncl-talk mailing list