<div dir="ltr">Dear GrADS users,<div><br></div><div>Please help me in solving this problem.</div><div><br></div><div>I am converting my model output from hourly to daily for one year using following procedure,</div><div><br>
</div><div><a href="http://grib2ctl.pl">grib2ctl.pl</a> r_pgb.2000010100 >r_p.ctl</div><div><br></div><div>then i edit the r_p.ctl file as follows to convert hourly data to daily data;</div><div><br></div><div><div><div>
dset ^r_pgb.%y4%m2%d2%h2</div><div>index ^r_pgb.2000010100.idx</div><div>options template</div><div>undef 9.999E+20</div></div><div><br></div><div>and</div><div>modify </div><div><br></div><div>tdef 360 linear 01jan2000 1dy<br>
</div><div><br></div><div>now when i display the variables in this control file, it works well. </div><div><br></div><div>The second step i want to do to extract few variables in ascii format from the above control file. For that i used script from GrADS page to obtain data for specific domain; (<a href="http://www.iges.org/grads/gadoc/ascii.html">http://www.iges.org/grads/gadoc/ascii.html</a>)</div>
<div><br></div><div><br></div><div><div>'open r_p.ctl'</div><div>'set x 113 155'</div><div>'set y 90 140'</div><div>outfile='variables.txt'</div><div>'!/bin/rm -f 'outfile</div><div>
'set gxout print'</div><div>fmt='%8.3f'</div><div>numcols=43</div><div>'set prnopts 'fmt' 'numcols' 1'</div><div>'d lon'</div><div>lon_data = result</div><div>'d lat'</div>
<div>lat_data = result</div><div>'d tmp2m-273.15'</div><div>v1_data = result</div><div>'d pratesfc*60*60'24*</div><div>v2_data = result</div><div>'d tmpsfc-273.15'</div><div>v3_data = result</div><div>
i=1</div><div>while (1)</div><div> lons = sublin(lon_data,i)</div><div> lats = sublin(lat_data,i)</div><div> line1 = sublin(v1_data,i)</div><div> line2 = sublin(v2_data,i)</div><div> line3 = sublin(v3_data,i)</div><div> if (lons='' | lats='' | line1='' | line2='' | line3=''); break; endif</div>
<div> if (i>1)</div><div> j=1</div><div> while (j<=numcols)</div><div> str = subwrd(lons,j); lon = math_format(fmt,str)</div><div> str = subwrd(lats,j); lat = math_format(fmt,str)</div><div> str = subwrd(line1,j); v1 = math_format(fmt,str)</div>
<div> str = subwrd(line2,j); v2 = math_format(fmt,str)</div><div> str = subwrd(line3,j); v3 = math_format(fmt,str)</div><div> record = lon' 'lat' 'v1' 'v2' 'v3</div><div> rc = write(outfile,record,append)</div>
<div> j=j+1</div><div> endwhile</div><div> endif</div><div> i=i+1</div><div>endwhile</div></div><div><br></div><div><br></div><div>It is giving me output file as well. I copied the output data to EXCEL spreadsheet. Now i am confused about reading the output data.</div>
<div><br></div><div>The grid spacing between two lat/lon is 0.5 degree and there are 360 days in one year. Want to get values for each grid for all 360 days. </div><div><br></div><div>Please tell me where i am making mistake?</div>
<div><br></div><div>Thank you so much.</div><div><br></div><div>With Best Regards,</div><div><br></div><div>Mehwish</div><div> </div><div> </div><div><br></div><div dir="ltr"><div><br></div><div><br></div></div>
</div></div>