[ncl-talk] How to resolve SVD warning: column contains constant

Bithi De bde at purdue.edu
Wed Dec 16 16:19:46 MST 2015


Hi All,

I am calculating SVD between seaice concentration anomaly (documentation of the data at   http://nsidc.org/data/docs/daac/nsidc0079_bootstrap_seaice.gd.html ) and geopotential height anomaly from ERA-interim data, for winter(35years). I am not getting any error until the step for calculating SVD.

The part of my code is as follows:

;***********************************************************
   ; calculate SVD
 ;**************************************************
  ; Z-anomaly (timexlatxlon)

   nxy = dimsizes(lon1)*dimsizes(latz)   ;size(space)
    ntim = 35                                           ;size(time)

   ; reorder so time varying fast
   ; create spacextime matrix for Z_ano

    Z = z_djf(longitude|:,latitude|:,time|:)
    printVarSummary(Z)
    Z2 = onedtond(ndtooned(Z),(/nxy,ntim/))  ;convert into spacextime matrix
    printVarSummary(Z2)
    printMinMax(Z2,True)

Z2!0="space"
Z2!1="time"


  Z2 at _FillValue=0.0
 delete(Z2 at _FillValue)
 printVarSummary(Z2)
 printMinMax(Z2,True)

 if(any(ismissing(Z2))) then
    print("Your data contains some missing values. Beware.")
  end if    ; did not get any error

   ;********* SIC anomaly *********************
   ; create spacextime matrix for sic_ano(timex448x304) ; 448rows x304columns in 25kmx25km grid


  xy=448*304
  si = ice_djf(::-1,::-1,::-1)                                  ;dimension reordering -->448x304xtime
  printVarSummary(si)

    Si2 = onedtond(ndtooned(si),(/xy,ntim/))        ;convert into (spacextime)
    printVarSummary(Si2)
    printMinMax(Si2,True)

Si2!0="space"
Si2!1="time"

 Si2 at _FillValue=0.0
 delete(Si2 at _FillValue)
 printVarSummary(Si2)
 printMinMax(Si2,True)

 if(any(ismissing(Si2))) then
    print("Your data contains some missing values. Beware.")
  end if                                                                                           ; did not get any error


; check if some columns has constant value
p2d=Si2(time|:,space|:)
printVarSummary(p2d)

p2d_dims = dimsizes(p2d) ; I assume this is time x p1d

ntim = p2d_dims(0)
np1d = p2d_dims(1)

;do i=0,np1d-1
  ;pmin = min(p2d(:,i))
 ; pmax = max(p2d(:,i))
  ;if(pmin.eq.pmax) then
  ;  print("p2d contains all constant values at np1d = " + i)
  ;end if
;end do
  exit

  ; delete([/Z,Zano,SIC,si/])

   ;***************************************************
   ;spatial plot of 1st mode of left and right singular vector
   ;*************************************************************

       nsvd = nxy
       svLeft = new((/nsvd,nxy/),float)   ; pre-allocate space
        svRight = new((/nsvd,xy/),float)

    pc = svdcov_sv(Z2,Si2,nsvd,svLeft,svRight)

   printVarSummary(pc)

  end

;; giving warning ==> all Y values in columns are missing or constant

*********

I checked for Si2 following the http://www.ncl.ucar.edu/Support/talk_archives/2011/2803.html and it is shows it has constant value.

Could you suggest how I can solve it?


Thanks in advance!

Bithi De

Purdue University



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


More information about the ncl-talk mailing list