I have created a ticket and a patch for this problem<div><br></div><div><a href="http://trac.osgeo.org/gdal/ticket/5119">http://trac.osgeo.org/gdal/ticket/5119</a></div><div><br><br><div class="gmail_quote">On Fri, May 31, 2013 at 3:28 PM, Etienne Tourigny <span dir="ltr"><<a href="mailto:etourigny.dev@gmail.com" target="_blank">etourigny.dev@gmail.com</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><br><br><div class="gmail_quote"><div class="im">On Fri, May 31, 2013 at 1:04 PM, Jonathan Greenberg <span dir="ltr"><<a href="mailto:jgrn@illinois.edu" target="_blank">jgrn@illinois.edu</a>></span> wrote:<br>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr">Thanks -- I did notice it was an earlier version (switching to the latest OSGeo4W), I apologize for not checking the latest, but as Etienne confirmed, the bug seems to be there in the latest as well.  The HDF files from various sources are so odd when it comes to naming layers, that this SDS argument is really helpful (if it would name the files correctly).  <div>


<br></div><div>Speaking of -sds --> perhaps I can request that gdal_translate allow for a layer # flag rather than the full layer name for subdataset files?  Is this relatively easy to implement (since gdalinfo seems to already have the capability)?</div>

</div></blockquote><div><br></div></div><div>that depends on the driver actually... for hdf4 files normal syntax uses number, whereas the netcdf driver uses variable name (which is more informative). Changing this behaviour involves tweaking the driver code, not gdal_translate.</div>

<div><br></div><div>e.g.   </div><div>SUBDATASET_1_NAME=HDF4_SDS:MODIS_L1B:GSUB1.A2001124.0855.003.200219309451.hdf:0</div><div><br></div><div>SUBDATASET_1_NAME=NETCDF:"<a href="http://sst.nc" target="_blank">sst.nc</a>":lon_bnds</div>

<div><br></div><div>Now perhaps you mean to select a single dataset by number, without the full SUBDATASET_X_NAME syntax ?</div><div><br></div><div>such as</div><div>gdalinfo -subdatset 1 file.hdf</div><div><br></div><div>

which would be equivalent to</div><div>gdalinfo HDF4_SDS:file.hdf:0</div><div><br></div><div>that would be marginally handy, but not much as the rest of gdal uses the driver:file:subdataset syntax.</div><div><div class="h5">
<div><br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div dir="ltr"><span><font color="#888888">
<div><br></div><div>--j</div></font></span></div><div class="gmail_extra"><br><br><div class="gmail_quote"><div>On Thu, May 30, 2013 at 3:50 PM, Etienne Tourigny <span dir="ltr"><<a href="mailto:etourigny.dev@gmail.com" target="_blank">etourigny.dev@gmail.com</a>></span> wrote:<br>


</div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">



<div>
<br>
<br>
<div class="gmail_quote"><div><div>On Thu, May 30, 2013 at 4:46 PM, Jukka Rahkonen <span dir="ltr">
<<a href="mailto:jukka.rahkonen@mmmtike.fi" target="_blank">jukka.rahkonen@mmmtike.fi</a>></span> wrote:<br>
</div></div><div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<div><div>Jonathan Greenberg <jgrn <at> <a href="http://illinois.edu" target="_blank">
illinois.edu</a>> writes:<br>
<br>
><br></div><div>
> Folks:<br>
> I'm using a Windows install of GDAL 1.7.0 (FWTools) -- when I run:<br>
><br>
> gdal_translate -sds -of "GTiff" [some.hdf] "myoutput"<br>
> The output filenames do not have the .tif extension.  If I set the output<br>
file to "myoutput.tif", it appends the "layer numbers" to the end of the<br>
file, e.g. myoutput.tif1.  Any tricks to getting the naming working properly<br>
(myoutput1.tif would be what I'd expect)?<br>
<br>
</div></div><div>
Hi,<br>
<br>
First, acquire more fresh GDAL, current version is 1.10. Use OSGeo4W or<br>
download Windows binaries from <a href="http://gisinternals.com/sdk/" target="_blank">
http://gisinternals.com/sdk/</a></div></blockquote>
<div><br>
</div>
</div><div><div>actually the same thing happens with gdal-1.10. I will prepare a bug report and fix.</div></div><div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br><div>
Then, perhaps you should use gdalinfo first for seeing the exact names of<br>
layers as GDAL understands them and use such a layer name as input instead<br>
of [some.hdf]. Read usage examples from <a href="http://www.gdal.org/frmt_hdf4.html" target="_blank">
http://www.gdal.org/frmt_hdf4.html</a></div></blockquote>
<div><br>
</div>
</div><div><div>the idea of using the -sds argument is to generate an output file for each subdataset, without having to search for subdataset names</div></div><div>
<div> </div>
<blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
<br>
<br><div>
-Jukka Rahkonen-<br>
<br>
_______________________________________________<br>
gdal-dev mailing list<br>
<a href="mailto:gdal-dev@lists.osgeo.org" target="_blank">gdal-dev@lists.osgeo.org</a><br>
<a href="http://lists.osgeo.org/mailman/listinfo/gdal-dev" target="_blank">http://lists.osgeo.org/mailman/listinfo/gdal-dev</a></div></blockquote>
</div></div>
<br>
</div>

</blockquote></div><br><br clear="all"><div><div><br></div>-- <br><div dir="ltr">Jonathan A. Greenberg, PhD<br>Assistant Professor<div>Global Environmental Analysis and Remote Sensing (GEARS) Laboratory<br>Department of Geography and Geographic Information Science<br>


University of Illinois at Urbana-Champaign<br>607 South Mathews Avenue, MC 150<br>Urbana, IL 61801<br><span>Phone: <span title="Call with Google Voice"><a href="tel:217-300-1924" value="+552173001924" target="_blank">217-300-1924</a></span></span><div>

<a href="http://www.geog.illinois.edu/~jgrn/" target="_blank">http://www.geog.illinois.edu/~jgrn/</a><br>
AIM: jgrn307, MSN: <a href="mailto:jgrn307@hotmail.com" target="_blank">jgrn307@hotmail.com</a>, Gchat: jgrn307, Skype: jgrn3007<br></div></div></div>
</div></div>
</blockquote></div></div></div><br>
</blockquote></div><br></div>