Skip to content

Commit 204442f

Browse files
authored
Doc: Add Python API docs for Group.CreateMDArray
1 parent e1b1929 commit 204442f

File tree

4 files changed

+41
-1
lines changed

4 files changed

+41
-1
lines changed

gcore/gdalmultidim.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -722,7 +722,7 @@ std::shared_ptr<GDALDimension> GDALGroup::CreateDimension(
722722
* @param papszOptions Driver specific options determining how the array
723723
* should be created.
724724
*
725-
* @return the new array, or nullptr if case of error
725+
* @return the new array, or nullptr in case of error
726726
*/
727727
std::shared_ptr<GDALMDArray> GDALGroup::CreateMDArray(
728728
CPL_UNUSED const std::string &osName,
Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
%feature("docstring") CreateMDArray "
2+
3+
Create a multidimensional array within a group.
4+
5+
It is recommended that the GDALDimension objects passed in ``dimensions``
6+
belong to this group, either by retrieving them with :py:meth:`GetDimensions`
7+
or creating a new one with :py:meth:`CreateDimension`.
8+
9+
See :cpp:func:`GDALGroup::CreateMDArray`.
10+
11+
Parameters
12+
----------
13+
name : str
14+
name
15+
dimensions : list
16+
List of dimensions, ordered from the slowest varying
17+
dimension first to the fastest varying dimension last.
18+
Might be empty for a scalar array (if supported by driver)
19+
data_type: :py:class:`osgeo.gdal.ExtendedDataType`
20+
options: dict/list
21+
an optional dict or list of driver specific ``NAME=VALUE`` option strings.
22+
23+
Returns
24+
-------
25+
26+
MDArray:
27+
the new :py:class:`osgeo.gdal.MDArray` or ``None`` on failure.
28+
29+
Examples
30+
--------
31+
>>> drv = gdal.GetDriverByName('MEM')
32+
>>> mem_ds = drv.CreateMultiDimensional('myds')
33+
>>> rg = mem_ds.GetRootGroup()
34+
>>> dimX = rg.CreateDimension('X', None, None, 3)
35+
>>> ar = rg.CreateMDArray('ar', [dimX], gdal.ExtendedDataType.Create(gdal.GDT_Byte))
36+
37+
";
38+

swig/include/python/gdal_python.i

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
%include "gdal_band_docs.i"
1111
%include "gdal_dataset_docs.i"
1212
%include "gdal_driver_docs.i"
13+
%include "gdal_mdm_docs.i"
1314
%include "gdal_operations_docs.i"
1415

1516
%init %{

swig/python/CMakeLists.txt

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@ set(GDAL_PYTHON_CSOURCES
2626
${PROJECT_SOURCE_DIR}/swig/include/python/docs/gdal_band_docs.i
2727
${PROJECT_SOURCE_DIR}/swig/include/python/docs/gdal_dataset_docs.i
2828
${PROJECT_SOURCE_DIR}/swig/include/python/docs/gdal_driver_docs.i
29+
${PROJECT_SOURCE_DIR}/swig/include/python/docs/gdal_mdm_docs.i
2930
${PROJECT_SOURCE_DIR}/swig/include/python/docs/gdal_operations_docs.i
3031
${PROJECT_SOURCE_DIR}/swig/include/python/docs/ogr_docs.i
3132
${PROJECT_SOURCE_DIR}/swig/include/python/docs/ogr_featuredef_docs.i

0 commit comments

Comments
 (0)