[ncl-talk] Segmentation fault
Arnold.Sullivan at csiro.au
Arnold.Sullivan at csiro.au
Wed Jul 23 23:16:24 MDT 2014
Hi there,
Trying to generate high resolution grid information and I got error message “Segmentation fault”. (The resolution is 432x234. N216)
The script can run 96x72 hardly on 192x144 but totally not able to run on 432x234.
Any suggestion to trick NCL??
Regards,
Arnold
The script is attached:
;************************************************
; Calculate T, U, V, C-Cell grid information
;
;************************************************
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"
load "$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl"
;************************************************
begin
;************************************************
resGrid = "N216" ;; "N48" ;; "N96"
if (resGrid .eq. "N48") then
nLonDims = 96
nLatDims = 72
end if
if (resGrid .eq. "N96") then
nLonDims = 192
nLatDims = 144
end if
if (resGrid .eq. "N216") then
nLonDims = 432
nLatDims = 234
end if
nVert = 4
nTLon = nLonDims
nTLat = nLatDims
nULon = nLonDims
nULat = nLatDims
nVLon = nLonDims
nVLat = nLatDims+1
nCLon = nLonDims
nCLat = nLatDims
;************************
; basic grid info
;************************
grid_x_Temp = fspan(0,360,nULon+1)
grid_x_T = grid_x_Temp(0:nULon-1)+360./nULon/2.
grid_y_Temp = fspan(0,180,nULat+1)-90
grid_y_T = grid_y_Temp(0:nULat-1)+180./nULat/2.
grid_x_Cemp = fspan(0,360,nULon+1)+360./nULon/2.
grid_x_C = grid_x_Cemp(0:nULon-1)-360./nULon/2.
grid_y_Cemp = fspan(0,180,nULat+1)-90+180./(nULat)/2.
grid_y_C = fspan(0,180,nULat+1)-90
if (grid_y_C(0) .le. -90) then
grid_y_C(0) = -89.995
end if
if (grid_y_C(nULat) .ge. 90) then
grid_y_C(nULat) = 89.995
end if
;printVarSummary(grid_x_T)
;************************
; setting new varialbes
;************************
x_T = new((/nTLat,nTLon/),float)
y_T = new((/nTLat,nTLon/),float)
x_U = new((/nULat,nULon/),float)
y_U = new((/nULat,nULon/),float)
x_V = new((/nVLat,nVLon/),float)
y_V = new((/nVLat,nVLon/),float)
x_vert_T = new((/nVert,nTLat,nTLon/),float)
y_vert_T = new((/nVert,nTLat,nTLon/),float)
x_vert_U = new((/nVert,nULat,nULon/),float)
y_vert_U = new((/nVert,nULat,nULon/),float)
x_vert_V = new((/nVert,nVLat,nVLon/),float)
y_vert_V = new((/nVert,nVLat,nVLon/),float)
; x_vert_C = new((/nVert,nCLat,nCLon/),float)
; y_vert_C = new((/nVert,nCLat,nCLon/),float)
;;**************************
;; T-Cell
;;**************************
do i=0,nTLon-1
y_T(:,i) = grid_y_T ;; "Center grid y"
do j=0,nTLat-1
x_T(j,:) = grid_x_T ;; "Center grid x"
x_vert_T(0,j,i) = grid_x_Temp(i)
x_vert_T(1,j,i) = grid_x_Temp(i+1)
x_vert_T(2,j,i) = grid_x_Temp(i+1)
x_vert_T(3,j,i) = grid_x_Temp(i)
if ( j .eq. 0 ) then
y_vert_T(0,j,i) = -89.9995
y_vert_T(1,j,i) = -89.9995
else
y_vert_T(0,j,i) = grid_y_Temp(j)
y_vert_T(1,j,i) = grid_y_Temp(j)
end if
if ( j .eq. nTLat-1 ) then
y_vert_T(2,j,i) = 89.9995
y_vert_T(3,j,i) = 89.9995
else
y_vert_T(2,j,i) = grid_y_Temp(j+1)
y_vert_T(3,j,i) = grid_y_Temp(j+1)
end if
end do
end do
x_T!0 = (/"nx1"/)
x_T!1 = (/"ny1"/)
y_T!0 = (/"nx1"/)
y_T!1 = (/"ny1"/)
x_vert_T!0 = (/"nc1"/)
x_vert_T!1 = (/"nx1"/)
x_vert_T!2 = (/"ny1"/)
y_vert_T!0 = (/"nc1"/)
y_vert_T!1 = (/"nx1"/)
y_vert_T!2 = (/"ny1"/)
;;**************************
;; U-Cell
;;**************************
do i=0,nULon-1
y_U(:,i) = grid_y_T ;; "Center grid y"
do j=0,nULat-1
x_U(j,:) = grid_x_C ;; "Center grid x"
if ( i .eq. 0 ) then
x_vert_U(0,j,i) = 360-360./nULon/2.
x_vert_U(3,j,i) = 360-360./nULon/2.
else
x_vert_U(0,j,i) = grid_x_Cemp(i-1)
x_vert_U(3,j,i) = grid_x_Cemp(i-1)
end if
x_vert_U(1,j,i) = grid_x_Cemp(i)
x_vert_U(2,j,i) = grid_x_Cemp(i)
if ( j .eq. 0 ) then
y_vert_U(0,j,i) = -89.9995
y_vert_U(1,j,i) = -89.9995
else
y_vert_U(0,j,i) = grid_y_Temp(j)
y_vert_U(1,j,i) = grid_y_Temp(j)
end if
if ( j .eq. nULat-1 ) then
y_vert_U(2,j,i) = 89.9995
y_vert_U(3,j,i) = 89.9995
else
y_vert_U(2,j,i) = grid_y_Temp(j+1)
y_vert_U(3,j,i) = grid_y_Temp(j+1)
end if
end do
end do
x_U!0 = (/"nx2"/)
x_U!1 = (/"ny2"/)
y_U!0 = (/"nx2"/)
y_U!1 = (/"ny2"/)
x_vert_U!0 = (/"nc2"/)
x_vert_U!1 = (/"nx2"/)
x_vert_U!2 = (/"ny2"/)
y_vert_U!0 = (/"nc2"/)
y_vert_U!1 = (/"nx2"/)
y_vert_U!2 = (/"ny2"/)
;;**************************
;; V-Cell
;;**************************
do i=0,nVLon-1
y_V(:,i) = grid_y_C ;; "Center grid y"
do j=0,nVLat-1
x_V(j,:) = grid_x_T ;; "Center grid x"
x_vert_V(0,j,i) = grid_x_Temp(i)
x_vert_V(1,j,i) = grid_x_Temp(i+1)
x_vert_V(2,j,i) = grid_x_Temp(i+1)
x_vert_V(3,j,i) = grid_x_Temp(i)
if ( j .eq. 0 ) then
y_vert_V(0,j,i) = -89.9995
y_vert_V(1,j,i) = -89.9995
else
y_vert_V(0,j,i) = grid_y_Cemp(j-1)
y_vert_V(1,j,i) = grid_y_Cemp(j-1)
end if
if ( j .eq. nVLat-1 ) then
y_vert_V(2,j,i) = 89.9995
y_vert_V(3,j,i) = 89.9995
else
y_vert_V(2,j,i) = grid_y_Cemp(j)
y_vert_V(3,j,i) = grid_y_Cemp(j)
end if
end do
end do
x_V!0 = (/"nx3"/)
x_V!1 = (/"ny3"/)
y_V!0 = (/"nx3"/)
y_V!1 = (/"ny3"/)
x_vert_V!0 = (/"nc3"/)
x_vert_V!1 = (/"nx3"/)
x_vert_V!2 = (/"ny3"/)
y_vert_V!0 = (/"nc3"/)
y_vert_V!1 = (/"nx3"/)
y_vert_V!2 = (/"ny3"/)
;***********************
; Save epcp lts
;***********************
diro = "./"
outFileCT = diro+"oasis3_grids_"+resGrid+"_ct_22072014.nc"
system("\rm "+outFileCT)
outFileCN = diro+"oasis3_grids_"+resGrid+"_cn_22072014.nc"
system("\rm "+outFileCN)
outFileLC = diro+"oasis3_grids_"+resGrid+"_lc_22072014.nc"
system("\rm "+outFileLC)
tLonName = "um1t.lon"
tLatName = "um1t.lat"
uLonName = "um1u.lon"
uLatName = "um1u.lat"
vLonName = "um1v.lon"
vLatName = "um1v.lat"
tAngName = "um1t.ang"
uAngName = "um1u.ang"
vAngName = "um1v.ang"
tVertLonName = "um1t.clo"
tVertLatName = "um1t.cla"
uVertLonName = "um1u.clo"
uVertLatName = "um1u.cla"
vVertLonName = "um1v.clo"
vVertLatName = "um1v.cla"
fout = addfile( outFileCT,"c")
fout at title = resGrid+" Grid Info"
;** centre grid ***************
fout->$tLonName$ = x_T
fout->$tLonName$@units = "degrees_east"
fout->$tLonName$@title = resGrid+" T-cell grid center longitude"
fout->$tLatName$ = y_T
fout->$tLatName$@units = "degrees_north"
fout->$tLatName$@title = resGrid+" T-cell grid center longitude"
fout->$uLonName$ = x_U
fout->$uLonName$@units = "degrees_east"
fout->$uLonName$@title = resGrid+" U-cell grid center longitude"
fout->$uLatName$ = y_U
fout->$uLatName$@units = "degrees_north"
fout->$uLatName$@title = resGrid+" U-cell grid center longitude"
fout->$vLonName$ = x_V
fout->$vLonName$@units = "degrees_east"
fout->$vLonName$@title = resGrid+" V-cell grid center longitude"
fout->$vLatName$ = y_V
fout->$vLatName$@units = "degrees_north"
fout->$vLatName$@title = resGrid+" V-cell grid center longitude"
delete(fout)
fout = addfile( outFileCN,"c")
fout at title = resGrid+" Grid Info"
;** coner grid ***************
fout->$uVertLonName$ = x_vert_U
fout->$uVertLonName$@units = "degrees_north"
fout->$uVertLonName$@title = resGrid+" U-cell grid corner longitude"
fout->$uVertLatName$ = y_vert_U
fout->$uVertLatName$@units = "degrees_east"
fout->$uVertLatName$@title = resGrid+" U-cell grid corner latitude"
fout->$vVertLonName$ = x_vert_V
fout->$vVertLonName$@units = "degrees_north"
fout->$vVertLonName$@title = resGrid+" V-cell grid corner longitude"
fout->$vVertLatName$ = y_vert_V
fout->$vVertLatName$@units = "degrees_east"
fout->$vVertLatName$@title = resGrid+" V-cell grid corner latitude"
fout->$tVertLonName$ = x_vert_T
fout->$tVertLonName$@units = "degrees_north"
fout->$tVertLonName$@title = resGrid+" T-cell grid corner longitude"
fout->$tVertLatName$ = y_vert_T
fout->$tVertLatName$@units = "degrees_east"
fout->$tVertLatName$@title = resGrid+" T-cell grid corner latitude"
delete(fout)
fout = addfile( outFileLC,"c")
fout at title = resGrid+" Grid Info"
;** local rotation angle ***************
fout->$tAngName$ = x_T-x_T
fout->$tAngName$@units = "degrees"
fout->$tAngName$@title = resGrid+" T-cell local rotation angle"
fout->$uAngName$ = x_U-x_U
fout->$uAngName$@units = "degrees"
fout->$uAngName$@title = resGrid+" T-cell local rotation angle"
fout->$vAngName$ = x_V-x_V
fout->$vAngName$@units = "degrees"
fout->$vAngName$@title = resGrid+" T-cell local rotation angle"
print("Now we finish outputing data .....")
end
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mailman.ucar.edu/pipermail/ncl-talk/attachments/20140724/5ad68a6f/attachment.html
More information about the ncl-talk
mailing list