0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?

More than 3 years have passed since last update.

pythonでラスタデータのバンドの情報をぶっこ抜く

Last updated at Posted at 2021-01-04

はじめに

GPV(ラスターデータ)をQGISで開いた時のプロパティで確認できる以下のバンド情報をpythonでぶっこ抜きたいと思ったので、その方法のメモ。
image.png

方法

from osgeo import gdal
data = gdal.Open("パス")

band = バンド数
data.GetRasterBand(band).GetMetadata()

結果

結果は辞書形式で取得されます。
以下はバンド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'}

見やすくするとこうですね
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

無事ぶっこぬけました。

各情報の詳細はこちらをご覧ください

0
1
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
1

Delete article

Deleted articles cannot be recovered.

Draft of this article would be also deleted.

Are you sure you want to delete this article?