Re: Is this the new bug of Version 5?

From: Dennis Shea <shea_at_nyahnyahspammersnyahnyah>
Date: Wed, 16 Apr 2008 09:47:32 -0600

Hello,

I can not address the "coredump".

However, NCL has built-in functions for performing EOFs and
varimax rotation: eofunc_varimax and then reorder the output
eof_varimax_reorder.

http://www.ncl.ucar.edu/Document/Functions/Built-in/eofunc_varimax.shtml
http://www.ncl.ucar.edu/Document/Functions/Contributed/eofunc_varimax_reorder.shtml
Note: due to a naming error the actual function name is:
eof_varimax_reorder.

Comments on your NCL code:

[1] Why are you preallocating memory for variables like "lat", "lon"...?
If they are on the netCDF file

f = addfile(allfiles(0), "r") ; open 1st file ....
lat = f->lat
lon= f->lon

[2] Rather than allocate "pr" and then fill it piecewise, why not
use "addfiles_GetVar" ?

http://www.ncl.ucar.edu/Document/Functions/Contributed/addfiles_GetVar.shtml

So, avoid the loop ....

pr = addfiles_GetVar(f,fils,"px")
printVarSummary( pr )

[3] Always, load shea_util.ncl *after* contributed.ncl

load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"

leo_aries wrote:
> Hi, all
> I often use the NCL script ( along with the fotran program of
> fparreof.f ) to calculate the REOF and it run good
> in the old version of NCL. Today I found that the same script can not
> run as well as before and the message tell
> that it will cause a "coredump". Because my NCL has recently been
> updated to version 5.0, I doubt that it is a new bug.
> The script is below , anyone can show me a hand? Thanks a lot!
> external PRNT "./fparreof.so"
> +2 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl"
> +3 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl"
> +4 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
> +5 load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl"
> +8 begin
> all_files = systemfunc("ls ../*.nc")
> +17
> +18 np = dimsizes(all_files)
> +19 nd = 40
> +20 print("using "+np+" data in EOFs")
> +21
> +22 pr = new((/np,nd/),"float")
> +23 lon = new((/np/),"float")
> +24 lat = new((/np/),"float")
> +25 do i =0,np-1 ; read nc files and store in a array
> +26 print("open "+all_files(i))
> +27 fi = addfile(all_files(i),"r")
> +28 x = fi->px
> +30 pr(i,:) = x({time|1961:2000})
> +33 delete(x)
> +34 end do
>
> ; define input and output array
> +44 var1 = transpose(dim_standardize(pr,0))
> +45 ;var1 = transpose(pr) ; input, notice: leftmost dim vary fast in
> NCL while the rightmost most in Fortran
> +46 ; refer to "the NCL/Fortran Array Mapping" in NCL Mannual
> +47 reof = new((/5,np/),float) ; define rotated eof pattern variable
> (first 5 reof patterns retrieved)
> +48 pctreof = new((/5/),float) ; define % variance var
> +49 ts_reof = new((/nd,5/),"float")
> +50 eofs = new((/5,np/),float)
> +51 pcteof = new((/5/),float) ; define % variance var
> +52 ts_eof = new((/nd,5/),"float")
> +53
> +54
> +55 ;mx = npts ; # total grid pts in area
> +56 mx = np ; total number in space ( proxy )
> +57 ; there is no missing in the input pr data, so mx = np
> +58 ;m = cnt ; # grid pts in area with data (e.g. over land)
> +59 m = np ; number (of no missing ) in space
> +60 ; In my reof case,m=mx=np because there is no missing in the input
> pr data
> +61 ;n = ntim ; # times
> +62 n = nd
> +63 ip = 5 ; modes calculated
> +64 kt = 15 ; iteration time
> +65
> +66 print("mx = "+mx+" m= "+m+" n= "+n)
> +67
> +68 ;WAPIT sends var1 and receives reof and pctr
> +69
> PRNT::rotated(var1,mx,m,n,ip,kt,reof,pctreof,ts_reof,eofs,pcteof,ts_eof)
> ; call subroutine
> * And the script just cause some error when calling subroutine
> Thanks
> Lin
>

_______________________________________________
ncl-talk mailing list
ncl-talk_at_ucar.edu
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Wed Apr 16 2008 - 09:47:32 MDT

This archive was generated by hypermail 2.2.0 : Wed Apr 16 2008 - 11:00:26 MDT