# Re: Problem

Date: Fri, 12 Jun 2009 10:56:40 -0600

Hi Mathew,
Can you tell us which line is causing the segmentation fault? You can
use print statements to isolate the line. If the error occurs within the
double do loop, let us know the i and j values when the script fails.
(Again, you can use print statements for that.)

Mathew Freeman wrote:
> Hello everyone,
>
> I am using the following script to convert the daily 0.25 degree data
> into monthly data but getting segmentation fault error. Can anyone
> please guide to this case. The script is as follows:
>
>
> begin
> t=f->time
> v=f->a
> v2=v(latitude|:,longitude|:,time|:)
> delete(v)
> t=fspan(0,dimsizes(t)-1,dimsizes(t))
> utc_date = ut_calendar(t, 0)
>
> year = floattointeger(utc_date(:,0))
> month = floattointeger(utc_date(:,1))
>
> dims=dimsizes(v2)
> v1=new((/12*(2002-1970+1),dims(0),dims(1)/),"float")
> time1=fspan(0,12*(2002-1970+1)-1,12*(2002-1970+1))
> time1_at_units="months since 1970-01-01"
> k=0
> do i=1970,2002
> do j=1,12
>
> indx = ind(year.eq.i.and. month.eq.j)
> printVarSummary(indx)
> print(max(indx))
> print(min(indx))
> v1(k,:,:)=dim_avg(v2(:,:,indx))
> delete(indx)
> ; if (j.eq.1) then
> print(i*100+j)
> ; end if
> k=k+1
> end do
> end do
>
> v1!0="time"
> v1&time=time1
> v1!1="lat" v1&lat=f->latitude
> v1!2="lon"
> v1&lon=f->longitude
>
> system("rm 0904_mon.nc")
> fo->a=v1
> end
>
> thankyou
>
> matt
>
>
>
>
> ------------------------------------------------------------------------
>
> _______________________________________________
> ncl-talk mailing list
> List instructions, subscriber options, unsubscribe:
> http://mailman.ucar.edu/mailman/listinfo/ncl-talk

```--
--------------------------------------------------------------