<div>Hi Frank:</div>
<div> Thanks for your response. I wasn't sure if the whitespace was allways going to be there, because for some fields had the white space but others didn't. I will remove the trailing whitespace. </div>
<div> </div>
<div>Now, I'm trying to develop a modification on the HDF5 driver to allow it to get the georreference information from COSMO-SKYMED HDF5 files... The thing is I'm not really familiar with the libraries used by GDAL(the use of iostream is not allowed right?), what would be the better way to trim a string? I looked into cpl_string and didn't found a simple way to do it (I could use CSLTokenizeString() and get the first field on the list, but this seems overly convoluted for a simple trim)</div>
<div> </div>
<div>Also, is there any guidelines on which libraries to use on C++ in replace of their std equivalents?</div>
<div> </div>
<div>Thanks again</div>
<div>Alex</div>
<div> </div>
<div><br><br> </div>
<div class="gmail_quote">2011/6/13 Frank Warmerdam <span dir="ltr"><<a href="mailto:warmerdam@pobox.com">warmerdam@pobox.com</a>></span><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="im">On 11-06-13 04:53 PM, Alex Mantaut wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Hi all:<br> I've ran into some troubles while trying to interpret an HDF5's<br>metadata...<br>
<br>Every field on HDF5 has it's own type(string, uchar, double) But<br>GetMetadataItem("field_name") converts the data from the dataset into a<br>C-style zero terminated string.<br><br>This gives me a few problems:<br>
<br> a-This string has a trailing space for some datatypes, but not for others (in<br>unsigned char there is no space) ... There is no comment in the driver's code<br>explaining if this is necesary or not(hdf5dataset.cpp from line 661)... I need<br>
to know if there will allways be a trailing space or not, to be able to perform<br>type conversion on the data...<br></blockquote><br></div>Alex,<br><br>I don't quite grasp why you need to know if there will be a trailing<br>
space. I see the spaces are being appended as a separator in the hdf5<br>driver in case the value is actually an array of values. I would suggest<br>you just strip off trailing white space in your client code if it is an<br>
issue.
<div class="im"><br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">b-Some items are type double and have more than 6 digits on the integer part,<br>but the string show the output in exponential notation, that makes me lose some<br>
significant digits...<br><br>I looked into the code and the problems seems to be on hdf5dataset.cpp on line<br>744, and changed the type on sprintf() from %g to %f, But now the number of<br>decimal digits is fixed, which could bring me similar problems when using<br>
doubles... The question is: Is there a convention on how many<br>decimal digits you have to show on the string? there could be another way to<br>return a number from an item that doesn't truncate the digits?<br></blockquote>
<br></div>To preserve precision it is normal to format these as %.15g. I believe<br>this does a pretty good job of preserving double precision floating point.<br><br>I have changed the float and double code to use this format in trunk and<br>
1.8 branches.
<div class="im"><br><br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">Given all this problems i wonder: Could somebody provide a way to retrieve the<br>data in it's binary form with maybe some information on the metadata's type? or<br>
this would only be usefull on the HDF5 format?<br></blockquote><br></div>This would be a substantial change to the metadata handling mechanism in<br>GDAL and is unlikely to occur.<br><br>Best regards,<br>-- <br>---------------------------------------+--------------------------------------<br>
I set the clouds in motion - turn up | Frank Warmerdam, <a href="mailto:warmerdam@pobox.com" target="_blank">warmerdam@pobox.com</a><br>light and sound - activate the windows | <a href="http://pobox.com/~warmerdam" target="_blank">http://pobox.com/~warmerdam</a><br>
and watch the world go round - Rush | Geospatial Programmer for Rent<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><br></blockquote></div><br><br clear="all"><br>-- <br>--<br> Alex Mantaut<br>SUR Emprendimientos Tecnológicos<br>
<br>Perú 345 Piso 5to Oficina "B" (C1067AAG)<br>Ciudad de Buenos Aires, Argentina<br>Tel. +54 (11) 4342-2976/84<br><a href="mailto:javierurien@suremptec.com.ar" target="_blank">javierurien@suremptec.com.ar</a><br>
<a href="http://www.suremptec.com/" target="_blank">www.suremptec.com</a><br>