-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathCF-1.11.yml
944 lines (848 loc) · 37.5 KB
/
CF-1.11.yml
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
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
netcdf_schema_version: '1.0'
# CF-11
constants:
cf_attributes:
- actual_range
- add_offset
- ancillary_variables
- axis
- bounds
- calendar
- cell_measures
- cell_methods
- cf_role
- climatology
- comment
- compress
- computed_standard_name
- Conventions
- coordinate_interpolation
- coordinates
- dimensions
- external_variables
- _FillValue
- featureType
- flag_masks
- flag_meanings
- flag_values
- formula_terms
- geometry
- geometry_type
- grid_mapping
- history
- instance_dimension
- institution
- interior_ring
- leap_month
- leap_year
- location
- location_index_set
- long_name
- mesh
- missing_value
- month_lengths
- node_coordinates
- node_count
- nodes
- part_node_count
- positive
- references
- sample_dimension
- scale_factor
- source
- standard_error_multiplier
- standard_name
- title
- units
- units_metadata
- valid_max
- valid_min
- valid_range
groups:
# Root group
- name: /
attributes:
# 2.6.1 Files that conform to the CF version 1.11 conventions must indicate this by setting the global Conventions attribute to contain the CF string value "CF-1.11"
- criteria:
name: Conventions
value: "CF-1.11"
count: 1
comments: '2.6.1 Files that conform to the CF version 1.11 conventions must indicate this by setting the global Conventions attribute to contain the CF string value "CF-1.11"'
# Any group except root
- name: "[^/]+"
attributes:
# 2.7 The Conventions and external_variables attributes must not be used in non-root groups.
- criteria:
name: Conventions
count: 0
comments: '2.7 The Conventions and external_variables attributes must not be used in non-root groups.'
- criteria:
name: external_variables
count: 0
comments: '2.7 The Conventions and external_variables attributes must not be used in non-root groups.'
##
# Any group
- name: '.+'
attributes:
# 2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).
- schema:
name:
re: ^[A-Za-z][A-Za-z0-9_]*$
comments: '2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).'
##
# 2.6.2 The title, history, institution, source, references, and comment attributes are all type string
- criteria:
name: title
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
- criteria:
name: history
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
- criteria:
name: institution
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
- criteria:
name: source
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
- criteria:
name: references
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
- criteria:
name: comment
schema:
type: str
comments: '2.6.2 The title, history, institution, source, references, and comment attributes are all type string'
##
# 2.6.3 The external_variables attribute is of string type and contains a blank-separated list of variable names.
- criteria:
name: external_variables
schema:
value:
re: \S+(?:\s+\S+)*
comments: '2.6.3 The external_variables attribute is of string type and contains a blank-separated list of variable names'
# 3.1 The type of the units attribute is a string that must be recognizable by the UDUNITS package.
# Exceptions are the units level, layer, and sigma_level.
- criteria:
name: units
schema:
connector: OR
statements:
- value:
udunits:
is_valid: true
- value:
choice: [level, layer, sigma_level]
comments: '3.1 The type of the units attribute is a string that must be recognizable by the UDUNITS package. Exceptions are the units level, layer, and sigma_level.'
# 3.1 If present, the units_metadata attribute must have one of these values: temperature: on_scale, temperature: difference, temperature: unknown.
- criteria:
name: units_metadata
schema:
value:
choice: ['temperature: on_scale', 'temperature: difference', 'temperature: unknown']
comments: '3.1 If present, the units_metadata attribute must have one of these values: temperature: on_scale, temperature: difference, temperature: unknown.'
- criteria:
name: coordinates
schema:
name: coordinates
type: str
value:
parse:
re: '\S+'
comparator:
find:
variable:
name: $VALUE
comments: "5 The type of the coordinates attribute is a string whose value is a blank separated list of variable names. All specified variable names must exist in the file."
- criteria:
name: standard_name
schema:
name: standard_name
value:
choice: [] # TODO: Put all the allowed values here or think about a better way. Constant?
comments: '3.3 The standard_name attribute takes a string value comprised of a standard name optionally followed by one or more blanks and a standard name modifier.'
- criteria:
attributes:
- name: positive
schema:
attributes:
- name: positive
value:
choice: [up, UP, down, DOWN]
comments: '4.3 The only legal values for the positive attribute are up or down (case insensitive).'
- criteria:
name: grid_mapping
schema:
connector: AND
statements:
- name: grid_mapping
value:
re: /^(\w+)(:\s*\w+(\s+\w+)*\s*)?(\s+\w+(:\s*\w+(\s+\w+)*\s*)?)*$/
- name: grid_mapping
type: str
value:
parse:
re: '\w+(?=\s*:)' # matches each grid_mapping_name
comparator:
find:
variable:
name: $VALUE
attributes:
- name: grid_mapping_name
- name: grid_mapping
type: str
value:
parse:
re: '\b(?!\w+:)\w+' # matches each coord_var
comparator:
find:
variable:
name: $VALUE
attributes:
- name: coordinates
value:
contains: $VALUE
comments:
- '5.6 The type of the grid_mapping attribute is a string whose value is of the following form, in which brackets indicate optional text: grid_mapping_name[: coord_var [coord_var ...]] [grid_mapping_name: [coord_var ... ]]'
- '5.6 Note that in its simplest form the attribute comprises just a grid_mapping_name as a single word.'
- '5.6 Each grid_mapping_name is the name of a variable (known as a grid mapping variable), which must exist in the file.'
- '5.6 Each coord_var is the name of a coordinate variable or auxiliary coordinate variable, which must exist in the file. If it is an auxiliary coordinate variable, it must be listed in the coordinates attribute.'
- criteria:
name: grid_mapping_name
schema:
name: grid_mapping_name
value:
choice:
- albers_conical_equal_area
- azimuthal_equidistant
- geostationary
- lambert_azimuthal_equal_area
- lambert_conformal_conic
- lambert_cylindrical_equal_area
- latitude_longitude
- mercator
- oblique_mercator
- orthographic
- polar_stereographic
- rotated_latitude_longitude
- sinusoidal
- stereographic
- transverse_mercator
- vertical_perspective
comments: '5.6 The grid mapping variables must have the grid_mapping_name attribute. The legal values for the grid_mapping_name attribute are contained in Appendix F.'
# TODO: The data types of the attributes of the grid mapping variable must be specified in Table 1 of Appendix F.
dimensions:
# 2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).
- schema:
name:
re: ^[A-Za-z][A-Za-z0-9_]*$
comments: '2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).'
##
variables:
## actual_range
- criteria:
attributes:
- name: actual_range
schema:
attributes:
- name: actual_range
type:
choice: ['byte', 'short', 'int', 'float', 'double']
- criteria:
dimensions_count: 1
dimensions:
- name:
contains:
locator:
path: ./
type: variable
attr: name
type:
choice: ['byte', 'short', 'int', 'float', 'double']
attributes:
- name:
choice:
- ancillary_variables
count: 0
comments: 'Attribute not allowed for Coordinate variables'
# 2.6.3 No variable named by external_variables is allowed in the file.
- criteria:
name: external_variables
count: 0
comments: '2.6.3 No variable named by external_variables is allowed in the file.'
# 2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).
- schema:
name:
re: ^[A-Za-z][A-Za-z0-9_]*$
comments: '2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).2.3 Variable, dimension and attribute names should begin with a letter and be composed of letters (A-Z, a-z), digits (0-9), and underscores(_).'
##
# 2.4 The dimensions of a variable must all have different names.
- schema:
unique_dimensions: true
comments: '2.4 The dimensions of a variable must all have different names.'
##
# 2.5.1 The valid_range attribute must not be present if the valid_min and/or valid_max attributes are present
- criteria:
connector: AND
statements:
- attributes:
- name: valid_range
- connector: OR
statements:
- attributes:
- name: valid_max
- attributes:
- name: valid_min
count: 0
comments: '2.5.1 The valid_range attribute must not be present if the valid_min and/or valid_max attributes are present'
##
# 2.5.1 The _FillValue attribute must be the same type as its associated variable
- criteria:
attributes:
- name: _FillValue
schema:
attributes:
- name: _FillValue
type:
locator:
path: ./
type: variable
attr: type
comments: '2.5.1 The _FillValue attribute must be the same type as its associated variable'
##
# 2.5.1 The missing_value attribute must be the same type as its associated variable.
- criteria:
attributes:
- name: missing_value
schema:
attributes:
- name: missing_value
type:
locator:
path: ./
type: variable
attr: type
comments: '2.5.1 The missing_value attribute must be the same type as its associated variable'
##
# 2.5.1 The actual_range attribute must be of the same type as its associated variable unless there is a scale_factor and/or add_offset attribute,
# in which case it must be of the same type as those attributes.
- criteria:
attributes:
- name: actual_range
- name: scale_factor
schema:
attributes:
- name: actual_range
type:
locator:
path: ./scale_factor
type: attribute
attr: type
comments: '2.5.1 The actual_range attribute must be of the same type as its associated variable unless there is a scale_factor and/or add_offset attribute, in which case it must be of the same type as those attributes.'
- criteria:
attributes:
- name: actual_range
- name: scale_factor
schema:
attributes:
- name: actual_range
type:
locator:
path: ./add_offset
type: attribute
attr: type
comments: '2.5.1 The actual_range attribute must be of the same type as its associated variable unless there is a scale_factor and/or add_offset attribute, in which case it must be of the same type as those attributes.'
- criteria:
connector: AND
statements:
- attributes:
- name: actual_range
- attributes:
- name:
neq: add_offset
- attributes:
- name:
neq: scale_factor
schema:
attributes:
- name: actual_range
type:
locator:
path: ./
type: variable
attr: type
comments: '2.5.1 The actual_range attribute must be of the same type as its associated variable unless there is a scale_factor and/or add_offset attribute, in which case it must be of the same type as those attributes.'
##
# 2.5.1 The actual_range attribute must have two elements, of which the first exactly equals the minimum non-missing value occurring in
# the associated variable after any scale_factor and add_offset are applied, and the second exactly equals the maximum value in the same way.
- criteria:
attributes:
- name: actual_range
schema:
attributes:
- name: actual_range
length: 2
comments: '2.5.1 The actual_range attribute must have two elements, of which the first exactly equals the minimum non-missing value occurring in the associated variable after any scale_factor and add_offset are applied, and the second exactly equals the maximum value in the same way.'
##
# 2.5.1 If both the actual_range and valid_range/valid_min/valid_max are specified, the values of the actual_range must be valid values
- criteria:
attributes:
- name: actual_range
- name: valid_range
schema:
attributes:
- name: actual_range
value:
range:
min:
locator:
path: ./valid_range
type: attribute
attr: value
index: [0]
max:
locator:
path: ./valid_range
type: attribute
attr: value
index: [1]
comments: '2.5.1 If both the actual_range and valid_range/valid_min/valid_max are specified, the values of the actual_range must be valid values'
- criteria:
attributes:
- name: actual_range
- name: valid_min
- name: valid_max
schema:
attributes:
- name: actual_range
value:
range:
min:
locator:
path: ./valid_min
type: attribute
attr: value
max:
locator:
path: ./valid_max
type: attribute
attr: value
comments: '2.5.1 If both the actual_range and valid_range/valid_min/valid_max are specified, the values of the actual_range must be valid values'
##
# 3.1 Dimensionless units for volume fractions defined by UDUNITS (ppv, ppmv, ppbv, pptv, ppqv) are not allowed
# in the units attribute of any variable which also has a standard_name attribute.
- criteria:
attributes:
- name: units
value:
choice: [ppv, ppmv, ppbv, pptv, ppqv]
- name: standard_name
count: 0
comments: 'Dimensionless units for volume fractions defined by UDUNITS (ppv, ppmv, ppbv, pptv, ppqv) are not allowed in the units attribute of any variable which also has a standard_name attribute.'
##
# 3.1 The units of a variable that specifies a standard_name must be physically equivalent to the canonical units given in the standard name table,
# as modified by the standard_name modifier, if there is one, according to Appendix C, and then modified by all the methods listed in order
# by the cell_methods attribute, if one is present, according to Appendix E.
# TODO
##
# 3.1 If the standard_name attribute includes the standard_error modifier, the units_metadata attribute, if present,
# must have the value temperature: difference.
- criteria:
attributes:
- name: units_metadata
- name: standard_name
schema:
attributes:
- name: units_metadata
value: 'temperature: difference'
comments: '3.1 If the standard_name attribute includes the standard_error modifier, the units_metadata attribute, if present, must have the value temperature: difference.'
##
# 3.1 If the cell_methods attribute includes any entry with any of the methods range, standard_deviation or variance,
# the units_metadata attribute, if present, must have the value temperature: difference.
- criteria:
attributes:
- name: units_metadata
- name: cell_methods
value:
re: '.*name: [standard_deviation|variance].*'
schema:
attributes:
- name: units_metadata
value: 'temperature: difference'
comments: 'If the cell_methods attribute includes any entry with any of the methods range, standard_deviation or variance, the units_metadata attribute, if present, must have the value temperature: difference.'
# 3.1 A variable must not have a units_metadata attribute if it has no units attribute or if its units do not involve a temperature unit.
- criteria:
attributes:
- name: units_metadata
- name:
neq: units
count: 0
comments: '3.1 A variable must not have a units_metadata attribute if it has no units attribute or if its units do not involve a temperature unit.'
- criteria:
attributes:
- name: units
value:
neq: "" # TODO: Check the best way to filter udunits temp
- name: temperature_metadata
count: 0
comments: '3.1 A variable must not have a units_metadata attribute if it has no units attribute or if its units do not involve a temperature unit.'
# 3.3 If a variable has a standard_name of region or area_type, it must have value(s) from the permitted list.
- criteria:
attributes:
- name: standard_name
value:
re: "area_type.*"
schema:
attributes:
- name: standard_name
value:
re: '' # TODO: Put all the allowed values here or think about a better way
comments: 'If a variable has a standard_name of region or area_type, it must have value(s) from the permitted list.'
##
# 3.5 The flag_values attribute must have the same type as the variable to which it is attached.
# The type of the flag_meanings attribute is a string whose value is a blank separated list of words or phrases,
# each consisting of characters from the alphanumeric set and the following five: '_', '-', '.', '+', '@'
- criteria:
attributes:
- name: flag_values
schema:
attributes:
- name: flag_meanings
type: str
value:
re: ^([a-zA-Z0-9_\-\.@+]+)(\s[a-zA-Z0-9_\-\.@+]+)*$
- name: flag_values
type:
locator:
path: ./
type: variable
attr: type
comments: "The type of the flag_meanings attribute is a string whose value is a blank separated list of words or phrases, each consisting of characters from the alphanumeric set and the following five: '_', '-', '.', '+', '@'."
# 3.5 The number of flag_values attribute values must equal the number of words or phrases appearing in the flag_meanings string.
- criteria:
attributes:
- name: flag_values
- name: flag_meanings
schema:
attributes:
- name: flag_values
length:
locator:
path: ./flag_meanings
type: attribute
attr: length
comments: '3.5 The number of flag_values attribute values must equal the number of words or phrases appearing in the flag_meanings string.'
# 3.5 The number of flag_masks attribute values must equal the number of words or phrases appearing in the flag_meanings string.
- criteria:
attributes:
- name: flag_masks
- name: flag_meanings
schema:
attributes:
- name: flag_masks
length:
locator:
path: ./flag_meanings
type: attribute
attr: length
comments: '3.5 The number of flag_masks attribute values must equal the number of words or phrases appearing in the flag_meanings string.'
# 3.5 Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.
- criteria:
attributes:
- name: flag_masks
schema:
connector: AND
statements:
- type:
choice: [char, byte, short, int]
attributes:
- name: flag_masks
type:
locator:
path: ./
type: variable
attr: type
comments: '3.5 Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.3.5 Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.Variables with a flag_masks attribute must have a type that is compatible with bit field expression (char, byte, short and int), not floating-point (float, real, double), and the flag_masks attribute must have the same type.'
# 3.5 The flag_masks attribute values must be non-zero.The flag_masks attribute values must be non-zero.
- criteria:
attributes:
- name: flag_masks
value:
contains: 0
count: 0
comments: '3.5 The flag_masks attribute values must be non-zero.The flag_masks attribute values must be non-zero.'
# 4 The axis attribute may only be attached to coordinate variables and geometry node coordinate variable
- criteria:
attributes:
- name: axis
schema:
dimensions_count: 1
dimensions:
- name:
locator:
path: ./
type: variable
attr: name
comments: '4 The axis attribute may only be attached to coordinate variables and geometry node coordinate variable'
##
##
# 4 The axis attribute must be consistent with the coordinate type deduced from units and positive
# TODO
##
# 4 The axis attribute is not allowed for auxiliary coordinate variables.
# TODO: Check contradiction
# If an axis attribute is attached to an auxiliary coordinate variable, it can be used by applications in the same way the axis attribute attached to a coordinate variable is used.
##
# 4 A data variable must not have more than one coordinate variable with a particular value of the axis attribute.
- criteria:
attributes:
- name: axis
value:
choice: [x, X]
count:
operator: <
value: 2
comments: "4 A data variable must not have more than one coordinate variable with a particular value of the axis attribute."
- criteria:
attributes:
- name: axis
value:
choice: [y, Y]
count:
operator: <
value: 2
comments: "4 A data variable must not have more than one coordinate variable with a particular value of the axis attribute."
- criteria:
attributes:
- name: axis
value:
choice: [z, Z]
count:
operator: <
value: 2
comments: "4 A data variable must not have more than one coordinate variable with a particular value of the axis attribute."
- criteria:
attributes:
- name: axis
value:
choice: [t, T]
count:
operator: <
value: 2
comments: "4 A data variable must not have more than one coordinate variable with a particular value of the axis attribute."
##
# 4.3.3 The formula_terms attribute is only allowed on a coordinate variable which has a standard_name listed in Appendix C.
- criteria:
attributes:
- name: formula_terms
schema:
attributes:
- name: standard_name
value:
choice:
- atmosphere_ln_pressure_coordinate
- atmosphere_sigma_coordinate
- atmosphere_hybrid_sigma_pressure_coordinate
- atmosphere_hybrid_height_coordinate
- atmosphere_sleve_coordinate
- ocean_sigma_coordinate
- ocean_s_coordinate
- ocean_s_coordinate_g1
- ocean_s_coordinate_g2
- ocean_sigma_z_coordinate
- ocean_double_sigma_coordinate
comments: '4.3.3 The formula_terms attribute is only allowed on a coordinate variable which has a standard_name listed in Appendix C.'
# 4.3.3 The type of the formula_terms attribute is a string whose value is list of blank separated word pairs in the form term: var. The legal values term are contained in Appendix C for each valid standard_name. The values of var must be variables that exist in the file.
- criteria:
attributes:
- name: formula_terms
- name: standard_name
value: atmosphere_ln_pressure_coordinate
schema:
attributes:
- name: formula_terms
type: str
value:
re: '(?:\b\w+:\s*\w+\b\s*)+'
- name: formula_terms
value:
parse:
re: '\b\w+:\s*(\w+)\b'
comparator:
find:
variable:
name: $VALUE
- name: formula_terms
value:
parse:
re: '\b(\w+):\s*\w+\b'
comparator:
choice:
- p0
- lev
comments: '4.3.3 The type of the formula_terms attribute is a string whose value is list of blank separated word pairs in the form term: var. The legal values term are contained in Appendix C for each valid standard_name. The values of var must be variables that exist in the file.'
# ^
# |
# TODO: Expand for all standard name values and their computed_standard_name
#
# 4.3.3 The computed_standard_name attribute is only allowed on a coordinate variable which has a formula_terms attribute.
- criteria:
attributes:
- name: computed_standard_name
schema:
attributes:
- name: formula_terms
comments: '4.3.3 The computed_standard_name attribute is only allowed on a coordinate variable which has a formula_terms attribute.'
# 4.3.3 The computed_standard_name attribute is a string whose value must be consistent with the standard_name of the coordinate variable it is attached to, and in some cases also with the standard_name attributes of variables named by the formula_terms attribute, according to the appropriate definition in Appendix D.
- criteria:
attributes:
- name: computed_standard_name
- name: standard_name
value: atmosphere_ln_pressure_coordinate
schema:
attributes:
- name: computed_standard_name
type: str
- name: computed_standard_name
value: air_pressure
comments: '4.3.3 TThe computed_standard_name attribute is a string whose value must be consistent with the standard_name of the coordinate variable it is attached to, and in some cases also with the standard_name attributes of variables named by the formula_terms attribute, according to the appropriate definition in Appendix D.'
# ^
# |
# TODO: Expand for all standard name values and their computed_standard_name
#
# TODO: The units of a variable named by the formula_terms attribute must be consistent with the units defined in Appendix D.
# 4.4 The time units of a time coordinate variable must contain a reference date/time.
- criteria:
connector: OR
statements:
- attributes:
- name: units
value:
udunits:
is_reftime: true
- attributes:
- name: axis
value: T
- attributes:
- name: standard_name
value:
choice:
- time
- forecast_reference_time
schema:
attributes:
- name: units
value:
udunits:
is_reftime: true
comments: '4.3.3 The time units of a time coordinate variable must contain a reference date/time.'
# 4.4.1 The attributes calendar, month_lengths, leap_year, and leap_month may only be attached to time coordinate variables.
- criteria:
connector: OR
statements:
- attributes:
- name: calendar
- attributes:
- name: month_lengths
- attributes:
- name: leap_year
- attributes:
- name: leap_month
schema:
attributes:
- name: units
value:
udunits:
is_reftime: true
comments: '4.4.1 The attributes calendar, month_lengths, leap_year, and leap_month may only be attached to time coordinate variables.'
# 4.4.1 The standardized values (case insensitive) of the calendar attribute are standard, gregorian (deprecated), proleptic_gregorian, noleap, 365_day, all_leap, 366_day, 360_day, julian, and none. If the calendar attribute is given a non-standard value, then the attribute month_lengths is required, along with leap_year and leap_month as appropriate.
- criteria:
connector: AND
statements:
- attributes:
- name: calendar
- negated:
attributes:
- name: calendar
value:
re: "(?i)\b(standard|gregorian|proleptic_gregorian|noleap|365_day|all_leap|366_day|360_day|julian|none)\b"
schema:
attributes:
- name: month_lengths
- name: leap_year
- name: leap_month
comments: "4.4.1 The standardized values (case insensitive) of the calendar attribute are standard, gregorian (deprecated), proleptic_gregorian, noleap, 365_day, all_leap, 366_day, 360_day, julian, and none. If the calendar attribute is given a non-standard value, then the attribute month_lengths is required, along with leap_year and leap_month as appropriate."
# 4.4.1 The type of the month_lengths attribute must be an integer array of size 12.
- criteria:
attributes:
- name: month_lengths
schema:
attributes:
- name: month_lengths
type: int
length: 12
comments: '4.4.1 The type of the month_lengths attribute must be an integer array of size 12.'
# 4.4.1 The values of the leap_month attribute must be in the range 1-12.
- criteria:
attributes:
- name: leap_month
schema:
attributes:
- name: leap_month
type: int
length: 1
value:
range:
min: 1
max: 12
comments: '4.4.1 The values of the leap_month attribute must be in the range 1-12.'
# 4.4.1 The values of the leap_year and leap_month attributes are integer scalars.
- criteria:
attributes:
- name: leap_year
schema:
attributes:
- name: leap_year
type: int
length: 1
comments: '4.4.1 The values of the leap_year and leap_month attributes are integer scalars.'
# 5 Coordinate System
- criteria:
dimensions_count: 1
dimensions:
- name:
locator:
path: ./
type: variable
attr: name
schema:
value:
monotonic: True
comments: '5 A coordinate variable must have values that are strictly monotonic (increasing or decreasing).'
- criteria:
connector: AND
statements:
- dimensions_count: 1
dimensions:
- name:
locator:
path: ./
type: variable
attr: name
- connector: OR
statements:
- attributes:
- name: _FillValue
- attributes:
- name: missing_value
count: 0
comments: "5 A coordinate variable must not have the _FillValue or missing_value attributes."
# TODO: The dimensions of each auxiliary coordinate must be a subset of the dimensions of the variable they are attached to, with three exceptions. First, a label variable of type char will have a trailing dimension for the maximum string length. Second, if an auxiliary coordinate variable of a data variable that has been compressed by gathering (8.2 Lossless Compression by Gathering) does not span the compressed dimension, then its dimensions may be any subset of the data variable’s uncompressed dimensions, i.e. any of the dimensions of the data variable except the compressed dimension, and any of the dimensions listed by the compress attribute of the compressed coordinate variable. Third, a ragged array (Chapter 9, Discrete sampling geometries and Appendix H) uses special, more indirect, methods to connect the data and coordinates.