-
Notifications
You must be signed in to change notification settings - Fork 10
Add the Ability to Load and Save External Metadata #173
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
2d54399
116ddb2
ab3f3cc
9af1590
dff558e
de3d650
877a88e
fa39ac1
4c354b7
3dc860b
e9a30f3
da8e951
36148d5
79793ee
119dfcf
04b3f9c
abcdeae
212dd0b
ae8aab8
2c00cd4
1519caa
0af2ece
8f49436
95538de
8b33349
077b0db
4bbb166
feac1b3
1761aee
23f56ef
03bf800
8dc2919
106714d
1835b26
3d37136
8b5447e
b808ac9
d9c6d05
d71456b
886ff24
4ec679b
f79cc0d
9b71d8f
7fcbbc3
f1e4f8c
9e7e27a
a0e13e8
e1b0595
5e70363
8480857
acbf778
f1d7906
3ef2e61
7c5d69c
7453293
67301b0
cc97f9f
9abe77c
df08391
ccce4db
84362b5
cc84db7
ae88f57
a159bc7
7df8ca4
0e14c70
fe9c9bd
cff3f66
d0478ec
296fce1
f3b85fb
e3aea7e
98813d8
fcf45a4
d9294f8
a672626
5676e05
209b4c6
c0e3128
37ccb13
5db76c4
1a95458
7cff684
8910d4a
39e5229
288ef80
bedd16c
d1163ea
30c68ae
fd98e00
8b299c8
f1f4f3e
fd5cec4
64152eb
1239cf3
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -0,0 +1,56 @@ | ||||||
| .. meta:: | ||||||
| :description lang=en: Tutorial on managing metadata | ||||||
| :keywords: metadata, license, licensing, attribution, references, development, tutorial | ||||||
| :property=og:locale: en_GB | ||||||
|
|
||||||
| .. include:: common.txt | ||||||
|
|
||||||
|
|
||||||
| Managing Metadata | ||||||
| ================= | ||||||
|
|
||||||
| Metadata in this tutorial refers to information about the data in a file, that does not | ||||||
| directly affect that data. For example, licensing information or attributions. | ||||||
|
|
||||||
| Some ancillary file formats cannot include metadata. Metadata can be very important to | ||||||
| keep alongside the data as often data will have rome form of requirement or restriction | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| on it. Because of this, ANTS can handle in external metadata files, provided they match | ||||||
| the naming convention of `filename.attribute.accepted-metadata`. The current accepted | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. As discussed, can this be clarified a bit? It would be good to have a concrete example here, e.g. for
Suggested change
|
||||||
| metadata attributes are "license", "attribution", "restrictions", "institution", | ||||||
| "acknowledgement", and "references". | ||||||
|
|
||||||
| This functionality can be turned off through the use of the argument | ||||||
| ``--ignore-metadata-files`` on the command line or when calling the ANTS load: | ||||||
|
|
||||||
| .. code-block:: python | ||||||
|
|
||||||
| cube = ants.io.load('data', ignore_metadata_files=True) | ||||||
|
|
||||||
|
|
||||||
| .. note:: | ||||||
| Any attributes or files referencing licensing should use the 'license' spelling for | ||||||
| consistency. | ||||||
|
|
||||||
| Loading Metadata | ||||||
| ---------------- | ||||||
|
|
||||||
| ANTS can load in external metadata files or 'sidecar' files, if they are kept in the | ||||||
| same directory as the data files, and have the same name (including the extension). | ||||||
| Metadata can be loaded alongside all files, including NetCDF files, however ANTS will | ||||||
| not allow you to load a file with a metadata attribute and a sidecar file with the same | ||||||
| attribute. This is to prevent unintentional loss or overwriting of metadata information. | ||||||
|
|
||||||
| .. note:: | ||||||
| When using wildcards for loading with sidecar files, add the file extension to the | ||||||
| end to prevent issues with ANTS attempting to load the sidecar files. E.g. | ||||||
| `data*.pp` rather than `data*`. | ||||||
|
|
||||||
|
|
||||||
| Saving Metadata | ||||||
| --------------- | ||||||
|
|
||||||
| Metadata will only be saved to a sidecar file, if the ancil loader is used. This is | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Just to check, should it be the ancil saver rather than loader that determines whether sidecar files are saved?
Suggested change
|
||||||
| because NetCDF files will include the attributes within the file. | ||||||
|
|
||||||
| The sidecar files produced by ANTS follow the same naming covenstions at those loaded in | ||||||
|
Collaborator
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more.
Suggested change
|
||||||
| `filename.attribute.accepted-metadata`. Only accepted metadata will be written out. | ||||||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -14,3 +14,4 @@ Tutorials | |
| tutorial_KGO.rst | ||
| tutorial_sources.rst | ||
| tutorial_rose_stem.rst | ||
| tutorial_metadata.rst | ||
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I really like this documentation, but I do wonder if it is really a tutorial as such, maybe it would make sense somewhere else? Perhaps under Ancillary Generation Pipeline? Alternatively, it could be made into a tutorial with some more examples