gribberish 0.30.0

Parse grib 2 files with Rust
Documentation
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
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
1022
1023
1024
1025
1026
1027
1028
1029
1030
1031
1032
1033
1034
1035
1036
1037
1038
1039
1040
1041
1042
1043
1044
1045
1046
1047
1048
1049
1050
1051
1052
1053
1054
1055
1056
1057
1058
1059
1060
1061
1062
1063
1064
1065
1066
1067
1068
1069
use gribberish_macros::{DisplayDescription, FromValue, ToParameter};
use gribberish_types::Parameter;

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum TemperatureProduct {
    #[abbrev = "TMP"]
    #[unit = "K"]
    Temperature = 0,
    #[description = "virtual temperature"]
    #[abbrev = "VTMP"]
    #[unit = "K"]
    VirtualTemperature = 1,
    #[description = "potential temperature"]
    #[abbrev = "POT"]
    #[unit = "K"]
    PotentialTemperature = 2,
    #[description = "pseudo-adiabatic potential temperature"]
    #[abbrev = "EPOT"]
    #[unit = "K"]
    PseudoAdiabaticPotentialTemperature = 3,
    #[description = "maximum temperature"]
    #[abbrev = "TMAX"]
    #[unit = "K"]
    MaximumTemperature = 4,
    #[description = "minimum temperature"]
    #[abbrev = "TMIN"]
    #[unit = "K"]
    MinimumTemperature = 5,
    #[description = "dewpoint temperature"]
    #[abbrev = "DPT"]
    #[unit = "K"]
    DewpointTemperature = 6,
    #[description = "dewpoint depression"]
    #[abbrev = "DEPR"]
    #[unit = "K"]
    DewpointDepression = 7,
    #[description = "lapse rate"]
    #[abbrev = "LAPR"]
    #[unit = "Km-1"]
    LapseRate = 8,
    #[description = "temperature anomaly"]
    #[abbrev = "TMPA"]
    #[unit = "K"]
    TemperatureAnomaly = 9,
    #[description = "latent heat net flux"]
    #[abbrev = "LHTFL"]
    #[unit = "Wm-2"]
    LatentHeatNetFlux = 10,
    #[description = "sensible heat net flux"]
    #[abbrev = "SHTFL"]
    #[unit = "Wm-2"]
    SensibleHeatNetFlux = 11,
    #[description = "heat index"]
    #[abbrev = "HEATX"]
    #[unit = "K"]
    HeatIndex = 12,
    #[description = "wind chill factor"]
    #[abbrev = "WCF"]
    #[unit = "K"]
    WindChillFactor = 13,
    #[description = "apparent temperature"]
    #[abbrev = "APTMP"]
    #[unit = "K"]
    ApparentTemperature = 21,
    #[description = "skin temperature"]
    #[abbrev = "SKINT"]
    #[unit = "K"]
    SkinTemperature = 17,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum MoistureProduct {
    #[description = "specific humidity"]
    #[abbrev = "SPFH"]
    #[unit = "kgkg-1"]
    SpecificHumidity = 0,
    #[description = "relative humidity"]
    #[abbrev = "RH"]
    #[unit = "%"]
    RelativeHumidity = 1,
    #[description = "humidity mixing ratio"]
    #[abbrev = "MIXR"]
    #[unit = "kgkg-1"]
    HumidityMixingRatio = 2,
    #[description = "precipitable water"]
    #[abbrev = "PWAT"]
    #[unit = "kgm-2"]
    PrecipitableWater = 3,
    #[abbrev = "EVP"]
    #[unit = "kgm-2"]
    Evaporation = 4,
    #[description = "precipitation rate"]
    #[abbrev = "PRATE"]
    #[unit = "kgm-2s-1"]
    PrecipitationRate = 7,
    #[description = "large-scale precipitation (non-convective)"]
    #[abbrev = "NCPCP"]
    #[unit = "kgm-2"]
    LargeScalePrecipitation = 9,
    #[description = "precipitation type"]
    #[abbrev = "PTYPE"]
    #[unit = "code table 4.201"]
    PrecipitationType = 19,
    #[description = "total precipitation"]
    #[abbrev = "APCP"]
    #[unit = "kgm-2"]
    TotalPrecipitation = 8,
    #[description = "convective precipitation"]
    #[abbrev = "ACPCP"]
    #[unit = "gm-2"]
    ConvectivePrecipitation = 10,
    #[description = "snow depth"]
    #[abbrev = "SNOD"]
    #[unit = "m"]
    SnowDepth = 11,
    #[description = "water equivalent of accumulated snow depth"]
    #[abbrev = "WEASD"]
    #[unit = "kgm-2"]
    WaterEquavalentSnowDepth = 13,
    #[description = "cloud mixing ratio"]
    #[abbrev = "CLWMR"]
    #[unit = "kgkg-1"]
    CloudMixingRatio = 22,
    #[description = "ice water mixing ratio"]
    #[abbrev = "ICMR"]
    #[unit = "kgkg-1"]
    IceWaterMixingRatio = 23,
    #[description = "rain mixing ratio"]
    #[abbrev = "RWMR"]
    #[unit = "kgkg-1"]
    RainMixingRatio = 24,
    #[description = "snow mixing ratio"]
    #[abbrev = "SNMR"]
    #[unit = "kgkg-1"]
    SnowMixingRatio = 25,
    #[description = "total snowfall"]
    #[abbrev = "ASNOW"]
    #[unit = "m"]
    TotalSnowfall = 29,
    #[abbrev = "HAIL"]
    #[unit = "m"]
    Hail = 31,
    #[description = "graupel"]
    #[abbrev = "GRLE"]
    #[unit = "kgkg-1"]
    Graupel = 32,
    #[description = "categorical rain"]
    #[abbrev = "CRAIN"]
    #[unit = "BOOL"]
    CategoricalRain = 33,
    #[description = "categorical freezing rain"]
    #[abbrev = "CFRZR"]
    #[unit = "BOOL"]
    CategoricalFreezingRain = 34,
    #[description = "categorical ice pellets"]
    #[abbrev = "CICEP"]
    #[unit = "BOOL"]
    CategoricalIcePellets = 35,
    #[description = "categorical snow"]
    #[abbrev = "CSNOW"]
    #[unit = "BOOL"]
    CategoricalSnow = 36,
    #[description = "convective precipitation"]
    #[abbrev = "CPRAT"]
    #[unit = "kgm-2"]
    ConvectivePrecipitationWmo = 37,
    #[description = "percent frozen precipitation"]
    #[abbrev = "CPOFP"]
    #[unit = "%"]
    PercentFrozenPrecipitation = 39,
    #[description = "snow cover"]
    #[abbrev = "SNOWC"]
    #[unit = "%"]
    SnowCover = 42,
    #[description = "total column water"]
    #[abbrev = "TCW"]
    #[unit = "kgm-2"]
    TotalColumnWater = 51,
    #[description = "total precipitation"]
    #[abbrev = "TP"]
    #[unit = "kgm-2"]
    TotalPrecipitationWmo = 52,
    #[description = "snowfall water equivalent"]
    #[abbrev = "SF"]
    #[unit = "kgm-2"]
    SnowfallWaterEquivalent = 53,
    #[description = "total column-integrated cloud water"]
    #[abbrev = "TCOLW"]
    #[unit = "kgm-2"]
    TotalColumnIntegratedCloudWater = 69,
    #[description = "total column-integrated cloud ice"]
    #[abbrev = "TCOLI"]
    #[unit = "kgm-2"]
    TotalColumnIntegratedCloudIce = 70,
    #[description = "snow density"]
    #[abbrev = "RSN"]
    #[unit = "kgm-3"]
    SnowDensity = 61,
    #[description = "total column vertically-integrated water vapour"]
    #[abbrev = "TCWV"]
    #[unit = "kgm-2"]
    TotalColumnWaterVapour = 64,
    #[description = "total column integrated graupel"]
    #[abbrev = "TCOLG"]
    #[unit = "kgm-2"]
    TotalColumnIntegratedGraupel = 74,
    #[description = "cloud ice mixing ratio"]
    #[abbrev = "CIMIXR"]
    #[unit = "kgkg-1"]
    CloudIceMixingRatio = 82,
    #[description = "effective radius of hail"]
    #[abbrev = "EFRHAIL"]
    #[unit = "m"]
    EffectiveRadiusOfHail = 134,
    #[description = "categorical rain (NCEP)"]
    #[abbrev = "CRAIN"]
    #[unit = "BOOL"]
    CategoricalRainNcep = 192,
    #[description = "categorical freezing rain (NCEP)"]
    #[abbrev = "CFRZR"]
    #[unit = "BOOL"]
    CategoricalFreezingRainNcep = 193,
    #[description = "categorical ice pellets (NCEP)"]
    #[abbrev = "CICEP"]
    #[unit = "BOOL"]
    CategoricalIcePelletsNcep = 194,
    #[description = "categorical snow (NCEP)"]
    #[abbrev = "CSNOW"]
    #[unit = "BOOL"]
    CategoricalSnowNcep = 195,
    #[description = "convective precipitation rate (NCEP)"]
    #[abbrev = "CPRAT"]
    #[unit = "kgm-2s-1"]
    ConvectivePrecipitationRateNcep = 196,
    #[description = "potential evaporation rate"]
    #[abbrev = "PEVPR"]
    #[unit = "Wm-2"]
    PotentialEvaporationRate = 200,
    #[description = "snow cover (NCEP)"]
    #[abbrev = "SNOWC"]
    #[unit = "%"]
    SnowCoverNcep = 201,
    #[description = "total icing potential diagnostic"]
    #[abbrev = "TIPD"]
    #[unit = "nondim"]
    TotalIcingPotentialDiagnostic = 206,
    #[description = "liquid precipitation (rainfall)"]
    #[abbrev = "ARAIN"]
    #[unit = "kgm-2"]
    LiquidPrecipitationRainfall = 221,
    #[description = "snowfall"]
    #[abbrev = "SF"]
    #[unit = "m"]
    SnowfallEcmwf = 198,
    #[description = "snow depth water equivalent"]
    #[abbrev = "SD"]
    #[unit = "m"]
    SnowDepthWaterEquivalent = 254,
    #[description = "relative humidity with respect to precipitable water"]
    #[abbrev = "RHPW"]
    #[unit = "%"]
    RelativeHumidityPrecipitableWater = 242,
    #[description = "freezing rain"]
    #[abbrev = "FRZR"]
    #[unit = "kgm-2"]
    FreezingRain = 225,
    #[description = "frozen rain"]
    #[abbrev = "FROZR"]
    #[unit = "kgm-2"]
    FrozenRain = 227,
    #[description = "snow to liquid ratio"]
    #[abbrev = "SNLR"]
    #[unit = "kgkg-1"]
    SnowToLiquidRatio = 233,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum MomentumProduct {
    #[description = "wind direction"]
    #[abbrev = "WDIR"]
    #[unit = "degrees"]
    WindDirection = 0,
    #[description = "wind speed"]
    #[abbrev = "WIND"]
    #[unit = "ms-1"]
    WindSpeed = 1,
    #[description = "u-component of wind speed"]
    #[abbrev = "UGRD"]
    #[unit = "ms-1"]
    UComponentWindSpeed = 2,
    #[description = "v-component of wind speed"]
    #[abbrev = "VGRD"]
    #[unit = "ms-1"]
    VComponentWindSpeed = 3,
    #[abbrev = "RELV"]
    #[unit = "s-1"]
    ShortWaveRadiation = 4,
    #[description = "montgomery stream function"]
    #[abbrev = "MNTSF"]
    #[unit = "m2s-2"]
    MontgomeryStreamFunction = 6,
    #[description = "vertical velocity (pressure)"]
    #[abbrev = "VVEL"]
    #[unit = "Pas-1"]
    VerticalVelocityPressure = 8,
    #[description = "vertical velocity (geometric)"]
    #[abbrev = "DZDT"]
    #[unit = "ms-1"]
    VerticalVelocityGeometric = 9,
    #[description = "absolute vorticity"]
    #[abbrev = "ABSV"]
    #[unit = "s-1"]
    AbsoluteVorticity = 10,
    #[description = "relative vorticity"]
    #[abbrev = "RELV"]
    #[unit = "s-1"]
    RelativeVorticity = 12,
    #[description = "divergence"]
    #[abbrev = "DIV"]
    #[unit = "s-1"]
    Divergence = 13,
    #[description = "potential vorticity"]
    #[abbrev = "PVORT"]
    #[unit = "Km2kg-1s-1"]
    PotentialVorticity = 14,
    #[description = "vertical u-component shear"]
    #[abbrev = "VUCSH"]
    #[unit = "s-1"]
    VerticalUComponentShear = 15,
    #[description = "vertical v-component shear"]
    #[abbrev = "VVCSH"]
    #[unit = "s-1"]
    VerticalVComponentShear = 16,
    #[description = "momentum flux, u-component"]
    #[abbrev = "UFLX"]
    #[unit = "Nm-2"]
    MomentumFluxU = 17,
    #[description = "momentum flux, v-component"]
    #[abbrev = "VFLX"]
    #[unit = "Nm-2"]
    MomentumFluxV = 18,
    #[description = "Maximum wind speed"]
    #[abbrev = "MAXGUST"]
    #[unit = "ms-1"]
    MaximumWindSpeed = 21,
    #[description = "wind gust speed"]
    #[abbrev = "GUST"]
    #[unit = "ms-1"]
    WindGust = 22,
    #[description = "u-component of wind gust"]
    #[abbrev = "UGUST"]
    #[unit = "ms-1"]
    UComponentWindGust = 23,
    #[description = "v-component of wind gust"]
    #[abbrev = "VGUST"]
    #[unit = "ms-1"]
    VComponentWindGust = 24,
    #[description = "wind fetch"]
    #[abbrev = "WINDF"]
    #[unit = "m"]
    WindFetch = 33,
    #[description = "time-integrated eastward turbulent surface stress"]
    #[abbrev = "EWSS"]
    #[unit = "Nm-2s"]
    EastwardTurbulentSurfaceStress = 62,
    #[description = "time-integrated northward turbulent surface stress"]
    #[abbrev = "NSSS"]
    #[unit = "Nm-2s"]
    NorthwardTurbulentSurfaceStress = 63,
    #[description = "u-component of storm motion"]
    #[abbrev = "UTSM"]
    #[unit = "ms-1"]
    UComponentStormMotion = 27,
    #[description = "v-component of storm motion"]
    #[abbrev = "VSTM"]
    #[unit = "ms-1"]
    VComponentStormMotion = 28,
    #[description = "frictional velocity"]
    #[abbrev = "FRICV"]
    #[unit = "ms-1"]
    FrictionalVelocity = 30,
    #[description = "vertical speed shear (NCEP)"]
    #[abbrev = "VWSH"]
    #[unit = "s-1"]
    VerticalSpeedShearNcep = 192,
    #[description = "u-component of storm motion (NCEP)"]
    #[abbrev = "USTM"]
    #[unit = "ms-1"]
    UComponentStormMotionNcep = 194,
    #[description = "v-component of storm motion (NCEP)"]
    #[abbrev = "VSTM"]
    #[unit = "ms-1"]
    VComponentStormMotionNcep = 195,
    #[description = "frictional velocity (NCEP)"]
    #[abbrev = "FRICV"]
    #[unit = "ms-1"]
    FrictionalVelocityNcep = 197,
    #[description = "hourly maximum of upward vertical velocity"]
    #[abbrev = "MAXUVV"]
    #[unit = "ms-1"]
    HourlyMaxUpwardVerticalVelocity = 220,
    #[description = "hourly maximum of downward vertical velocity"]
    #[abbrev = "MAXDVV"]
    #[unit = "ms-1"]
    HourlyMaxDownwardVerticalVelocity = 221,
    #[description = "u component of hourly maximum 10m wind speed"]
    #[abbrev = "MAXUW"]
    #[unit = "ms-1"]
    UComponentHourlyMaximumWindSpeed = 222,
    #[description = "v component of hourly maximum 10m wind speed"]
    #[abbrev = "MAXVW"]
    #[unit = "ms-1"]
    VComponentHourlyMaximumWindSpeed = 223,
    #[description = "ventilation rate"]
    #[abbrev = "VRATE"]
    #[unit = "m2s-1"]
    VentilationRate = 224,
    #[description = "tropical wind direction"]
    #[abbrev = "TPWDIR"]
    #[unit = "degrees"]
    TropicalWindDirection = 231,
    #[description = "tropical wind speed"]
    #[abbrev = "TPWSPD"]
    #[unit = "ms-1"]
    TropicalWindSpeed = 232,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum CloudProduct {
    #[description = "total cloud cover"]
    #[abbrev = "TCDC"]
    #[unit = "%"]
    TotalCloudCover = 1,
    #[description = "convective cloud cover"]
    #[abbrev = "CDCON"]
    #[unit = "%"]
    ConvectiveCloudCover = 2,
    #[description = "low cloud cover"]
    #[abbrev = "LCDC"]
    #[unit = "%"]
    LowCloudCover = 3,
    #[description = "middle cloud cover"]
    #[abbrev = "MCDC"]
    #[unit = "%"]
    MediumCloudCover = 4,
    #[description = "high cloud cover"]
    #[abbrev = "HCDC"]
    #[unit = "%"]
    HighCloudCover = 5,
    #[description = "cloud water"]
    #[abbrev = "CWAT"]
    #[unit = "kgm-2"]
    CloudWater = 6,
    #[description = "cloud amount"]
    #[abbrev = "CDCA"]
    #[unit = "%"]
    CloudAmount = 7,
    #[description = "sunshine duration"]
    #[abbrev = "SUNSD"]
    #[unit = "s"]
    SunshineDuration = 201,
    #[description = "total cloud cover"]
    #[abbrev = "TCC"]
    #[unit = "proportion"]
    TotalCloudCoverEcmwf = 192,
    #[description = "cloud work function"]
    #[abbrev = "CWORK"]
    #[unit = "Jkg-1"]
    CloudWorkFunction = 193,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum ShortWaveRadiationProduct {
    #[description = "net shortwave radiation flux surface"]
    #[abbrev = "nswrs"]
    #[unit = "Wm-2"]
    NetShortwaveRadiationFluxSurface = 0,
    #[description = "net shortwave radiation flux top of atmosphere"]
    #[abbrev = "nswrt"]
    #[unit = "Wm-2"]
    NetShortwaveRadiationFluxTop = 1,
    #[description = "shortwave radiation flux"]
    #[abbrev = "swavr"]
    #[unit = "Wm-2"]
    ShortwaveRadiationFlux = 2,
    #[description = "global radiation flux"]
    #[abbrev = "grad"]
    #[unit = "Wm-2"]
    GlobalRadiationFlux = 3,
    #[description = "brightness temperature"]
    #[abbrev = "brtmp"]
    #[unit = "K"]
    BrightnessTemperature = 4,
    #[description = "radiance with respect to wave number"]
    #[abbrev = "lwrad"]
    #[unit = "Wm-1sr-1"]
    RadianceFromWaveNumber = 5,
    #[description = "radiance with respect to wavelength"]
    #[abbrev = "swrad"]
    #[unit = "Wm-3sr-1"]
    RadianceFromWavelength = 6,
    #[description = "downward shortwave radiation flux"]
    #[abbrev = "dswrf"]
    #[unit = "Wm-2"]
    DownwardShortwaveRadiationFlux = 7,
    #[description = "upward shortwave radiation flux"]
    #[abbrev = "uswrf"]
    #[unit = "Wm-2"]
    UpwardShortwaveRadiationFlux = 8,
    #[description = "net short wave radiation flux"]
    #[abbrev = "nswrf"]
    #[unit = "Wm-2"]
    NetShortWaveRadiationFlux = 9,
    #[description = "photosynthetically active radiation"]
    #[abbrev = "photar"]
    #[unit = "Wm-2"]
    PhotosyntheticallyActiveRadiation = 10,
    #[description = "net short wave radiation flux, clear sky"]
    #[abbrev = "nswrfcs"]
    #[unit = "Wm-2"]
    NetShortWaveRadiationFluxClearSky = 11,
    #[description = "downward uv radiation"]
    #[abbrev = "dwuvr"]
    #[unit = "Wm-2"]
    DownwardUVRadiation = 12,
    #[description = "direct short wave radiation flux"]
    #[abbrev = "dswrflx"]
    #[unit = "Wm-2"]
    DirectShortWaveRadiationFlux = 13,
    #[description = "diffuse short wave radiation flux"]
    #[abbrev = "difswrf"]
    #[unit = "Wm-2"]
    DiffuseShortWaveRadiationFlux = 14,
    #[description = "upward uv radiation emitted/reflected from the earth's surface"]
    #[abbrev = "uvvearth"]
    #[unit = "Wm-2"]
    UpwardUVRadiationEmittedReflectedFromTheEarth = 15,
    #[description = "uv index clear sky"]
    #[abbrev = "uviucs"]
    #[unit = "numeric"]
    UVIndexClearSky = 50,
    #[description = "uv index"]
    #[abbrev = "uvi"]
    #[unit = "numeric"]
    UVIndex = 51,
    #[description = "downward short wave radiation flux clear sky"]
    #[abbrev = "dswrfcs"]
    #[unit = "Wm-2"]
    DownwardShortWaveRadiationFluxClearSky = 52,
    #[description = "upward short wave radiation flux clear sky"]
    #[abbrev = "uswrfcs"]
    #[unit = "Wm-2"]
    UpwardShortWaveRadiationFluxClearSky = 53,
    #[description = "direct normal short wave radiation flux,"]
    #[abbrev = "dnswrflx"]
    #[unit = "Wm-2"]
    DirectNormalShortWaveRadiationFlux = 54,
    #[description = "uv visible albedo for diffuse radiation"]
    #[abbrev = "uvalbdif"]
    #[unit = "%"]
    UVVisibleAlbedoForDiffuseRadiation = 55,
    #[description = "uv visible albedo for direct radiation"]
    #[abbrev = "uvalbdir"]
    #[unit = "%"]
    UVVisibleAlbedoForDirectRadiation = 56,
    #[description = "uv visible albedo for direct radiation, geometric component"]
    #[abbrev = "ubalbdirg"]
    #[unit = "%"]
    UVVisibleAlbedoForDirectRadiationGeometricComponent = 57,
    #[description = "uv visible albedo for direct radiation, isotropic component"]
    #[abbrev = "uvalbdiri"]
    #[unit = "%"]
    UVVisibleAlbedoForDirectRadiationIsotropicComponent = 58,
    #[description = "uv visible albedo for direct radiation, volumetric component"]
    #[abbrev = "uvbdirv"]
    #[unit = "%"]
    UVVisibleAlbedoForDirectRadiationVolumetricComponent = 59,
    #[description = "photosynthetically active radiation flux, clear sky"]
    #[abbrev = "phoarfcs"]
    #[unit = "Wm-2"]
    PhotosyntheticallyActiveRadiationFluxClearSky = 60,
    #[description = "direct short wave radiation flux, clear sky"]
    #[abbrev = "dswrflxcs"]
    #[unit = "Wm-2"]
    DirectShortWaveRadiationFluxClearSky = 61,
    #[description = "downward short wave radiation flux"]
    #[abbrev = "dswrf"]
    #[unit = "Wm-2"]
    DownwardShortWaveRadiationFlux = 192,
    #[description = "upward short wave radiation flux"]
    #[abbrev = "uswrf"]
    #[unit = "Wm-2"]
    UpwardShortWaveRadiationFlux = 193,
    #[description = "uv b downward solar flux"]
    #[abbrev = "duvb"]
    #[unit = "Wm-2"]
    UVBDownwardSolarFlux = 194,
    #[description = "clear sky uv b downward solar flux"]
    #[abbrev = "cduvb"]
    #[unit = "Wm-2"]
    ClearSkyUVBDownwardSolarFlux = 195,
    #[description = "clear sky downward solar flux"]
    #[abbrev = "csdsf"]
    #[unit = "Wm-2"]
    ClearSkyDownwardSolarFlux = 196,
    #[description = "solar radiative heating rate"]
    #[abbrev = "swhr"]
    #[unit = "Ks-1"]
    SolarRadiativeHeatingRate = 197,
    #[description = "clear sky upward solar flux"]
    #[abbrev = "csusf"]
    #[unit = "Wm-2"]
    ClearSkyUpwardSolarFlux = 198,
    #[description = "cloud forcing net solar flux"]
    #[abbrev = "cfnsf"]
    #[unit = "Wm-2"]
    CloudForcingNetSolarFlux = 199,
    #[description = "visible beam downward solar flux"]
    #[abbrev = "vbdsf"]
    #[unit = "Wm-2"]
    VisibleBeamDownwardSolarFlux = 200,
    #[description = "visible diffuse downward solar flux"]
    #[abbrev = "vddsf"]
    #[unit = "Wm-2"]
    VisibleDiffuseDownwardSolarFlux = 201,
    #[description = "near ir beam downward solar flux"]
    #[abbrev = "nbdsf"]
    #[unit = "Wm-2"]
    NearIrBeamDownwardSolarFlux = 202,
    #[description = "near ir diffuse downward solar flux"]
    #[abbrev = "nddsf"]
    #[unit = "Wm-2"]
    NearIrDiffuseDownwardSolarFlux = 203,
    #[description = "downward total radiation flux"]
    #[abbrev = "dtrf"]
    #[unit = "Wm-2"]
    DownwardTotalRadiationFlux = 204,
    #[description = "upward total radiation flux"]
    #[abbrev = "utrf"]
    #[unit = "Wm-2"]
    UpwardTotalRadiationFlux = 205,
    #[description = "diffuse short wave radiation flux, clear sky"]
    #[abbrev = "dfswrflxcs"]
    #[unit = "Wm-2"]
    DiffuseShortWaveRadiationFluxClearSky = 206,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum MassProduct {
    #[abbrev = "PRES"]
    #[unit = "pa"]
    Pressure = 0,
    #[description = "pressure reduced to MSL"]
    #[abbrev = "PRMSL"]
    #[unit = "pa"]
    PressureReducedMSL = 1,
    #[description = "pressure tendency"]
    #[abbrev = "PTEND"]
    #[unit = "pas-1"]
    PressureTendency = 2,
    #[description = "icao standard atmosphere reference height"]
    #[abbrev = "ICAHT"]
    #[unit = "m"]
    IcaoStandardAtmosphereReferenceHeight = 3,
    #[description = "geopotential"]
    #[abbrev = "GP"]
    #[unit = "m2s-2"]
    Geopotential = 4,
    #[description = "geopotential height"]
    #[abbrev = "HGT"]
    #[unit = "gpm"]
    GeopotentialHeight = 5,
    #[description = "geopotential height anomaly"]
    #[abbrev = "GPA"]
    #[unit = "gpm"]
    GeopotentialHeightAnomaly = 9,
    #[description = "density"]
    #[abbrev = "DEN"]
    #[unit = "kgm-3"]
    Density = 10,
    #[description = "thickness"]
    #[abbrev = "THICK"]
    #[unit = "m"]
    Thickness = 12,
    #[description = "planetary boundary layer height"]
    #[abbrev = "HPBL"]
    #[unit = "m"]
    PlanetaryBoundaryLayerHeight = 18,
    #[description = "standard deviation of sub-gridscale orography"]
    #[abbrev = "SDOR"]
    #[unit = "m"]
    StandardDeviationOfOrography = 20,
    #[description = "slope of sub-gridscale orography"]
    #[abbrev = "SLOR"]
    #[unit = "numeric"]
    SlopeOfOrography = 22,
    #[description = "mslp (eta model reduction)"]
    #[abbrev = "MSLET"]
    #[unit = "pa"]
    MSLP = 192,
    #[description = "zonal flux of gravity wave stress"]
    #[abbrev = "UGWD"]
    #[unit = "Nm-2"]
    ZonalFluxGravityWaveStress = 194,
    #[description = "meridional flux of gravity wave stress"]
    #[abbrev = "VGWD"]
    #[unit = "Nm-2"]
    MeridionalFluxGravityWaveStress = 195,
    #[description = "planetary boundary layer height (NCEP)"]
    #[abbrev = "HPBL"]
    #[unit = "m"]
    PlanetaryBoundaryLayerHeightNcep = 196,
    #[description = "mslp (maps system reduction)"]
    #[abbrev = "MSLMA"]
    #[unit = "pa"]
    MSLPMaps = 198,
    #[description = "pressure of level from which parcel was lifted"]
    #[abbrev = "PLPL"]
    #[unit = "pa"]
    PressureOfLiftedParcel = 200,
    #[description = "layer thickness"]
    #[abbrev = "LAYTH"]
    #[unit = "m"]
    LayerThickness = 205,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum RadarProduct {
    #[description = "base spectrum width"]
    #[abbrev = "BSWID"]
    #[unit = "ms-1"]
    BaseSpectrumWidth = 0,
    #[description = "vertically-integrated liquid"]
    #[abbrev = "VERIL"]
    #[unit = "kgm-1"]
    VerticallyIntegratedLiquid = 3,
    #[description = "base reflectivity"]
    #[abbrev = "BREF"]
    #[unit = "dB"]
    BaseReflectivity = 1,
    #[description = "layer maximum base reflectivity"]
    #[abbrev = "LMAXBR"]
    #[unit = "dB"]
    LayerMaximumBaseReflectivity = 4,
    #[description = "precipitation"]
    #[abbrev = "PREC"]
    #[unit = "kgm-2"]
    Precipitation = 5,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum ForecastRadarImagery {
    #[description = "echo top"]
    #[abbrev = "RETOP"]
    #[unit = "m"]
    EchoTop = 3,
    #[description = "reflectivity"]
    #[abbrev = "REFD"]
    #[unit = "dB"]
    Reflectivity = 195,
    #[description = "composite reflectivity"]
    #[abbrev = "REFC"]
    #[unit = "dB"]
    CompositeReflectivity = 196,
    #[description = "hourly maximum of simulated reflectivity"]
    #[abbrev = "MAXREF"]
    #[unit = "dB"]
    HourlyMaxSimulatedReflectivity = 198,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum Electromagnetics {
    #[abbrev = "LTNGSD"]
    #[unit = "m-2 s-1"]
    LightingStrikeDensity = 0,
    #[description = "lightning potential index"]
    #[abbrev = "LTPINX"]
    #[unit = "J kg-1"]
    LightingPotentialIndex = 1,
    #[description = "cloud-to-ground lightning flash density"]
    #[abbrev = "CDGDLTFD"]
    #[unit = "km-2 day-1"]
    CloudToGroundLightingFlashDensity = 2,
    #[description = "cloud-to-cloud lightning flash density"]
    #[abbrev = "CDCDLTFD"]
    #[unit = "km-2 day-1"]
    CloudToCloudLightingFlashDensity = 3,
    #[description = "total lightning flash density"]
    #[abbrev = "TLGTFD"]
    #[unit = "km-2 day-1"]
    TotalLightningFlashDensity = 4,
    #[abbrev = "LTNG"]
    #[unit = "nondim"]
    Lightning = 192,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum ThermodynamicStabilityProduct {
    #[description = "parcel lifted index"]
    #[abbrev = "PLI"]
    #[unit = "K"]
    ParcelLiftedIndex = 0,
    #[description = "best lifted index"]
    #[abbrev = "BLI"]
    #[unit = "K"]
    BestLiftedIndex = 1,
    #[description = "k index"]
    #[abbrev = "KX"]
    #[unit = "K"]
    KIndex = 2,
    #[description = "ko index"]
    #[abbrev = "KOX"]
    #[unit = "K"]
    KOIndex = 3,
    #[description = "total totals index"]
    #[abbrev = "TOTALX"]
    #[unit = "K"]
    TotalTotalsIndex = 4,
    #[description = "sweat index"]
    #[abbrev = "SX"]
    #[unit = "numeric"]
    SweatIndex = 5,
    #[description = "convective available potential energy"]
    #[abbrev = "CAPE"]
    #[unit = "Jkg-1"]
    ConvectiveAvailablePotentialEnergy = 6,
    #[description = "convective inhibition"]
    #[abbrev = "CIN"]
    #[unit = "Jkg-1"]
    ConvectiveInhibition = 7,
    #[description = "storm relative helicity"]
    #[abbrev = "HLCY"]
    #[unit = "m2s-2"]
    StormRelativeHelicity = 8,
    #[description = "energy helicity index"]
    #[abbrev = "EHLX"]
    #[unit = "numeric"]
    EnergyHelicityIndex = 9,
    #[description = "surface lifted index"]
    #[abbrev = "LFTX"]
    #[unit = "K"]
    SurfaceLiftedIndex = 10,
    #[description = "best (4 layer) lifted index"]
    #[abbrev = "4LFTX"]
    #[unit = "K"]
    Best4LayerLiftedIndex = 11,
    #[description = "richardson number"]
    #[abbrev = "RI"]
    #[unit = "numeric"]
    RichardsonNumber = 12,
    #[description = "leaf area index"]
    #[abbrev = "LAI"]
    #[unit = "numeric"]
    LeafAreaIndex = 198,
    #[description = "surface lifted index (NCEP)"]
    #[abbrev = "LFTX"]
    #[unit = "K"]
    SurfaceLiftedIndexNcep = 192,
    #[description = "best (4 layer) lifted index (NCEP)"]
    #[abbrev = "4LFTX"]
    #[unit = "K"]
    Best4LayerLiftedIndexNcep = 193,
    #[description = "hourly maximum of updraft helicity"]
    #[abbrev = "MXUPHL"]
    #[unit = "m2s-2"]
    HourlyMaxUpdraftHelicity = 199,
    #[description = "hourly minimum of updraft helicity"]
    #[abbrev = "MNUPHL"]
    #[unit = "m2s-2"]
    HourlyMinUpdraftHelicity = 200,
    #[description = "downdraft CAPE"]
    #[abbrev = "DCAPE"]
    #[unit = "Jkg-1"]
    DowndraftCAPE = 203,
    #[description = "effective layer height"]
    #[abbrev = "EFHL"]
    #[unit = "m"]
    EffectiveLayerHeight = 204,
    #[description = "effective storm relative helicity"]
    #[abbrev = "ESP"]
    #[unit = "m2s-2"]
    EffectiveStormRelativeHelicity = 205,
    #[description = "critical angle"]
    #[abbrev = "CANGLE"]
    #[unit = "degree"]
    CriticalAngle = 206,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum PhysicalAtmosphericProperties {
    #[description = "visibility"]
    #[abbrev = "VIS"]
    #[unit = "m"]
    Visibility = 0,
    #[description = "albedo"]
    #[abbrev = "ALBDO"]
    #[unit = "%"]
    Albedo = 1,
    #[description = "clear air turbulence"]
    #[abbrev = "CAT"]
    #[unit = "%"]
    ClearAirTurbulence = 22,
    #[description = "snow albedo"]
    #[abbrev = "ASN"]
    #[unit = "proportion"]
    SnowAlbedo = 192,
    #[description = "turbulence potential forecast index"]
    #[abbrev = "TPFI"]
    #[unit = "nondim"]
    TurbulencePotentialForecastIndex = 219,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum LongWaveRadiationProduct {
    #[description = "net long-wave radiation flux"]
    #[abbrev = "NLWRS"]
    #[unit = "Wm-2"]
    NetLongWaveRadiationFlux = 0,
    #[description = "downward long-wave radiation flux"]
    #[abbrev = "DLWRF"]
    #[unit = "Wm-2"]
    DownwardLongWaveRadiationFlux = 3,
    #[description = "upward long-wave radiation flux"]
    #[abbrev = "ULWRF"]
    #[unit = "Wm-2"]
    UpwardLongWaveRadiationFlux = 4,
    #[description = "net long-wave radiation flux (top of atmosphere)"]
    #[abbrev = "NLWRT"]
    #[unit = "Wm-2"]
    NetLongWaveRadiationFluxTop = 5,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum TraceGasesProduct {
    #[description = "total ozone"]
    #[abbrev = "TOZNE"]
    #[unit = "DU"]
    TotalOzone = 0,
    #[description = "ozone mixing ratio"]
    #[abbrev = "O3MR"]
    #[unit = "kgkg-1"]
    OzoneMixingRatio = 1,
    #[description = "total column integrated ozone"]
    #[abbrev = "TCIOZ"]
    #[unit = "DU"]
    TotalColumnIntegratedOzone = 2,
    #[description = "ozone mixing ratio"]
    #[abbrev = "O3MR"]
    #[unit = "kgkg-1"]
    OzoneMixingRatio192 = 192,
    #[description = "ozone concentration"]
    #[abbrev = "OZCON"]
    #[unit = "ppb"]
    OzoneConcentration = 193,
    #[description = "categorical ozone concentration"]
    #[abbrev = "OZCAT"]
    #[unit = "nondim"]
    CategoricalOzoneConcentration = 194,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum AtmosphericChemicalConstituents {
    #[description = "mass density"]
    #[abbrev = "MASSDEN"]
    #[unit = "kg m-3"]
    MassDensity = 0,
    #[description = "column integrated mass density"]
    #[abbrev = "COLMD"]
    #[unit = "kg m-2"]
    ColumnIntegratedMassDensity = 1,
    #[description = "mass mixing ratio"]
    #[abbrev = "MASSMR"]
    #[unit = "kg kg-1"]
    MassMixingRatio = 2,
    #[description = "atmosphere optical thickness"]
    #[abbrev = "APTS"]
    #[unit = ""]
    AtmosphereOpticalThickness = 102,
    Missing = 255,
}

#[repr(u8)]
#[derive(Eq, PartialEq, Debug, DisplayDescription, FromValue, ToParameter)]
pub enum NcepMiscellaneous {
    #[description = "latitude"]
    #[abbrev = "NLAT"]
    #[unit = "degrees"]
    Latitude = 192,
    #[description = "east longitude"]
    #[abbrev = "ELON"]
    #[unit = "degrees"]
    EastLongitude = 193,
    Missing = 255,
}

pub fn meteorological_parameter(category: u8, parameter: u8) -> Option<Parameter> {
    match category {
        0 => Some(Parameter::from(TemperatureProduct::from(parameter))),
        1 => Some(Parameter::from(MoistureProduct::from(parameter))),
        2 => Some(Parameter::from(MomentumProduct::from(parameter))),
        3 => Some(Parameter::from(MassProduct::from(parameter))),
        4 => Some(Parameter::from(ShortWaveRadiationProduct::from(parameter))),
        5 => Some(Parameter::from(LongWaveRadiationProduct::from(parameter))),
        6 => Some(Parameter::from(CloudProduct::from(parameter))),
        7 => Some(Parameter::from(ThermodynamicStabilityProduct::from(
            parameter,
        ))),
        14 => Some(Parameter::from(TraceGasesProduct::from(parameter))),
        15 => Some(Parameter::from(RadarProduct::from(parameter))),
        16 => Some(Parameter::from(ForecastRadarImagery::from(parameter))),
        17 => Some(Parameter::from(Electromagnetics::from(parameter))),
        19 => Some(Parameter::from(PhysicalAtmosphericProperties::from(
            parameter,
        ))),
        20 => Some(Parameter::from(AtmosphericChemicalConstituents::from(
            parameter,
        ))),
        191 => Some(Parameter::from(NcepMiscellaneous::from(parameter))),
        _ => None,
    }
}

pub fn meteorological_category(category: u8) -> &'static str {
    match category {
        0 => "temperature",
        1 => "moisture",
        2 => "momentum",
        3 => "mass",
        4 => "short wave radiation",
        5 => "long wave radiation",
        6 => "cloud",
        7 => "thermodynamic stability",
        14 => "trace gases",
        15 => "radar",
        16 => "forecast radar imagery",
        17 => "electromagnetics",
        19 => "physical atmospheric properties",
        20 => "atmospheric chemical constituents",
        191 => "miscellaneous",
        _ => "other",
    }
}