Re: Segmentation Fault

From: Mary Haley <haley_at_nyahnyahspammersnyahnyah>
Date: Sun, 7 Jun 2009 16:02:57 -0600 (MDT)

Hi Ibraheem,

As Adam said, we need more information. If there's no error message,
then another thing you can try is to temporarily comment out the
"begin" and "end" statements, and run your script with with the "-x"
option.

    ncl -x your_script.ncl

This will cause every line to be echoed as it is executed, and then
you should see exactly where it seg faults.

--Mary

On Fri, 5 Jun 2009, Adam Phillips wrote:

> Hi Ibraheem,
> Can you send us the complete error message? And if the line number isn't
> specified in the error message, can you tell us exactly what line the
> error message is occurring? (You can find that out via print statements)..
> Adam
>
> Ibraheem Khan wrote:
>> Hi,
>>
>> I am using an NCL script to calculate the zonal mean and precipitation anomaly. The number of "*.nc" files are 30. It crashes with an error "segmentation fault". Please help me with to rectify this error.
>> The script is given below:
>>
>>
>> ;************************************************
>> 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
>> ;************************************************
>> ; variable and file handling
>> ;************************************************
>> fils = systemfunc("ls 19*.nc") ; define filename
>> f = addfiles(fils,"r") ; open netcdf file
>> p = f[:]->precip ; select variable to ave
>> ;************************************************
>> ; calculate deviation from zonal mean
>> ;************************************************
>> anom = p ; trick to copy cv's and atts
>> anom = dim_rmvmean(p)
>> ;************************************************
>> ; plot parameters
>> ;************************************************
>> wks = gsn_open_wks("ps","dev_zonal") ; Opens a ps file
>> plot = new(2,graphic) ; create graphical array
>> gsn_define_colormap(wks,"radar")
>> res = True
>> ;************************************************
>> ; original data
>> ;************************************************
>> res_at_gsnDraw = False ; don't draw yet
>> res_at_gsnFrame = False ; don't advance frame yet
>> res_at_gsnPaperOrientation = "portrait"
>> res_at_gsnMaximize = True
>>
>> res_at_lbLabelBarOn = False
>> res_at_cnFillOn = True ; color plot
>> res_at_gsnSpreadColors = True ; subset color map
>> res_at_cnLinesOn = False ; no cn lines
>> res_at_cnLevelSelectionMode = "ManualLevels" ; set manual contour level
>>
>> res_at_cnMinLevelValF = -10. ; set min contour level
>> res_at_cnMaxLevelValF = 50 ; set max contour level
>> res_at_cnLevelSpacingF = 5 ; set contour spacing
>> res_at_gsnSpreadColors = True ; full colors
>>
>> res_at_gsnAddCyclic = False
>> res_at_gsnZonalMean = True ; add zonal plot
>> res_at_mpFillOn = False ; no grey continent
>> res_at_cnInfoLabelOrthogonalPosF = -0.17 ; move info label up
>> res_at_cnLineLabelFontHeightF = .012 ; increase font size
>> res_at_gsnLeftString = " " ; left string name
>> res_at_gsnRightString = "mm" ; units
>> res_at_gsnCenterString = "Original Data"
>>
>> ; panel expects plots to be of the same size. Since these two plots are
>> ; very different, we are forcing them to be the same size by setting the
>> ; width.
>>
>> res_at_vpWidthF = 0.7
>> res_at_vpYF = 0.5
>> plot(0) = gsn_csm_contour_map(wks,p(0,:,:),res)
>>
>> zres=True
>> zres_at_amOrthogonalPosF = 0.2
>> zonal_id=gsn_csm_attach_zonal_means(wks,plot(0),p(0,:,:),zres)
>> ;delete(res_at_gsnZonalMean) ; delete zonal plot
>> ;************************************************
>> ; anomaly data
>> ;************************************************
>> gsn_define_colormap(wks,"radar")
>>
>> res_at_cnFillOn = True ; color plot
>> res_at_gsnSpreadColors = True ; subset color map
>> res_at_gsnAddCyclic = False
>> plot(1) = gsn_csm_contour_map_ce(wks,anom(0,:,:),res)
>>
>> ; panel the two plots together
>> resP = True ; modify the panel plot
>>
>> resP_at_txPosYF = 0.88
>> resP_at_txString = "Precipitation Climatology (1980-2002)"
>>
>> resP_at_gsnPanelYF = (/0.8 , 0.5/)
>>
>> resP_at_gsnPanelDebug = True ; Maybe helpful
>> resP_at_gsnPanelYWhiteSpacePercent = 10 ; it can make plots closer or farther
>> ; between each other.
>>
>>
>> resP_at_lbLabelFontHeightF = 0.005
>> resP_at_gsnPanelLabelBar = True ; add common colorbar
>> resP_at_gsnPanelBottom = 0.03
>> gsn_panel(wks,plot,(/2,1/),resP)
>> end
>>
>>
>>
>>
>> _______________________________________________
>> ncl-talk mailing list
>> List instructions, subscriber options, unsubscribe:
>> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
> --
> --------------------------------------------------------------
> Adam Phillips asphilli_at_ucar.edu
> National Center for Atmospheric Research tel: (303) 497-1726
> ESSL/CGD/CAS fax: (303) 497-1333
> P.O. Box 3000
> Boulder, CO 80307-3000 http://www.cgd.ucar.edu/cas/asphilli
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk
>
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Sun Jun 07 2009 - 16:02:57 MDT

This archive was generated by hypermail 2.2.0 : Mon Jun 08 2009 - 09:30:31 MDT