-
Notifications
You must be signed in to change notification settings - Fork 5
/
Copy pathdrs_entities.py
305 lines (277 loc) · 8.5 KB
/
drs_entities.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
# -*- coding: utf-8 -*-
"""
.. module:: drs_entities.py
:synopsis: Set of CIM v2 ontology type definitions.
applying to the description of CMIP6 Data Reference Syntax quantities.
"""
def drs_atomic_dataset():
"""An entity in a DRS file system."""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
(
"frequency",
"drs.drs_frequency_types",
"1.1",
"Frequency at which data is stored.",
),
(
"geographical_constraint",
"drs.drs_geographical_indicator",
"0.1",
"Identifies geographical subsets and spatial means.",
),
(
"mip_table",
"str",
"1.1",
"The MIP table, together with the variable defines the "
"physical quantity.",
),
("realm", "drs.drs_realms", "0.1", "Modelling realm."),
(
"temporal_constraint",
"drs.drs_temporal_identifier",
"0.1",
"Identifies temporal subsets or means.",
),
(
"variable_name",
"str",
"1.1",
"Identifies the physical quantity (when used in conjunction "
"with the MIP table).",
),
(
"version_number",
"int",
"0.1",
"Uniquely identifies a particular version of a publication "
"level dataset.",
),
],
}
def drs_ensemble_identifier():
"""Identifies a 'response ensemble' realisation using the semantic
content ofa 'run_variant_id'."""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
(
"forcing_number",
"int",
"0.1",
"Identifies possible perturbatinos in forcing.",
),
(
"initialisation_method_number",
"int",
"1.1",
"Identifies which method of initialisation was used, if "
"multiple methods used.",
),
(
"perturbation_number",
"int",
"1.1",
"Identifies different members of a perturbed physics "
"ensemble.",
),
(
"realisation_number",
"int",
"1.1",
"Standard ensemble axis realisation number (usually an "
"initial condition ensemble).",
),
],
}
def drs_experiment():
"""An encoding of a drs experiment_id."""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
("axis_identifer", "activity.axis_member", "0.1", "FIXME."),
(
"axis_type",
"designing.ensemble_types",
"0.1",
"Type of experimental family ensemble required.",
),
("family", "str", "1.1", "Main experimental family."),
],
}
def drs_frequency_types():
"""Set of allowed DRS frequency types."""
return {
"type": "enum",
"is_open": False,
"members": [
("yr", "Yearly"),
("mon", "Monthly"),
("day", "Daily"),
("6hr", "Every six hours"),
("3hr", "Every three hours"),
("subhr", "Sampling frequency less than an hour"),
("monClim", "Climatological Monthly Mean"),
("fx", "Fixed Time independent"),
],
}
def drs_geographical_indicator():
"""Specifies geographical subsets described by bounding boxes or by
named regions.
One of spatial domain or bounding box must appear.
"""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
(
"bounding_box",
"str",
"0.1",
"DRS bounding box of the form 'latJHJJHHlonMZMMZZ' where H, "
"HH, Z, ZZ are from {NS} {EW} respectively.",
),
(
"operator",
"drs.drs_geographical_operators",
"0.1",
"Spatial averagin applied to the geographical region.",
),
(
"spatial_domain",
"str",
"0.1",
"Geographical indicator (currently only 'global' is "
"acceptable).",
),
],
}
def drs_geographical_operators():
"""Set of permitted spatial averaging operator suffixes for drs
spatial indicators (yyyy-zzzz)."""
return {
"type": "enum",
"is_open": False,
"members": [
("zonalavg", "Data is zonally averaged"),
("lnd-zonalavg", "Data is zonally averaged over land in region"),
("ocn-zonalavg", "Data is zonally averaged over oceans in region"),
("areaavg", "Data is averaged over the area of the region"),
(
"lnd-areaavg",
"Data is averaged over the land area of the region",
),
(
"ocn-areaavg",
"Data is averaged over the ocean area of the region",
),
],
}
def drs_publication_dataset():
"""PLACEHOLDER for the real drs_publication_dataset."""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [],
}
def drs_realms():
"""Set of allowed DRS modelling realms."""
return {
"type": "enum",
"is_open": False,
"members": [
("atmos", "Atmosphere"),
("ocean", "Ocean"),
("land", "Land"),
("landIce", "Land Ice"),
("seaIce", "Sea Ice"),
("aerosol", "Aerosol"),
("atmosChem", "Atmospheric Chemistry"),
("ocnBgchem", "Ocean Biogeochemistry"),
],
}
def drs_simulation_identifier():
"""That part of the DRS which identifies the response to the
experiment: the simulation."""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
(
"institute",
"str",
"1.1",
"The institute responsible for this data entity.",
),
(
"model",
"str",
"1.1",
"A model identifier (sans blanks/periods and parenthesis).",
),
(
"run_variant_id",
"drs.drs_ensemble_identifier",
"1.1",
"Also known as ensemble_identifier, unambiguously identifiers "
"ensemble realisation information.",
),
],
}
def drs_temporal_identifier():
"""Provides information about temporal subsetting and/or averaging.
If only N1 is present, it a temporal instant, If N1-N2 are present
with no suffix, it is a temporal subset, If N1-N2 with a suffix are
present, then some sort of temporal averaging has been applied
across the period.
"""
return {
"type": "class",
"base": None,
"is_abstract": False,
"properties": [
("end", "str", "0.1", "N2, required to indicate a period."),
(
"start",
"str",
"1.1",
"N1, of the form yyyy[MM[dd[hh[mm[ss]]]]].",
),
(
"suffix",
"drs.drs_time_suffixes",
"0.1",
"If present, used to indicate climatology or average.",
),
],
}
def drs_time_suffixes():
"""Set of permitted time averaging suffixes for drs temporal
identifiers."""
return {
"type": "enum",
"is_open": False,
"members": [
(
"avg",
"Indicates data is a single average of DRS frequency data "
"across temporal period N1-N2",
),
(
"clim",
"Indicates data is climatological average data at the DRS "
"frequency from the period N1-N2",
),
],
}