I wanted to extract the following band information that can be confirmed in the properties when GPV (raster data) is opened in QGIS with python, so a memo of how to do it.
from osgeo import gdal
data = gdal.Open("path")
band =Number of bands
data.GetRasterBand(band).GetMetadata()
The results are retrieved in dictionary format. The following is the information of band 1.
{'GRIB_COMMENT': 'Geopotential height [gpm]', 'GRIB_DISCIPLINE': '0(Meteorological)', 'GRIB_ELEMENT': 'HGT', 'GRIB_FORECAST_SECONDS': '0 sec', 'GRIB_IDS': 'CENTER=34(Tokyo) SUBCENTER=0 MASTER_TABLE=2 LOCAL_TABLE=1 SIGNF_REF_TIME=1(Start_of_Forecast) REF_TIME=2017-12-05T00:00:00Z PROD_STATUS=0(Operational) TYPE=1(Forecast)', 'GRIB_PDS_PDTN': '0', 'GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES': '3 5 1 31 255 0 50 1 0 100 -2 1000 255 -127 -2147483647', 'GRIB_PDS_TEMPLATE_NUMBERS': '3 5 1 31 255 0 0 50 1 0 0 0 0 100 130 0 0 3 232 255 255 255 255 255 255', 'GRIB_REF_TIME': '1512432000 sec UTC', 'GRIB_SHORT_NAME': '100000-ISBL', 'GRIB_UNIT': '[gpm]', 'GRIB_VALID_TIME': '1512432000 sec UTC', 'STATISTICS_MAXIMUM': '250.91836547852', 'STATISTICS_MEAN': '118.31441361789', 'STATISTICS_MINIMUM': '-55.081642150879', 'STATISTICS_STDDEV': '60.506839414168', 'STATISTICS_VALID_PERCENT': '100'}
It looks like this to make it easier to see
GRIB_COMMENT : Geopotential height [gpm] GRIB_DISCIPLINE : 0(Meteorological) GRIB_ELEMENT : HGT GRIB_FORECAST_SECONDS : 0 sec GRIB_IDS : CENTER=34(Tokyo) SUBCENTER=0 MASTER_TABLE=2 LOCAL_TABLE=1 SIGNF_REF_TIME=1(Start_of_Forecast) REF_TIME=2017-12-05T00:00:00Z PROD_STATUS=0(Operational) TYPE=1(Forecast) GRIB_PDS_PDTN : 0 GRIB_PDS_TEMPLATE_ASSEMBLED_VALUES : 3 5 1 31 255 0 50 1 0 100 -2 1000 255 -127 -2147483647 GRIB_PDS_TEMPLATE_NUMBERS : 3 5 1 31 255 0 0 50 1 0 0 0 0 100 130 0 0 3 232 255 255 255 255 255 255 GRIB_REF_TIME : 1512432000 sec UTC GRIB_SHORT_NAME : 100000-ISBL GRIB_UNIT : [gpm] GRIB_VALID_TIME : 1512432000 sec UTC STATISTICS_MAXIMUM : 250.91836547852 STATISTICS_MEAN : 118.31441361789 STATISTICS_MINIMUM : -55.081642150879 STATISTICS_STDDEV : 60.506839414168 STATISTICS_VALID_PERCENT : 100
I was able to get through safely.
Please see here for details of each information.
Recommended Posts