<table cellspacing="0" cellpadding="0" border="0" ><tr><td valign="top" style="font: inherit;">Hi Eric,<br><br>I figured out the problem, and can display the wind time series with height. The problem is that I include a ' symbol in my ctl file by mistake. Thanks.<br>Emily<br><br><br>--- On <b>Wed, 9/30/09, Eric Altshuler <i>&lt;ela@COLA.IGES.ORG&gt;</i></b> wrote:<br><blockquote style="border-left: 2px solid rgb(16, 16, 255); margin-left: 5px; padding-left: 5px;"><br>From: Eric Altshuler &lt;ela@COLA.IGES.ORG&gt;<br>Subject: Re: fwrite a grib data file from nc data<br>To: GRADSUSR@LIST.CINECA.IT<br>Received: Wednesday, September 30, 2009, 10:20 PM<br><br><div class="plainMail">Hi Emily,<br><br>What is the size of the binary file? It should be 7*5*4=140 bytes. If it's not that size, check your script for any bugs I may have missed. If it is 140 bytes, then I don't know why grads can't open the binary file. In fact, even if the file exists but has a size
 of 0 bytes, grads should open it. Make sure the file is actually being created. If it doesn't exist, I have no idea why.<br><br>Best regards,<br>Eric<br><br>----- Original Message -----<br>From: "Emily" &lt;<a ymailto="mailto:yi_zhou01@YAHOO.CA" href="/mc/compose?to=yi_zhou01@YAHOO.CA">yi_zhou01@YAHOO.CA</a>&gt;<br>To: <a ymailto="mailto:GRADSUSR@LIST.CINECA.IT" href="/mc/compose?to=GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>Sent: Wednesday, September 30, 2009 9:47:24 PM GMT -05:00 US/Canada Eastern<br>Subject: Re: fwrite a grib data file from nc data<br><br>Hi Eric,<br><br>Thank you for figuring out the bugs. I corrected the problems, and rerun the gs to get a new grd file. However after scaning the discription file, it still can not open the binary file. It shows:<br><br>open error, cann't open the binary file.<br>My grads version is grads2.0 a3 for window XP.<br><br>BTW, my vwnd ddf file as below:<br>================<br>DSET
 d:\gradsfile\ncdata\vwnd.200812.nc<br>DTYPE netcdf<br>TITLE NARR 4D field Lambert Conformal Conic projection<br>UNDEF 32766 missing_value<br>UNPACK scale_factor=0.01f add_offset=47.66f<br>PDEF 349 277 lcc 1 -145.5 1 1 50 50 -107 32463.41 32463.41<br>XDEF 615 linear 150 0.3333<br>YDEF 255 linear 2 0.3333<br>ZDEF 29 levels 1000, 975, 950, 925, 900, 875, 850, 825, 800, 775, 750, 725, 700,<br> 650, 600, 550, 500, 450, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100<br>tdef 248 linear 00:00z01dec2008 3hr<br>vars 3<br>vwnd 29 t,z,y,xÂ&nbsp; grid_northward_wind<br>lat=&gt;glat 0 y,x Latitude<br>lon=&gt;glon 0 y,x Longitude<br>endvars<br>===========<br><br><br>Emily,<br>York University, Toronto<br><br>--- On Wed, 9/30/09, Eric Altshuler &lt;<a ymailto="mailto:ela@COLA.IGES.ORG" href="/mc/compose?to=ela@COLA.IGES.ORG">ela@COLA.IGES.ORG</a>&gt; wrote:<br><br><br><br>From: Eric Altshuler &lt;<a ymailto="mailto:ela@COLA.IGES.ORG"
 href="/mc/compose?to=ela@COLA.IGES.ORG">ela@COLA.IGES.ORG</a>&gt;<br>Subject: Re: fwrite a grib data file from nc data<br>To: <a ymailto="mailto:GRADSUSR@LIST.CINECA.IT" href="/mc/compose?to=GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>Received: Wednesday, September 30, 2009, 5:18 PM<br><br><br>Hi Emily,<br><br>fwrite writes data in binary format, not GRIB. Remove the line 'DTYPE grib' from the ctl file. You also have two bugs in your script:<br><br>while (t0&lt;222)<br><br>should be:<br><br>while (t0&lt;=222)<br><br>and also<br><br>while (h&gt;850)<br><br>should be:<br><br>while (h&gt;=850)<br><br>Using &lt; and &gt;, the values for t=222 and lev=850 will not be written because the last iteration of the loops will be for t=221 and lev=875.<br><br>I also don't see any entry for the v wind in your ctl file for the netcdf data. If it is not in the dataset, your wind speed calculation will fail because of missing v wind.<br><br>Best
 regards,<br><br>Eric L. Altshuler<br>Assistant Research Scientist<br>Center for Ocean-Land-Atmosphere Studies<br>4041 Powder Mill Road, Suite 302<br>Calverton, MD 20705-3106<br>USA<br><br>E-mail: <a ymailto="mailto:ela@cola.iges.org" href="/mc/compose?to=ela@cola.iges.org">ela@cola.iges.org</a><br>Phone: (301) 902-1257<br>Fax: (301) 595-9793<br><br>----- Original Message -----<br>From: "Emily" &lt; <a ymailto="mailto:yi_zhou01@YAHOO.CA" href="/mc/compose?to=yi_zhou01@YAHOO.CA">yi_zhou01@YAHOO.CA</a> &gt;<br>To: <a ymailto="mailto:GRADSUSR@LIST.CINECA.IT" href="/mc/compose?to=GRADSUSR@LIST.CINECA.IT">GRADSUSR@LIST.CINECA.IT</a><br>Sent: Wednesday, September 30, 2009 4:02:13 PM GMT -05:00 US/Canada Eastern<br>Subject: fwrite a grib data file from nc data<br><br><br>Hi group memeber,<br><br>I write a gs file to create a data set which is time series changing with height..<br>My original data is NARR netCDF data sets (8 times per day)<br>The ddf file as
 below:<br>==========<br>DSET d:\gradsfile\ncdata\uwnd.200812.nc<br>DTYPE netcdf<br>TITLE NARR 4D field Lambert Conformal Conic projection<br>UNDEF 32766 missing_value<br>UNPACK scale_factor=0.01f add_offset=47.66f<br>PDEF 349 277 lcc 1 -145.5 1 1 50 50 -107 32463.41 32463.41<br>XDEF 615 linear 150 0.3333<br>YDEF 255 linear 2 0.3333<br>ZDEF 29 levels 1000, 975, 950, 925, 900, 875, 850, 825, 800, 775, 750, 725, 700,<br>650, 600, 550, 500, 450, 400, 350, 300, 275, 250, 225, 200, 175, 150, 125, 100<br>tdef 248 linear 00:00z01dec2008 3hr<br>vars 3<br>uwnd 29 t,z,y,x grid_eastward_wind<br>lat=&gt;glat 0 y,x Latitude<br>lon=&gt;glon 0 y,x Longitude<br>endvars<br>===============<br>vwnd200812.ddf is simillar with above.<br><br>My gs file as below:<br>=============<br>'reinit'<br>'open d:\gradsfile\ncdata\uwnd200812.ddf'<br>'open d:\gradsfile\ncdata\vwnd200812.ddf'<br>*'set grads off'<br>*'set grid off'<br>'set gxout fwrite'<br>'set fwrite
 d:\gradsfile\ncdata\wind-height09z28dec2008.grd'<br>'set dfile 1'<br>'set lon 283.3'<br>'set lat 43.66'<br>*'set time 09z28dec2008'<br>'set dfile 2'<br>'set lon 283.3'<br>'set lat 43.66'<br>*'set time 09z28dec2008'<br>h=1000<br>t0=218<br>while(t0&lt;222)<br>'set t 't0''<br>while(h&gt;850)<br>'set lev 'h''<br>'u=0.01*uwnd.1+47.66'<br>'v=0.01*vwnd.2+47.66'<br>'wind=mag(u,v)'<br>'d wind'<br>h=h-25<br>endwhile<br>t0=t0+1<br>endwhile<br>say 'ok'<br>===============<br>My ctl file is as below:<br>==========<br>DSET d:\gradsfile\ncdata\wind-height09z28dec2008.grd'<br>DTYPE grib<br>TITLE Wind-Height 09z12dec2008<br>UNDEF 32766 missing_value<br>XDEF 1 linear 1 1<br>YDEF 1 linear 1 1<br>ZDEF 7 levels 1000, 975, 950, 925, 900, 875, 850<br>tdef 5 linear 03z28dec2008 3hr<br>vars 1<br>wind 7 99 wind_height<br>endvars<br>=========<br>When I open the ctl file from Grads, it shows:<br>can not open station/index map file (null)<br>the data file was not open.<br><br>I
 don't know what's wrong with it. Is there any one can tell me the reason? Thanks.<br><br>Regards<br><br><br>Emily<br>York University, Toronto<br></div></blockquote></td></tr></table>