<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;"><div id="yiv1232809242"><div id="yiv1507402885"><div id="yiv428980845">
<div> Dear all,</div>
<div> </div>
<div> I have a relatively long (6-year) series of sattelite-based hourly 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> </div>
<div> 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> Would anybody gently help me to identify what is causing the error? Following is the script code...<br><br> Thanks in advance.<br><br> 'reinit'; 'c';
<br> <br> prompt 'Variable: '; pull var
<br> prompt 'Latitude (lat1 lat2): '; pull lat
<br> prompt 'Longitude (lon1 lon2): '; pull lon
<br> prompt 'Tempo (t1 t2): '; pull t
<br> <br> 'open /usr/local/grads-1.9b4/lib/CMORPH_8km-30-minute.ctl'
<br> <br> ' set lat 'lat; 'set lon 'lon; 'set t 't;
<br> <br> 'q dims';
x=sublin(result,2); y=sublin(result,3); t=sublin(result,5);
<br> x1=subwrd(x,11); y1=subwrd(y,11); t1=subwrd(t,11);
<br> x2=subwrd(x,13); y2=subwrd(y,13); t2=subwrd(t,13);
<br> <br> if(x2=''); x1=subwrd(x, 9); x2=x1; endif
<br> if(y2=''); y1=subwrd(y, 9); y2=y1; endif
<br> if(t2=''); t1=subwrd(t, 9); t2=t1; endif
<br> <br> x=x1; xmax=x2; y=y1; ymax=y2; t=t1; tmax=t2;
<br> <br>
<br> lixo=write(var'.txt', 'lon lat lev time 'r)
<br> <br> while (t<=tmax)
<br> <br> 'set t 't; y=y1;
<br> <br> while (y<=ymax)
<br> <br> 'set y 'y; x=x1;
<br>
<br> while(x<=xmax)
<br> <br> 'set x 'x; 'set t 't;
<br> <br> r1=xyzt();
<br> <br> 'd 'var; r=subwrd(result, 4);
<br> <br> lixo=write(var'.txt', r1%r,append);
<br> x=x+1
<br> endwhile
<br> y=y+1
<br> endwhile
<br> t=t+1
<br> endwhile
<br> say ' End of Process!'
<br> <br> <br> <br> function xyzt()
<br> 'q dims'; x=sublin(result,2); y=sublin(result,3); z=sublin(result,4); t=sublin(result,5);
<br> x=subwrd(x,6); y=subwrd(y,6); z=subwrd(z,6); t=subwrd(t,6);
<br> return(x' 'y' 'z' 't' ')
<br> <br> function countwrd(x)
<br> i=0
<br> while
(subwrd(x,i+1)!='')
<br> i=i+1;
<br> endwhile
<br> return(i)
<br> <br> function openfile(arq)
<br> 'open 'arq; r=sublin(result,2);
<br> if subwrd(r,2)='Error'
<br> 'sdfopen 'arq;
<br> endif
<br> return
<br><br></div></div></div></div></td></tr></table><br>