<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=Windows-1252">
<style type="text/css" style="display:none;"><!-- P {margin-top:0;margin-bottom:0;} --></style>
</head>
<body dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt;color:#000000;background-color:#FFFFFF;font-family:Calibri,Arial,Helvetica,sans-serif;">
<p>Hi All,</p>
<p>Thanks for the reply Will! </p>
<p>But is there any way to suppress the warning and let the code run? I'm having too many warning.</p>
<p><br>
</p>
<p>I'm copying the 1st part of the code (before doing SVD) here, if anybody could help to clean it up! <span style="font-size: 12pt;">There is no error message but probably I did something wrong .</span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><span style="font-size: 12pt;">Thanks in advance!</span></p>
<p><span style="font-size: 12pt;">Bithi </span></p>
<p><span style="font-size: 12pt;"><br>
</span></p>
<p><br>
</p>
<div>;********************************************************</div>
<div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"</div>
<div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"</div>
<div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"</div>
<div> load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"</div>
<div>;*********************************************************</div>
<div> begin</div>
<div> </div>
<div> ;********************************</div>
<div> ;read binary files</div>
<div> ;********************************</div>
<div> data_path = "/scratch/lustreD/b/bde/seaice_bin/" </div>
<div> ;data_filename= "bt_197812_n07_v02_n.bin"</div>
<div> nrows = 448</div>
<div> ncols = 304</div>
<div> </div>
<div> </div>
<div> ;************* read sic data *************************************************************************</div>
<div> ; documentation of the data at http://nsidc.org/data/docs/daac/nsidc0079_bootstrap_seaice.gd.html </div>
<div> ; 2-byte integer is NCL type "short"</div>
<div> ; divide stored value by 10 to get the percent (SIC values stored as 0-1000)</div>
<div> ; land is registered as 1200 andnorth pole as 1100</div>
<div> ;***************************************************************************************************</div>
<div> </div>
<div> nrec=0</div>
<div> Idims1 = (/448,304/)</div>
<div> </div>
<div> </div>
<div> fils = systemfunc("ls /scratch/lustreD/b/bde/seaice_bin/*.bin")</div>
<div><br>
</div>
<div> SIC = new((/dimsizes(fils),nrows,ncols/),”short") ; predefine array for data files</div>
<div> </div>
<div> do gg =0,dimsizes(fils)-1</div>
<div> setfileoption("bin","ReadByteOrder","LittleEndian")</div>
<div> </div>
<div> SIC(gg,:,:) = fbindirread(fils(gg),nrec,dims1,"short")</div>
<div> end do</div>
<div><br>
</div>
<div> printVarSummary(SIC)</div>
<div> printMinMax(SIC,True)</div>
<div> </div>
<div> </div>
<div> SIC_f= short2flt(SIC)</div>
<div> SIC_f@_FillValue = -999</div>
<div> SIC_f = SIC_f/10</div>
<div> printVarSummary(SIC_f)</div>
<div> printMinMax(SIC_f,True)</div>
<div><br>
</div>
<div> </div>
<div> SIC_f = where(SIC_f .gt. 100,SIC_f@_FillValue,SIC_f) </div>
<div> SIC_f@_FillValue = -999</div>
<div> printVarSummary(SIC_f)</div>
<div> printMinMax(SIC_f,True)</div>
<div> </div>
<div><br>
</div>
<div> </div>
<div> ;*********************** read lat-lon for 25x25 km grid points in polar stereographic projection *</div>
<div> ; documentation for the grid ;http://nsidc.org/data/polar_stereo/tools_geo_pixel.html#psn25_pss25_lats</div>
<div> ; Grids that determine the latitude of a given pixel for the 25 km grids for either hemisphere</div>
<div> ; 4-byte integer(little endian), scaled by 100,000</div>
<div> ; Each array location (i, j) contains the latitude/longitude value at the center of the ;corresponding data grid cells</div>
<div> ; 304 columns x 448 rows, range = [31.102, 89.836] for lats ; 304 columns x 448 rows, range = ;[-180.000, 179.814] for lons</div>
<div> ;****************************************************************************************************</div>
<div><br>
</div>
<div> setfileoption("bin","ReadByteOrder","LittleEndian")</div>
<div> lat = fbindirread("/scratch/lustreD/b/bde/seaice_bin/psn25lats_v3.dat",0,(/nrows,ncols/), "integer") /100000.</div>
<div> lon = fbindirread("/scratch/lustreD/b/bde/seaice_bin/psn25lons_v3.dat",0,(/nrows,ncols/), "integer") /100000.</div>
<div><br>
</div>
<div> lat@units = "degrees_north"</div>
<div> lon@units = "degrees_east"</div>
<div> printVarSummary(lon)</div>
<div> printVarSummary(lat)</div>
<div><br>
</div>
<div> print(max(lon)+" " +min(lon))</div>
<div> print(max(lat)+" " +min(lat))</div>
<div> </div>
<div> SIC_f@lat2d = lat</div>
<div> SIC_f@lon2d = lon</div>
<div><br>
</div>
<div> printVarSummary(SIC_f)</div>
<div> printMinMax(SIC_f,True)</div>
<div><br>
</div>
<div>;************* remove mean ****************8</div>
<div>ice_ano= dim_rmvmean_n_Wrap(SIC_f,0) ;timexlatxlon</div>
<div>printVarSummary(ice_ano)</div>
<div>printMinMax(ice_ano,True)</div>
<div><br>
</div>
<div> if(any(ismissing(ice_ano))) then</div>
<div> print("Your data contains some missing values. Beware.")</div>
<div> end if</div>
<div><br>
</div>
<div><br>
</div>
<div>;; SVD will not contain any data with missingvalue so change fillvalue to 0.0 </div>
<div>;; http://www.ncl.ucar.edu/Support/talk_archives/2013/3756.html</div>
<div><br>
</div>
<div><br>
</div>
<div>ice_ano@_FillValue=0.0</div>
<div>delete(ice_ano@_FillValue)</div>
<div>printVarSummary(ice_ano)</div>
<div><br>
</div>
<div> ;**************************************************</div>
<div> ; split into month and year</div>
<div> ;******************************************************** </div>
<div> ice_ym = new((/12,35,448,304/),"float")</div>
<div><br>
</div>
<div> m = 0 </div>
<div> y = 0</div>
<div><br>
</div>
<div> do ii = 2,421</div>
<div><br>
</div>
<div> ; print(ii)</div>
<div> ; print(m)</div>
<div> ; print(y)</div>
<div><br>
</div>
<div> ice_ym(m,y,:,:) = ice_ano(ii,:,:)</div>
<div><br>
</div>
<div> m = m+1 </div>
<div><br>
</div>
<div> if (m .eq. 12) </div>
<div> y = y+1</div>
<div> m = 0</div>
<div> end if</div>
<div><br>
</div>
<div> end do</div>
<div> printVarSummary(ice_ym)</div>
<div> </div>
<div><br>
</div>
<div> ice_Jan=ice_ym(0,:,:,:)</div>
<div> copy_VarCoords(ice_ym(0,0,:,:),ice_Jan)</div>
<div> printVarSummary(ice_Jan)</div>
<div><br>
</div>
<div> ice_Feb=ice_ym(1,:,:,:)</div>
<div> copy_VarCoords(ice_ym(0,0,:,:),ice_Feb)</div>
<div> printVarSummary(ice_Feb)</div>
<div> </div>
<div> ice_Dec=ice_ym(11,:,:,:)</div>
<div> copy_VarCoords(ice_ym(0,0,:,:),ice_Dec)</div>
<div> printVarSummary(ice_Dec)</div>
<div><br>
</div>
<div><br>
</div>
<div>ice_Wint = new((/3,35,448,304/),"float") </div>
<div>ice_Wint(0,:,:,:)=ice_Dec</div>
<div>ice_Wint(1,:,:,:)=ice_Jan</div>
<div>ice_Wint(2,:,:,:)=ice_Feb</div>
<div> printVarSummary(ice_Wint)</div>
<div> printMinMax(ice_Wint,True)</div>
<div><br>
</div>
<div> ice_djf=dim_avg_n_Wrap(ice_Wint,0)</div>
<div> printVarSummary(ice_djf)</div>
<div> printMinMax(ice_djf,True)</div>
<div><br>
</div>
<div> if(any(ismissing(ice_djf))) then</div>
<div> print("Your data contains some missing values. Beware.")</div>
<div> end if</div>
<div> </div>
<div><br>
</div>
<div> ;***********************************************************************************************************</div>
<div> ; read Z500 data and remove climatology for each winter month</div>
<div> ;***********************************************************************************************************</div>
<div> in = addfile("/scratch/lustreD/b/bde/reanalysis/ERA_data/ERA_z500_lowreso.nc","r")</div>
<div><br>
</div>
<div> lat1 = in->latitude</div>
<div> lon1 = in->longitude</div>
<div> printVarSummary(lat1)</div>
<div> printVarSummary(lon1)</div>
<div> </div>
<div> latz=lat1({90:20})</div>
<div> l1 = dimsizes(latz)</div>
<div> </div>
<div><br>
</div>
<div> z500 = (short2flt(in->z)) ;m2/s2 geopotential</div>
<div> printVarSummary(z500)</div>
<div> printMinMax(z500,True)</div>
<div> z5 = (z500(0,0,:)/9.8) ;geopotential height </div>
<div> </div>
<div> copy_VarCoords(z500,z5)</div>
<div> printVarSummary(z5)</div>
<div> printMinMax(z5,True)</div>
<div><br>
</div>
<div> z_35 =z5(2:421,:,:); ;timesteps for 1979-2013, 35 years</div>
<div> printVarSummary(z_35)</div>
<div> printMinMax(z_35,True)</div>
<div><br>
</div>
<div> zClm = clmMonTLL( z_35 ) ; monthly climatology (12xlatxlon)</div>
<div> printVarSummary(zClm) </div>
<div> printMinMax(zClm,True)</div>
<div><br>
</div>
<div>;************* remove monthly climatology and calculate anomaly for each month *************</div>
<div> zAno= calcMonAnomTLL (z_35,zClm)</div>
<div> printVarSummary(zAno) </div>
<div> printMinMax(zAno,True) ;time(420=35*12)xlatxlon for zanomaly</div>
<div><br>
</div>
<div><br>
</div>
<div> if(any(ismissing(zAno))) then</div>
<div> print("Your data contains some missing values. Beware.")</div>
<div> end if</div>
<div><br>
</div>
<div><br>
</div>
<div>;; SVD will not contain any data with missingvalue so change fillvalue to 0.0 </div>
<div> zAno@_FillValue=0.0</div>
<div> delete(zAno@_FillValue)</div>
<div> printVarSummary(zAno)</div>
<div> printMinMax(zAno,True)</div>
<div><br>
</div>
<div> if(any(ismissing(zAno))) then</div>
<div> print("Your data contains some missing values. Beware.")</div>
<div> end if</div>
<div><br>
</div>
<div><br>
</div>
<div>;********************* split in monthsxyear of the z-anomaly ***********************************</div>
<div> z_ym = new((/12,35,dimsizes(lat1),dimsizes(lon1)/),"float")</div>
<div><br>
</div>
<div> m = 0 </div>
<div> y = 0</div>
<div><br>
</div>
<div> do ii = 0,419</div>
<div><br>
</div>
<div> z_ym(m,y,:,:) = zAno(ii,:,:)</div>
<div><br>
</div>
<div> m = m+1 </div>
<div><br>
</div>
<div> if (m .eq. 12) </div>
<div> y = y+1</div>
<div> m = 0</div>
<div> end if</div>
<div> end do</div>
<div> </div>
<div> printVarSummary(z_ym)</div>
<div> printMinMax(z_ym,True)</div>
<div><br>
</div>
<div><br>
</div>
<div> z_Jan=z_ym(0,:,:,:)</div>
<div> printVarSummary(z_Jan)</div>
<div><br>
</div>
<div> z_Feb=z_ym(1,:,:,:)</div>
<div> printVarSummary(z_Feb)</div>
<div> </div>
<div> z_Dec=z_ym(11,:,:,:)</div>
<div> printVarSummary(z_Dec)</div>
<div><br>
</div>
<div><br>
</div>
<div>z_Wint = new((/3,35,dimsizes(latz),dimsizes(lon1)/),"float") </div>
<div>z_Wint(0,:,:,:)=z_Dec(:,{90:20},:)</div>
<div>z_Wint(1,:,:,:)=z_Jan(:,{90:20},:)</div>
<div>z_Wint(2,:,:,:)=z_Feb(:,{90:20},:)</div>
<div> printVarSummary(z_Wint)</div>
<div> printMinMax(z_Wint,True)</div>
<div><br>
</div>
<div>z_djf=dim_avg_n_Wrap(z_Wint,0)</div>
<div>z_djf!0="time"</div>
<div> printVarSummary(z_djf)</div>
<div> printMinMax(z_djf,True)</div>
<div><br>
</div>
<div>if(any(ismissing(z_djf))) then</div>
<div> print("Your data contains some missing values. Beware.")</div>
<div> end if</div>
<div><br>
</div>
<div><br>
</div>
<div> ;***********************************************************</div>
<div> ; calculate SVD</div>
<div> ;*****************************************<span style="font-size: 12pt;"> *******</span></div>
<div><span style="font-size: 12pt;"> </span></div>
<div><span style="font-size: 12pt;"> ;posted before</span></div>
<div></div>
<div><br>
</div>
<div></div>
<div><br>
</div>
<div></div>
<div> end</div>
<div><br>
</div>
<br>
<div style="color: rgb(0, 0, 0);">
<hr tabindex="-1" style="display:inline-block; width:98%">
<div id="divRplyFwdMsg" dir="ltr"><font face="Calibri, sans-serif" color="#000000" style="font-size:11pt"><b>From:</b> Will Hobbs <will.hobbs@utas.edu.au><br>
<b>Sent:</b> Wednesday, December 16, 2015 6:29 PM<br>
<b>To:</b> Bithi De; ncl-talk@ucar.edu<br>
<b>Subject:</b> Re: [ncl-talk] How to resolve SVD warning: column contains constant</font>
<div> </div>
</div>
<div>
<div>Bithi</div>
<div><br>
</div>
<div>You will have constant values in the SIC array anywhere that is a) land, b) perenially ice covered or c) never ice covered. Any of these conditions are physically plausible for some data points in either the Arctic or Southern Ocean, and you would get
the same warning with a regular cross-correlation using escort()</div>
<div><br>
</div>
<div>In short, it's not (necessarily) a problem and is encountered in almost all gridded ocean data.</div>
<div><br>
</div>
<div>Will</div>
<div><br>
</div>
<span id="OLK_SRC_BODY_SECTION">
<div style="font-family:Calibri; font-size:11pt; text-align:left; color:black; border-bottom:medium none; border-left:medium none; padding-bottom:0in; padding-left:0in; padding-right:0in; border-top:#b5c4df 1pt solid; border-right:medium none; padding-top:3pt">
<span style="font-weight:bold">From: </span>Bithi De <<a href="mailto:bde@purdue.edu">bde@purdue.edu</a>><br>
<span style="font-weight:bold">Date: </span>Thursday, 17 December 2015 10:19 AM<br>
<span style="font-weight:bold">To: </span>"<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>" <<a href="mailto:ncl-talk@ucar.edu">ncl-talk@ucar.edu</a>><br>
<span style="font-weight:bold">Subject: </span>[ncl-talk] How to resolve SVD warning: column contains constant<br>
</div>
<div><br>
</div>
<div>
<div dir="ltr">
<div id="divtagdefaultwrapper" style="font-size:12pt; color:#000000; background-color:#FFFFFF; font-family:Calibri,Arial,Helvetica,sans-serif">
<p>Hi All,</p>
<p>I am calculating SVD between seaice concentration anomaly (documentation of the data at
<a href="http://nsidc.org/data/docs/daac/nsidc0079_bootstrap_seaice.gd.html">http://nsidc.org/data/docs/daac/nsidc0079_bootstrap_seaice.gd.html</a> ) and geopotential height anomaly from ERA-interim data, for winter(35years). I am not getting any error until
the step for calculating SVD. <br>
</p>
<p>The part of my code is as follows:</p>
<p>;***********************************************************<br>
; calculate SVD<br>
;**************************************************<br>
; Z-anomaly (timexlatxlon)<br>
</p>
<p> nxy = dimsizes(lon1)*dimsizes(latz) ;size(space)<br>
ntim = 35 ;size(time)<br>
<br>
; reorder so time varying fast <br>
; create spacextime matrix for Z_ano</p>
<p><br>
Z = z_djf(longitude|:,latitude|:,time|:)<br>
printVarSummary(Z)<br>
Z2 = onedtond(ndtooned(Z),(/nxy,ntim/)) ;convert into spacextime matrix<br>
printVarSummary(Z2)<br>
printMinMax(Z2,True)<br>
<br>
Z2!0="space"<br>
Z2!1="time"<br>
<br>
</p>
<p> <a href="mailto:Z2@_FillValue=0.0">Z2@_FillValue=0.0</a><br>
delete(Z2@_FillValue)<br>
printVarSummary(Z2)<br>
printMinMax(Z2,True)<br>
<br>
if(any(ismissing(Z2))) then<br>
print("Your data contains some missing values. Beware.")<br>
end if ; did not get any error<br>
<br>
;********* SIC anomaly *********************<br>
; create spacextime matrix for sic_ano(timex448x304) ; 448rows x304columns in 25kmx25km grid<br>
<br>
<br>
xy=448*304<br>
si = ice_djf(::-1,::-1,::-1) ;dimension reordering -->448x304xtime<br>
printVarSummary(si)</p>
<p><br>
Si2 = onedtond(ndtooned(si),(/xy,ntim/)) ;convert into (spacextime)<br>
printVarSummary(Si2)<br>
printMinMax(Si2,True)</p>
<p>Si2!0="space"<br>
Si2!1="time"<br>
<br>
<a href="mailto:Si2@_FillValue=0.0">Si2@_FillValue=0.0</a><br>
delete(Si2@_FillValue)<br>
printVarSummary(Si2)<br>
printMinMax(Si2,True)<br>
<br>
if(any(ismissing(Si2))) then<br>
print("Your data contains some missing values. Beware.")<br>
end if ; did not get any error<br>
<br>
<br>
; check if some columns has constant value<br>
p2d=Si2(time|:,space|:)<br>
printVarSummary(p2d)<br>
<br>
p2d_dims = dimsizes(p2d) ; I assume this is time x p1d<br>
<br>
ntim = p2d_dims(0)<br>
np1d = p2d_dims(1)<br>
<br>
;do i=0,np1d-1<br>
;pmin = min(p2d(:,i))<br>
; pmax = max(p2d(:,i))<br>
;if(pmin.eq.pmax) then<br>
; print("p2d contains all constant values at np1d = " + i)<br>
;end if<br>
;end do <br>
exit<br>
<br>
; delete([/Z,Zano,SIC,si/])<br>
<br>
;***************************************************<br>
;spatial plot of 1st mode of left and right singular vector<br>
;************************************************************* <br>
<br>
nsvd = nxy<br>
svLeft = new((/nsvd,nxy/),float) ; pre-allocate space<br>
svRight = new((/nsvd,xy/),float) <br>
<br>
pc = svdcov_sv(Z2,Si2,nsvd,svLeft,svRight)<br>
<br>
printVarSummary(pc) </p>
<p> end<br>
</p>
<p>;; giving warning ==> all Y values in columns are missing or constant</p>
<h1>*********</h1>
<p>I checked for Si2 following the <a id="LPlnk886053" href="http://www.ncl.ucar.edu/Support/talk_archives/2011/2803.html">
http://www.ncl.ucar.edu/Support/talk_archives/2011/2803.html</a> and it is shows it has constant value.
<br>
</p>
<p>Could you suggest how I can solve it?</p>
<p><br>
</p>
<p>Thanks in advance!</p>
<p>Bithi De</p>
<p>Purdue University<br>
</p>
<p><br>
</p>
<br>
<p></p>
<p><br>
</p>
</div>
</div>
</div>
</span>
<p style="font-size:10pt; line-height:10pt; font-family:Calibri,sans-serif"><br>
<br>
University of Tasmania Electronic Communications Policy (December, 2014). <br>
This email is confidential, and is for the intended recipient only. Access, disclosure, copying, distribution, or reliance on any of it by anyone outside the intended recipient organisation is prohibited and may be a criminal offence. Please delete if obtained
in error and email confirmation to the sender. The views expressed in this email are not necessarily the views of the University of Tasmania, unless clearly intended otherwise.
</p>
</div>
</div>
</div>
</body>
</html>