@@ -12,7 +12,7 @@ import and interpret XDI-formatted data.
12
12
13
13
## API
14
14
15
- ### read an XDI file
15
+ ### Read an XDI file
16
16
17
17
Read an XDI file, store it's content in an XDIFile struct, and return
18
18
an integer return code.
@@ -25,9 +25,9 @@ an integer return code.
25
25
ret = XDI_readfile(" mydata.xdi" , xdifile);
26
26
```
27
27
28
- ### interpret the XDI_readfile error code
28
+ ### Interpret the XDI_readfile error code
29
29
30
- Interpret the return code by printing teh corresponding error massage
30
+ Interpret the return code by printing the corresponding error message
31
31
to the screen:
32
32
33
33
``` C
@@ -51,23 +51,24 @@ or warning message from the most recent action. If an error code
51
51
returns as non-zero, the content of `xdifile->error_message` will
52
52
explain the meaning of the error code in English.
53
53
54
- ### test for required metadata
54
+ ### Test for required metadata
55
55
56
56
Test whether the **required** metadata was present in the XDI file.
57
57
If `XDI_required_metadata` returns a non-zero value, the file is
58
58
**not compliant** with the XDI specification.
59
59
60
60
```C
61
61
j = XDI_required_metadata(xdifile);
62
- if (j != 0) {
63
- printf("\n# check for required metadata -- (requirement code %ld):\n%s\n", j, xdifile->error_message);
62
+ if (j != 0 ) {
63
+ printf("\n# check for required metadata -- (requirement code %ld):\n%s\n",
64
+ j, xdifile->error_message);
64
65
}
65
66
```
66
67
67
68
Run ` xdi_reader ` agains ` baddata/bad_30.xdi ` for an example of a
68
69
file which is non-compliant because of missing ** required** metadata.
69
70
70
- ### test for recommended metadata
71
+ ### Test for recommended metadata
71
72
72
73
Test whether the ** recommended** metadata was present in the XDI file.
73
74
If ` XDI_required_metadata ` returns a non-zero value, the file is
@@ -76,8 +77,9 @@ highly useful to the interchange of the data contained in the file.
76
77
77
78
``` C
78
79
j = XDI_recommended_metadata(xdifile);
79
- if (j != ) {
80
- printf ("\n# check for recommended metadata -- (recommendation code %ld):\n%s\n", j, xdifile->error_message);
80
+ if (j != 0 ) {
81
+ printf ("\n# check for recommended metadata -- (recommendation code %ld):\n%s\n",
82
+ j, xdifile->error_message);
81
83
}
82
84
```
83
85
@@ -131,33 +133,58 @@ translation of a table of error messages into another language.
131
133
132
134
### XDI_readfile error codes
133
135
134
- | code | message |
135
- | -1 | |
136
- | -2 | |
136
+ | code | message |
137
+ | ------| --------------------------------------------------------------|
138
+ | -1 | not an XDI file, no XDI versioning information in first line |
139
+ | -2 | <word > -- invalid family name in metadata |
140
+ | -4 | <word > -- invalid keyword name in metadata |
141
+ | -8 | <word > -- not formatted as Family.Key: Value |
142
+ | -16 | number of columns changes in data table |
143
+ | -32 | non-numeric value in data table: <word > |
144
+
145
+ Here ` <word> ` will be the the text that triggered the error.
137
146
138
147
### XDI_readfile warning codes
139
148
140
- | 1 | |
141
- | 2 | |
149
+ | code | message |
150
+ | -------| --------------------------------------------------------------|
151
+ | 1 | no mono.d_spacing given with angle array |
152
+ | 2 | no line of minus signs '#-----' separating header from data |
153
+ | 4 | contains unrecognized header lines |
154
+ | 8 | element.symbol missing or not valid |
155
+ | 16 | element.edge missing or not valid |
156
+ | 32 | element.reference not valid |
157
+ | 64 | element.ref\_ edge not valid |
158
+ | 128 | extension field used without versioning information |
159
+ | 256 | Column.1 is not "energy" or "angle" |
160
+ | 512 | invalid timestamp: format should be ISO 8601 (YYYY-MM-DD HH:MM: SS ) |
161
+ | 1024 | invalid timestamp: date out of valuid range |
162
+
142
163
143
164
### XDI_required_metadata return codes
144
165
145
166
The return code from ` XDI_required_metadata ` can be interpreted
146
167
bitwise. That is, a return code of 7 means that all three required
147
168
metadata fields were missing.
148
169
149
- | 1 | |
150
- | 2 | |
151
- | 4 | |
170
+ | code | message |
171
+ | ------| -------------------------------------|
172
+ | 1 | Element.symbol missing or not valid |
173
+ | 2 | Element.edge missing or not valid |
174
+ | 4 | Mono.d\_ spacing missing |
175
+ | 4 | Mono.d\_ spacing not valid |
152
176
153
177
### XDI_recommended_metadata return codes
154
178
155
179
The return code from ` XDI_recommended_metadata ` can be interpreted
156
180
bitwise. That is, a return code of 7 means that the first three
157
181
recommendation metadata fields were missing.
158
182
159
- | 1 | |
160
- | 2 | |
161
- | 4 | |
162
- | 8 | |
163
- | 16 | |
183
+ | code | message |
184
+ | ------| -----------------------------------------------------|
185
+ | 1 | Missing recommended metadata field: Facility.name |
186
+ | 2 | Missing recommended metadata field: Facility.source |
187
+ | 4 | Missing recommended metadata field: Beamline.name |
188
+ | 8 | Missing recommended metadata field: Scan.start_time |
189
+ | 16 | Missing recommended metadata field: Column.1 |
190
+
0 commit comments