On Thu, 2010-02-25 at 18:40 +0000, Nikos Dumakis wrote: > Thanks but I don't have that module installed :( > What I mean was to run gdalinfo directly and have a variable to store > the result from gdalinfo...
> By the way, where can I find that python module (osgeo)? Hmmm, as far as I know, you don't need to install anything extra if you already have/use GDAL tools _and_ Python in your system. Information (that should be) of your interest: http://wiki.osgeo.org/wiki/OSGeo_Python_Library http://trac.osgeo.org/gdal/wiki/GdalOgrInPython http://grass.osgeo.org/wiki/GRASS_and_Python Cheers, Nikos Al. --%<--- On 25 February 2010 16:32, Nikos Dumakis <[email protected]>: > > I'm doing/trying a Python Script to retrieve MODIS > subset > > names using GDALinfo. > > 1- is there any Script already developed in GRASS- > python to > > retrieve subset names using GDALINFO > > 2- If not, how can I store in a variable the result > from > > GDALinfo? On Thu, 2010-02-25 at 17:26 +0000, Jose Gomez-Dans wrote: > > Hi, > > It'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 > > > > hands on example ;) > > > > In [1]: from osgeo import gdal > > > > In [2]: > g=gdal.Open("MOD09GA.A2009270.h21v10.005.2009272135254.hdf") > > > > In [3]: g.GetSubDatasets() > > > > Out[3]: > > > > [('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:num_observations_1km', > > '[1200x1200] num_observations_1km MODIS_Grid_1km_2D (8-bit > > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:state_1km_1', > > '[1200x1200] state_1km_1 MODIS_Grid_1km_2D (16-bit > unsigned > > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:SensorZenith_1', > > '[1200x1200] SensorZenith_1 MODIS_Grid_1km_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:SensorAzimuth_1', > > '[1200x1200] SensorAzimuth_1 MODIS_Grid_1km_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:Range_1', > > '[1200x1200] Range_1 MODIS_Grid_1km_2D (16-bit unsigned > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:SolarZenith_1', > > '[1200x1200] SolarZenith_1 MODIS_Grid_1km_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:SolarAzimuth_1', > > '[1200x1200] SolarAzimuth_1 MODIS_Grid_1km_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:gflags_1', > > '[1200x1200] gflags_1 MODIS_Grid_1km_2D (8-bit unsigned > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_1km_2D:orbit_pnt_1', > > '[1200x1200] orbit_pnt_1 MODIS_Grid_1km_2D (8-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:num_observations_500m', > > '[2400x2400] num_observations_500m MODIS_Grid_500m_2D > (8-bit > > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b01_1', > > '[2400x2400] sur_refl_b01_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b02_1', > > '[2400x2400] sur_refl_b02_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b03_1', > > '[2400x2400] sur_refl_b03_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b04_1', > > '[2400x2400] sur_refl_b04_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b05_1', > > '[2400x2400] sur_refl_b05_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b06_1', > > '[2400x2400] sur_refl_b06_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:sur_refl_b07_1', > > '[2400x2400] sur_refl_b07_1 MODIS_Grid_500m_2D (16-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:QC_500m_1', > > '[2400x2400] QC_500m_1 MODIS_Grid_500m_2D (32-bit unsigned > > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:obscov_500m_1', > > '[2400x2400] obscov_500m_1 MODIS_Grid_500m_2D (8-bit > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:iobs_res_1', > > '[2400x2400] iobs_res_1 MODIS_Grid_500m_2D (8-bit unsigned > > integer)'), > > > > ('HDF4_EOS:EOS_GRID:"MOD09GA.A2009270.h21v10.005.2009272135254.hdf":MODIS_Grid_500m_2D:q_scan_1', > > '[2400x2400] q_scan_1 MODIS_Grid_500m_2D (8-bit unsigned > integer)') 2010/2/25 Νίκος Αλεξανδρής <[email protected]> > (You are too fast Jose ;-) > > I have also something in bash (just in case...). > Regards, Nikos Al. _______________________________________________ grass-user mailing list [email protected] http://lists.osgeo.org/mailman/listinfo/grass-user
