Skip to content

Commit ea1b379

Browse files
committed
Doc: Add docstrings to CreateAttribute and CreateDimension
1 parent ffb8660 commit ea1b379

1 file changed

Lines changed: 69 additions & 0 deletions

File tree

swig/include/python/docs/gdal_mdm_docs.i

Lines changed: 69 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,71 @@
1+
%feature("docstring") CreateAttribute "
2+
3+
Create an attribute within a :py:class:`osgeo.gdal.MDArray` or :py:class:`osgeo.gdal.Group`.
4+
5+
See :cpp:func:`GDALIHasAttribute::CreateAttribute`.
6+
7+
Parameters
8+
----------
9+
name : str
10+
name
11+
dimensions : list
12+
List of dimensions, ordered from the slowest varying
13+
dimension first to the fastest varying dimension last.
14+
Might be empty for a scalar array (if supported by driver)
15+
data_type: :py:class:`osgeo.gdal.ExtendedDataType`
16+
Attribute data type
17+
options: dict/list
18+
an optional dict or list of driver specific ``NAME=VALUE`` option strings.
19+
20+
Returns
21+
-------
22+
23+
Attribute:
24+
the new :py:class:`osgeo.gdal.Attribute` or ``None`` on failure.
25+
26+
Examples
27+
--------
28+
>>> numeric_attr = ar.CreateAttribute('numeric_attr', [], gdal.ExtendedDataType.Create(gdal.GDT_Float64))
29+
>>> string_attr = ar.CreateAttribute('string_attr', [], gdal.ExtendedDataType.CreateString())
30+
31+
";
32+
33+
%feature("docstring") CreateDimension "
34+
35+
Create a dimension within a :py:class:`osgeo.gdal.Group`.
36+
37+
See :cpp:func:`GDALGroup::CreateDimension`.
38+
39+
Parameters
40+
----------
41+
name : str
42+
Dimension name
43+
dim_type : str
44+
Dimension type (might be empty, and ignored by drivers)
45+
direction: str
46+
Dimension direction (might be empty, and ignored by drivers)
47+
size : int
48+
Number of values indexed by this dimension. Should be > 0
49+
options: dict/list
50+
an optional dict or list of driver specific ``NAME=VALUE`` option strings.
51+
52+
Returns
53+
-------
54+
55+
Dimension:
56+
the new :py:class:`osgeo.gdal.Dimension` or ``None`` on failure.
57+
58+
Examples
59+
--------
60+
>>> dim_band = rg.CreateDimension('band', None, None, 3)
61+
>>> dim_x = rg.CreateDimension('X', None, None, 2)
62+
>>> dim_x.GetFullName()
63+
'/X'
64+
>>> lat = rg.CreateDimension('latitude', gdal.DIM_TYPE_HORIZONTAL_X, None, 2)
65+
>>> lat.GetType()
66+
'HORIZONTAL_X'
67+
";
68+
169
%feature("docstring") CreateMDArray "
270
371
Create a multidimensional array within a group.
@@ -17,6 +85,7 @@ dimensions : list
1785
dimension first to the fastest varying dimension last.
1886
Might be empty for a scalar array (if supported by driver)
1987
data_type: :py:class:`osgeo.gdal.ExtendedDataType`
88+
Array data type
2089
options: dict/list
2190
an optional dict or list of driver specific ``NAME=VALUE`` option strings.
2291

0 commit comments

Comments
 (0)