主要内容

本页采用了机器翻译。点击此处可查看英文原文。

georasterinfo

关于地理空间栅格数据文件的信息

说明

info = georasterinfo(filename) 为地理或投影栅格数据文件创建一个 RasterInfo 对象,该文件格式包括 GeoTIFF、Esri 二进制网格、GRIB 或 DTED 等。有关支持格式的完整列表,请参阅 支持的格式

示例

示例

全部折叠

通过创建一个 RasterInfo 对象来获取地理空间栅格数据文件的信息。

info = georasterinfo("boston.tif");

使用点表示法访问 RasterInfo 对象的各个属性。

info.NativeFormat
ans = 
"uint8"

通过创建一个 RasterInfo 对象来获取 DTED 文件的信息。通过访问 RasterInfo 对象的 Metadata 属性,获取 DTED 文件的特定元数据。

info = georasterinfo("n39_w106_3arc_v2.dt1");
md = info.Metadata
md = struct with fields:
                  AREA_OR_POINT: "Point"
           DTED_CompilationDate: "0002"
               DTED_DataEdition: "02"
          DTED_DigitizingSystem: "SRTM      "
        DTED_HorizontalAccuracy: "0013"
           DTED_HorizontalDatum: "WGS84"
           DTED_MaintenanceDate: "0000"
    DTED_MaintenanceDescription: "0000"
            DTED_MatchMergeDate: "0000"
         DTED_MatchMergeVersion: "A"
            DTED_NimaDesignator: "DTED1"
            DTED_OriginLatitude: "0390000N"
           DTED_OriginLongitude: "1060000W"
      DTED_PartialCellIndicator: "00"
                  DTED_Producer: "USCNIMA "
     DTED_RelHorizontalAccuracy: "NA  "
       DTED_RelVerticalAccuracy: "0006"
          DTED_SecurityCode_DSI: "U"
          DTED_SecurityCode_UHL: "U  "
             DTED_UniqueRef_DSI: "G19 107        "
             DTED_UniqueRef_UHL: "G19 107     "
      DTED_VerticalAccuracy_ACC: "0006"
      DTED_VerticalAccuracy_UHL: "0006"
             DTED_VerticalDatum: "E96"

通过访问元数据结构的 DTED_OriginLatitudeDTED_OriginLongitude 字段,获取数据左下角的坐标。坐标以字符串形式存储。将字符串转换为角度。

latS = md.DTED_OriginLatitude;
lonS = md.DTED_OriginLongitude;
latA = str2angle(latS) 
latA = 
39
lonA = str2angle(lonS)
lonA = 
-106

本示例中使用的 DTED 文件由美国地质调查局提供。

自 R2023b 起

通过创建一个 RasterInfo 对象获取 GRIB 文件的信息 [1][2]。通过访问 RasterInfo 对象的 Metadata 属性获取 GRIB 文件的元数据。

info = georasterinfo("seaice.grib");
md = info.Metadata
md=7×8 table
                Description                          Comment             Unit     Element    ShortName       ReferenceTime             ValidTime          ForecastSeconds
    ____________________________________    _________________________    _____    _______    _________    ____________________    ____________________    _______________

    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2010 12:00:00    01-Sep-2010 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2012 12:00:00    01-Sep-2012 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2014 12:00:00    01-Sep-2014 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2016 12:00:00    01-Sep-2016 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2018 12:00:00    01-Sep-2018 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2020 12:00:00    01-Sep-2020 12:00:00         0 sec     
    "0[-] SFC (Ground or water surface)"    "Sea ice cover (0-1) [-]"    "[-]"     "CI"       "0-SFC"     01-Sep-2022 12:00:00    01-Sep-2022 12:00:00         0 sec     

RasterInfo 对象使用表格存储 GRIB 元数据,其中表格的每行对应文件中的一条数据带。查看第三数据带的评论、参考时间和预测持续时间。

md3 = md(3,:);
md3.Comment
ans = 
"Sea ice cover (0-1) [-]"
md3.ReferenceTime
ans = datetime
   01-Sep-2014 12:00:00

md3.ForecastSeconds
ans = duration
   0 sec

[1] Hersbach, H., B. Bell, P. Berrisford, G. Biavati, A. Horányi, J. Muñoz Sabater, J. Nicolas, et al."ERA5 Hourly Data on Single Levels from 1940 to Present."Copernicus Climate Change Service (C3S) Climate Data Store (CDS), 2023.Accessed May 22, 2023. https://doi.org/10.24381/cds.adbb2d47.

[2] Neither the European Commission nor ECMWF is responsible for any use that may be made of the Copernicus information or data it contains.

输入参数

全部折叠

栅格数据文件的名称,指定为字符向量或字符串标量。filename 的形式取决于文件所在的位置。

  • 如果文件位于当前文件夹或 MATLAB® 路径下的某个文件夹中,则指定文件名,例如 "myFile.dem"

  • 如果文件不在当前文件夹或位于 MATLAB 路径下的文件夹中,则需指定完整路径或相对路径名称,例如 "C:\myfolder\myFile.tif""dataDir\myFile.dat"

有关支持的文件格式列表,请参阅 支持的格式

数据类型: char | string

详细信息

全部折叠

版本历史记录

在 R2020a 中推出

全部展开