@@ -29,6 +29,43 @@ New features
29
29
>>> a02.equals(a[' a1:a3' ] >> ' group_a' )
30
30
False
31
31
32
+ * allowed arrays to have metadata (e.g. title, description, authors, ...).
33
+ Metadata can be accessed using the syntax ``array.meta.name``.
34
+ See bellow for use cases:
35
+
36
+ >>> # add metadata to/from an array
37
+ >>> # for Python <= 3.5
38
+ >>> arr = ndtest((3 , 3 ), meta=[(' title' , ' array for testing' ), (' author' , ' John Smith' )])
39
+ >>> # for Python >= 3.6
40
+ >>> arr = ndtest((3 , 3 ), meta=Metadata(title=' array for testing' , author=' John Smith' ))
41
+ >>> # access an item
42
+ >>> arr.meta.author
43
+ ' John Smith'
44
+ >>> # update/add an item (the item is added if not found in existing metadata)
45
+ >>> arr.meta.city = 'London'
46
+ >>> # delete an item
47
+ >>> del arr.meta.city
48
+
49
+ Warnings:
50
+
51
+ - Currently, only the HDF (.h5) file format supports saving and loading metadata.
52
+ - Metadata are not kept when actions or methods are applied on a array
53
+ except for operations modifying the object in-place, such as `pop[age < 10] = 0`,
54
+ and when the method `copy()` is called. Do not add metadata to an array if you know
55
+ you will apply actions or methods on it before dumping it.
56
+
57
+ Closes :issue:`78` and :issue:`79`.
58
+
59
+ * deprecated attribute `title` of array objects. A title is now considered as a metadata
60
+ and must be added as:
61
+
62
+ >>> # add title at array creation
63
+ >>> arr = ndtest((3 , 3 ), meta=[(' title' , ' array for testing' )])
64
+
65
+ >>> # or after array creation
66
+ >>> arr = ndtest((3 , 3 ))
67
+ >>> arr.meta.title = ' array for testing'
68
+
32
69
33
70
.. _misc:
34
71
0 commit comments