<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">Hi, Owen --<div>It sounds like you have a problem specifying the undef value in your data file. I can't help with the Matlab bit, but if you need help to figure out why GrADS can't read your file, you need to post:&nbsp;</div><div><br></div><div>1. The output from ncdump -c on your file (in case Matlab changes the metadata in some way)</div><div>2. Your descriptor file (if you are using 'open' with 'dtype netcdf' or 'xdfopen').&nbsp;</div><div>3. The version of GrADS that you are using</div><div>4. The text from the GrADS session that illustrates the error. &nbsp;</div><div><br></div><div>Jennifer</div><div><br></div><div><br><div><div>On Jan 4, 2010, at 6:31 PM, Owen Doherty wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear Grads Users,<br><br>I am having difficulties creating and writing to a netcdf file that can be read by GrADS. &nbsp;The data is loaded into GrADS successfully, but when displayed looks similar to improperly written binary data (e.g. all data is in the range of 0 to 9e+36 interval 1e+36). &nbsp;Below are the steps I take to create a 4-D gridded netCDF, write to the netCDF and finally to read the file into GrADS.<br><br>First, I create an nc file using the ncgen utility. &nbsp;I have tried creating netCDF files with the variable both as "float" and "double" neither of which is successful and the errors from which appear to be similar. &nbsp;Below is my source code (.cdl file) for this step.<br><br>netcdf test_ncgen{<br>dimensions:<br> &nbsp;&nbsp;longitude=144;<br> &nbsp;&nbsp;latitude =73;<br> &nbsp;&nbsp;t=31;<br> &nbsp;&nbsp;z=9;<br><br>variables:<br> &nbsp;&nbsp;double longitude(longitude);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;longitude:units = "degrees_east";<br><br> &nbsp;&nbsp;double latitude(latitude);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;latitude:units = "degrees_north";<br> &nbsp;&nbsp;&nbsp;&nbsp;double t(t);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;t:units = "seconds since 1970-1-1 00:00:00";<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;double z(z);<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z:units = "lev";<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;z:valid_range = 200.,1000.;<br><br> &nbsp;&nbsp;float omejjam(longitude, latitude, t, z) ;<br> &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>data:<br>omejjam = 0;<br><br>Secondly, I write to the netCDF file using MATLAB. &nbsp;The write step is fairly simple and I suspect that I am missing something in here to have it write out as binary. &nbsp;I have tried outputting single precision (float) and double precision data from MATLAB both of which result in the same error. &nbsp;I am using MATLAB 2008b to do the writing. &nbsp;The write command is as follows:<br><br>nc=netcdf.open('test_ncgen.nc','nc_write');<br>[varname, xtype, dimids, numatts] = netcdf.inqVar(nc,4)% 0 - omejjam<br>netcdf.putVar(nc,4,omejjam);<br><br>Lastly, I read the data into GrADS. &nbsp;I have tried using sdfopen, xdfopen and the regular open command. &nbsp;Adding the OPTION little_endian to the control file does not solve the issue. &nbsp;All of the data looks erroneous, but consistent in between each different open command. &nbsp;If anyone has any advice as to how to solve this problem, I would be grateful for the insight.<br><br>Owen<br><br>-- <br>Owen Doherty<br>School of Marine and Atmospheric Science<br>Institute for Terrestrial and Planetary Atmospheres<br>103 Discovery Hall<br>Stony Brook University<br>Stony Brook, NY 11794<br>(631)-632-8682 (office)<br></div></blockquote></div><br><div apple-content-edited="true"> <span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><span class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Helvetica; font-size: 12px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><div>--</div><div>Jennifer M. Adams</div><div>IGES/COLA</div><div>4041 Powder Mill Road, Suite 302</div><div>Calverton, MD 20705</div><div><a href="mailto:jma@cola.iges.org">jma@cola.iges.org</a></div><div><br class="khtml-block-placeholder"></div><br class="Apple-interchange-newline"></span></span></div></span> </div><br></div></body></html>