<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; "><br><div><div>On Jan 5, 2010, at 11:35 AM, Owen Doherty wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div>Dear Jennifer et al,<br><br>Thanks for your help. Here is the information you requested.<br><br>1) ncdump output (omitting the data section for space constraints, but that looks good)<br>owen@graupel:~/data/barbados$ ncdump -c test_ncgen6.nc<br>netcdf test_ncgen6 {<br>dimensions:<br> longitude = 144 ;<br> latitude = 73 ;<br> t = 31 ;<br> z = 9 ;<br>variables:<br> double longitude(longitude) ;<br> longitude:units = "degrees_east" ;<br> double latitude(latitude) ;<br> latitude:units = "degrees_north" ;<br> double t(t) ;<br> t:units = "seconds since 1970-1-1 00:00:00" ;<br> double z(z) ;<br> z:units = "lev" ;<br> z:valid_range = 200., 1000. ;<br> float omejjam(longitude, latitude, t, z) ;<br></div></blockquote>Your variable has no attributes! That's a really bad file-writing practice. What is omejjam? Also, your data are written out with a highly unconventional axis order: x,y,t,z. Is that intentional? Are you sure Matlab is writing it out that way? </div><div><br><blockquote type="cite"><div>data:<br><br>2) Control files first for XDF and then for CTL<br><br>DSET ^test_ncgen6.nc<br>DTYPE netcdf<br>TITLE This is a test<br>UNDEF -9999<br>XDEF longitude 144 LINEAR 0.0 2.5<br>YDEF latitude 73 LINEAR -90.0 2.5<br>TDEF t 31 LINEAR 0Z01JUN1979 1YR<br>ZDEF z 9 LEVELS 1000 925 850 700 600 500 400 300 250<br>VARS 1<br>omejjam=>ome 9 99 longitude,latitude,t,z seasonal mean vertical motion<br>ENDVARS<br><br>DSET ^test_ncgen6.nc<br>DTYPE netcdf<br>TITLE This is a test<br>OPTIONS little_endian<br>UNDEF -9999<br></div></blockquote>How do you know this is the undef value? What if you put 9e36 (or whatever the actual data value is that is causing GrADS to chose those contour intervals ... find out what the right missing value is in your file. <br><blockquote type="cite"><div>XDEF 144 LINEAR 0.0 2.5<br>YDEF 73 LINEAR -90.0 2.5<br>TDEF 31 LINEAR 0Z01JUN1979 1YR<br>ZDEF 9 LEVELS 1000 925 850 700 600 500 400 300 250<br>VARS 1<br>omejjam=>ome 9 x,y,z,t seasonal mean vertical motion<br>ENDVARS<br><br>3) Version of Grads: Version 2.0.a5.oga.5<br><br>4) Error message received:<br>No error exactly, but rather all the data is displayed as 0 to 9e+36 interval 1e+36 instead of the actual values.<br><br>Thanks again,<br><br>Owen<br><br>Jennifer Adams wrote:<br><blockquote type="cite">Hi, Owen --<br></blockquote><blockquote type="cite">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: <br></blockquote><blockquote type="cite">1. The output from ncdump -c on your file (in case Matlab changes the metadata in some way)<br></blockquote><blockquote type="cite">2. Your descriptor file (if you are using 'open' with 'dtype netcdf' or 'xdfopen'). 3. The version of GrADS that you are using<br></blockquote><blockquote type="cite">4. The text from the GrADS session that illustrates the error. <br></blockquote><blockquote type="cite">Jennifer<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">On Jan 4, 2010, at 6:31 PM, Owen Doherty wrote:<br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><blockquote type="cite">Dear Grads Users,<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">I am having difficulties creating and writing to a netcdf file that can be read by GrADS. 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). 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></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">First, I create an nc file using the ncgen utility. 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. Below is my source code (.cdl file) for this step.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">netcdf test_ncgen{<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">dimensions:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> longitude=144;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> latitude =73;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> t=31;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> z=9;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">variables:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> double longitude(longitude);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> longitude:units = "degrees_east";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> double latitude(latitude);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> latitude:units = "degrees_north";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> double t(t);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> t:units = "seconds since 1970-1-1 00:00:00";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> double z(z);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> z:units = "lev";<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> z:valid_range = 200.,1000.;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> float omejjam(longitude, latitude, t, z) ;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"> data:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">omejjam = 0;<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Secondly, I write to the netCDF file using MATLAB. The write step is fairly simple and I suspect that I am missing something in here to have it write out as binary. I have tried outputting single precision (float) and double precision data from MATLAB both of which result in the same error. I am using MATLAB 2008b to do the writing. The write command is as follows:<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">nc=netcdf.open('test_ncgen.nc','nc_write');<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">[varname, xtype, dimids, numatts] = netcdf.inqVar(nc,4)% 0 - omejjam<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">netcdf.putVar(nc,4,omejjam);<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Lastly, I read the data into GrADS. I have tried using sdfopen, xdfopen and the regular open command. Adding the OPTION little_endian to the control file does not solve the issue. All of the data looks erroneous, but consistent in between each different open command. If anyone has any advice as to how to solve this problem, I would be grateful for the insight.<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Owen<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite"><br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">-- <br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Owen Doherty<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">School of Marine and Atmospheric Science<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Institute for Terrestrial and Planetary Atmospheres<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">103 Discovery Hall<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Stony Brook University<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">Stony Brook, NY 11794<br></blockquote></blockquote><blockquote type="cite"><blockquote type="cite">(631)-632-8682 (office)<br></blockquote></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite">--<br></blockquote><blockquote type="cite">Jennifer M. Adams<br></blockquote><blockquote type="cite">IGES/COLA<br></blockquote><blockquote type="cite">4041 Powder Mill Road, Suite 302<br></blockquote><blockquote type="cite">Calverton, MD 20705<br></blockquote><blockquote type="cite">jma@cola.iges.org <<a href="mailto:jma@cola.iges.org">mailto:jma@cola.iges.org</a>><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><blockquote type="cite"><br></blockquote><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></body></html>