Dear all,
Have been experiencing a couple of problems in eof analysis using some of
the scripts on ncl sites. Through have tried using some of the experiences
before, posted online, have not managed to solve my difficulties.
Any suggestion is really appreciated.
*
Please see process below;*
Variable: eof_ts
Type: float
Total Size: 2880 bytes
720 values
Number of Dimensions: 2
Dimensions and sizes: [evn | 3] x [time | 240]
Coordinates:
evn: [1..3]
Number Of Attributes: 3
ts_mean : ( -59.76283, -171.605, 35.54322 )
matrix : covariance
_FillValue : 1e+30
(0) check_for_y_lat_coord: Warning: Data either does not contain a
valid latitude coordinate array or doesn't contain one at all.
(0) A valid latitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0) 'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
.
.
.
'degrees_north' 'degrees-north' 'degree_north' 'degrees north'
'degrees_N' 'Degrees_north' 'degree_N' 'degreeN' 'degreesN' 'deg north'
(0) check_for_lon_coord: Warning: Data either does not contain a valid
longitude coordinate array or doesn't contain one at all.
(0) A valid longitude coordinate array should have a 'units' attribute
equal to one of the following values:
(0) 'degrees_east' 'degrees-east' 'degree_east' 'degrees east'
'degrees_E' 'Degrees_east' 'degree_E' 'degreeE' 'degreesE' 'deg east'
fatal:No coordinate variable exists for dimension (time) in variable
(eof_ts)
fatal:Execute: Error occurred at or near line 144 in file eofcordex3.ncl
*** modified scipt :**
**
*; ==============================================================
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
begin
; ==============================================================
; User defined parameters that specify region of globe and
; ==============================================================
latS = -12.
latN = 23.
lonL = 20.
lonR = 60.
yrStrt = 1989
yrLast = 2008
season = "MAM"
neof = 3
optEOF = True
optEOF@jopt = 0
optETS = False
; ==============================================================
; Open the file: Read only the user specified period
; ==============================================================
dir = "/scratch/DATA/CORDEX/UC-WRF/"
f = addfile
(dir+"AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc", "r")
TIME = f->time
YYYY = cd_calendar(TIME, -1)/100
iYYYY = ind(YYYY.ge.yrStrt .and. YYYY.le.yrLast)
pr = f->pr(:,:,:)
print(dimsizes(pr))
x = pr*86400
printVarSummary(x) ; variable overview
nlat = 249
nlon = 209
lat = latGlobeFo(nlat, "lat", "latitude", "degrees_north")
lon = lonGlobeFo(nlon, "lon", "longitude", "degrees_east")
printVarSummary(lat)
printVarSummary(lon)
x!0 = "time"
x!1 = "lat"
x!2 = "lon"
; x&lat = x&lat
; x&lon = x&lon
; x&time = Months
; x&lat = "degrees_north"
; x&lon = "degrees_east"
printVarSummary(x)
; x&lat@units = "degrees_north"
; x&lon@units = "degrees_east"
; ==============================================================
;compute desired monthly climatology and monthly anomalies
;===============================================================
xClm = clmMonTLL(x)
printVarSummary(xClm)
xAnom = calcMonAnomTLL(x,xClm)
printVarSummary(xAnom)
; ================================================================
; Reorder (lat,lon,time) the *weighted* input data
; Access the area of interest via coordinate subscripting
; ================================================================
; xr = xAnom(lat|:,lon|:,time|:)
xr = x(lat|:,lon|:,time|:)
eof = eofunc_Wrap(xr, neof, optEOF)
; eof =-1*eof
eof_ts = eofunc_ts_Wrap (xr, eof, optETS)
printVarSummary( eof )
printVarSummary( eof_ts )
;============================================================
; PLOTS
;============================================================
xwks = gsn_open_wks("x11","eof")
pswks = gsn_open_wks("eps","Africa-WRF-Cordex_eof-mam1989-2008")
gsn_define_colormap(xwks,"BlWhRe") ; choose colormap
gsn_define_colormap(pswks,"BlWhRe")
plot = new(neof,graphic) ; create graphic array
; only needed if paneling
; EOF patterns
res = True
res@gsnDraw = False ; don't draw yet
res@gsnFrame = False ; don't advance frame yet
res@gsnSpreadColors = True ; spread out color table
res@gsnAddCyclic = False ; plotted dataa are not cyclic
res@mpFillOn = False ; turn off map fill
res@mpOutlineBoundarySets = "National"
res@mpGeophysicalLineColor = "Navy"
; res@mpGeophysicalLineThickness = 1.5
res@mpMinLatF = latS ; zoom in on map
res@mpMaxLatF = latN
res@mpMinLonF = lonL
res@mpMaxLonF = lonR
res@cnFillOn = True ; turn on color fill
res@cnLinesOn = False ; True is default
; res@cnLineLabelsOn = False ; True is default
res@lbLabelBarOn = False ; turn off individual lb's
; set symmetric plot min/max
symMinMaxPlt(eof, 16, False, res) ; contributed.ncl
; panel plot only resources
resP = True ; modify the panel plot
resP@gsnMaximize = True ; large format
resP@gsnPanelLabelBar = True ; add common colorbar
resP@lbLabelAutoStride = True ; auto stride on
;*******************************************
; first plot
;*******************************************
do n=0,neof-1
res@gsnLeftString = "EOF "+(n+1)
res@gsnRightString = sprintf("%5.1f", eof@pcvar(n)) +"%"
plot(n)=gsn_csm_contour_map_ce(xwks,eof(n,:,:),res)
plot(n)=gsn_csm_contour_map_ce(pswks,eof(n,:,:),res)
end do
gsn_panel(xwks,plot,(/neof,1/),resP) ; now draw as one plot
gsn_panel(pswks,plot,(/neof,1/),resP)
;*******************************************
; second plot
;*******************************************
;; EOF time series [bar form]
time = eof_ts&time
do n=0,neof-1
ascii_file1 = "WRF-cordex_eof1-mam1989-2008.txt"
ascii_file2 = "WRF-cordex_eof2-mam1989-2008.txt"
ascii_file3 = "WRF-cordex_eof3-mam1989-2008.txt"
asciiwrite(ascii_file1,eof_ts(0,:))
asciiwrite(ascii_file2,eof_ts(1,:))
asciiwrite(ascii_file3,eof_ts(2,:))
end do
end
script also attached.
You can find my data here :
https://dropbox.uconn.edu/dropbox?n=AFRICA_UC-WRF311_CTL_ERAINT_MM_50km_1989-2008_pr.nc&p=WzAFDxwPm1IMFjpIL
Thanks in advance.
-- Owanda Otieno Department of Natural Resources and the Environment University of Connecticut 1376 Storrs Road, Unit 4087 Storrs, CT 06269-4087 Phone: (860) 486-1876 -- Owanda Otieno Department of Natural Resources and the Environment University of Connecticut 1376 Storrs Road, Unit 4087 Storrs, CT 06269-4087 Phone: (860) 486-1876 -- Owanda Otieno Department of Natural Resources and the Environment University of Connecticut 1376 Storrs Road, Unit 4087 Storrs, CT 06269-4087 Phone: (860) 486-1876
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
This archive was generated by hypermail 2.1.8 : Mon Mar 05 2012 - 14:12:07 MST