# Multi-dimensional array API

class osgeo.gdal.Group(*args, **kwargs)

  Proxy of C++ GDALGroupHS class.

  CreateAttribute(Group self, char const * name, int dimensions, ExtendedDataType data_type, char ** options=None) → Attribute
  CreateDimension(Group self, char const * name, char const * type, char const * direction, GUIntBig size, char ** options=None) → Dimension
  CreateGroup(Group self, char const * name, char ** options=None) → Group
  CreateMDArray(Group self, char const * name, int dimensions, ExtendedDataType data_type, char ** options=None) → MDArray

    Create a multidimensional array within a group.

    It is recommended that the GDALDimension objects passed in `dimensions` belong to this group, either by retrieving them with `GetDimensions()` or creating a new one with `CreateDimension()`.

    See `GDALGroup::CreateMDArray()`.

    Parameters:

      - name (str) -- name

      - dimensions (list) -- List of dimensions, ordered from the slowest varying dimension first to the fastest varying dimension last. Might be empty for a scalar array (if supported by driver)

      - data_type (`osgeo.gdal.ExtendedDataType`)

      - options (dict/list) -- an optional dict or list of driver specific `NAME=VALUE` option strings.

    Returns:

      the new `osgeo.gdal.MDArray` or `None` on failure.

    Return type:

      MDArray

    Examples

        >>> drv = gdal.GetDriverByName('MEM')
        >>> mem_ds = drv.CreateMultiDimensional('myds')
        >>> rg = mem_ds.GetRootGroup()
        >>> dimX = rg.CreateDimension('X', None, None, 3)
        >>> ar = rg.CreateMDArray('ar', [dimX], gdal.ExtendedDataType.Create(gdal.GDT_Byte))

  DeleteAttribute(Group self, char const * name, char ** options=None) → CPLErr
  DeleteGroup(Group self, char const * name, char ** options=None) → CPLErr
  DeleteMDArray(Group self, char const * name, char ** options=None) → CPLErr
  GetAttribute(Group self, char const * name) → Attribute
  GetAttributes(Group self, char ** options=None)
  GetDimensions(Group self, char ** options=None)
  GetFullName(Group self) → char const *
  GetGroupNames(options=[]) → list[str]
  GetMDArrayFullNamesRecursive(Group self, char ** groupOptions=None, char ** arrayOptions=None) → char **
  GetMDArrayNames(options=[]) → list[str]
  GetName(Group self) → char const *
  GetStructuralInfo(Group self) → char **
  GetVectorLayerNames(Group self, char ** options=None) → char **
  OpenGroup(Group self, char const * name, char ** options=None) → Group
  OpenGroupFromFullname(Group self, char const * name, char ** options=None) → Group
  OpenMDArray(Group self, char const * name, char ** options=None) → MDArray
  OpenMDArrayFromFullname(Group self, char const * name, char ** options=None) → MDArray
  OpenVectorLayer(Group self, char const * name, char ** options=None) → Layer
  Rename(Group self, char const * newName) → CPLErr
  ResolveMDArray(Group self, char const * name, char const * starting_point, char ** options=None) → MDArray
  SubsetDimensionFromSelection(Group self, char const * selection, char ** options=None) → Group

class osgeo.gdal.Dimension(*args, **kwargs)

  Proxy of C++ GDALDimensionHS class.

  GetDirection(Dimension self) → char const *
  GetFullName(Dimension self) → char const *
  GetIndexingVariable(Dimension self) → MDArray
  GetName(Dimension self) → char const *
  GetSize(Dimension self) → GUIntBig
  GetType(Dimension self) → char const *
  Rename(Dimension self, char const * newName) → CPLErr
  SetIndexingVariable(Dimension self, MDArray array) → bool

class osgeo.gdal.MDArray(*args, **kwargs)

  Proxy of C++ GDALMDArrayHS class.

  AdviseRead(array_start_idx=None, count=None, options=[])
  AsClassicDataset(MDArray self, size_t iXDim, size_t iYDim, Group hRootGroup=None, char ** options=None) → Dataset
  Cache(MDArray self, char ** options=None) → bool
  ComputeStatistics(MDArray self, bool approx_ok=FALSE, GDALProgressFunc callback=0, void * callback_data=None, char ** options=None) → Statistics
  CreateAttribute(MDArray self, char const * name, int dimensions, ExtendedDataType data_type, char ** options=None) → Attribute
  DeleteAttribute(MDArray self, char const * name, char ** options=None) → CPLErr
  DeleteNoDataValue(MDArray self) → CPLErr
  GetAttribute(MDArray self, char const * name) → Attribute
  GetAttributes(MDArray self, char ** options=None)
  GetBlockSize(MDArray self)
  GetCoordinateVariables(MDArray self)
  GetDataType(MDArray self) → ExtendedDataType
  GetDimensionCount(MDArray self) → size_t
  GetDimensions(MDArray self)
  GetFullName(MDArray self) → char const *
  GetGridded(MDArray self, char const * pszGridOptions, MDArray xArray=None, MDArray yArray=None, char ** options=None) → MDArray
  GetMask(MDArray self, char ** options=None) → MDArray
  static GetMeshGrid(int nInputArrays, char ** options=None)
  GetName(MDArray self) → char const *
  GetNoDataValue(MDArray self) → value
  GetNoDataValueAsDouble(MDArray self)
  GetNoDataValueAsInt64(MDArray self)
  GetNoDataValueAsRaw(MDArray self) → CPLErr
  GetNoDataValueAsString(MDArray self) → retStringAndCPLFree *
  GetNoDataValueAsUInt64(MDArray self)
  GetOffset(MDArray self)
  GetOffsetStorageType(MDArray self) → GDALDataType
  GetProcessingChunkSize(MDArray self, size_t nMaxChunkMemory)
  GetResampled(MDArray self, int nDimensions, GDALRIOResampleAlg resample_alg, OSRSpatialReferenceShadow ** srs, char ** options=None) → MDArray
  GetScale(MDArray self)
  GetScaleStorageType(MDArray self) → GDALDataType
  GetShape()

    Return the shape of the array

  GetSpatialRef(MDArray self) → SpatialReference
  GetStatistics(MDArray self, bool approx_ok=FALSE, bool force=TRUE, GDALProgressFunc callback=0, void * callback_data=None) → Statistics
  GetStructuralInfo(MDArray self) → char **
  GetTotalElementsCount(MDArray self) → GUIntBig
  GetUnit(MDArray self) → char const *
  GetUnscaled(MDArray self) → MDArray
  GetView(MDArray self, char const * viewExpr) → MDArray
  Read(array_start_idx=None, count=None, array_step=None, buffer_stride=None, buffer_datatype=None)
  ReadAsArray(array_start_idx=None, count=None, array_step=None, buffer_datatype=None, buf_obj=None)
  ReadAsMaskedArray(array_start_idx=None, count=None, array_step=None)

    Return a numpy masked array of ReadAsArray() with GetMask()

  Rename(MDArray self, char const * newName) → CPLErr
  Resize(MDArray self, int newDimensions, char ** options=None) → CPLErr
  SetNoDataValue(MDArray self, value) → CPLErr
  SetNoDataValueDouble(MDArray self, double d) → CPLErr
  SetNoDataValueInt64(MDArray self, GIntBig v) → CPLErr
  SetNoDataValueRaw(MDArray self, GIntBig nLen) → CPLErr
  SetNoDataValueString(MDArray self, char const * nodata) → CPLErr
  SetNoDataValueUInt64(MDArray self, GUIntBig v) → CPLErr
  SetOffset(MDArray self, double val, GDALDataType storageType=GDT_Unknown) → CPLErr
  SetScale(MDArray self, double val, GDALDataType storageType=GDT_Unknown) → CPLErr
  SetSpatialRef(MDArray self, SpatialReference srs) → OGRErr
  SetUnit(MDArray self, char const * unit) → CPLErr
  Transpose(MDArray self, int axisMap) → MDArray
  Write(buffer, array_start_idx=None, count=None, array_step=None, buffer_stride=None, buffer_datatype=None)
  WriteArray(array, array_start_idx=None, array_step=None)
  WriteStringArray(MDArray self, int nDims1, int nDims2, int nDims3, ExtendedDataType buffer_datatype, char ** options) → CPLErr
  property shape

    Returns the shape of the array.

class osgeo.gdal.Attribute(*args, **kwargs)

  Proxy of C++ GDALAttributeHS class.

  GetDataType(Attribute self) → ExtendedDataType
  GetDimensionCount(Attribute self) → size_t
  GetDimensionsSize(Attribute self)
  GetFullName(Attribute self) → char const *
  GetName(Attribute self) → char const *
  GetTotalElementsCount(Attribute self) → GUIntBig
  Read()

    Read an attribute and return it with the most appropriate type

  ReadAsDouble(Attribute self) → double
  ReadAsDoubleArray(Attribute self)
  ReadAsInt(Attribute self) → int
  ReadAsInt64(Attribute self) → long long
  ReadAsInt64Array(Attribute self)
  ReadAsIntArray(Attribute self)
  ReadAsRaw(Attribute self) → CPLErr
  ReadAsString(Attribute self) → char const *
  ReadAsStringArray(Attribute self) → char **
  Rename(Attribute self, char const * newName) → CPLErr
  Write(val)
  WriteDouble(Attribute self, double val) → CPLErr
  WriteDoubleArray(Attribute self, int nList) → CPLErr
  WriteInt(Attribute self, int val) → CPLErr
  WriteInt64(Attribute self, long long val) → CPLErr
  WriteInt64Array(Attribute self, int nList) → CPLErr
  WriteIntArray(Attribute self, int nList) → CPLErr
  WriteRaw(Attribute self, GIntBig nLen) → CPLErr
  WriteString(Attribute self, char const * val) → CPLErr
  WriteStringArray(Attribute self, char ** vals) → CPLErr

class osgeo.gdal.ExtendedDataType(*args, **kwargs)

  Proxy of C++ GDALExtendedDataTypeHS class.

  CanConvertTo(ExtendedDataType self, ExtendedDataType other) → bool
  static Create(GDALDataType dt) → ExtendedDataType
  static CreateCompound(char const * name, size_t nTotalSize, int nComps) → ExtendedDataType
  static CreateString(size_t nMaxStringLength=0, GDALExtendedDataTypeSubType eSubType=GEDTST_NONE) → ExtendedDataType
  Equals(ExtendedDataType self, ExtendedDataType other) → bool
  GetClass(ExtendedDataType self) → GDALExtendedDataTypeClass
  GetComponents(ExtendedDataType self)
  GetMaxStringLength(ExtendedDataType self) → size_t
  GetName(ExtendedDataType self) → char const *
  GetNumericDataType(ExtendedDataType self) → GDALDataType
  GetSize(ExtendedDataType self) → size_t
  GetSubType(ExtendedDataType self) → GDALExtendedDataTypeSubType