Hi, all
I want to do a SVD analysis between sea ice (time,lat,lon) and slp(time,lat,lon).
The SVD function of NCL do not allow the missing value, but the sea ice grid datas often
contain some missing values. So My question is how to change the 3-dimension array of sea
ice with some _FillValue points into a 2-dimension(required by the SVD function) array without
_FillValue points.
I write some script to solve it, but it is a little fussy. Anyone could show me a easy way?
possiblely, without using loops. Thanks!
Here below is my script:
+2 begin
+3
+6 fi = addfile("/dgpfs/fs1/linxiang/Seaice/HadISST_ice.nc","r")
+7 x = fi->ice(1308:1655,{-50.5:},:) ; Jan 1979 to Dec 2007, 348 months in total
+8
+9 lat = x&lat
+10 lon = x&lon
+11 printVarSummary(x)
+12
+13 numbers = new((/dimsizes(x&lat),dimsizes(x&lon)/),"integer")
+14 do i = 0,dimsizes(x&lat)-1
+15 do j = 0,dimsizes(x&lon)-1
+16 numbers(i,j) = num(x(:,i,j).ne.x@_FillValue)
+17 end do
+18 end do
+19
+20 nx = num(numbers.eq.348)
+21
+22 y = new((/nx,348/),"float")
+23 ylat = new((/nx/),"float")
+24 ylon = new((/nx/),"float")
+25
+26 n = 0
+27 do i = 0,dimsizes(x&lat)-1
+28 do j = 0,dimsizes(x&lon)-1
+29 if(all(.not.ismissing(x(:,i,j)))) then
+30 y(n,:) = x(:,i,j)
+31 ylat(n) = lat(i)
+32 ylon(n) = lon(j)
+33 n = n+1
+34 end if
+35 end do
+36 end do
end
Regards
Lin
2008-10-04
leo.aries.g
_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sat Oct 04 2008 - 21:48:28 MDT
This archive was generated by hypermail 2.2.0 : Tue Oct 07 2008 - 09:09:48 MDT