<html><body style="word-wrap: break-word; -webkit-nbsp-mode: space; -webkit-line-break: after-white-space; ">
Ryo et al., <div>The seg fault happens when you try to display the 3-dimensional variable tr with the Z dimension set to something other than 1. That is a bug in the sdfopen code in GrADS 1.9. That code is no longer in version 2.0, and I am unlikely to spend any time debugging it since the problem is readily fixed if you use a 'dtype netcdf' descriptor file:</div><div><br class="webkit-block-placeholder"></div><div><div>DSET    ^mom_clim46.nc</div><div>dtype netcdf</div><div>options zrev</div><div>TITLE   Ocean Only Model to Case 45</div><div>UNDEF   -2.56E33  missing_value</div><div>XDEF 362 LINEAR 115.0 0.5 </div><div>YDEF 142 LINEAR -35.0 0.5  </div><div>ZDEF 30  LEVELS</div><div>  5.0000   15.0000   25.0000   35.0000   45.0000   55.0000   65.0000   75.0000   85.0000   95.0000</div><div>  105.0000  115.9789  129.7985  148.0428  171.8625  201.8625  238.0428  279.7985  325.9789  375.0000</div><div> 425.0000  491.1513  604.1757  790.2066 1068.2310 1448.2310 1930.2066 2504.1757 3151.1513 3845.0000</div><div>TDEF 12 LINEAR 1JAN1998  1mo</div><div>VARS   5                   </div><div>u          30  t,z,y,x  U velocity</div><div>v          30  t,z,y,x  V velocity</div><div>temp       30  t,z,y,x  Temperature</div><div>s          30  t,z,y,x  Salinity(PSU)</div><div>tr          0  t,y,x    Transport(Sv)</div><div>ENDVARS             </div><div><br class="webkit-block-placeholder"></div><div>With this descriptor, the variable tr displays correctly no matter what the Z dimension is set to.  If you continue to have problems, please let me know. </div><div><br class="webkit-block-placeholder"></div><div>Debugging this problem also revealed a little bug in the netcdf handling code in version 2.0 for Z-reversed data, so thanks for helping me uncover that. </div><div><br></div><div>More inline below on the Z index: </div><div><br class="webkit-block-placeholder"></div><div><div>On Feb 21, 2008, at 4:50 AM, Ryo Furue wrote:</div><br class="Apple-interchange-newline"><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Hi Jennifer,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| You will have to provide all the ncdump -c</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| output from your file -- maybe this will help me to reproduce the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| error.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">I've created a more complete "kit" to reproduce the error:</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span><a href="http://iprc.soest.hawaii.edu/~furue/tmp/grads-segfault.tar.gz">http://iprc.soest.hawaii.edu/~furue/tmp/grads-segfault.tar.gz</a></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Download this archive, expand it, descend into the directory,</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">and run the GrADS script "segfault.gs" contained in it.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">The archive is about 370MB.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| As for the positive:down attribute, GrADS was designed with the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| atmosphere in mind, so z=1 is the bottom (close to the surface) and</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| z=zmax is at the top.<span class="Apple-converted-space">  </span>When your z axis is depth, this orientation</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| is maintained, so that the bottom (deepest) level is z=1 and the top</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| (shallowest) layer is z=30. That is somewhat opposite to the way</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| oceanographers think of the Z (depth) axis, where z=1 is usually at</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">| or just below the surface.</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Does that mean "z" is NOT an index into the underlying array?</div></blockquote>No it does not mean that. Z is the grid index for the vertical dimension in GrADS. <br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">After opening my netCDF file (such as the ones contained</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">in the kit above), this command</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span>ga-&gt; set lev 5</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span>ga-&gt; d temp</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">correctly plots sea surface temperature, and</span></div></blockquote><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">  ga-&gt; set lev 3845</span></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; "><span class="Apple-converted-space">  </span>ga-&gt; d temp</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">correctly plots bottom temperature.</span></div></blockquote>these commands work because you're using world coordinates (set lev) and not grid indices (set z). </div><div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><span class="Apple-style-span" style="-webkit-text-stroke-width: -1; ">So, unless GrADS bothers to transpose the temperature array</span></div></blockquote>GrADS bothers to do this when you have 'options zrev' in your descriptor file or 'positive down' as a netcdf attribute.</div><div><br><blockquote type="cite"><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">on memory, index 1 of the array's 3rd dimension must be</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">correctly pointing to lev=5, and index 30 must be pointing</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">to lev=3845, because that's how my array is stored in</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">my netCDF file.<span class="Apple-converted-space">  </span>Therefore, "z" is not an index. . . .</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Is there a variable which is a true index into the</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">underlying array? such as i, j, and k?</div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; min-height: 14px; "><br></div><div style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ">Ryo</div> </blockquote></div><br><div> <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; "><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></span> </div><br></div></body></html>