多维栅格数据模型

本文试图描述GDAL 3.1中添加的GDAL多维数据模型。这就是GDAL多维数据集可以包含的信息类型及其语义。

多维栅格API是传统的 栅格数据模型 ,以处理三维、4D或更高维度的数据集。目前,它仅限于基本的读/写API,没有那么多插入到其他更高级别的实用程序中。

它的灵感来自netCDF和HDF5 API以及数据模型。见 HDF5 format and data model .

A GDALDataset with multidimensional content contains a root GDALGroup.

A GDALGroup (模型a HDF5 Group )是GDALAttribute、GDALMDArray或其他GDALGroup的命名容器。因此,GDALGroup可以描述对象的层次结构。

属性

A GDALAttribute (模型a HDF5 Attribute )具有名称和值,通常用于描述元数据项。在一般情况下,该值可以是“any”类型的多维数组(对于HDF5格式)(在大多数情况下,这将是string或numeric类型的单个值)

多维数组

A GDALMDArray (模型a HDF5 Dataset )具有名称、多维数组、引用多个GDALDimension以及GDALAttribute列表。

Most drivers use the row-major convention for dimensions: that is, when considering that the array elements are stored consecutively in memory, the first dimension is the slowest varying one (in a 2D image, the row), and the last dimension the fastest varying one (in a 2D image, the column). That convention is the default convention used for NumPy arrays, the MEM driver and the HDF5 and netCDF APIs. The GDAL API is mostly agnostic about that convention, except when passing a NULL array as the stride parameter for the GDALAbstractMDArray::Read() and GDALAbstractMDArray::Write() methods. You can refer to NumPy documentation about multidimensional array indexing order issues

GDALMDArray还具有可选属性:

  • 坐标参考系: OGRSpatialReference

  • 无数据值:

  • 单位

  • 偏移量,使未缩放的值=偏移量+比例*原始值

  • 缩放,使未缩放值=偏移量+缩放*原始值

Number of operations can be applied on an array to get modified views of it: GDALMDArray::Transpose(), GDALMDArray::GetView(), etc.

The GDALMDArray::Cache() method can be used to cache the value of a view array into a sidecar file.

尺寸

A GDALDimension 描述用于索引多维数组的维度/轴。它具有以下特性:

  • 名字

  • 大小,即可以沿维度索引的值的数目

  • a type, which is a string giving the nature of the dimension. Predefined values are: HORIZONTAL_X, HORIZONTAL_Y, VERTICAL, TEMPORAL, PARAMETRIC Other values might be used. Empty value means unknown.

  • 一个方向。预定义的值有:东、西、南、北、上、下、未来、过去,可以使用其他值。空值表示未知。

  • 对GDALMDArray变量的引用,通常是一维的,描述维度所取的值。对于地理参考GDALMDArray及其X维,这通常是每个网格点的东距/经度值。

数据类型

A GDALExtendedDataType (模型a HDF5 datatype )描述GDALAttribute或GDALMDArray的单个值所采用的类型。它的类可以是数值、字符串或复合。对于NUMERIC,现有的 GDALDataType 支持枚举值。对于COMPOUND,数据类型是一个成员列表,每个成员由名称、复合结构中的字节偏移量和GDALExtendedDataType来描述。

备注

HDF5模型化允许更复杂的数据类型。

备注

HDF5没有复杂值的本机数据类型,而GDALDataType没有。因此,驱动程序可能决定从表示复杂值的HDF5复合数据类型公开GDTucxxx数据类型。

与GDAL二维栅格数据模型的区别

  • GDALRasterBand的概念不再用于多维。可以将其建模为不同的GDALMDArray或使用复合数据类型。

GDAL二维经典栅格数据模型与多维数据模型的桥梁

这个 GDALRasterBand::AsMDArray()GDALMDArray::AsClassicDataset() 可分别用于将栅格带转换为MD阵列或将二维数据集转换为MD阵列。

应用

以下应用程序可用于检查和操作多维数据集: