多维VRT

3.1 新版功能.

Multidimensional VRT is a specific variant of the VRT—GDAL虚拟格式 format, dedicated to represent Multidimensional arrays, according to the 多维栅格数据模型.

下面是这样一个文件的示例:

<VRTDataset>
    <Group name="/">
        <Dimension name="Y" size="4"/>
        <Dimension name="X" size="3"/>

        <Array name="temperature">
            <DataType>Float64</DataType>
            <DimensionRef ref="Y"/>
            <DimensionRef ref="X"/>
            <Source>
                <SourceFilename>my.nc</SourceFilename>
                <SourceArray>temperature</SourceArray>
                <SourceSlab offset="1,1" count="2,2" step="2,1"/>
                <DestSlab offset="2,1"/>
            </Source>
        </Array>
    </Group>
</VRTDataset>

.vrt格式

A XML schema of the GDAL VRT format is available.

存储在磁盘上的虚拟文件以XML格式保存,包含以下元素。

VRTDataset :这是整个GDAL数据集的根元素。它没有属性,并且必须有一个属性名设置为“/”的组子元素

<VRTDataset>
    <Group name="/">

:这表示 GDALGroup . VRTDataset元素下至少有一个名为“/”的根组。一个组必须有一个 name 属性,并且可以具有以下子元素,其多重性为0:n:维度、属性、数组、组

尺寸 :这表示 GDALDimension . 它具有以下属性: name (要求) size (要求) type方向

<Dimension name="X" size="30" type="HORIZONTAL_X" direction="EAST"/>

属性 :这表示 GDALAttribute . 它一定有一个 name 属性和子级 DataType 元素。属性值存储在一个或多个子项中 价值 元素

价值 DataType 可以是:String、Byte、UInt16、Int16、UInt32、Int32、Float32、Float64、CInt16、CInt32、CFloat32或CFloat64。

<Attribute name="foo">
    <DataType>String</DataType>
    <Value>bar</Value>
</Attribute>

数组 :这表示 GDALMDArray . 它一定有一个 name 属性和子级 DataType 元素。可能有0个或更多 DimensionRef尺寸 子元素来定义其维度。可以选择指定以下元素来定义其属性。 SRS系统, 单位 , * NoDataValue *, * 抵消 *和 规模 . 为了定义它的值,它可能有一个 RegularlySpacedValues 元素,或零,其中的一个或多个元素 ConstantValue , * InlineValues *, * InlineValuesWithValueElement * or * 来源

<Array name="longitude">
    <DataType>Float64</DataType>
    <DimensionRef ref="longitude"/>
    <RegularlySpacedValues start="-180" step="0.5"/>
</Array>
<Array name="time">
    <DataType>String</DataType>
    <DimensionRef ref="time"/>
    <InlineValuesWithValueElement>
        <Value>2010-01-01</Value>
        <Value>2011-01-01</Value>
        <Value>2012-01-01</Value>
    </InlineValuesWithValueElement>
</Array>
<Array name="temperature">
    <DataType>Float64</DataType>
    <DimensionRef ref="Y"/>
    <Dimension name="X" size="3"/>
    <SRS dataAxisToSRSAxisMapping="2,1">EPSG:32631</SRS>
    <Unit>Kelvin</Unit>
    <NoDataValue>-999</NoDataValue>
    <Offset>0</Offset>
    <Scale>1</Scale>
    <Source>
        <SourceFilename>my.nc</SourceFilename>
        <SourceArray>temperature</SourceArray>
    </Source>
</Array>

Source: This indicates that raster data should be read from a separate dataset. A Source must have a SourceFilename, and either a SourceArray (when the source is a Multidimensional dataset), or a SourceBand (when the source is a classic 2D dataset) child element. It may have a SourceTranspose child element to apply a GDALMDArray::Transpose() operation and a SourceView to apply slicing/trimming operations or extraction of a component of a compound data type (see GDALMDArray::GetView()). It may have a SourceSlab element with attributes offset, count and step defining respectively the starting offset of the source, the number of values along each dimension and the step between source elements. It may have a DestSlab element with an offset attribute to define where the source data is placed into the target array. SourceSlab operates on the output of SourceView if specified, which operates itself on the output of SourceTranspose if specified.

<Source>
    <SourceFilename>my.nc</SourceFilename>
    <SourceArray>temperature</SourceArray>
    <SourceTranspose>1,0</SourceTranspose>
    <SourceView>[...]</SourceView>
    <SourceSlab offset="1,1" count="2,2" step="2,1"/>
    <DestSlab offset="2,1"/>
</Source>