<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv1232809242"><div id="yiv1507402885"><div id="yiv428980845">
<div>&nbsp;Dear all,</div>
<div>&nbsp;</div>
<div>&nbsp;I have a relatively long (6-year) series of sattelite-based hourly&nbsp;precipitation estimates, which is in binary format. Considering I need to manipulate this data on external programs, I'm trying to extract it to ascii files.<br></div>
<div>&nbsp;</div>
<div>&nbsp;Currently I´m using GrADS v1.9b4 running on a ordinary 32-bit desktop Ubuntu 9.04. Some years ago a colleague (now retired) developed a script which used to work in out previous datasets. But it won't work with these specific precipitation estimates files (maybe due to the enormous volume). GrADS suddenly crashes with an "segmentation fault" error message.<br><br>&nbsp;Would anybody gently help me to identify what is causing the error? Following is the script code...<br><br>&nbsp;Thanks in advance.<br><br>&nbsp;&nbsp; 'reinit'; 'c'; <br>&nbsp;<br>&nbsp;&nbsp; prompt 'Variable: '; pull var <br>&nbsp;&nbsp; prompt 'Latitude&nbsp; (lat1 lat2): '; pull lat <br>&nbsp;&nbsp; prompt 'Longitude (lon1 lon2): '; pull lon <br>&nbsp;&nbsp; prompt 'Tempo (t1 t2): '; pull t <br>&nbsp;<br>&nbsp;&nbsp; 'open /usr/local/grads-1.9b4/lib/CMORPH_8km-30-minute.ctl' <br>&nbsp;<br>&nbsp; ' set lat 'lat; 'set lon 'lon; 'set t 't; <br>&nbsp;<br>&nbsp; 'q dims';
 x=sublin(result,2); y=sublin(result,3); t=sublin(result,5); <br>&nbsp; x1=subwrd(x,11); y1=subwrd(y,11); t1=subwrd(t,11);&nbsp; <br>&nbsp; x2=subwrd(x,13); y2=subwrd(y,13); t2=subwrd(t,13); <br>&nbsp;<br>&nbsp; if(x2=''); x1=subwrd(x, 9); x2=x1; endif&nbsp; <br>&nbsp; if(y2=''); y1=subwrd(y, 9); y2=y1; endif&nbsp; <br>&nbsp; if(t2=''); t1=subwrd(t, 9); t2=t1; endif <br>&nbsp;<br>&nbsp; x=x1; xmax=x2; y=y1; ymax=y2; t=t1; tmax=t2; <br>&nbsp;<br>&nbsp; <br> lixo=write(var'.txt', 'lon &nbsp;&nbsp;&nbsp; lat&nbsp;&nbsp;&nbsp; lev&nbsp;&nbsp;&nbsp; time&nbsp;&nbsp;&nbsp; 'r) <br>&nbsp;<br>&nbsp;while (t&lt;=tmax) <br>&nbsp;<br>&nbsp;&nbsp;&nbsp; 'set t 't; y=y1; <br>&nbsp;<br>&nbsp;&nbsp;&nbsp; while (y&lt;=ymax) <br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'set y 'y; x=x1; <br>&nbsp; <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; while(x&lt;=xmax) <br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'set x 'x; 'set t 't;&nbsp;
<br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; r1=xyzt();&nbsp; <br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'd 'var; r=subwrd(result, 4); <br>&nbsp;<br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; lixo=write(var'.txt', r1%r,append); <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x=x+1 <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; endwhile <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; y=y+1 <br>&nbsp;&nbsp;&nbsp; endwhile <br>&nbsp;&nbsp;&nbsp; t=t+1 <br>&nbsp; endwhile <br>&nbsp; say ' End of Process!' <br>&nbsp;<br>&nbsp;<br> <br>&nbsp; function xyzt() <br>&nbsp;&nbsp;&nbsp; 'q dims'; x=sublin(result,2); y=sublin(result,3); z=sublin(result,4); t=sublin(result,5); <br>&nbsp;&nbsp;&nbsp; x=subwrd(x,6); y=subwrd(y,6); z=subwrd(z,6); t=subwrd(t,6); <br>&nbsp; return(x'&nbsp;&nbsp;&nbsp; 'y'&nbsp;&nbsp;&nbsp; 'z'&nbsp;&nbsp;&nbsp; 't'&nbsp;&nbsp;&nbsp; ') <br>&nbsp;<br>&nbsp; function countwrd(x) <br>&nbsp;&nbsp;&nbsp; i=0 <br>&nbsp;&nbsp;&nbsp; while
 (subwrd(x,i+1)!='') <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; i=i+1; <br>&nbsp;&nbsp;&nbsp; endwhile <br>&nbsp; return(i) <br>&nbsp;<br>&nbsp; function openfile(arq) <br>&nbsp;&nbsp;&nbsp; 'open 'arq; r=sublin(result,2); <br>&nbsp;&nbsp;&nbsp; if subwrd(r,2)='Error' <br>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 'sdfopen 'arq; <br>&nbsp;&nbsp;&nbsp; endif <br>&nbsp; return <br><br></div></div></div></div></td></tr></table><br>