Hi,<br><br><div class="gmail_quote">On 25 February 2010 16:32, Nikos Dumakis <span dir="ltr">&lt;<a href="mailto:nikosdu1980@gmail.com">nikosdu1980@gmail.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div>I&#39;m doing/trying a Python Script to retrieve MODIS subset names using GDALinfo. </div><div>1- is there any Script already developed in GRASS- python to retrieve subset names using GDALINFO </div>
<div>2- If not, how can I store in a variable the result from GDALinfo?</div></blockquote><div><br>It&#39;s quite easy to do this with the GDAL python bindings (presumably installed if you bothered to install gdalinfo). GetSubDatasets() returns a list where each element is the dataset name and the description<br>
<br>hands on example ;)<br><br> In [1]: from osgeo import gdal<br><br>In [2]: g=gdal.Open(&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;)<br><br>In [3]: g.GetSubDatasets()<br><br>Out[3]:<br>[(&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:num_observations_1km&#39;,<br>
  &#39;[1200x1200] num_observations_1km MODIS_Grid_1km_2D (8-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:state_1km_1&#39;,<br>  &#39;[1200x1200] state_1km_1 MODIS_Grid_1km_2D (16-bit unsigned integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:SensorZenith_1&#39;,<br>  &#39;[1200x1200] SensorZenith_1 MODIS_Grid_1km_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:SensorAzimuth_1&#39;,<br>
  &#39;[1200x1200] SensorAzimuth_1 MODIS_Grid_1km_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:Range_1&#39;,<br>  &#39;[1200x1200] Range_1 MODIS_Grid_1km_2D (16-bit unsigned integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:SolarZenith_1&#39;,<br>  &#39;[1200x1200] SolarZenith_1 MODIS_Grid_1km_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:SolarAzimuth_1&#39;,<br>
  &#39;[1200x1200] SolarAzimuth_1 MODIS_Grid_1km_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:gflags_1&#39;,<br>  &#39;[1200x1200] gflags_1 MODIS_Grid_1km_2D (8-bit unsigned integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_1km_2D:orbit_pnt_1&#39;,<br>  &#39;[1200x1200] orbit_pnt_1 MODIS_Grid_1km_2D (8-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:num_observations_500m&#39;,<br>
  &#39;[2400x2400] num_observations_500m MODIS_Grid_500m_2D (8-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b01_1&#39;,<br>  &#39;[2400x2400] sur_refl_b01_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b02_1&#39;,<br>  &#39;[2400x2400] sur_refl_b02_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b03_1&#39;,<br>
  &#39;[2400x2400] sur_refl_b03_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b04_1&#39;,<br>  &#39;[2400x2400] sur_refl_b04_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b05_1&#39;,<br>  &#39;[2400x2400] sur_refl_b05_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b06_1&#39;,<br>
  &#39;[2400x2400] sur_refl_b06_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:sur_refl_b07_1&#39;,<br>  &#39;[2400x2400] sur_refl_b07_1 MODIS_Grid_500m_2D (16-bit integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:QC_500m_1&#39;,<br>  &#39;[2400x2400] QC_500m_1 MODIS_Grid_500m_2D (32-bit unsigned integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:obscov_500m_1&#39;,<br>
  &#39;[2400x2400] obscov_500m_1 MODIS_Grid_500m_2D (8-bit integer)&#39;),<br> (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:iobs_res_1&#39;,<br>  &#39;[2400x2400] iobs_res_1 MODIS_Grid_500m_2D (8-bit unsigned integer)&#39;),<br>
 (&#39;HDF4_EOS:EOS_GRID:&quot;MOD09GA.A2009270.h21v10.005.2009272135254.hdf&quot;:MODIS_Grid_500m_2D:q_scan_1&#39;,<br>  &#39;[2400x2400] q_scan_1 MODIS_Grid_500m_2D (8-bit unsigned integer)&#39;)]<br></div></div>