When I changed them to ' outfile->rain = (/rain/) outfile->snow = (/snow/)', it works fine, although I don't quite understand the reason. Anyway it got fixed. Thanks.
From: Guo Zhang <wswzg6666@yahoo.com.cn>
To: NCL <ncl-talk@ucar.edu>
Sent: Friday, April 13, 2012 3:39 PM
Subject: extract variables from grib: Segmentation fault
Hi,
I'm trying extract variables from grib data. When I just output precip, it works pretty well. But when I added ' outfile->rain = rain
outfile->snow = snow' , I got error: Segmentation fault. How can I fix it? Thanks.
Guo
The part of my script is like this:
precip = new((endday-startday+1)*8,float)
gribfiles = systemfunc("ls /d1/zhangg/GLDAS/*A"+year+day3+"*.grb")
do ihr = 0,7
print("Starting: "+gribfiles(ihr))
gribfile = addfile(gribfiles(ihr), "r")
rain = gribfile->Rainf_GDS0_SFC(416,1174)
snow = gribfile->Snowf_GDS0_SFC(416,1174)
precip((iday-startday)*8+ihr) = rain + snow
end do
delete(gribfiles)
outfile = addfile("output_precip_"+year+"_"+startday3+"_"+endday3+".nc", "c")
outfile->precip = precip
outfile->rain = rain
outfile->snow = snow
_______________________________________________
ncl-talk mailing list
List instructions, subscriber options, unsubscribe:
http://mailman.ucar.edu/mailman/listinfo/ncl-talk
Received on Fri Apr 13 16:17:32 2012
This archive was generated by hypermail 2.1.8 : Fri Apr 20 2012 - 16:21:18 MDT