grib2io.templates

GRIB2 section templates classes and metadata descriptor classes.

   1"""GRIB2 section templates classes and metadata descriptor classes."""
   2
   3from dataclasses import dataclass, field
   4from decimal import Decimal
   5from collections import defaultdict
   6from typing import Union
   7import copy
   8import datetime
   9import numpy as np
  10import warnings
  11
  12from . import tables
  13from . import utils
  14
  15# This dict is used by grib2io.Grib2Message.attrs_by_section() method
  16# to get attr names that defined in the Grib2Message base class.
  17_section_attrs = {
  18    0: ["discipline"],
  19    1: [
  20        "originatingCenter",
  21        "originatingSubCenter",
  22        "masterTableInfo",
  23        "localTableInfo",
  24        "significanceOfReferenceTime",
  25        "year",
  26        "month",
  27        "day",
  28        "hour",
  29        "minute",
  30        "second",
  31        "refDate",
  32        "productionStatus",
  33        "typeOfData",
  34    ],
  35    2: [],
  36    3: [
  37        "sourceOfGridDefinition",
  38        "numberOfDataPoints",
  39        "interpretationOfListOfNumbers",
  40        "gridDefinitionTemplateNumber",
  41        "shapeOfEarth",
  42        "earthRadius",
  43        "earthMajorAxis",
  44        "earthMinorAxis",
  45        "resolutionAndComponentFlags",
  46        "ny",
  47        "nx",
  48        "scanModeFlags",
  49    ],
  50    4: [],
  51    5: ["dataRepresentationTemplateNumber", "numberOfPackedValues", "typeOfValues"],
  52    6: ["bitMapFlag"],
  53    7: [],
  54    8: [],
  55}
  56
  57_continuous_pdtns = [int(k) for k, v in tables.get_table("4.0").items() if "a point in time" in v]
  58_timeinterval_pdtns = [int(k) for k, v in tables.get_table("4.0").items() if "continuous or non-continuous time interval" in v]
  59
  60
  61def _calculate_scale_factor(value: float):
  62    """
  63    Calculate the scale factor for a given value.
  64
  65    Parameters
  66    ----------
  67    value : float
  68        Value for which to calculate the scale factor.
  69
  70    Returns
  71    -------
  72    int
  73        Scale factor for the value.
  74    """
  75    return len(f"{value}".split(".")[1].rstrip("0"))
  76
  77
  78class Grib2Metadata:
  79    """
  80    Class to hold GRIB2 metadata.
  81
  82    Stores both numeric code value as stored in GRIB2 and its plain language
  83    definition.
  84
  85    Attributes
  86    ----------
  87    value : int
  88        GRIB2 metadata integer code value.
  89    table : str, optional
  90        GRIB2 table to lookup the `value`. Default is None.
  91    definition : str
  92        Plain language description of numeric metadata.
  93    """
  94
  95    __slots__ = ("value", "table")
  96
  97    def __init__(self, value, table=None):
  98        self.value = int(value)
  99        self.table = table
 100
 101    def __call__(self):
 102        return self.value
 103
 104    def __repr__(self):
 105        return f"{self.__class__.__name__}({self.value}, table = '{self.table}')"
 106
 107    def __str__(self):
 108        return f"{self.value} - {self.definition}"
 109
 110    def __eq__(self, other):
 111        return self.value == other or self.definition[0] == other
 112
 113    def __gt__(self, other):
 114        return self.value > other
 115
 116    def __ge__(self, other):
 117        return self.value >= other
 118
 119    def __lt__(self, other):
 120        return self.value < other
 121
 122    def __le__(self, other):
 123        return self.value <= other
 124
 125    def __contains__(self, other):
 126        return other in self.definition
 127
 128    def __index__(self):
 129        return int(self.value)
 130
 131    def __hash__(self):
 132        return hash(self.value)
 133
 134    @property
 135    def definition(self):
 136        """Provide the definition of the numeric metadata."""
 137        return tables.get_value_from_table(self.value, self.table)
 138
 139    def show_table(self):
 140        """Provide the table related to this metadata."""
 141        return tables.get_table(self.table)
 142
 143
 144# ----------------------------------------------------------------------------------------
 145# Descriptor Classes for Section 0 metadata.
 146# ----------------------------------------------------------------------------------------
 147class IndicatorSection:
 148    """
 149    [GRIB2 Indicator Section (0)](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect0.shtml)
 150    """
 151
 152    def __get__(self, obj, objtype=None):
 153        return obj.section0
 154
 155    def __set__(self, obj, value):
 156        obj.section0 = value
 157
 158
 159class Discipline:
 160    """[Discipline](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table0-0.shtml)"""
 161
 162    def __get__(self, obj, objtype=None):
 163        return Grib2Metadata(obj.indicatorSection[2], table="0.0")
 164
 165    def __set__(self, obj, value):
 166        obj.section0[2] = value
 167
 168
 169# ----------------------------------------------------------------------------------------
 170# Descriptor Classes for Section 1 metadata.
 171# ----------------------------------------------------------------------------------------
 172class IdentificationSection:
 173    """
 174    GRIB2 Section 1, [Identification Section](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect1.shtml)
 175    """
 176
 177    def __get__(self, obj, objtype=None):
 178        return obj.section1
 179
 180    def __set__(self, obj, value):
 181        obj.section1 = value
 182
 183
 184class OriginatingCenter:
 185    """[Originating Center](https://www.nco.ncep.noaa.gov/pmb/docs/on388/table0.html)"""
 186
 187    def __get__(self, obj, objtype=None):
 188        return Grib2Metadata(obj.section1[0], table="originating_centers")
 189
 190    def __set__(self, obj, value):
 191        obj.section1[0] = value
 192
 193
 194class OriginatingSubCenter:
 195    """[Originating SubCenter](https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablec.html)"""
 196
 197    def __get__(self, obj, objtype=None):
 198        return Grib2Metadata(obj.section1[1], table="originating_subcenters")
 199
 200    def __set__(self, obj, value):
 201        obj.section1[1] = value
 202
 203
 204class MasterTableInfo:
 205    """[GRIB2 Master Table Version](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-0.shtml)"""
 206
 207    def __get__(self, obj, objtype=None):
 208        return Grib2Metadata(obj.section1[2], table="1.0")
 209
 210    def __set__(self, obj, value):
 211        obj.section1[2] = value
 212
 213
 214class LocalTableInfo:
 215    """[GRIB2 Local Tables Version Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-1.shtml)"""
 216
 217    def __get__(self, obj, objtype=None):
 218        return Grib2Metadata(obj.section1[3], table="1.1")
 219
 220    def __set__(self, obj, value):
 221        obj.section1[3] = value
 222
 223
 224class SignificanceOfReferenceTime:
 225    """[Significance of Reference Time](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-2.shtml)"""
 226
 227    def __get__(self, obj, objtype=None):
 228        return Grib2Metadata(obj.section1[4], table="1.2")
 229
 230    def __set__(self, obj, value):
 231        obj.section1[4] = value
 232
 233
 234class Year:
 235    """Year of reference time"""
 236
 237    def __get__(self, obj, objtype=None):
 238        return obj.section1[5]
 239
 240    def __set__(self, obj, value):
 241        rd = copy.copy(obj.section1[5:11])
 242        rd[0] = value
 243        # Test validity of datetime values
 244        _ = datetime.datetime(*rd)
 245        obj.section1[5] = value
 246
 247
 248class Month:
 249    """Month of reference time"""
 250
 251    def __get__(self, obj, objtype=None):
 252        return obj.section1[6]
 253
 254    def __set__(self, obj, value):
 255        rd = copy.copy(obj.section1[5:11])
 256        rd[1] = value
 257        # Test validity of datetime values
 258        _ = datetime.datetime(*rd)
 259        obj.section1[6] = value
 260
 261
 262class Day:
 263    """Day of reference time"""
 264
 265    def __get__(self, obj, objtype=None):
 266        return obj.section1[7]
 267
 268    def __set__(self, obj, value):
 269        rd = copy.copy(obj.section1[5:11])
 270        rd[2] = value
 271        # Test validity of datetime values
 272        _ = datetime.datetime(*rd)
 273        obj.section1[7] = value
 274
 275
 276class Hour:
 277    """Hour of reference time"""
 278
 279    def __get__(self, obj, objtype=None):
 280        return obj.section1[8]
 281
 282    def __set__(self, obj, value):
 283        rd = copy.copy(obj.section1[5:11])
 284        rd[3] = value
 285        # Test validity of datetime values
 286        _ = datetime.datetime(*rd)
 287        obj.section1[8] = value
 288
 289
 290class Minute:
 291    """Minute of reference time"""
 292
 293    def __get__(self, obj, objtype=None):
 294        return obj.section1[9]
 295
 296    def __set__(self, obj, value):
 297        rd = copy.copy(obj.section1[5:11])
 298        rd[4] = value
 299        # Test validity of datetime values
 300        _ = datetime.datetime(*rd)
 301        obj.section1[9] = value
 302
 303
 304class Second:
 305    """Second of reference time"""
 306
 307    def __get__(self, obj, objtype=None):
 308        return obj.section1[10]
 309
 310    def __set__(self, obj, value):
 311        rd = copy.copy(obj.section1[5:11])
 312        rd[5] = value
 313        # Test validity of datetime values
 314        _ = datetime.datetime(*rd)
 315        obj.section1[10] = value
 316
 317
 318class RefDate:
 319    """Reference Date. NOTE: This is a `datetime.datetime` object."""
 320
 321    def __get__(self, obj, objtype=None):
 322        return datetime.datetime(*obj.section1[5:11])
 323
 324    def __set__(self, obj, value):
 325        if isinstance(value, np.datetime64):
 326            timestamp = (value - np.datetime64("1970-01-01T00:00:00")) / np.timedelta64(1, "s")
 327            try:
 328                # Python >= 3.10
 329                value = datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
 330            except AttributeError:
 331                # Python < 3.10
 332                value = datetime.datetime.utcfromtimestamp(timestamp)
 333        if isinstance(value, datetime.datetime):
 334            obj.section1[5] = value.year
 335            obj.section1[6] = value.month
 336            obj.section1[7] = value.day
 337            obj.section1[8] = value.hour
 338            obj.section1[9] = value.minute
 339            obj.section1[10] = value.second
 340            # IMPORTANT: Update validDate components when message is time interval
 341            if obj.pdtn in _timeinterval_pdtns:
 342                vd = value + obj.leadTime + obj.duration
 343                obj.yearOfEndOfTimePeriod = vd.year
 344                obj.monthOfEndOfTimePeriod = vd.month
 345                obj.dayOfEndOfTimePeriod = vd.day
 346                obj.hourOfEndOfTimePeriod = vd.hour
 347                obj.minuteOfEndOfTimePeriod = vd.minute
 348                obj.secondOfEndOfTimePeriod = vd.second
 349        else:
 350            msg = "Reference date must be a datetime.datetime or np.datetime64 object."
 351            raise TypeError(msg)
 352
 353
 354class ProductionStatus:
 355    """[Production Status of Processed Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-3.shtml)"""
 356
 357    def __get__(self, obj, objtype=None):
 358        return Grib2Metadata(obj.section1[11], table="1.3")
 359
 360    def __set__(self, obj, value):
 361        obj.section1[11] = value
 362
 363
 364class TypeOfData:
 365    """[Type of Processed Data in this GRIB message](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-4.shtml)"""
 366
 367    def __get__(self, obj, objtype=None):
 368        return Grib2Metadata(obj.section1[12], table="1.4")
 369
 370    def __set__(self, obj, value):
 371        obj.section1[12] = value
 372
 373
 374# ----------------------------------------------------------------------------------------
 375# Descriptor Classes for Section 2 metadata.
 376# ----------------------------------------------------------------------------------------
 377
 378
 379# ----------------------------------------------------------------------------------------
 380# Descriptor Classes for Section 3 metadata.
 381# ----------------------------------------------------------------------------------------
 382class GridDefinitionSection:
 383    """
 384    GRIB2 Section 3, [Grid Definition Section](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect3.shtml)
 385    """
 386
 387    def __get__(self, obj, objtype=None):
 388        return obj.section3[0:5]
 389
 390    def __set__(self, obj, value):
 391        raise RuntimeError
 392
 393
 394class SourceOfGridDefinition:
 395    """[Source of Grid Definition](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-0.shtml)"""
 396
 397    def __get__(self, obj, objtype=None):
 398        return Grib2Metadata(obj.section3[0], table="3.0")
 399
 400    def __set__(self, obj, value):
 401        raise RuntimeError
 402
 403
 404class NumberOfDataPoints:
 405    """Number of Data Points"""
 406
 407    def __get__(self, obj, objtype=None):
 408        return obj.section3[1]
 409
 410    def __set__(self, obj, value):
 411        raise RuntimeError
 412
 413
 414class InterpretationOfListOfNumbers:
 415    """Interpretation of List of Numbers"""
 416
 417    def __get__(self, obj, objtype=None):
 418        return Grib2Metadata(obj.section3[3], table="3.11")
 419
 420    def __set__(self, obj, value):
 421        raise RuntimeError
 422
 423
 424class GridDefinitionTemplateNumber:
 425    """[Grid Definition Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-1.shtml)"""
 426
 427    def __get__(self, obj, objtype=None):
 428        return Grib2Metadata(obj.section3[4], table="3.1")
 429
 430    def __set__(self, obj, value):
 431        raise RuntimeError
 432
 433
 434class GridDefinitionTemplate:
 435    """Grid definition template"""
 436
 437    def __get__(self, obj, objtype=None):
 438        return obj.section3[5:]
 439
 440    def __set__(self, obj, value):
 441        raise RuntimeError
 442
 443
 444class EarthParams:
 445    """Metadata about the shape of the Earth"""
 446
 447    def __get__(self, obj, objtype=None):
 448        if obj.section3[5] in {50, 51, 52, 1200}:
 449            return None
 450        return tables.get_table("earth_params")[str(obj.section3[5])]
 451
 452    def __set__(self, obj, value):
 453        raise RuntimeError
 454
 455
 456class DxSign:
 457    """Sign of Grid Length in X-Direction"""
 458
 459    def __get__(self, obj, objtype=None):
 460        if obj.section3[4] in {0, 1, 203, 205, 32768, 32769} and obj.section3[17] > obj.section3[20]:
 461            return -1.0
 462        return 1.0
 463
 464    def __set__(self, obj, value):
 465        raise RuntimeError
 466
 467
 468class DySign:
 469    """Sign of Grid Length in Y-Direction"""
 470
 471    def __get__(self, obj, objtype=None):
 472        if obj.section3[4] in {0, 1, 203, 205, 32768, 32769} and obj.section3[16] > obj.section3[19]:
 473            return -1.0
 474        return 1.0
 475
 476    def __set__(self, obj, value):
 477        raise RuntimeError
 478
 479
 480class LLScaleFactor:
 481    """Scale Factor for Lats/Lons"""
 482
 483    def __get__(self, obj, objtype=None):
 484        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
 485            llscalefactor = float(obj.section3[14])
 486            if llscalefactor == 0:
 487                return 1
 488            return llscalefactor
 489        return 1
 490
 491    def __set__(self, obj, value):
 492        raise RuntimeError
 493
 494
 495class LLDivisor:
 496    """Divisor Value for scaling Lats/Lons"""
 497
 498    def __get__(self, obj, objtype=None):
 499        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
 500            lldivisor = float(obj.section3[15])
 501            if lldivisor <= 0:
 502                return 1.0e6
 503            return lldivisor
 504        return 1.0e6
 505
 506    def __set__(self, obj, value):
 507        raise RuntimeError
 508
 509
 510class XYDivisor:
 511    """Divisor Value for scaling grid lengths"""
 512
 513    def __get__(self, obj, objtype=None):
 514        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
 515            return obj._lldivisor
 516        return 1.0e3
 517
 518    def __set__(self, obj, value):
 519        raise RuntimeError
 520
 521
 522class ShapeOfEarth:
 523    """[Shape of the Reference System](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-2.shtml)"""
 524
 525    def __get__(self, obj, objtype=None):
 526        return Grib2Metadata(obj.section3[5], table="3.2")
 527
 528    def __set__(self, obj, value):
 529        obj.section3[5] = value
 530
 531
 532class EarthShape:
 533    """Description of the shape of the Earth"""
 534
 535    def __get__(self, obj, objtype=None):
 536        return obj._earthparams["shape"]
 537
 538    def __set__(self, obj, value):
 539        raise RuntimeError
 540
 541
 542class EarthRadius:
 543    """Radius of the Earth (Assumes "spherical")"""
 544
 545    def __get__(self, obj, objtype=None):
 546        ep = obj._earthparams
 547        if ep["shape"] == "spherical":
 548            if ep["radius"] is None:
 549                return obj.section3[7] / (10.0 ** obj.section3[6])
 550            else:
 551                return ep["radius"]
 552        elif ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
 553            return None
 554
 555    def __set__(self, obj, value):
 556        raise RuntimeError
 557
 558
 559class EarthMajorAxis:
 560    """Major Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")"""
 561
 562    def __get__(self, obj, objtype=None):
 563        ep = obj._earthparams
 564        if ep["shape"] == "spherical":
 565            return None
 566        elif ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
 567            if ep["major_axis"] is None and ep["minor_axis"] is None:
 568                return obj.section3[9] / (10.0 ** obj.section3[8])
 569            else:
 570                return ep["major_axis"]
 571
 572    def __set__(self, obj, value):
 573        raise RuntimeError
 574
 575
 576class EarthMinorAxis:
 577    """Minor Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")"""
 578
 579    def __get__(self, obj, objtype=None):
 580        ep = obj._earthparams
 581        if ep["shape"] == "spherical":
 582            return None
 583        if ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
 584            if ep["major_axis"] is None and ep["minor_axis"] is None:
 585                return obj.section3[11] / (10.0 ** obj.section3[10])
 586            else:
 587                return ep["minor_axis"]
 588
 589    def __set__(self, obj, value):
 590        raise RuntimeError
 591
 592
 593class Nx:
 594    """Number of grid points in the X-direction (generally East-West)"""
 595
 596    def __get__(self, obj, objtype=None):
 597        return obj.section3[12]
 598
 599    def __set__(self, obj, value):
 600        obj.section3[12] = value
 601        obj.section3[1] = value * obj.section3[13]
 602
 603
 604class Ny:
 605    """Number of grid points in the Y-direction (generally North-South)"""
 606
 607    def __get__(self, obj, objtype=None):
 608        return obj.section3[13]
 609
 610    def __set__(self, obj, value):
 611        obj.section3[13] = value
 612        obj.section3[1] = value * obj.section3[12]
 613
 614
 615class ScanModeFlags:
 616    """[Scanning Mode](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-4.shtml)"""
 617
 618    _key = {
 619        0: 18,
 620        1: 18,
 621        10: 15,
 622        20: 17,
 623        30: 17,
 624        31: 17,
 625        40: 18,
 626        41: 18,
 627        90: 16,
 628        110: 15,
 629        203: 18,
 630        204: 18,
 631        205: 18,
 632        32768: 18,
 633        32769: 18,
 634    }
 635
 636    def __get__(self, obj, objtype=None):
 637        if obj.gdtn == 50:
 638            return [None, None, None, None]
 639        else:
 640            return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)[0:8]
 641
 642    def __set__(self, obj, value):
 643        obj.section3[self._key[obj.gdtn] + 5] = value
 644
 645
 646class ResolutionAndComponentFlags:
 647    """[Resolution and Component Flags](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-3.shtml)"""
 648
 649    _key = {
 650        0: 13,
 651        1: 13,
 652        10: 11,
 653        20: 11,
 654        30: 11,
 655        31: 11,
 656        40: 13,
 657        41: 13,
 658        90: 11,
 659        110: 11,
 660        203: 13,
 661        204: 13,
 662        205: 13,
 663        32768: 13,
 664        32769: 13,
 665    }
 666
 667    def __get__(self, obj, objtype=None):
 668        if obj.gdtn == 50:
 669            return [None for i in range(8)]
 670        else:
 671            return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)
 672
 673    def __set__(self, obj, value):
 674        obj.section3[self._key[obj.gdtn] + 5] = value
 675
 676
 677class LatitudeFirstGridpoint:
 678    """Latitude of first gridpoint"""
 679
 680    _key = {
 681        0: 11,
 682        1: 11,
 683        10: 9,
 684        20: 9,
 685        30: 9,
 686        31: 9,
 687        40: 11,
 688        41: 11,
 689        110: 9,
 690        203: 11,
 691        204: 11,
 692        205: 11,
 693        32768: 11,
 694        32769: 11,
 695    }
 696
 697    def __get__(self, obj, objtype=None):
 698        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 699
 700    def __set__(self, obj, value):
 701        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 702
 703
 704class LongitudeFirstGridpoint:
 705    """Longitude of first gridpoint"""
 706
 707    _key = {
 708        0: 12,
 709        1: 12,
 710        10: 10,
 711        20: 10,
 712        30: 10,
 713        31: 10,
 714        40: 12,
 715        41: 12,
 716        110: 10,
 717        203: 12,
 718        204: 12,
 719        205: 12,
 720        32768: 12,
 721        32769: 12,
 722    }
 723
 724    def __get__(self, obj, objtype=None):
 725        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 726
 727    def __set__(self, obj, value):
 728        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 729
 730
 731class LatitudeLastGridpoint:
 732    """Latitude of last gridpoint"""
 733
 734    _key = {
 735        0: 14,
 736        1: 14,
 737        10: 13,
 738        40: 14,
 739        41: 14,
 740        203: 14,
 741        204: 14,
 742        205: 14,
 743        32768: 14,
 744        32769: 19,
 745    }
 746
 747    def __get__(self, obj, objtype=None):
 748        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 749
 750    def __set__(self, obj, value):
 751        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 752
 753
 754class LongitudeLastGridpoint:
 755    """Longitude of last gridpoint"""
 756
 757    _key = {
 758        0: 15,
 759        1: 15,
 760        10: 14,
 761        40: 15,
 762        41: 15,
 763        203: 15,
 764        204: 15,
 765        205: 15,
 766        32768: 15,
 767        32769: 20,
 768    }
 769
 770    def __get__(self, obj, objtype=None):
 771        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 772
 773    def __set__(self, obj, value):
 774        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 775
 776
 777class LatitudeCenterGridpoint:
 778    """Latitude of center gridpoint"""
 779
 780    _key = {32768: 14, 32769: 14}
 781
 782    def __get__(self, obj, objtype=None):
 783        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 784
 785    def __set__(self, obj, value):
 786        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 787
 788
 789class LongitudeCenterGridpoint:
 790    """Longitude of center gridpoint"""
 791
 792    _key = {32768: 15, 32769: 15}
 793
 794    def __get__(self, obj, objtype=None):
 795        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 796
 797    def __set__(self, obj, value):
 798        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 799
 800
 801class GridlengthXDirection:
 802    """Grid lenth in the X-Direction"""
 803
 804    _key = {
 805        0: 16,
 806        1: 16,
 807        10: 17,
 808        20: 14,
 809        30: 14,
 810        31: 14,
 811        40: 16,
 812        41: 16,
 813        203: 16,
 814        204: 16,
 815        205: 16,
 816        32768: 16,
 817        32769: 16,
 818    }
 819
 820    def __get__(self, obj, objtype=None):
 821        return (obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._xydivisor) * obj._dxsign
 822
 823    def __set__(self, obj, value):
 824        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._xydivisor / obj._llscalefactor)
 825
 826
 827class GridlengthYDirection:
 828    """Grid lenth in the Y-Direction"""
 829
 830    _key = {
 831        0: 17,
 832        1: 17,
 833        10: 18,
 834        20: 15,
 835        30: 15,
 836        31: 15,
 837        203: 17,
 838        204: 17,
 839        205: 17,
 840        32768: 17,
 841        32769: 17,
 842    }
 843
 844    def __get__(self, obj, objtype=None):
 845        if obj.gdtn in {40, 41}:
 846            return obj.gridlengthXDirection
 847        else:
 848            return (obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._xydivisor) * obj._dysign
 849
 850    def __set__(self, obj, value):
 851        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._xydivisor / obj._llscalefactor)
 852
 853
 854class NumberOfParallels:
 855    """Number of parallels between a pole and the equator"""
 856
 857    _key = {40: 17, 41: 17}
 858
 859    def __get__(self, obj, objtype=None):
 860        return obj.section3[self._key[obj.gdtn] + 5]
 861
 862    def __set__(self, obj, value):
 863        raise RuntimeError
 864
 865
 866class LatitudeSouthernPole:
 867    """Latitude of the Southern Pole for a Rotated Lat/Lon Grid"""
 868
 869    _key = {1: 19, 30: 20, 31: 20, 41: 19}
 870
 871    def __get__(self, obj, objtype=None):
 872        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 873
 874    def __set__(self, obj, value):
 875        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 876
 877
 878class LongitudeSouthernPole:
 879    """Longitude of the Southern Pole for a Rotated Lat/Lon Grid"""
 880
 881    _key = {1: 20, 30: 21, 31: 21, 41: 20}
 882
 883    def __get__(self, obj, objtype=None):
 884        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 885
 886    def __set__(self, obj, value):
 887        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 888
 889
 890class AnglePoleRotation:
 891    """Angle of Pole Rotation for a Rotated Lat/Lon Grid"""
 892
 893    _key = {1: 21, 41: 21}
 894
 895    def __get__(self, obj, objtype=None):
 896        return obj.section3[self._key[obj.gdtn] + 5]
 897
 898    def __set__(self, obj, value):
 899        obj.section3[self._key[obj.gdtn] + 5] = int(value)
 900
 901
 902class LatitudeTrueScale:
 903    """Latitude at which grid lengths are specified"""
 904
 905    _key = {10: 12, 20: 12, 30: 12, 31: 12}
 906
 907    def __get__(self, obj, objtype=None):
 908        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 909
 910    def __set__(self, obj, value):
 911        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 912
 913
 914class GridOrientation:
 915    """Longitude at which the grid is oriented"""
 916
 917    _key = {10: 16, 20: 13, 30: 13, 31: 13}
 918
 919    def __get__(self, obj, objtype=None):
 920        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 921
 922    def __set__(self, obj, value):
 923        if obj.gdtn == 10 and (value < 0 or value > 90):
 924            raise ValueError("Grid orientation is limited to range of 0 to 90 degrees.")
 925        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 926
 927
 928class ProjectionCenterFlag:
 929    """[Projection Center](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-5.shtml)"""
 930
 931    _key = {20: 16, 30: 16, 31: 16}
 932
 933    def __get__(self, obj, objtype=None):
 934        return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)[0]
 935
 936    def __set__(self, obj, value):
 937        obj.section3[self._key[obj.gdtn] + 5] = value
 938
 939
 940class StandardLatitude1:
 941    """First Standard Latitude (from the pole at which the secant cone cuts the sphere)"""
 942
 943    _key = {30: 18, 31: 18}
 944
 945    def __get__(self, obj, objtype=None):
 946        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 947
 948    def __set__(self, obj, value):
 949        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 950
 951
 952class StandardLatitude2:
 953    """Second Standard Latitude (from the pole at which the secant cone cuts the sphere)"""
 954
 955    _key = {30: 19, 31: 19}
 956
 957    def __get__(self, obj, objtype=None):
 958        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
 959
 960    def __set__(self, obj, value):
 961        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)
 962
 963
 964class SpectralFunctionParameters:
 965    """Spectral Function Parameters"""
 966
 967    def __get__(self, obj, objtype=None):
 968        return obj.section3[0:3]
 969
 970    def __set__(self, obj, value):
 971        obj.section3[0:3] = value[0:3]
 972
 973
 974class ProjParameters:
 975    """PROJ Parameters to define the reference system"""
 976
 977    def __get__(self, obj, objtype=None):
 978        projparams = {}
 979        projparams["a"] = 1.0
 980        projparams["b"] = 1.0
 981        if obj.earthRadius is not None:
 982            projparams["a"] = float(obj.earthRadius)
 983            projparams["b"] = float(obj.earthRadius)
 984        else:
 985            if obj.earthMajorAxis is not None:
 986                projparams["a"] = float(obj.earthMajorAxis)
 987            if obj.earthMajorAxis is not None:
 988                projparams["b"] = float(obj.earthMinorAxis)
 989        if obj.gdtn == 0:
 990            projparams["proj"] = "longlat"
 991        elif obj.gdtn == 1:
 992            projparams["o_proj"] = "longlat"
 993            projparams["proj"] = "ob_tran"
 994            projparams["o_lat_p"] = float(-1.0 * obj.latitudeSouthernPole)
 995            projparams["o_lon_p"] = float(obj.anglePoleRotation)
 996            projparams["lon_0"] = float(obj.longitudeSouthernPole)
 997        elif obj.gdtn == 10:
 998            projparams["proj"] = "merc"
 999            projparams["lat_ts"] = float(obj.latitudeTrueScale)
1000            projparams["lon_0"] = 0.0
1001        elif obj.gdtn == 20:
1002            if obj.projectionCenterFlag == 0:
1003                lat0 = 90.0
1004            elif obj.projectionCenterFlag == 1:
1005                lat0 = -90.0
1006            projparams["proj"] = "stere"
1007            projparams["lat_ts"] = float(obj.latitudeTrueScale)
1008            projparams["lat_0"] = lat0
1009            projparams["lon_0"] = float(obj.gridOrientation)
1010        elif obj.gdtn == 30:
1011            projparams["proj"] = "lcc"
1012            projparams["lat_1"] = float(obj.standardLatitude1)
1013            projparams["lat_2"] = float(obj.standardLatitude2)
1014            projparams["lat_0"] = float(obj.latitudeTrueScale)
1015            projparams["lon_0"] = float(obj.gridOrientation)
1016        elif obj.gdtn == 31:
1017            projparams["proj"] = "aea"
1018            projparams["lat_1"] = float(obj.standardLatitude1)
1019            projparams["lat_2"] = float(obj.standardLatitude2)
1020            projparams["lat_0"] = float(obj.latitudeTrueScale)
1021            projparams["lon_0"] = float(obj.gridOrientation)
1022        elif obj.gdtn == 40:
1023            projparams["proj"] = "eqc"
1024        elif obj.gdtn == 32769:
1025            projparams["proj"] = "aeqd"
1026            projparams["lon_0"] = float(obj.longitudeCenterGridpoint)
1027            projparams["lat_0"] = float(obj.latitudeCenterGridpoint)
1028        return projparams
1029
1030    def __set__(self, obj, value):
1031        raise RuntimeError
1032
1033
1034@dataclass(init=False)
1035class GridDefinitionTemplate0:
1036    """[Grid Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-0.shtml)"""
1037
1038    _len = 19
1039    _num = 0
1040    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1041    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1042    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1043    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1044    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1045    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1046
1047    @classmethod
1048    def _attrs(cls):
1049        return list(cls.__dataclass_fields__.keys())
1050
1051
1052@dataclass(init=False)
1053class GridDefinitionTemplate1:
1054    """[Grid Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-1.shtml)"""
1055
1056    _len = 22
1057    _num = 1
1058    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1059    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1060    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1061    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1062    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1063    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1064    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1065    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1066    anglePoleRotation: float = field(init=False, repr=False, default=AnglePoleRotation())
1067
1068    @classmethod
1069    def _attrs(cls):
1070        return list(cls.__dataclass_fields__.keys())
1071
1072
1073@dataclass(init=False)
1074class GridDefinitionTemplate10:
1075    """[Grid Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-10.shtml)"""
1076
1077    _len = 19
1078    _num = 10
1079    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1080    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1081    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1082    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1083    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1084    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1085    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1086    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1087    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1088
1089    @classmethod
1090    def _attrs(cls):
1091        return list(cls.__dataclass_fields__.keys())
1092
1093
1094@dataclass(init=False)
1095class GridDefinitionTemplate20:
1096    """[Grid Definition Template 20](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-20.shtml)"""
1097
1098    _len = 18
1099    _num = 20
1100    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1101    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1102    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1103    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1104    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1105    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1106    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1107    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1108
1109    @classmethod
1110    def _attrs(cls):
1111        return list(cls.__dataclass_fields__.keys())
1112
1113
1114@dataclass(init=False)
1115class GridDefinitionTemplate30:
1116    """[Grid Definition Template 30](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-30.shtml)"""
1117
1118    _len = 22
1119    _num = 30
1120    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1121    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1122    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1123    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1124    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1125    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1126    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1127    standardLatitude1: float = field(init=False, repr=False, default=StandardLatitude1())
1128    standardLatitude2: float = field(init=False, repr=False, default=StandardLatitude2())
1129    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1130    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1131    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1132
1133    @classmethod
1134    def _attrs(cls):
1135        return list(cls.__dataclass_fields__.keys())
1136
1137
1138@dataclass(init=False)
1139class GridDefinitionTemplate31:
1140    """[Grid Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-31.shtml)"""
1141
1142    _len = 22
1143    _num = 31
1144    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1145    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1146    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1147    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1148    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1149    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1150    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1151    standardLatitude1: float = field(init=False, repr=False, default=StandardLatitude1())
1152    standardLatitude2: float = field(init=False, repr=False, default=StandardLatitude2())
1153    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1154    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1155
1156    @classmethod
1157    def _attrs(cls):
1158        return list(cls.__dataclass_fields__.keys())
1159
1160
1161@dataclass(init=False)
1162class GridDefinitionTemplate40:
1163    """[Grid Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-40.shtml)"""
1164
1165    _len = 19
1166    _num = 40
1167    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1168    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1169    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1170    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1171    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1172    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1173    numberOfParallels: int = field(init=False, repr=False, default=NumberOfParallels())
1174
1175    @classmethod
1176    def _attrs(cls):
1177        return list(cls.__dataclass_fields__.keys())
1178
1179
1180@dataclass(init=False)
1181class GridDefinitionTemplate41:
1182    """[Grid Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-41.shtml)"""
1183
1184    _len = 22
1185    _num = 41
1186    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1187    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1188    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1189    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1190    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1191    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1192    numberOfParallels: int = field(init=False, repr=False, default=NumberOfParallels())
1193    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1194    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1195    anglePoleRotation: float = field(init=False, repr=False, default=AnglePoleRotation())
1196
1197    @classmethod
1198    def _attrs(cls):
1199        return list(cls.__dataclass_fields__.keys())
1200
1201
1202@dataclass(init=False)
1203class GridDefinitionTemplate50:
1204    """[Grid Definition Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-50.shtml)"""
1205
1206    _len = 5
1207    _num = 50
1208    spectralFunctionParameters: list = field(init=False, repr=False, default=SpectralFunctionParameters())
1209
1210    @classmethod
1211    def _attrs(cls):
1212        return list(cls.__dataclass_fields__.keys())
1213
1214
1215@dataclass(init=False)
1216class GridDefinitionTemplate32768:
1217    """[Grid Definition Template 32768](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-32768.shtml)"""
1218
1219    _len = 19
1220    _num = 32768
1221    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1222    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1223    latitudeCenterGridpoint: float = field(init=False, repr=False, default=LatitudeCenterGridpoint())
1224    longitudeCenterGridpoint: float = field(init=False, repr=False, default=LongitudeCenterGridpoint())
1225    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1226    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1227
1228    @classmethod
1229    def _attrs(cls):
1230        return list(cls.__dataclass_fields__.keys())
1231
1232
1233@dataclass(init=False)
1234class GridDefinitionTemplate32769:
1235    """[Grid Definition Template 32769](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-32769.shtml)"""
1236
1237    _len = 19
1238    _num = 32769
1239    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1240    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1241    latitudeCenterGridpoint: float = field(init=False, repr=False, default=LatitudeCenterGridpoint())
1242    longitudeCenterGridpoint: float = field(init=False, repr=False, default=LongitudeCenterGridpoint())
1243    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1244    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1245    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1246    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1247
1248    @classmethod
1249    def _attrs(cls):
1250        return list(cls.__dataclass_fields__.keys())
1251
1252
1253_gdt_by_gdtn = {
1254    0: GridDefinitionTemplate0,
1255    1: GridDefinitionTemplate1,
1256    10: GridDefinitionTemplate10,
1257    20: GridDefinitionTemplate20,
1258    30: GridDefinitionTemplate30,
1259    31: GridDefinitionTemplate31,
1260    40: GridDefinitionTemplate40,
1261    41: GridDefinitionTemplate41,
1262    50: GridDefinitionTemplate50,
1263    32768: GridDefinitionTemplate32768,
1264    32769: GridDefinitionTemplate32769,
1265}
1266
1267
1268def gdt_class_by_gdtn(gdtn: int):
1269    """
1270    Provides a Grid Definition Template class via the template number
1271
1272    Parameters
1273    ----------
1274    gdtn
1275        Grid definition template number.
1276
1277    Returns
1278    -------
1279    gdt_class_by_gdtn
1280        Grid definition template class object (not an instance).
1281    """
1282    return _gdt_by_gdtn[gdtn]
1283
1284
1285# ----------------------------------------------------------------------------------------
1286# Descriptor Classes for Section 4 metadata.
1287# ----------------------------------------------------------------------------------------
1288class ProductDefinitionTemplateNumber:
1289    """[Product Definition Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml)"""
1290
1291    def __get__(self, obj, objtype=None):
1292        return Grib2Metadata(obj.section4[1], table="4.0")
1293
1294    def __set__(self, obj, value):
1295        raise RuntimeError
1296
1297
1298#  since PDT begins at position 2 of section4, code written with +2 for added readability with grib2 documentation
1299class ProductDefinitionTemplate:
1300    """Product Definition Template"""
1301
1302    def __get__(self, obj, objtype=None):
1303        return obj.section4[2:]
1304
1305    def __set__(self, obj, value):
1306        raise RuntimeError
1307
1308
1309class ParameterCategory:
1310    """[Parameter Category](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-1.shtml)"""
1311
1312    _key = defaultdict(lambda: 0)
1313
1314    def __get__(self, obj, objtype=None):
1315        return obj.section4[0 + 2]
1316
1317    def __set__(self, obj, value):
1318        obj.section4[self._key[obj.pdtn] + 2] = value
1319
1320
1321class ParameterNumber:
1322    """[Parameter Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-2.shtml)"""
1323
1324    _key = defaultdict(lambda: 1)
1325
1326    def __get__(self, obj, objtype=None):
1327        return obj.section4[1 + 2]
1328
1329    def __set__(self, obj, value):
1330        obj.section4[self._key[obj.pdtn] + 2] = value
1331
1332
1333class ParameterUnits:
1334    """Native units as described by the GRIB2 Discipline, Parameter Category, and Parameter Number"""
1335
1336    def __get__(self, obj, objtype=None):
1337        return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[1]
1338
1339    def __set__(self, obj, value):
1340        raise RuntimeError(
1341            "Cannot set the units of the message.  Instead set shortName OR set the appropriate discipline, parameterCategory, and parameterNumber.  The units will be set automatically from these other attributes."
1342        )
1343
1344
1345class VarInfo:
1346    """
1347    Variable Information.
1348
1349    These are the metadata returned for a specific variable according to
1350    discipline, parameter category, and parameter number.
1351    """
1352
1353    def __get__(self, obj, objtype=None):
1354        return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)
1355
1356    def __set__(self, obj, value):
1357        raise RuntimeError
1358
1359
1360class FullName:
1361    """Full name of the Variable."""
1362
1363    def __get__(self, obj, objtype=None):
1364        full_name = []
1365
1366        # Get aerosol type from table 4.233
1367        if not hasattr(obj, "typeOfAerosol"):
1368            return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[0]
1369        elif obj.typeOfAerosol is not None:
1370            aero_type = str(obj.typeOfAerosol.value)
1371            if aero_type in tables.table_4_233:
1372                full_name.append(tables.table_4_233[aero_type][0])
1373
1374            # Get base name from GRIB2 table
1375            base_name = tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[0]
1376            full_name.append(base_name)
1377
1378            # Add optical properties with wavelengths if present
1379            if hasattr(obj, "scaledValueOfFirstWavelength"):
1380                optical_type = str(obj.parameterNumber)
1381                first_wl = obj.scaledValueOfFirstWavelength
1382                second_wl = getattr(obj, "scaledValueOfSecondWavelength", None)
1383
1384                # Special case for AE between 440-870nm
1385                if optical_type == "111" and first_wl == 440 and second_wl == 870:
1386                    full_name.append("at 440-870nm")
1387
1388                # Handle wavelength-specific optical properties
1389                elif optical_type in ["102", "103", "104", "105", "106"]:
1390                    wavelength = f"{first_wl}nm"
1391                    if second_wl:
1392                        wavelength = f"{first_wl}-{second_wl}nm"
1393                    full_name.append(f"at {wavelength}")
1394
1395            final = " ".join(full_name)
1396
1397            return final.replace("Aerosol Aerosol", "Aerosol")
1398
1399    def __set__(self, obj, value):
1400        raise RuntimeError(
1401            "Cannot set the fullName of the message. Instead set shortName OR set the appropriate discipline, "
1402            "parameterCategory, and parameterNumber. The fullName will be set automatically from these other attributes."
1403        )
1404
1405
1406class Units:
1407    """Units of the Variable."""
1408
1409    def __get__(self, obj, objtype=None):
1410        units = obj.parameterUnits
1411        if obj.pdtn in {2}:
1412            if obj.typeOfDerivedForecast.value in {2, 3, 4}:
1413                units = f"delta_{obj.parameterUnits}"
1414        elif obj.pdtn in {5, 9}:
1415            units = "%"
1416        return units
1417
1418    def __set__(self, obj, value):
1419        raise RuntimeError(
1420            "Cannot set the units of the message.  Instead set shortName OR set the appropriate discipline, parameterCategory, and parameterNumber.  The units will be set automatically from these other attributes."
1421        )
1422
1423
1424class ShortName:
1425    """Short name of the variable (i.e. the variable abbreviation)."""
1426
1427    def __get__(self, obj, objtype=None):
1428        if obj._isAerosol:
1429            return tables._build_aerosol_shortname(obj)
1430        elif obj._isChemical:
1431            return tables._build_chemical_shortname(obj)
1432        else:
1433            return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[2]
1434
1435    def __set__(self, obj, value):
1436        metadata = tables.get_metadata_from_shortname(value)
1437        if len(metadata) > 1:
1438            raise ValueError(
1439                f"shortName={value} is ambiguous within the GRIB2 standard and you have to set instead with discipline, parameterCategory, and parameterNumber.\n{metadata}"
1440            )
1441        for attr, val in metadata[0].items():
1442            if attr in ["fullName", "units"]:
1443                continue
1444            setattr(obj, attr, val)
1445
1446
1447class TypeOfGeneratingProcess:
1448    """[Type of Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-3.shtml)"""
1449
1450    _key = defaultdict(lambda: 2, {48: 13})
1451
1452    def __get__(self, obj, objtype=None):
1453        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.3")
1454
1455    def __set__(self, obj, value):
1456        obj.section4[self._key[obj.pdtn] + 2] = value
1457
1458
1459class BackgroundGeneratingProcessIdentifier:
1460    """Background Generating Process Identifier"""
1461
1462    _key = defaultdict(lambda: 3, {48: 14})
1463
1464    def __get__(self, obj, objtype=None):
1465        return obj.section4[self._key[obj.pdtn] + 2]
1466
1467    def __set__(self, obj, value):
1468        obj.section4[self._key[obj.pdtn] + 2] = value
1469
1470
1471class GeneratingProcess:
1472    """[Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablea.html)"""
1473
1474    _key = defaultdict(lambda: 4, {48: 15})
1475
1476    def __get__(self, obj, objtype=None):
1477        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="generating_process")
1478
1479    def __set__(self, obj, value):
1480        obj.section4[self._key[obj.pdtn] + 2] = value
1481
1482
1483class HoursAfterDataCutoff:
1484    """Hours of observational data cutoff after reference time."""
1485
1486    _key = defaultdict(lambda: 5, {48: 16})
1487
1488    def __get__(self, obj, objtype=None):
1489        return obj.section4[self._key[obj.pdtn] + 2]
1490
1491    def __set__(self, obj, value):
1492        obj.section4[self._key[obj.pdtn] + 2] = value
1493
1494
1495class MinutesAfterDataCutoff:
1496    """Minutes of observational data cutoff after reference time."""
1497
1498    _key = defaultdict(lambda: 6, {48: 17})
1499
1500    def __get__(self, obj, objtype=None):
1501        return obj.section4[self._key[obj.pdtn] + 2]
1502
1503    def __set__(self, obj, value):
1504        obj.section4[self._key[obj.pdtn] + 2] = value
1505
1506
1507class UnitOfForecastTime:
1508    """[Units of Forecast Time](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
1509
1510    _key = defaultdict(lambda: 7, {48: 18})
1511
1512    def __get__(self, obj, objtype=None):
1513        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.4")
1514
1515    def __set__(self, obj, value):
1516        obj.section4[self._key[obj.pdtn] + 2] = value
1517
1518
1519class ValueOfForecastTime:
1520    """Value of forecast time in units defined by `UnitofForecastTime`."""
1521
1522    _key = defaultdict(lambda: 8, {48: 19})
1523
1524    def __get__(self, obj, objtype=None):
1525        return obj.section4[self._key[obj.pdtn] + 2]
1526
1527    def __set__(self, obj, value):
1528        obj.section4[self._key[obj.pdtn] + 2] = value
1529
1530
1531class LeadTime:
1532    """Forecast Lead Time. NOTE: This is a `datetime.timedelta` object."""
1533
1534    _key = ValueOfForecastTime._key
1535
1536    def __get__(self, obj, objtype=None):
1537        return utils.get_leadtime(obj.section4[1], obj.section4[2:]) + obj.duration
1538
1539    def __set__(self, obj, value):
1540        if isinstance(value, np.timedelta64):
1541            # Allows setting from xarray
1542            value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
1543        # First update validDate if necessary.
1544        # IMPORTANT: Update validDate components when message is time interval
1545        if obj.pdtn in _timeinterval_pdtns:
1546            vd = obj.refDate + value
1547            obj.yearOfEndOfTimePeriod = vd.year
1548            obj.monthOfEndOfTimePeriod = vd.month
1549            obj.dayOfEndOfTimePeriod = vd.day
1550            obj.hourOfEndOfTimePeriod = vd.hour
1551            obj.minuteOfEndOfTimePeriod = vd.minute
1552            obj.secondOfEndOfTimePeriod = vd.second
1553        # Update leadTime component in section4
1554        value -= obj.duration
1555        obj.section4[self._key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)
1556
1557
1558class FixedSfc1Info:
1559    """Information of the first fixed surface via [table 4.5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1560
1561    _key = defaultdict(lambda: 9, {48: 20})
1562
1563    def __get__(self, obj, objtype=None):
1564        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1565            return [None, None]
1566        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1567
1568    def __set__(self, obj, value):
1569        raise NotImplementedError
1570
1571
1572class FixedSfc2Info:
1573    """Information of the second fixed surface via [table 4.5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1574
1575    _key = defaultdict(lambda: 12, {48: 23})
1576
1577    def __get__(self, obj, objtype=None):
1578        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1579            return [None, None]
1580        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1581
1582    def __set__(self, obj, value):
1583        raise NotImplementedError
1584
1585
1586class TypeOfFirstFixedSurface:
1587    """[Type of First Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1588
1589    _key = defaultdict(
1590        lambda: 9,
1591        {
1592            40: 10,
1593            41: 10,
1594            42: 10,
1595            43: 10,
1596            44: 10,
1597            45: 10,
1598            46: 10,
1599            47: 10,
1600            48: 20,
1601            49: 20,
1602            57: 10,
1603            58: 10,
1604            67: 10,
1605            68: 10,
1606            76: 10,
1607            77: 10,
1608            78: 10,
1609            79: 10,
1610            80: 20,
1611            81: 20,
1612            82: 20,
1613            83: 20,
1614            84: 20,
1615            85: 20,
1616        },
1617    )
1618
1619    def __get__(self, obj, objtype=None):
1620        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1621
1622    def __set__(self, obj, value):
1623        obj.section4[self._key[obj.pdtn] + 2] = value
1624
1625
1626class ScaleFactorOfFirstFixedSurface:
1627    """Scale Factor of First Fixed Surface"""
1628
1629    _key = defaultdict(
1630        lambda: 10,
1631        {
1632            40: 11,
1633            41: 11,
1634            42: 11,
1635            43: 11,
1636            44: 11,
1637            45: 11,
1638            46: 11,
1639            47: 11,
1640            48: 21,
1641            49: 21,
1642            57: 11,
1643            58: 11,
1644            67: 11,
1645            68: 11,
1646            76: 11,
1647            77: 11,
1648            78: 11,
1649            79: 11,
1650            80: 21,
1651            81: 21,
1652            82: 21,
1653            83: 21,
1654            84: 21,
1655            85: 21,
1656        },
1657    )
1658
1659    def __get__(self, obj, objtype=None):
1660        return obj.section4[self._key[obj.pdtn] + 2]
1661
1662    def __set__(self, obj, value):
1663        obj.section4[self._key[obj.pdtn] + 2] = value
1664
1665
1666class ScaledValueOfFirstFixedSurface:
1667    """Scaled Value Of First Fixed Surface"""
1668
1669    _key = defaultdict(
1670        lambda: 11,
1671        {
1672            40: 12,
1673            41: 12,
1674            42: 12,
1675            43: 12,
1676            44: 12,
1677            45: 12,
1678            46: 12,
1679            47: 12,
1680            48: 22,
1681            49: 22,
1682            57: 12,
1683            58: 12,
1684            67: 12,
1685            68: 12,
1686            76: 12,
1687            77: 12,
1688            78: 12,
1689            79: 12,
1690            80: 22,
1691            81: 22,
1692            82: 22,
1693            83: 22,
1694            84: 22,
1695            85: 22,
1696        },
1697    )
1698
1699    def __get__(self, obj, objtype=None):
1700        return obj.section4[self._key[obj.pdtn] + 2]
1701
1702    def __set__(self, obj, value):
1703        obj.section4[self._key[obj.pdtn] + 2] = value
1704
1705
1706class UnitOfFirstFixedSurface:
1707    """Units of First Fixed Surface"""
1708
1709    def __get__(self, obj, objtype=None):
1710        return obj._fixedsfc1info[1]
1711
1712    def __set__(self, obj, value):
1713        pass
1714
1715
1716class ValueOfFirstFixedSurface:
1717    """Value of First Fixed Surface"""
1718
1719    def __get__(self, obj, objtype=None):
1720        scale_factor = getattr(obj, "scaleFactorOfFirstFixedSurface")
1721        scaled_value = getattr(obj, "scaledValueOfFirstFixedSurface")
1722        if scale_factor < 0:
1723            return 0.0
1724        else:
1725            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1726
1727    def __set__(self, obj, value):
1728        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1729        setattr(obj, "scaleFactorOfFirstFixedSurface", scale_factor)
1730        setattr(obj, "scaledValueOfFirstFixedSurface", scaled_value)
1731
1732
1733class TypeOfSecondFixedSurface:
1734    """[Type of Second Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1735
1736    _key = defaultdict(
1737        lambda: 12,
1738        {
1739            40: 13,
1740            41: 13,
1741            42: 13,
1742            43: 13,
1743            44: 13,
1744            45: 13,
1745            46: 13,
1746            47: 13,
1747            48: 23,
1748            49: 23,
1749            57: 13,
1750            58: 13,
1751            67: 13,
1752            68: 13,
1753            76: 13,
1754            77: 13,
1755            78: 13,
1756            79: 13,
1757            80: 23,
1758            81: 23,
1759            82: 23,
1760            83: 23,
1761            84: 23,
1762            85: 23,
1763        },
1764    )
1765
1766    def __get__(self, obj, objtype=None):
1767        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1768
1769    def __set__(self, obj, value):
1770        obj.section4[self._key[obj.pdtn] + 2] = value
1771
1772
1773class ScaleFactorOfSecondFixedSurface:
1774    """Scale Factor of Second Fixed Surface"""
1775
1776    _key = defaultdict(
1777        lambda: 13,
1778        {
1779            40: 14,
1780            41: 14,
1781            42: 14,
1782            43: 14,
1783            44: 14,
1784            45: 14,
1785            46: 14,
1786            47: 14,
1787            48: 24,
1788            49: 24,
1789            57: 14,
1790            58: 14,
1791            67: 14,
1792            68: 14,
1793            76: 14,
1794            77: 14,
1795            78: 14,
1796            79: 14,
1797            80: 24,
1798            81: 24,
1799            82: 24,
1800            83: 24,
1801            84: 24,
1802            85: 24,
1803        },
1804    )
1805
1806    def __get__(self, obj, objtype=None):
1807        return obj.section4[self._key[obj.pdtn] + 2]
1808
1809    def __set__(self, obj, value):
1810        obj.section4[self._key[obj.pdtn] + 2] = value
1811
1812
1813class ScaledValueOfSecondFixedSurface:
1814    """Scaled Value Of Second Fixed Surface"""
1815
1816    _key = defaultdict(
1817        lambda: 14,
1818        {
1819            40: 15,
1820            41: 15,
1821            42: 15,
1822            43: 15,
1823            44: 15,
1824            45: 15,
1825            46: 15,
1826            47: 15,
1827            48: 25,
1828            49: 25,
1829            57: 15,
1830            58: 15,
1831            67: 15,
1832            68: 15,
1833            76: 15,
1834            77: 15,
1835            78: 15,
1836            79: 15,
1837            80: 25,
1838            81: 25,
1839            82: 25,
1840            83: 25,
1841            84: 25,
1842            85: 25,
1843        },
1844    )
1845
1846    def __get__(self, obj, objtype=None):
1847        return obj.section4[self._key[obj.pdtn] + 2]
1848
1849    def __set__(self, obj, value):
1850        obj.section4[self._key[obj.pdtn] + 2] = value
1851
1852
1853class UnitOfSecondFixedSurface:
1854    """Units of Second Fixed Surface"""
1855
1856    def __get__(self, obj, objtype=None):
1857        return obj._fixedsfc2info[1]
1858
1859    def __set__(self, obj, value):
1860        pass
1861
1862
1863class ValueOfSecondFixedSurface:
1864    """Value of Second Fixed Surface"""
1865
1866    def __get__(self, obj, objtype=None):
1867        scale_factor = getattr(obj, "scaleFactorOfSecondFixedSurface")
1868        scaled_value = getattr(obj, "scaledValueOfSecondFixedSurface")
1869        if scale_factor < 0:
1870            return 0.0
1871        else:
1872            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1873
1874    def __set__(self, obj, value):
1875        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1876        setattr(obj, "scaleFactorOfSecondFixedSurface", scale_factor)
1877        setattr(obj, "scaledValueOfSecondFixedSurface", scaled_value)
1878
1879
1880class Level:
1881    """Level (same as provided by [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Level.c))"""
1882
1883    def __get__(self, obj, objtype=None):
1884        return tables.get_wgrib2_level_string(obj.pdtn, obj.section4[2:])
1885
1886    def __set__(self, obj, value):
1887        pass
1888
1889
1890class TypeOfEnsembleForecast:
1891    """[Type of Ensemble Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-6.shtml)"""
1892
1893    _key = {
1894        1: 15,
1895        11: 15,
1896        41: 16,
1897        43: 19,
1898        45: 16,
1899        47: 16,
1900        49: 26,
1901        81: 26,
1902        83: 26,
1903        84: 26,
1904        85: 26,
1905    }
1906
1907    def __get__(self, obj, objtype=None):
1908        pdtn = obj.section4[1]
1909        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.6")
1910
1911    def __set__(self, obj, value):
1912        pdtn = obj.section4[1]
1913        obj.section4[self._key[pdtn] + 2] = value
1914
1915
1916class PerturbationNumber:
1917    """Ensemble Perturbation Number"""
1918
1919    _key = {
1920        1: 16,
1921        11: 16,
1922        41: 17,
1923        43: 20,
1924        45: 17,
1925        47: 17,
1926        49: 27,
1927        81: 27,
1928        83: 27,
1929        84: 27,
1930        85: 27,
1931    }
1932
1933    def __get__(self, obj, objtype=None):
1934        pdtn = obj.section4[1]
1935        return obj.section4[self._key[pdtn] + 2]
1936
1937    def __set__(self, obj, value):
1938        pdtn = obj.section4[1]
1939        obj.section4[self._key[pdtn] + 2] = value
1940
1941
1942class NumberOfEnsembleForecasts:
1943    """Total Number of Ensemble Forecasts"""
1944
1945    _key = {
1946        1: 17,
1947        2: 16,
1948        11: 17,
1949        12: 16,
1950        41: 18,
1951        43: 21,
1952        45: 18,
1953        47: 18,
1954        49: 28,
1955        81: 28,
1956        83: 28,
1957        84: 28,
1958        85: 28,
1959    }
1960
1961    def __get__(self, obj, objtype=None):
1962        pdtn = obj.section4[1]
1963        return obj.section4[self._key[pdtn] + 2]
1964
1965    def __set__(self, obj, value):
1966        pdtn = obj.section4[1]
1967        obj.section4[self._key[pdtn] + 2] = value
1968
1969
1970class TypeOfDerivedForecast:
1971    """[Type of Derived Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-7.shtml)"""
1972
1973    _key = {2: 15, 12: 15}
1974
1975    def __get__(self, obj, objtype=None):
1976        pdtn = obj.section4[1]
1977        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.7")
1978
1979    def __set__(self, obj, value):
1980        pdtn = obj.section4[1]
1981        obj.section4[self._key[pdtn] + 2] = value
1982
1983
1984class ForecastProbabilityNumber:
1985    """Forecast Probability Number"""
1986
1987    _key = {5: 15, 9: 15}
1988
1989    def __get__(self, obj, objtype=None):
1990        pdtn = obj.section4[1]
1991        return obj.section4[self._key[pdtn] + 2]
1992
1993    def __set__(self, obj, value):
1994        pdtn = obj.section4[1]
1995        obj.section4[self._key[pdtn] + 2] = value
1996
1997
1998class TotalNumberOfForecastProbabilities:
1999    """Total Number of Forecast Probabilities"""
2000
2001    _key = {5: 16, 9: 16}
2002
2003    def __get__(self, obj, objtype=None):
2004        pdtn = obj.section4[1]
2005        return obj.section4[self._key[pdtn] + 2]
2006
2007    def __set__(self, obj, value):
2008        pdtn = obj.section4[1]
2009        obj.section4[self._key[pdtn] + 2] = value
2010
2011
2012class TypeOfProbability:
2013    """[Type of Probability](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-9.shtml)"""
2014
2015    _key = {5: 17, 9: 17}
2016
2017    def __get__(self, obj, objtype=None):
2018        pdtn = obj.section4[1]
2019        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.9")
2020
2021    def __set__(self, obj, value):
2022        pdtn = obj.section4[1]
2023        obj.section4[self._key[pdtn] + 2] = value
2024
2025
2026class ScaleFactorOfThresholdLowerLimit:
2027    """Scale Factor of Threshold Lower Limit"""
2028
2029    _key = {5: 18, 9: 18}
2030
2031    def __get__(self, obj, objtype=None):
2032        pdtn = obj.section4[1]
2033        return obj.section4[self._key[pdtn] + 2]
2034
2035    def __set__(self, obj, value):
2036        pdtn = obj.section4[1]
2037        obj.section4[self._key[pdtn] + 2] = value
2038
2039
2040class ScaledValueOfThresholdLowerLimit:
2041    """Scaled Value of Threshold Lower Limit"""
2042
2043    _key = {5: 19, 9: 19}
2044
2045    def __get__(self, obj, objtype=None):
2046        pdtn = obj.section4[1]
2047        return obj.section4[self._key[pdtn] + 2]
2048
2049    def __set__(self, obj, value):
2050        pdtn = obj.section4[1]
2051        obj.section4[self._key[pdtn] + 2] = value
2052
2053
2054class ScaleFactorOfThresholdUpperLimit:
2055    """Scale Factor of Threshold Upper Limit"""
2056
2057    _key = {5: 20, 9: 20}
2058
2059    def __get__(self, obj, objtype=None):
2060        pdtn = obj.section4[1]
2061        return obj.section4[self._key[pdtn] + 2]
2062
2063    def __set__(self, obj, value):
2064        pdtn = obj.section4[1]
2065        obj.section4[self._key[pdtn] + 2] = value
2066
2067
2068class ScaledValueOfThresholdUpperLimit:
2069    """Scaled Value of Threshold Upper Limit"""
2070
2071    _key = {5: 21, 9: 21}
2072
2073    def __get__(self, obj, objtype=None):
2074        pdtn = obj.section4[1]
2075        return obj.section4[self._key[pdtn] + 2]
2076
2077    def __set__(self, obj, value):
2078        pdtn = obj.section4[1]
2079        obj.section4[self._key[pdtn] + 2] = value
2080
2081
2082class ThresholdLowerLimit:
2083    """Threshold Lower Limit"""
2084
2085    def __get__(self, obj, objtype=None):
2086        scale_factor = getattr(obj, "scaleFactorOfThresholdLowerLimit")
2087        scaled_value = getattr(obj, "scaledValueOfThresholdLowerLimit")
2088        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2089            return 0.0
2090        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2091        return value
2092
2093    def __set__(self, obj, value):
2094        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2095        setattr(obj, "scaleFactorOfThresholdLowerLimit", scale_factor)
2096        setattr(obj, "scaledValueOfThresholdLowerLimit", scaled_value)
2097
2098
2099class ThresholdUpperLimit:
2100    """Threshold Upper Limit"""
2101
2102    def __get__(self, obj, objtype=None):
2103        scale_factor = getattr(obj, "scaleFactorOfThresholdUpperLimit")
2104        scaled_value = getattr(obj, "scaledValueOfThresholdUpperLimit")
2105        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2106            return 0.0
2107        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2108        return value
2109
2110    def __set__(self, obj, value):
2111        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2112        setattr(obj, "scaleFactorOfThresholdUpperLimit", scale_factor)
2113        setattr(obj, "scaledValueOfThresholdUpperLimit", scaled_value)
2114
2115
2116class Threshold:
2117    """Threshold string (same as [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Prob.c))"""
2118
2119    def __get__(self, obj, objtype=None):
2120        return utils.get_wgrib2_prob_string(*obj.section4[17 + 2 : 22 + 2])
2121
2122    def __set__(self, obj, value):
2123        pass
2124
2125
2126class PercentileValue:
2127    """Percentile Value"""
2128
2129    _key = {6: 15, 10: 15}
2130
2131    def __get__(self, obj, objtype=None):
2132        pdtn = obj.section4[1]
2133        return obj.section4[self._key[pdtn] + 2]
2134
2135    def __set__(self, obj, value):
2136        pdtn = obj.section4[1]
2137        obj.section4[self._key[pdtn] + 2] = value
2138
2139
2140class YearOfEndOfTimePeriod:
2141    """Year of End of Forecast Time Period"""
2142
2143    _key = {8: 15, 9: 22, 10: 16, 11: 18, 12: 17, 42: 16, 43: 22, 46: 16, 82: 26}
2144
2145    def __get__(self, obj, objtype=None):
2146        pdtn = obj.section4[1]
2147        return obj.section4[self._key[pdtn] + 2]
2148
2149    def __set__(self, obj, value):
2150        pdtn = obj.section4[1]
2151        obj.section4[self._key[pdtn] + 2] = value
2152
2153
2154class MonthOfEndOfTimePeriod:
2155    """Month Year of End of Forecast Time Period"""
2156
2157    _key = {8: 16, 9: 23, 10: 17, 11: 19, 12: 18, 42: 17, 43: 23, 46: 17, 82: 27}
2158
2159    def __get__(self, obj, objtype=None):
2160        pdtn = obj.section4[1]
2161        return obj.section4[self._key[pdtn] + 2]
2162
2163    def __set__(self, obj, value):
2164        pdtn = obj.section4[1]
2165        obj.section4[self._key[pdtn] + 2] = value
2166
2167
2168class DayOfEndOfTimePeriod:
2169    """Day Year of End of Forecast Time Period"""
2170
2171    _key = {8: 17, 9: 24, 10: 18, 11: 20, 12: 19, 42: 18, 43: 24, 46: 18, 82: 28}
2172
2173    def __get__(self, obj, objtype=None):
2174        pdtn = obj.section4[1]
2175        return obj.section4[self._key[pdtn] + 2]
2176
2177    def __set__(self, obj, value):
2178        pdtn = obj.section4[1]
2179        obj.section4[self._key[pdtn] + 2] = value
2180
2181
2182class HourOfEndOfTimePeriod:
2183    """Hour Year of End of Forecast Time Period"""
2184
2185    _key = {8: 18, 9: 25, 10: 19, 11: 21, 12: 20, 42: 19, 43: 25, 46: 19, 82: 29}
2186
2187    def __get__(self, obj, objtype=None):
2188        pdtn = obj.section4[1]
2189        return obj.section4[self._key[pdtn] + 2]
2190
2191    def __set__(self, obj, value):
2192        pdtn = obj.section4[1]
2193        obj.section4[self._key[pdtn] + 2] = value
2194
2195
2196class MinuteOfEndOfTimePeriod:
2197    """Minute Year of End of Forecast Time Period"""
2198
2199    _key = {8: 19, 9: 26, 10: 20, 11: 22, 12: 21, 42: 20, 43: 26, 46: 20, 82: 30}
2200
2201    def __get__(self, obj, objtype=None):
2202        pdtn = obj.section4[1]
2203        return obj.section4[self._key[pdtn] + 2]
2204
2205    def __set__(self, obj, value):
2206        pdtn = obj.section4[1]
2207        obj.section4[self._key[pdtn] + 2] = value
2208
2209
2210class SecondOfEndOfTimePeriod:
2211    """Second Year of End of Forecast Time Period"""
2212
2213    _key = {8: 20, 9: 27, 10: 21, 11: 23, 12: 22, 42: 21, 43: 27, 46: 21, 82: 31}
2214
2215    def __get__(self, obj, objtype=None):
2216        pdtn = obj.section4[1]
2217        return obj.section4[self._key[pdtn] + 2]
2218
2219    def __set__(self, obj, value):
2220        pdtn = obj.section4[1]
2221        obj.section4[self._key[pdtn] + 2] = value
2222
2223
2224class Duration:
2225    """Duration of time period. NOTE: This is a `datetime.timedelta` object."""
2226
2227    def __get__(self, obj, objtype=None):
2228        return utils.get_duration(obj.section4[1], obj.section4[2:])
2229
2230    def __set__(self, obj, value):
2231        if obj.pdtn in _continuous_pdtns:
2232            pass
2233        elif obj.pdtn in _timeinterval_pdtns:
2234            lt_orig = obj.leadTime
2235            _key = TimeRangeOfStatisticalProcess._key
2236            if isinstance(value, np.timedelta64):
2237                # Allows setting from xarray
2238                value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
2239            obj.section4[_key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)
2240            obj.leadTime = lt_orig
2241            # IMPORTANT: Update validDate components when message is time interval
2242            # if obj.pdtn in _timeinterval_pdtns:
2243            #    print(obj.refDate, value, obj.leadTime)
2244            #    vd = obj.refDate + value + obj.leadTime
2245            #    obj.yearOfEndOfTimePeriod = vd.year
2246            #    obj.monthOfEndOfTimePeriod = vd.month
2247            #    obj.dayOfEndOfTimePeriod = vd.day
2248            #    obj.hourOfEndOfTimePeriod = vd.hour
2249            #    obj.minuteOfEndOfTimePeriod = vd.minute
2250            #    obj.secondOfEndOfTimePeriod = vd.second
2251
2252
2253class ValidDate:
2254    """Valid Date of the forecast. NOTE: This is a `datetime.datetime` object."""
2255
2256    _key = {
2257        8: slice(15, 21),
2258        9: slice(22, 28),
2259        10: slice(16, 22),
2260        11: slice(18, 24),
2261        12: slice(17, 23),
2262    }
2263
2264    def __get__(self, obj, objtype=None):
2265        pdtn = obj.section4[1]
2266        try:
2267            s = slice(self._key[pdtn].start + 2, self._key[pdtn].stop + 2)
2268            return datetime.datetime(*obj.section4[s])
2269        except KeyError:
2270            return obj.refDate + obj.leadTime
2271
2272    def __set__(self, obj, value):
2273        warnings.warn("validDate attribute is read-only.")
2274
2275
2276class NumberOfTimeRanges:
2277    """Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field"""
2278
2279    _key = {8: 21, 9: 28, 10: 22, 11: 24, 12: 23, 42: 22, 43: 28, 46: 27}
2280
2281    def __get__(self, obj, objtype=None):
2282        pdtn = obj.section4[1]
2283        return obj.section4[self._key[pdtn] + 2]
2284
2285    def __set__(self, obj, value):
2286        pdtn = obj.section4[1]
2287        obj.section4[self._key[pdtn] + 2] = value
2288
2289
2290class NumberOfMissingValues:
2291    """Total number of data values missing in statistical process"""
2292
2293    _key = {8: 22, 9: 29, 10: 23, 11: 25, 12: 24, 42: 23, 43: 29, 46: 28}
2294
2295    def __get__(self, obj, objtype=None):
2296        pdtn = obj.section4[1]
2297        return obj.section4[self._key[pdtn] + 2]
2298
2299    def __set__(self, obj, value):
2300        pdtn = obj.section4[1]
2301        obj.section4[self._key[pdtn] + 2] = value
2302
2303
2304class StatisticalProcess:
2305    """[Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-10.shtml)"""
2306
2307    _key = {
2308        8: 23,
2309        9: 30,
2310        10: 24,
2311        11: 26,
2312        12: 25,
2313        15: 15,
2314        42: 24,
2315        43: 30,
2316        46: 30,
2317        47: 30,
2318        49: 30,
2319        80: 30,
2320        81: 30,
2321        82: 30,
2322        83: 30,
2323        84: 30,
2324        85: 30,
2325    }
2326
2327    def __get__(self, obj, objtype=None):
2328        pdtn = obj.section4[1]
2329        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.10")
2330
2331    def __set__(self, obj, value):
2332        pdtn = obj.section4[1]
2333        obj.section4[self._key[pdtn] + 2] = value
2334
2335
2336class TypeOfTimeIncrementOfStatisticalProcess:
2337    """[Type of Time Increment of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2338
2339    _key = {
2340        4: 31,
2341        8: 24,
2342        9: 31,
2343        10: 25,
2344        11: 27,
2345        12: 26,
2346        42: 25,
2347        43: 31,
2348        46: 31,
2349        47: 31,
2350        49: 31,
2351        80: 31,
2352        81: 31,
2353        82: 31,
2354        83: 31,
2355        84: 31,
2356        85: 31,
2357    }
2358
2359    def __get__(self, obj, objtype=None):
2360        pdtn = obj.section4[1]
2361        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.11")
2362
2363    def __set__(self, obj, value):
2364        pdtn = obj.section4[1]
2365        obj.section4[self._key[pdtn] + 2] = value
2366
2367
2368class UnitOfTimeRangeOfStatisticalProcess:
2369    """[Unit of Time Range of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2370
2371    _key = {
2372        4: 32,
2373        8: 25,
2374        9: 32,
2375        10: 26,
2376        11: 28,
2377        12: 27,
2378        42: 26,
2379        43: 32,
2380        46: 32,
2381        47: 32,
2382        49: 32,
2383        80: 32,
2384        81: 32,
2385        82: 32,
2386        83: 32,
2387        84: 32,
2388        85: 32,
2389    }
2390
2391    def __get__(self, obj, objtype=None):
2392        pdtn = obj.section4[1]
2393        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2394
2395    def __set__(self, obj, value):
2396        pdtn = obj.section4[1]
2397        obj.section4[self._key[pdtn] + 2] = value
2398
2399
2400class TimeRangeOfStatisticalProcess:
2401    """Time Range of Statistical Process"""
2402
2403    _key = {
2404        4: 33,
2405        8: 26,
2406        9: 33,
2407        10: 27,
2408        11: 29,
2409        12: 28,
2410        42: 27,
2411        43: 33,
2412        46: 33,
2413        47: 33,
2414        49: 33,
2415        80: 33,
2416        81: 33,
2417        82: 33,
2418        83: 33,
2419        84: 33,
2420        85: 33,
2421    }
2422
2423    def __get__(self, obj, objtype=None):
2424        pdtn = obj.section4[1]
2425        return obj.section4[self._key[pdtn] + 2]
2426
2427    def __set__(self, obj, value):
2428        pdtn = obj.section4[1]
2429        obj.section4[self._key[pdtn] + 2] = value
2430
2431
2432class UnitOfTimeRangeOfSuccessiveFields:
2433    """[Unit of Time Range of Successive Fields](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
2434
2435    _key = {
2436        4: 34,
2437        8: 27,
2438        9: 34,
2439        10: 28,
2440        11: 30,
2441        12: 29,
2442        42: 28,
2443        43: 34,
2444        46: 34,
2445        47: 34,
2446        49: 34,
2447        80: 34,
2448        81: 34,
2449        82: 34,
2450        83: 34,
2451        84: 34,
2452        85: 34,
2453    }
2454
2455    def __get__(self, obj, objtype=None):
2456        pdtn = obj.section4[1]
2457        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2458
2459    def __set__(self, obj, value):
2460        pdtn = obj.section4[1]
2461        obj.section4[self._key[pdtn] + 2] = value
2462
2463
2464class TimeIncrementOfSuccessiveFields:
2465    """Time Increment of Successive Fields"""
2466
2467    _key = {
2468        4: 35,
2469        8: 28,
2470        9: 35,
2471        10: 29,
2472        11: 31,
2473        12: 30,
2474        42: 29,
2475        43: 35,
2476        46: 67,
2477        47: 67,
2478        49: 67,
2479        80: 35,
2480        81: 35,
2481        82: 35,
2482        83: 35,
2483        84: 35,
2484        85: 35,
2485    }
2486
2487    def __get__(self, obj, objtype=None):
2488        pdtn = obj.section4[1]
2489        return obj.section4[self._key[pdtn] + 2]
2490
2491    def __set__(self, obj, value):
2492        pdtn = obj.section4[1]
2493        obj.section4[self._key[pdtn] + 2] = value
2494
2495
2496class TypeOfStatisticalProcessing:
2497    """[Type of Statistical Processing](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-15.shtml)"""
2498
2499    _key = {15: 16}
2500
2501    def __get__(self, obj, objtype=None):
2502        pdtn = obj.section4[1]
2503        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.15")
2504
2505    def __set__(self, obj, value):
2506        pdtn = obj.section4[1]
2507        obj.section4[self._key[pdtn] + 2] = value
2508
2509
2510class NumberOfDataPointsForSpatialProcessing:
2511    """Number of Data Points for Spatial Processing"""
2512
2513    _key = {15: 17}
2514
2515    def __get__(self, obj, objtype=None):
2516        pdtn = obj.section4[1]
2517        return obj.section4[self._key[pdtn] + 2]
2518
2519    def __set__(self, obj, value):
2520        pdtn = obj.section4[1]
2521        obj.section4[self._key[pdtn] + 2] = value
2522
2523
2524class NumberOfContributingSpectralBands:
2525    """Number of Contributing Spectral Bands (NB)"""
2526
2527    _key = {32: 9}
2528
2529    def __get__(self, obj, objtype=None):
2530        pdtn = obj.section4[1]
2531        return obj.section4[self._key[pdtn] + 2]
2532
2533    def __set__(self, obj, value):
2534        pdtn = obj.section4[1]
2535        obj.section4[self._key[pdtn] + 2] = value
2536
2537
2538class SatelliteSeries:
2539    """Satellte Series of band nb, where nb=1,NB if NB > 0"""
2540
2541    _key = {32: 10}
2542
2543    def __get__(self, obj, objtype=None):
2544        pdtn = obj.section4[1]
2545        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2546
2547    def __set__(self, obj, value):
2548        pass
2549
2550
2551class SatelliteNumber:
2552    """Satellte Number of band nb, where nb=1,NB if NB > 0"""
2553
2554    _key = {32: 11}
2555
2556    def __get__(self, obj, objtype=None):
2557        pdtn = obj.section4[1]
2558        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2559
2560    def __set__(self, obj, value):
2561        pass
2562
2563
2564class InstrumentType:
2565    """Instrument Type of band nb, where nb=1,NB if NB > 0"""
2566
2567    _key = {32: 12}
2568
2569    def __get__(self, obj, objtype=None):
2570        pdtn = obj.section4[1]
2571        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2572
2573    def __set__(self, obj, value):
2574        pass
2575
2576
2577class ScaleFactorOfCentralWaveNumber:
2578    """Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0"""
2579
2580    _key = {32: 13}
2581
2582    def __get__(self, obj, objtype=None):
2583        pdtn = obj.section4[1]
2584        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2585
2586    def __set__(self, obj, value):
2587        pass
2588
2589
2590class ScaledValueOfCentralWaveNumber:
2591    """Scaled Value Of Central WaveNumber of band NB"""
2592
2593    _key = {32: 14}
2594
2595    def __get__(self, obj, objtype=None):
2596        pdtn = obj.section4[1]
2597        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2598
2599    def __set__(self, obj, value):
2600        pass
2601
2602
2603class CetralWaveNumber:
2604    """Central WaveNumber of band NB"""
2605
2606    def __get__(self, obj, objtype=None):
2607        scale_factor = getattr(obj, "scaleFactorOfCentralWaveNumber")
2608        scaled_value = getattr(obj, "scaledValueOfCentralWaveNumber")
2609        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2610
2611    def __set__(self, obj, value):
2612        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2613        setattr(obj, "scaleFactorOfCentralWaveNumber", scale_factor)
2614        setattr(obj, "scaledValueOfCentralWaveNumber", scaled_value)
2615
2616
2617class TypeOfAerosol:
2618    """[Type of Aerosol](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-233.shtml)"""
2619
2620    _key = {
2621        44: 5,
2622        45: 5,
2623        46: 2,
2624        47: 2,
2625        48: 2,
2626        49: 2,
2627        50: 5,
2628        80: 2,
2629        81: 2,
2630        82: 2,
2631        83: 2,
2632        84: 2,
2633        85: 2,
2634    }
2635
2636    def __get__(self, obj, objtype=None):
2637        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.233")
2638
2639    def __set__(self, obj, value):
2640        obj.section4[self._key[obj.pdtn] + 2] = value
2641
2642
2643class TypeOfIntervalForAerosolSize:
2644    """[Type of Interval for Aerosol Size](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2645
2646    _key = {
2647        44: 6,
2648        45: 6,
2649        46: 3,
2650        47: 3,
2651        48: 3,
2652        49: 3,
2653        50: 6,
2654        80: 3,
2655        81: 3,
2656        82: 3,
2657        83: 3,
2658        84: 3,
2659        85: 3,
2660    }
2661
2662    def __get__(self, obj, objtype=None):
2663        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2664
2665    def __set__(self, obj, value):
2666        obj.section4[self._key[obj.pdtn] + 2] = value
2667
2668
2669class ScaleFactorOfFirstSize:
2670    """Scale Factor of First Size"""
2671
2672    _key = {
2673        44: 7,
2674        45: 7,
2675        46: 4,
2676        47: 4,
2677        48: 4,
2678        49: 4,
2679        50: 7,
2680        80: 4,
2681        81: 4,
2682        82: 4,
2683        83: 4,
2684        84: 4,
2685        85: 4,
2686    }
2687
2688    def __get__(self, obj, objtype=None):
2689        return obj.section4[self._key[obj.pdtn] + 2]
2690
2691    def __set__(self, obj, value):
2692        obj.section4[self._key[obj.pdtn] + 2] = value
2693
2694
2695class ScaledValueOfFirstSize:
2696    """Scaled Value of First Size"""
2697
2698    _key = {
2699        44: 8,
2700        45: 8,
2701        46: 5,
2702        47: 5,
2703        48: 5,
2704        49: 5,
2705        50: 8,
2706        80: 5,
2707        81: 5,
2708        82: 5,
2709        83: 5,
2710        84: 5,
2711        85: 5,
2712    }
2713
2714    def __get__(self, obj, objtype=None):
2715        return obj.section4[self._key[obj.pdtn] + 2]
2716
2717    def __set__(self, obj, value):
2718        obj.section4[self._key[obj.pdtn] + 2] = value
2719
2720
2721class FirstSizeOfAerosol:
2722    """First size of Aerosol"""
2723
2724    def __get__(self, obj, objtype=None):
2725        scale_factor = getattr(obj, "scaleFactorOfFirstSize")
2726        scaled_value = getattr(obj, "scaledValueOfFirstSize")
2727        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2728
2729    def __set__(self, obj, value):
2730        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2731        setattr(obj, "scaleFactorOfFirstSize", scale_factor)
2732        setattr(obj, "scaledValueOfFirstSize", scaled_value)
2733
2734
2735class ScaleFactorOfSecondSize:
2736    """Scale Factor of Second Size"""
2737
2738    _key = {
2739        44: 9,
2740        45: 9,
2741        46: 6,
2742        47: 6,
2743        48: 6,
2744        49: 6,
2745        50: 9,
2746        80: 6,
2747        81: 6,
2748        82: 6,
2749        83: 6,
2750        84: 6,
2751        85: 6,
2752    }
2753
2754    def __get__(self, obj, objtype=None):
2755        return obj.section4[self._key[obj.pdtn] + 2]
2756
2757    def __set__(self, obj, value):
2758        obj.section4[self._key[obj.pdtn] + 2] = value
2759
2760
2761class ScaledValueOfSecondSize:
2762    """Scaled Value of Second Size"""
2763
2764    _key = {
2765        44: 10,
2766        45: 10,
2767        46: 7,
2768        47: 7,
2769        48: 7,
2770        49: 7,
2771        50: 10,
2772        80: 7,
2773        81: 7,
2774        82: 7,
2775        83: 7,
2776        84: 7,
2777        85: 7,
2778    }
2779
2780    def __get__(self, obj, objtype=None):
2781        return obj.section4[self._key[obj.pdtn] + 2]
2782
2783    def __set__(self, obj, value):
2784        obj.section4[self._key[obj.pdtn] + 2] = value
2785
2786
2787class SecondSizeOfAerosol:
2788    """Second size of Aerosol"""
2789
2790    def __get__(self, obj, objtype=None):
2791        scale_factor = getattr(obj, "scaleFactorOfSecondSize")
2792        scaled_value = getattr(obj, "scaledValueOfSecondSize")
2793        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2794
2795    def __set__(self, obj, value):
2796        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2797        setattr(obj, "scaleFactorOfSecondSize", scale_factor)
2798        setattr(obj, "scaledValueOfSecondSize", scaled_value)
2799
2800
2801class TypeOfIntervalForAerosolWavelength:
2802    """[Type of Interval for Aerosol Wavelength](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2803
2804    _key = {48: 8}
2805
2806    def __get__(self, obj, objtype=None):
2807        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2808
2809    def __set__(self, obj, value):
2810        obj.section4[self._key[obj.pdtn] + 2] = value
2811
2812
2813class ScaleFactorOfFirstWavelength:
2814    """Scale Factor of First Wavelength"""
2815
2816    _key = {48: 9}
2817
2818    def __get__(self, obj, objtype=None):
2819        return obj.section4[self._key[obj.pdtn] + 2]
2820
2821    def __set__(self, obj, value):
2822        obj.section4[self._key[obj.pdtn] + 2] = value
2823
2824
2825class ScaledValueOfFirstWavelength:
2826    """Scaled Value of First Wavelength"""
2827
2828    _key = {48: 10}
2829
2830    def __get__(self, obj, objtype=None):
2831        return obj.section4[self._key[obj.pdtn] + 2]
2832
2833    def __set__(self, obj, value):
2834        obj.section4[self._key[obj.pdtn] + 2] = value
2835
2836
2837class FirstWavelength:
2838    """First Wavelength"""
2839
2840    def __get__(self, obj, objtype=None):
2841        scale_factor = getattr(obj, "scaleFactorOfFirstWavelength")
2842        scaled_value = getattr(obj, "scaledValueOfFirstWavelength")
2843        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2844
2845    def __set__(self, obj, value):
2846        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2847        setattr(obj, "scaleFactorOfFirstWavelength", scale_factor)
2848        setattr(obj, "scaledValueOfFirstWavelength", scaled_value)
2849
2850
2851class ScaleFactorOfSecondWavelength:
2852    """Scale Factor of Second Wavelength"""
2853
2854    _key = {48: 11}
2855
2856    def __get__(self, obj, objtype=None):
2857        return obj.section4[self._key[obj.pdtn] + 2]
2858
2859    def __set__(self, obj, value):
2860        obj.section4[self._key[obj.pdtn] + 2] = value
2861
2862
2863class ScaledValueOfSecondWavelength:
2864    """Scaled Value of Second Wavelength"""
2865
2866    _key = {48: 12}
2867
2868    def __get__(self, obj, objtype=None):
2869        return obj.section4[self._key[obj.pdtn] + 2]
2870
2871    def __set__(self, obj, value):
2872        obj.section4[self._key[obj.pdtn] + 2] = value
2873
2874
2875class SecondWavelength:
2876    """Second Wavelength"""
2877
2878    def __get__(self, obj, objtype=None):
2879        scale_factor = getattr(obj, "scaleFactorOfSecondWavelength")
2880        scaled_value = getattr(obj, "scaledValueOfSecondWavelength")
2881        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2882
2883    def __set__(self, obj, value):
2884        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2885        setattr(obj, "scaleFactorOfSecondWavelength", scale_factor)
2886        setattr(obj, "scaledValueOfSecondWavelength", scaled_value)
2887
2888
2889class SourceSinkIndicator:
2890    """[Source/Sink Indicator](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-238.shtml)"""
2891
2892    _key = {76: 10, 77: 10, 78: 10, 79: 10, 80: 3, 81: 3, 82: 3, 83: 3, 84: 3, 85: 3}
2893
2894    def __get__(self, obj, objtype=None):
2895        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.238")
2896
2897    def __set__(self, obj, value):
2898        obj.section4[self._key[obj.pdtn] + 2] = value
2899
2900
2901class ConstituentType:
2902    """[Constituent Type](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-230.shtml)"""
2903
2904    _key = defaultdict(lambda: 9)
2905
2906    def __get__(self, obj, objtype=None):
2907        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.230")
2908
2909    def __set__(self, obj, value):
2910        obj.section4[self._key[obj.pdtn] + 2] = value
2911
2912
2913"""
2914GRIB2 Section 4, Product Definition Template Classes
2915"""
2916
2917
2918@dataclass(init=False)
2919class ProductDefinitionTemplateBase:
2920    """Base attributes for Product Definition Templates"""
2921
2922    _varinfo: list = field(init=False, repr=False, default=VarInfo())
2923    fullName: str = field(init=False, repr=False, default=FullName())
2924    units: str = field(init=False, repr=False, default=Units())
2925    shortName: str = field(init=False, repr=False, default=ShortName())
2926    leadTime: datetime.timedelta = field(init=False, repr=False, default=LeadTime())
2927    duration: datetime.timedelta = field(init=False, repr=False, default=Duration())
2928    validDate: datetime.datetime = field(init=False, repr=False, default=ValidDate())
2929    level: str = field(init=False, repr=False, default=Level())
2930    # Begin template here...
2931    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
2932    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
2933    parameterUnits: int = field(init=False, repr=False, default=ParameterUnits())
2934    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
2935    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
2936    backgroundGeneratingProcessIdentifier: int = field(init=False, repr=False, default=BackgroundGeneratingProcessIdentifier())
2937    hoursAfterDataCutoff: int = field(init=False, repr=False, default=HoursAfterDataCutoff())
2938    minutesAfterDataCutoff: int = field(init=False, repr=False, default=MinutesAfterDataCutoff())
2939    unitOfForecastTime: Grib2Metadata = field(init=False, repr=False, default=UnitOfForecastTime())
2940    valueOfForecastTime: int = field(init=False, repr=False, default=ValueOfForecastTime())
2941
2942    @classmethod
2943    def _attrs(cls):
2944        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2945
2946
2947@dataclass(init=False)
2948class ProductDefinitionTemplateSurface:
2949    """Surface attributes for Product Definition Templates"""
2950
2951    _fixedsfc1info: list = field(init=False, repr=False, default=FixedSfc1Info())
2952    _fixedsfc2info: list = field(init=False, repr=False, default=FixedSfc2Info())
2953    typeOfFirstFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfFirstFixedSurface())
2954    scaleFactorOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfFirstFixedSurface())
2955    scaledValueOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfFirstFixedSurface())
2956    typeOfSecondFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfSecondFixedSurface())
2957    scaleFactorOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfSecondFixedSurface())
2958    scaledValueOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfSecondFixedSurface())
2959    unitOfFirstFixedSurface: str = field(init=False, repr=False, default=UnitOfFirstFixedSurface())
2960    valueOfFirstFixedSurface: int = field(init=False, repr=False, default=ValueOfFirstFixedSurface())
2961    unitOfSecondFixedSurface: str = field(init=False, repr=False, default=UnitOfSecondFixedSurface())
2962    valueOfSecondFixedSurface: int = field(init=False, repr=False, default=ValueOfSecondFixedSurface())
2963
2964    @classmethod
2965    def _attrs(cls):
2966        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2967
2968
2969@dataclass(init=False)
2970class ProductDefinitionTemplate0(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2971    """[Product Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml)"""
2972
2973    _len = 15
2974    _num = 0
2975
2976    @classmethod
2977    def _attrs(cls):
2978        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2979
2980
2981@dataclass(init=False)
2982class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2983    """[Product Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-1.shtml)"""
2984
2985    _len = 18
2986    _num = 1
2987    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
2988    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
2989    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2990
2991    @classmethod
2992    def _attrs(cls):
2993        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2994
2995
2996@dataclass(init=False)
2997class ProductDefinitionTemplate2(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2998    """[Product Definition Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-2.shtml)"""
2999
3000    _len = 17
3001    _num = 2
3002    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3003    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3004
3005    @classmethod
3006    def _attrs(cls):
3007        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3008
3009
3010@dataclass(init=False)
3011class ProductDefinitionTemplate5(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3012    """[Product Definition Template 5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-5.shtml)"""
3013
3014    _len = 22
3015    _num = 5
3016    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3017    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3018    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3019    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3020    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3021    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3022    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3023    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3024    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3025    threshold: str = field(init=False, repr=False, default=Threshold())
3026
3027    @classmethod
3028    def _attrs(cls):
3029        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3030
3031
3032@dataclass(init=False)
3033class ProductDefinitionTemplate6(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3034    """[Product Definition Template 6](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-6.shtml)"""
3035
3036    _len = 16
3037    _num = 6
3038    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3039
3040    @classmethod
3041    def _attrs(cls):
3042        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3043
3044
3045@dataclass(init=False)
3046class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3047    """[Product Definition Template 8](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-8.shtml)"""
3048
3049    _len = 29
3050    _num = 8
3051    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3052    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3053    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3054    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3055    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3056    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3057    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3058    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3059    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3060    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3061    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3062    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3063    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3064    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3065
3066    @classmethod
3067    def _attrs(cls):
3068        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3069
3070
3071@dataclass(init=False)
3072class ProductDefinitionTemplate9(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3073    """[Product Definition Template 9](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-9.shtml)"""
3074
3075    _len = 36
3076    _num = 9
3077    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3078    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3079    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3080    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3081    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3082    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3083    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3084    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3085    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3086    threshold: str = field(init=False, repr=False, default=Threshold())
3087    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3088    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3089    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3090    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3091    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3092    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3093    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3094    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3095    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3096    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3097    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3098    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3099    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3100    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3101
3102    @classmethod
3103    def _attrs(cls):
3104        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3105
3106
3107@dataclass(init=False)
3108class ProductDefinitionTemplate10(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3109    """[Product Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-10.shtml)"""
3110
3111    _len = 30
3112    _num = 10
3113    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3114    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3115    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3116    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3117    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3118    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3119    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3120    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3121    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3122    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3123    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3124    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3125    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3126    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3127    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3128
3129    @classmethod
3130    def _attrs(cls):
3131        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3132
3133
3134@dataclass(init=False)
3135class ProductDefinitionTemplate11(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3136    """[Product Definition Template 11](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-11.shtml)"""
3137
3138    _len = 32
3139    _num = 11
3140    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3141    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3142    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3143    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3144    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3145    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3146    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3147    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3148    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3149    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3150    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3151    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3152    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3153    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3154    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3155    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3156    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3157
3158    @classmethod
3159    def _attrs(cls):
3160        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3161
3162
3163@dataclass(init=False)
3164class ProductDefinitionTemplate12(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3165    """[Product Definition Template 12](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-12.shtml)"""
3166
3167    _len = 31
3168    _num = 12
3169    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3170    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3171    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3172    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3173    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3174    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3175    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3176    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3177    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3178    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3179    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3180    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3181    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3182    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3183    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3184    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3185
3186    @classmethod
3187    def _attrs(cls):
3188        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3189
3190
3191@dataclass(init=False)
3192class ProductDefinitionTemplate13(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3193    """[Product Definition Template 13](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-13.shtml)"""
3194
3195    _len = 18
3196    _num = 13
3197    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3198    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3199    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3200    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3201    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3202    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3203    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3204    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3205
3206    @classmethod
3207    def _attrs(cls):
3208        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3209
3210
3211@dataclass(init=False)
3212class ProductDefinitionTemplate14(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3213    """[Product Definition Template 14](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-14.shtml)"""
3214
3215    _len = 18
3216    _num = 14
3217    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3218    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3219    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3220    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3221    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3222    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3223    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3224    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3225
3226    @classmethod
3227    def _attrs(cls):
3228        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3229
3230
3231@dataclass(init=False)
3232class ProductDefinitionTemplate15(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3233    """[Product Definition Template 15](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-15.shtml)"""
3234
3235    _len = 18
3236    _num = 15
3237    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3238    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3239    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3240
3241    @classmethod
3242    def _attrs(cls):
3243        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3244
3245
3246# @dataclass(init=False)
3247# class ProductDefinitionTemplate20(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3248#     """[Product Definition Template 20](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-20.shtml)"""
3249#     __slots__ = ('section4',)
3250#     _len = 19
3251#     _num = 20
3252
3253#     typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3254#     unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3255#     timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3256#     unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3257#     timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3258#     statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3259#     spatialProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfSpatialProcessing())
3260#     numberOfPointsUsed: int = field(init=False, repr=False, default=NumberOfPointsUsed())
3261
3262
3263@dataclass(init=False)
3264class ProductDefinitionTemplate31:
3265    """[Product Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-31.shtml)"""
3266
3267    _len = 5
3268    _num = 31
3269    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
3270    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
3271    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
3272    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
3273    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3274    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3275    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3276    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3277    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3278    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3279
3280    @classmethod
3281    def _attrs(cls):
3282        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3283
3284
3285@dataclass(init=False)
3286class ProductDefinitionTemplate32(ProductDefinitionTemplateBase):
3287    """[Product Definition Template 32](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-32.shtml)"""
3288
3289    _len = 10
3290    _num = 32
3291    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3292    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3293    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3294    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3295    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3296    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3297
3298    @classmethod
3299    def _attrs(cls):
3300        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3301
3302
3303# @dataclass(init=False)
3304# class ProductDefinitionTemplate33(ProductDefinitionTemplateBase):
3305#     """[Product Definition Template 33] - Individual ensemble forecast, control and perturbed at intervals"""
3306#     _len = None  # Length depends on number of spectral bands
3307#     _num = 33
3308#     # Note: parameterCategory through valueOfForecastTime inherited from base class
3309#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3310#     # Spectral band fields - these will need special handling since they repeat
3311#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3312#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3313#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3314#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3315#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3316#     # Continue with remaining fields
3317#     typeOfEnsembleForecast: Grib2Metadata = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3318#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3319#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3320#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3321#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3322#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3323#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3324#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3325#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3326#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3327#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())
3328# @dataclass(init=False)
3329# class ProductDefinitionTemplate34(ProductDefinitionTemplateBase):
3330#     """[Product Definition Template 34] - Individual ensemble forecast, control and perturbed at intervals - chemical"""
3331#     _len = None  # Length depends on number of spectral bands
3332#     _num = 34
3333#     constituentType: int = field(init=False,repr=False,default=ConstituentType())
3334#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3335#     # For each band nb=1 to NB:
3336#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3337#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3338#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3339#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3340#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3341#     # After spectral bands:
3342#     typeOfEnsembleForecast: int = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3343#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3344#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3345#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3346#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3347#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3348#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3349#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3350#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3351#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3352#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())
3353
3354# @dataclass(init=False)
3355# class ProductDefinitionTemplate35(ProductDefinitionTemplateBase):
3356#     """[Product Definition Template 35] - Individual ensemble forecast, control and perturbed at intervals - aerosol"""
3357#     _len = None  # Length depends on number of spectral bands
3358#     _num = 35
3359#     aerosolType: int = field(init=False,repr=False,default=AerosolType())
3360#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3361#     # For each band nb=1 to NB:
3362#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3363#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3364#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3365#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3366#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3367#     # After spectral bands:
3368#     typeOfEnsembleForecast: int = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3369#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3370#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3371#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3372#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3373#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3374#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3375#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3376#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3377#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3378#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())@dataclass(init=False)
3379
3380
3381@dataclass(init=False)
3382class ProductDefinitionTemplate44(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3383    """[Product Definition Template 4.44](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-44.shtml)"""
3384
3385    _len = 25
3386    _num = 44
3387    # Aerosol parameters
3388    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3389    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3390    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3391    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3392    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3393    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3394    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3395    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3396
3397    @classmethod
3398    def _attrs(cls):
3399        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3400
3401
3402@dataclass(init=False)
3403class ProductDefinitionTemplate45(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3404    """[Product Definition Template 4.45](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-45.shtml)"""
3405
3406    _len = 28
3407    _num = 45
3408    # Aerosol parameters
3409    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3410    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3411    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3412    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3413    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3414    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3415    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3416    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3417
3418    # Ensemble parameters
3419    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3420    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3421    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3422
3423    @classmethod
3424    def _attrs(cls):
3425        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3426
3427
3428@dataclass(init=False)
3429class ProductDefinitionTemplate50(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3430    """[Product Definition Template 4.50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-50.shtml)"""
3431
3432    _len = 25
3433    _num = 50
3434    # Aerosol parameters
3435    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3436    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3437    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3438    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3439    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3440    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3441    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3442    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3443
3444    @classmethod
3445    def _attrs(cls):
3446        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3447
3448
3449@dataclass(init=False)
3450class ProductDefinitionTemplate46(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3451    """[Product Definition Template 4.46](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-46.shtml)"""
3452
3453    _len = 38  # Total number of octets
3454    _num = 46
3455
3456    # Aerosol-specific parameters
3457    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3458    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3459    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3460    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3461    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3462    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3463    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3464    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3465
3466    # Time interval parameters
3467    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3468    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3469    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3470    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3471    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3472    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3473    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3474    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3475
3476    # Statistical processing parameters
3477    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3478    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3479    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3480    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3481    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3482    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3483    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3484
3485    @classmethod
3486    def _attrs(cls):
3487        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3488
3489
3490@dataclass(init=False)
3491class ProductDefinitionTemplate47(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3492    """[Product Definition Template 4.47](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-47.shtml)"""
3493
3494    _len = 41  # Total number of octets for base template
3495    _num = 47
3496
3497    # Aerosol parameters
3498    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3499    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3500    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3501    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3502    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3503    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3504    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3505    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3506
3507    # Ensemble parameters
3508    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3509    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3510    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3511
3512    # Time interval parameters
3513    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3514    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3515    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3516    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3517    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3518    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3519    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3520    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3521
3522    # Statistical processing parameters
3523    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3524    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3525    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3526    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3527    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3528    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3529    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3530
3531    @classmethod
3532    def _attrs(cls):
3533        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3534
3535
3536@dataclass(init=False)
3537class ProductDefinitionTemplate48(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3538    """[Product Definition Template 48](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-48.shtml)"""
3539
3540    _len = 26
3541    _num = 48
3542    # Aerosol parameters
3543    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3544    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3545    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3546    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3547    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3548    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3549    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3550    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3551
3552    # Wavelength parameters
3553    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3554    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3555    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3556    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3557    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3558    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3559    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3560
3561    @classmethod
3562    def _attrs(cls):
3563        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3564
3565
3566@dataclass(init=False)
3567class ProductDefinitionTemplate49(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3568    """[Product Definition Template 4.49](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-49.shtml)"""
3569
3570    _len = 28
3571    _num = 49
3572
3573    # Aerosol parameters
3574    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3575    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3576    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3577    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3578    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3579    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3580    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3581    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3582
3583    # Wavelength parameters
3584    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3585    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3586    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3587    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3588    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3589    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3590    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3591
3592    # Ensemble parameters
3593    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3594    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3595    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3596
3597
3598@dataclass(init=False)
3599class ProductDefinitionTemplate80(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3600    """[Product Definition Template 4.80](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-80.shtml)"""
3601
3602    _len = 26
3603    _num = 80
3604
3605    # Aerosol parameters
3606    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3607    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3608    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3609    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3610    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3611    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3612    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3613    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3614    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3615
3616    # Wavelength parameters
3617    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3618    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3619    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3620    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3621    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3622    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3623    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3624
3625
3626@dataclass(init=False)
3627class ProductDefinitionTemplate81(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3628    """[Product Definition Template 4.81](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-81.shtml)"""
3629
3630    _len = 31
3631    _num = 81
3632
3633    # Aerosol parameters
3634    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3635    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3636    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3637    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3638    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3639    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3640    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3641    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3642    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3643
3644    # Wavelength parameters
3645    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3646    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3647    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3648    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3649    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3650    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3651    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3652
3653    # Ensemble parameters
3654    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3655    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3656    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3657
3658
3659@dataclass(init=False)
3660class ProductDefinitionTemplate82(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3661    """[Product Definition Template 4.82](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-82.shtml)"""
3662
3663    _len = 41
3664    _num = 82
3665
3666    # Aerosol parameters
3667    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3668    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3669    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3670    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3671    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3672    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3673    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3674    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3675    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3676
3677    # Wavelength parameters
3678    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3679    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3680    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3681    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3682    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3683    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3684    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3685
3686    # Time interval parameters
3687    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3688    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3689    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3690    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3691    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3692    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3693    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3694    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3695
3696    # Statistical processing parameters
3697    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3698    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3699    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3700    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3701    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3702    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3703    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3704    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3705
3706
3707@dataclass(init=False)
3708class ProductDefinitionTemplate83(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3709    """[Product Definition Template 4.83](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-83.shtml)"""
3710
3711    _len = 44
3712    _num = 83
3713
3714    # Aerosol parameters
3715    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3716    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3717    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3718    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3719    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3720    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3721    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3722    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3723    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3724
3725    # Wavelength parameters
3726    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3727    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3728    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3729    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3730    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3731    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3732    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3733
3734    # Ensemble parameters
3735    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3736    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3737    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3738
3739    # Time interval parameters
3740    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3741    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3742    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3743    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3744    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3745    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3746    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3747    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3748
3749
3750@dataclass(init=False)
3751class ProductDefinitionTemplate84(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3752    """[Product Definition Template 4.84](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-84.shtml)"""
3753
3754    _len = 44
3755    _num = 84
3756
3757    # Aerosol parameters
3758    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3759    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3760    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3761    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3762    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3763    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3764    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3765    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3766    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3767
3768    # Wavelength parameters
3769    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3770    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3771    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3772    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3773    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3774    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3775    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3776
3777    # Ensemble parameters
3778    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3779    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3780    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3781
3782    # Time interval parameters
3783    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3784    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3785    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3786    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3787    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3788    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3789
3790    # Statistical processing parameters
3791    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3792    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3793    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3794    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3795    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3796    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3797    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3798    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3799
3800
3801@dataclass(init=False)
3802class ProductDefinitionTemplate85(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3803    """[Product Definition Template 4.85](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-85.shtml)"""
3804
3805    _len = 33
3806    _num = 85
3807
3808    # Aerosol parameters
3809    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3810    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3811    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3812    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3813    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3814    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3815    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3816    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3817    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3818
3819    # Wavelength parameters
3820    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3821    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3822    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3823    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3824    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3825    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3826    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3827
3828    # Ensemble parameters
3829    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3830    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3831    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3832
3833
3834@dataclass(init=False)
3835class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3836    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3837
3838    _len = 16
3839    _num = 40
3840    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3841
3842
3843@dataclass(init=False)
3844class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3845    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3846
3847    _len = 19
3848    _num = 41
3849    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3850    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3851    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3852    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3853
3854
3855@dataclass(init=False)
3856class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3857    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
3858
3859    _len = 30
3860    _num = 42
3861    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3862    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3863    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3864    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3865    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3866    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3867    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3868    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3869    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3870    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3871    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3872    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3873    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3874    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3875    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3876
3877
3878@dataclass(init=False)
3879class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3880    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
3881
3882    _len = 33
3883    _num = 43
3884    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3885    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3886    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3887    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3888    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3889    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3890    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3891    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3892    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3893    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3894    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3895    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3896    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3897    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3898    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3899    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3900    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3901    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3902
3903
3904@dataclass(init=False)
3905class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3906    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
3907
3908    _len = 17
3909    _num = 76
3910    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3911    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3912
3913
3914@dataclass(init=False)
3915class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3916    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
3917
3918    _len = 20
3919    _num = 77
3920    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3921    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3922    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3923    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3924    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3925
3926
3927@dataclass(init=False)
3928class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3929    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
3930
3931    _len = 31
3932    _num = 78
3933    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3934    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3935    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3936    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3937    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3938    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3939    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3940    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3941    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3942    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3943    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3944    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3945    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3946    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3947    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3948    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3949
3950
3951@dataclass(init=False)
3952class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3953    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
3954
3955    _len = 34
3956    _num = 79
3957    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3958    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3959    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3960    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3961    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3962    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3963    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3964    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3965    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3966    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3967    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3968    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3969    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3970    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3971    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3972    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3973    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3974    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3975    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3976
3977
3978@dataclass(init=False)
3979class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3980    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3981
3982    _len = 16
3983    _num = 40
3984    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3985
3986
3987@dataclass(init=False)
3988class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3989    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3990
3991    _len = 19
3992    _num = 41
3993    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3994    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3995    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3996    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3997
3998
3999@dataclass(init=False)
4000class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4001    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
4002
4003    _len = 30
4004    _num = 42
4005    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4006    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4007    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4008    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4009    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4010    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4011    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4012    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4013    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4014    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4015    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4016    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4017    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4018    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4019    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4020
4021
4022@dataclass(init=False)
4023class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4024    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
4025
4026    _len = 33
4027    _num = 43
4028    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4029    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4030    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4031    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4032    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4033    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4034    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4035    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4036    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4037    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4038    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4039    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4040    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4041    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4042    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4043    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4044    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4045    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4046
4047
4048@dataclass(init=False)
4049class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4050    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
4051
4052    _len = 17
4053    _num = 76
4054    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4055    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4056
4057
4058@dataclass(init=False)
4059class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4060    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
4061
4062    _len = 20
4063    _num = 77
4064    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4065    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4066    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4067    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4068    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4069
4070
4071@dataclass(init=False)
4072class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4073    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
4074
4075    _len = 31
4076    _num = 78
4077    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4078    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4079    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4080    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4081    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4082    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4083    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4084    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4085    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4086    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4087    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4088    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4089    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4090    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4091    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4092    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4093
4094
4095@dataclass(init=False)
4096class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4097    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
4098
4099    _len = 34
4100    _num = 79
4101    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4102    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4103    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4104    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4105    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4106    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4107    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4108    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4109    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4110    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4111    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4112    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4113    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4114    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4115    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4116    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4117    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4118    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4119    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4120
4121
4122_pdt_by_pdtn = {
4123    0: ProductDefinitionTemplate0,
4124    1: ProductDefinitionTemplate1,
4125    2: ProductDefinitionTemplate2,
4126    5: ProductDefinitionTemplate5,
4127    6: ProductDefinitionTemplate6,
4128    8: ProductDefinitionTemplate8,
4129    9: ProductDefinitionTemplate9,
4130    10: ProductDefinitionTemplate10,
4131    11: ProductDefinitionTemplate11,
4132    12: ProductDefinitionTemplate12,
4133    15: ProductDefinitionTemplate15,
4134    31: ProductDefinitionTemplate31,
4135    32: ProductDefinitionTemplate32,
4136    40: ProductDefinitionTemplate40,
4137    41: ProductDefinitionTemplate41,
4138    42: ProductDefinitionTemplate42,
4139    43: ProductDefinitionTemplate43,
4140    44: ProductDefinitionTemplate44,
4141    45: ProductDefinitionTemplate45,
4142    46: ProductDefinitionTemplate46,
4143    47: ProductDefinitionTemplate47,
4144    48: ProductDefinitionTemplate48,
4145    49: ProductDefinitionTemplate49,
4146    50: ProductDefinitionTemplate50,
4147    76: ProductDefinitionTemplate76,
4148    77: ProductDefinitionTemplate77,
4149    78: ProductDefinitionTemplate78,
4150    79: ProductDefinitionTemplate79,
4151    80: ProductDefinitionTemplate80,
4152    81: ProductDefinitionTemplate81,
4153    82: ProductDefinitionTemplate82,
4154    83: ProductDefinitionTemplate83,
4155    84: ProductDefinitionTemplate84,
4156    85: ProductDefinitionTemplate85,
4157}
4158
4159
4160def pdt_class_by_pdtn(pdtn: int):
4161    """
4162    Provide a Product Definition Template class via the template number.
4163
4164    Parameters
4165    ----------
4166    pdtn
4167        Product definition template number.
4168
4169    Returns
4170    -------
4171    pdt_class_by_pdtn
4172        Product definition template class object (not an instance).
4173    """
4174    return _pdt_by_pdtn[pdtn]
4175
4176
4177# ----------------------------------------------------------------------------------------
4178# Descriptor Classes for Section 5 metadata.
4179# ----------------------------------------------------------------------------------------
4180class NumberOfPackedValues:
4181    """Number of Packed Values"""
4182
4183    def __get__(self, obj, objtype=None):
4184        return obj.section5[0]
4185
4186    def __set__(self, obj, value):
4187        pass
4188
4189
4190class DataRepresentationTemplateNumber:
4191    """[Data Representation Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-0.shtml)"""
4192
4193    def __get__(self, obj, objtype=None):
4194        return Grib2Metadata(obj.section5[1], table="5.0")
4195
4196    def __set__(self, obj, value):
4197        pass
4198
4199
4200class DataRepresentationTemplate:
4201    """Data Representation Template"""
4202
4203    def __get__(self, obj, objtype=None):
4204        return obj.section5[2:]
4205
4206    def __set__(self, obj, value):
4207        raise NotImplementedError
4208
4209
4210class RefValue:
4211    """Reference Value (represented as an IEEE 32-bit floating point value)"""
4212
4213    def __get__(self, obj, objtype=None):
4214        return utils.ieee_int_to_float(obj.section5[0 + 2])
4215
4216    def __set__(self, obj, value):
4217        pass
4218
4219
4220class BinScaleFactor:
4221    """Binary Scale Factor"""
4222
4223    def __get__(self, obj, objtype=None):
4224        return obj.section5[1 + 2]
4225
4226    def __set__(self, obj, value):
4227        obj.section5[1 + 2] = value
4228
4229
4230class DecScaleFactor:
4231    """Decimal Scale Factor"""
4232
4233    def __get__(self, obj, objtype=None):
4234        return obj.section5[2 + 2]
4235
4236    def __set__(self, obj, value):
4237        obj.section5[2 + 2] = value
4238
4239
4240class NBitsPacking:
4241    """Minimum number of bits for packing"""
4242
4243    def __get__(self, obj, objtype=None):
4244        return obj.section5[3 + 2]
4245
4246    def __set__(self, obj, value):
4247        obj.section5[3 + 2] = value
4248
4249
4250class TypeOfValues:
4251    """[Type of Original Field Values](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)"""
4252
4253    def __get__(self, obj, objtype=None):
4254        return Grib2Metadata(obj.section5[4 + 2], table="5.1")
4255
4256    def __set__(self, obj, value):
4257        obj.section5[4 + 2] = value
4258
4259
4260class GroupSplittingMethod:
4261    """[Group Splitting Method](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-4.shtml)"""
4262
4263    def __get__(self, obj, objtype=None):
4264        return Grib2Metadata(obj.section5[5 + 2], table="5.4")
4265
4266    def __set__(self, obj, value):
4267        obj.section5[5 + 2] = value
4268
4269
4270class TypeOfMissingValueManagement:
4271    """[Type of Missing Value Management](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-5.shtml)"""
4272
4273    def __get__(self, obj, objtype=None):
4274        return Grib2Metadata(obj.section5[6 + 2], table="5.5")
4275
4276    def __set__(self, obj, value):
4277        obj.section5[6 + 2] = value
4278
4279
4280class PriMissingValue:
4281    """Primary Missing Value"""
4282
4283    def __get__(self, obj, objtype=None):
4284        if obj.typeOfValues == 0:
4285            return utils.ieee_int_to_float(obj.section5[7 + 2]) if obj.section5[6 + 2] in {1, 2} and obj.section5[7 + 2] != 255 else None
4286        elif obj.typeOfValues == 1:
4287            return obj.section5[7 + 2] if obj.section5[6 + 2] in [1, 2] else None
4288
4289    def __set__(self, obj, value):
4290        if obj.typeOfValues == 0:
4291            obj.section5[7 + 2] = utils.ieee_float_to_int(value)
4292        elif self.typeOfValues == 1:
4293            obj.section5[7 + 2] = int(value)
4294        obj.section5[6 + 2] = 1
4295
4296
4297class SecMissingValue:
4298    """Secondary Missing Value"""
4299
4300    def __get__(self, obj, objtype=None):
4301        if obj.typeOfValues == 0:
4302            return utils.ieee_int_to_float(obj.section5[8 + 2]) if obj.section5[6 + 2] in {1, 2} and obj.section5[8 + 2] != 255 else None
4303        elif obj.typeOfValues == 1:
4304            return obj.section5[8 + 2] if obj.section5[6 + 2] in {1, 2} else None
4305
4306    def __set__(self, obj, value):
4307        if obj.typeOfValues == 0:
4308            obj.section5[8 + 2] = utils.ieee_float_to_int(value)
4309        elif self.typeOfValues == 1:
4310            obj.section5[8 + 2] = int(value)
4311        obj.section5[6 + 2] = 2
4312
4313
4314class NGroups:
4315    """Number of Groups"""
4316
4317    def __get__(self, obj, objtype=None):
4318        return obj.section5[9 + 2]
4319
4320    def __set__(self, obj, value):
4321        pass
4322
4323
4324class RefGroupWidth:
4325    """Reference Group Width"""
4326
4327    def __get__(self, obj, objtype=None):
4328        return obj.section5[10 + 2]
4329
4330    def __set__(self, obj, value):
4331        pass
4332
4333
4334class NBitsGroupWidth:
4335    """Number of bits for Group Width"""
4336
4337    def __get__(self, obj, objtype=None):
4338        return obj.section5[11 + 2]
4339
4340    def __set__(self, obj, value):
4341        pass
4342
4343
4344class RefGroupLength:
4345    """Reference Group Length"""
4346
4347    def __get__(self, obj, objtype=None):
4348        return obj.section5[12 + 2]
4349
4350    def __set__(self, obj, value):
4351        pass
4352
4353
4354class GroupLengthIncrement:
4355    """Group Length Increment"""
4356
4357    def __get__(self, obj, objtype=None):
4358        return obj.section5[13 + 2]
4359
4360    def __set__(self, obj, value):
4361        pass
4362
4363
4364class LengthOfLastGroup:
4365    """Length of Last Group"""
4366
4367    def __get__(self, obj, objtype=None):
4368        return obj.section5[14 + 2]
4369
4370    def __set__(self, obj, value):
4371        pass
4372
4373
4374class NBitsScaledGroupLength:
4375    """Number of bits of Scaled Group Length"""
4376
4377    def __get__(self, obj, objtype=None):
4378        return obj.section5[15 + 2]
4379
4380    def __set__(self, obj, value):
4381        pass
4382
4383
4384class SpatialDifferenceOrder:
4385    """[Spatial Difference Order](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-6.shtml)"""
4386
4387    def __get__(self, obj, objtype=None):
4388        return Grib2Metadata(obj.section5[16 + 2], table="5.6")
4389
4390    def __set__(self, obj, value):
4391        obj.section5[16 + 2] = value
4392
4393
4394class NBytesSpatialDifference:
4395    """Number of bytes for Spatial Differencing"""
4396
4397    def __get__(self, obj, objtype=None):
4398        return obj.section5[17 + 2]
4399
4400    def __set__(self, obj, value):
4401        pass
4402
4403
4404class Precision:
4405    """[Precision for IEEE Floating Point Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-7.shtml)"""
4406
4407    def __get__(self, obj, objtype=None):
4408        return Grib2Metadata(obj.section5[0 + 2], table="5.7")
4409
4410    def __set__(self, obj, value):
4411        obj.section5[0 + 2] = value
4412
4413
4414class TypeOfCompression:
4415    """[Type of Compression](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-40.shtml)"""
4416
4417    def __get__(self, obj, objtype=None):
4418        return Grib2Metadata(obj.section5[5 + 2], table="5.40")
4419
4420    def __set__(self, obj, value):
4421        obj.section5[5 + 2] = value
4422
4423
4424class TargetCompressionRatio:
4425    """Target Compression Ratio"""
4426
4427    def __get__(self, obj, objtype=None):
4428        return obj.section5[6 + 2]
4429
4430    def __set__(self, obj, value):
4431        pass
4432
4433
4434class RealOfCoefficient:
4435    """Real of Coefficient"""
4436
4437    def __get__(self, obj, objtype=None):
4438        return utils.ieee_int_to_float(obj.section5[4 + 2])
4439
4440    def __set__(self, obj, value):
4441        obj.section5[4 + 2] = utils.ieee_float_to_int(float(value))
4442
4443
4444class CompressionOptionsMask:
4445    """Compression Options Mask for AEC/CCSDS"""
4446
4447    def __get__(self, obj, objtype=None):
4448        return obj.section5[5 + 2]
4449
4450    def __set__(self, obj, value):
4451        obj.section5[5 + 2] = value
4452
4453
4454class BlockSize:
4455    """Block Size for AEC/CCSDS"""
4456
4457    def __get__(self, obj, objtype=None):
4458        return obj.section5[6 + 2]
4459
4460    def __set__(self, obj, value):
4461        obj.section5[6 + 2] = value
4462
4463
4464class RefSampleInterval:
4465    """Reference Sample Interval for AEC/CCSDS"""
4466
4467    def __get__(self, obj, objtype=None):
4468        return obj.section5[7 + 2]
4469
4470    def __set__(self, obj, value):
4471        obj.section5[7 + 2] = value
4472
4473
4474@dataclass(init=False)
4475class DataRepresentationTemplate0:
4476    """[Data Representation Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml)"""
4477
4478    _len = 5
4479    _num = 0
4480    _packingScheme = "simple"
4481    refValue: float = field(init=False, repr=False, default=RefValue())
4482    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4483    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4484    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4485
4486    @classmethod
4487    def _attrs(cls):
4488        return list(cls.__dataclass_fields__.keys())
4489
4490
4491@dataclass(init=False)
4492class DataRepresentationTemplate2:
4493    """[Data Representation Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-2.shtml)"""
4494
4495    _len = 16
4496    _num = 2
4497    _packingScheme = "complex"
4498    refValue: float = field(init=False, repr=False, default=RefValue())
4499    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4500    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4501    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4502    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4503    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4504    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4505    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4506    nGroups: int = field(init=False, repr=False, default=NGroups())
4507    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4508    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4509    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4510    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4511    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4512    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4513
4514    @classmethod
4515    def _attrs(cls):
4516        return list(cls.__dataclass_fields__.keys())
4517
4518
4519@dataclass(init=False)
4520class DataRepresentationTemplate3:
4521    """[Data Representation Template 3](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-3.shtml)"""
4522
4523    _len = 18
4524    _num = 3
4525    _packingScheme = "complex-spdiff"
4526    refValue: float = field(init=False, repr=False, default=RefValue())
4527    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4528    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4529    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4530    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4531    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4532    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4533    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4534    nGroups: int = field(init=False, repr=False, default=NGroups())
4535    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4536    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4537    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4538    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4539    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4540    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4541    spatialDifferenceOrder: Grib2Metadata = field(init=False, repr=False, default=SpatialDifferenceOrder())
4542    nBytesSpatialDifference: int = field(init=False, repr=False, default=NBytesSpatialDifference())
4543
4544    @classmethod
4545    def _attrs(cls):
4546        return list(cls.__dataclass_fields__.keys())
4547
4548
4549@dataclass(init=False)
4550class DataRepresentationTemplate4:
4551    """[Data Representation Template 4](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-4.shtml)"""
4552
4553    _len = 1
4554    _num = 4
4555    _packingScheme = "ieee-float"
4556    precision: Grib2Metadata = field(init=False, repr=False, default=Precision())
4557
4558    @classmethod
4559    def _attrs(cls):
4560        return list(cls.__dataclass_fields__.keys())
4561
4562
4563@dataclass(init=False)
4564class DataRepresentationTemplate40:
4565    """[Data Representation Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-40.shtml)"""
4566
4567    _len = 7
4568    _num = 40
4569    _packingScheme = "jpeg"
4570    refValue: float = field(init=False, repr=False, default=RefValue())
4571    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4572    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4573    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4574    typeOfCompression: Grib2Metadata = field(init=False, repr=False, default=TypeOfCompression())
4575    targetCompressionRatio: int = field(init=False, repr=False, default=TargetCompressionRatio())
4576
4577    @classmethod
4578    def _attrs(cls):
4579        return list(cls.__dataclass_fields__.keys())
4580
4581
4582@dataclass(init=False)
4583class DataRepresentationTemplate41:
4584    """[Data Representation Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-41.shtml)"""
4585
4586    _len = 5
4587    _num = 41
4588    _packingScheme = "png"
4589    refValue: float = field(init=False, repr=False, default=RefValue())
4590    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4591    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4592    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4593
4594    @classmethod
4595    def _attrs(cls):
4596        return list(cls.__dataclass_fields__.keys())
4597
4598
4599@dataclass(init=False)
4600class DataRepresentationTemplate42:
4601    """[Data Representation Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-42.shtml)"""
4602
4603    _len = 8
4604    _num = 42
4605    _packingScheme = "aec"
4606    refValue: float = field(init=False, repr=False, default=RefValue())
4607    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4608    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4609    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4610    compressionOptionsMask: int = field(init=False, repr=False, default=CompressionOptionsMask())
4611    blockSize: int = field(init=False, repr=False, default=BlockSize())
4612    refSampleInterval: int = field(init=False, repr=False, default=RefSampleInterval())
4613
4614    @classmethod
4615    def _attrs(cls):
4616        return list(cls.__dataclass_fields__.keys())
4617
4618
4619@dataclass(init=False)
4620class DataRepresentationTemplate50:
4621    """[Data Representation Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-50.shtml)"""
4622
4623    _len = 5
4624    _num = 0
4625    _packingScheme = "spectral-simple"
4626    refValue: float = field(init=False, repr=False, default=RefValue())
4627    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4628    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4629    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4630    realOfCoefficient: float = field(init=False, repr=False, default=RealOfCoefficient())
4631
4632    @classmethod
4633    def _attrs(cls):
4634        return list(cls.__dataclass_fields__.keys())
4635
4636
4637_drt_by_drtn = {
4638    0: DataRepresentationTemplate0,
4639    2: DataRepresentationTemplate2,
4640    3: DataRepresentationTemplate3,
4641    4: DataRepresentationTemplate4,
4642    40: DataRepresentationTemplate40,
4643    41: DataRepresentationTemplate41,
4644    42: DataRepresentationTemplate42,
4645    50: DataRepresentationTemplate50,
4646}
4647
4648
4649def drt_class_by_drtn(drtn: int):
4650    """
4651    Provide a Data Representation Template class via the template number.
4652
4653    Parameters
4654    ----------
4655    drtn
4656        Data Representation template number.
4657
4658    Returns
4659    -------
4660    drt_class_by_drtn
4661        Data Representation template class object (not an instance).
4662    """
4663    return _drt_by_drtn[drtn]
class Grib2Metadata:
 79class Grib2Metadata:
 80    """
 81    Class to hold GRIB2 metadata.
 82
 83    Stores both numeric code value as stored in GRIB2 and its plain language
 84    definition.
 85
 86    Attributes
 87    ----------
 88    value : int
 89        GRIB2 metadata integer code value.
 90    table : str, optional
 91        GRIB2 table to lookup the `value`. Default is None.
 92    definition : str
 93        Plain language description of numeric metadata.
 94    """
 95
 96    __slots__ = ("value", "table")
 97
 98    def __init__(self, value, table=None):
 99        self.value = int(value)
100        self.table = table
101
102    def __call__(self):
103        return self.value
104
105    def __repr__(self):
106        return f"{self.__class__.__name__}({self.value}, table = '{self.table}')"
107
108    def __str__(self):
109        return f"{self.value} - {self.definition}"
110
111    def __eq__(self, other):
112        return self.value == other or self.definition[0] == other
113
114    def __gt__(self, other):
115        return self.value > other
116
117    def __ge__(self, other):
118        return self.value >= other
119
120    def __lt__(self, other):
121        return self.value < other
122
123    def __le__(self, other):
124        return self.value <= other
125
126    def __contains__(self, other):
127        return other in self.definition
128
129    def __index__(self):
130        return int(self.value)
131
132    def __hash__(self):
133        return hash(self.value)
134
135    @property
136    def definition(self):
137        """Provide the definition of the numeric metadata."""
138        return tables.get_value_from_table(self.value, self.table)
139
140    def show_table(self):
141        """Provide the table related to this metadata."""
142        return tables.get_table(self.table)

Class to hold GRIB2 metadata.

Stores both numeric code value as stored in GRIB2 and its plain language definition.

Attributes
  • value (int): GRIB2 metadata integer code value.
  • table (str, optional): GRIB2 table to lookup the value. Default is None.
  • definition (str): Plain language description of numeric metadata.
Grib2Metadata(value, table=None)
 98    def __init__(self, value, table=None):
 99        self.value = int(value)
100        self.table = table
value
table
definition
135    @property
136    def definition(self):
137        """Provide the definition of the numeric metadata."""
138        return tables.get_value_from_table(self.value, self.table)

Provide the definition of the numeric metadata.

def show_table(self):
140    def show_table(self):
141        """Provide the table related to this metadata."""
142        return tables.get_table(self.table)

Provide the table related to this metadata.

class IndicatorSection:
148class IndicatorSection:
149    """
150    [GRIB2 Indicator Section (0)](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect0.shtml)
151    """
152
153    def __get__(self, obj, objtype=None):
154        return obj.section0
155
156    def __set__(self, obj, value):
157        obj.section0 = value
class Discipline:
160class Discipline:
161    """[Discipline](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table0-0.shtml)"""
162
163    def __get__(self, obj, objtype=None):
164        return Grib2Metadata(obj.indicatorSection[2], table="0.0")
165
166    def __set__(self, obj, value):
167        obj.section0[2] = value
class IdentificationSection:
173class IdentificationSection:
174    """
175    GRIB2 Section 1, [Identification Section](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect1.shtml)
176    """
177
178    def __get__(self, obj, objtype=None):
179        return obj.section1
180
181    def __set__(self, obj, value):
182        obj.section1 = value

GRIB2 Section 1, Identification Section

class OriginatingCenter:
185class OriginatingCenter:
186    """[Originating Center](https://www.nco.ncep.noaa.gov/pmb/docs/on388/table0.html)"""
187
188    def __get__(self, obj, objtype=None):
189        return Grib2Metadata(obj.section1[0], table="originating_centers")
190
191    def __set__(self, obj, value):
192        obj.section1[0] = value
class OriginatingSubCenter:
195class OriginatingSubCenter:
196    """[Originating SubCenter](https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablec.html)"""
197
198    def __get__(self, obj, objtype=None):
199        return Grib2Metadata(obj.section1[1], table="originating_subcenters")
200
201    def __set__(self, obj, value):
202        obj.section1[1] = value
class MasterTableInfo:
205class MasterTableInfo:
206    """[GRIB2 Master Table Version](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-0.shtml)"""
207
208    def __get__(self, obj, objtype=None):
209        return Grib2Metadata(obj.section1[2], table="1.0")
210
211    def __set__(self, obj, value):
212        obj.section1[2] = value
class LocalTableInfo:
215class LocalTableInfo:
216    """[GRIB2 Local Tables Version Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-1.shtml)"""
217
218    def __get__(self, obj, objtype=None):
219        return Grib2Metadata(obj.section1[3], table="1.1")
220
221    def __set__(self, obj, value):
222        obj.section1[3] = value
class SignificanceOfReferenceTime:
225class SignificanceOfReferenceTime:
226    """[Significance of Reference Time](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-2.shtml)"""
227
228    def __get__(self, obj, objtype=None):
229        return Grib2Metadata(obj.section1[4], table="1.2")
230
231    def __set__(self, obj, value):
232        obj.section1[4] = value
class Year:
235class Year:
236    """Year of reference time"""
237
238    def __get__(self, obj, objtype=None):
239        return obj.section1[5]
240
241    def __set__(self, obj, value):
242        rd = copy.copy(obj.section1[5:11])
243        rd[0] = value
244        # Test validity of datetime values
245        _ = datetime.datetime(*rd)
246        obj.section1[5] = value

Year of reference time

class Month:
249class Month:
250    """Month of reference time"""
251
252    def __get__(self, obj, objtype=None):
253        return obj.section1[6]
254
255    def __set__(self, obj, value):
256        rd = copy.copy(obj.section1[5:11])
257        rd[1] = value
258        # Test validity of datetime values
259        _ = datetime.datetime(*rd)
260        obj.section1[6] = value

Month of reference time

class Day:
263class Day:
264    """Day of reference time"""
265
266    def __get__(self, obj, objtype=None):
267        return obj.section1[7]
268
269    def __set__(self, obj, value):
270        rd = copy.copy(obj.section1[5:11])
271        rd[2] = value
272        # Test validity of datetime values
273        _ = datetime.datetime(*rd)
274        obj.section1[7] = value

Day of reference time

class Hour:
277class Hour:
278    """Hour of reference time"""
279
280    def __get__(self, obj, objtype=None):
281        return obj.section1[8]
282
283    def __set__(self, obj, value):
284        rd = copy.copy(obj.section1[5:11])
285        rd[3] = value
286        # Test validity of datetime values
287        _ = datetime.datetime(*rd)
288        obj.section1[8] = value

Hour of reference time

class Minute:
291class Minute:
292    """Minute of reference time"""
293
294    def __get__(self, obj, objtype=None):
295        return obj.section1[9]
296
297    def __set__(self, obj, value):
298        rd = copy.copy(obj.section1[5:11])
299        rd[4] = value
300        # Test validity of datetime values
301        _ = datetime.datetime(*rd)
302        obj.section1[9] = value

Minute of reference time

class Second:
305class Second:
306    """Second of reference time"""
307
308    def __get__(self, obj, objtype=None):
309        return obj.section1[10]
310
311    def __set__(self, obj, value):
312        rd = copy.copy(obj.section1[5:11])
313        rd[5] = value
314        # Test validity of datetime values
315        _ = datetime.datetime(*rd)
316        obj.section1[10] = value

Second of reference time

class RefDate:
319class RefDate:
320    """Reference Date. NOTE: This is a `datetime.datetime` object."""
321
322    def __get__(self, obj, objtype=None):
323        return datetime.datetime(*obj.section1[5:11])
324
325    def __set__(self, obj, value):
326        if isinstance(value, np.datetime64):
327            timestamp = (value - np.datetime64("1970-01-01T00:00:00")) / np.timedelta64(1, "s")
328            try:
329                # Python >= 3.10
330                value = datetime.datetime.fromtimestamp(timestamp, datetime.UTC)
331            except AttributeError:
332                # Python < 3.10
333                value = datetime.datetime.utcfromtimestamp(timestamp)
334        if isinstance(value, datetime.datetime):
335            obj.section1[5] = value.year
336            obj.section1[6] = value.month
337            obj.section1[7] = value.day
338            obj.section1[8] = value.hour
339            obj.section1[9] = value.minute
340            obj.section1[10] = value.second
341            # IMPORTANT: Update validDate components when message is time interval
342            if obj.pdtn in _timeinterval_pdtns:
343                vd = value + obj.leadTime + obj.duration
344                obj.yearOfEndOfTimePeriod = vd.year
345                obj.monthOfEndOfTimePeriod = vd.month
346                obj.dayOfEndOfTimePeriod = vd.day
347                obj.hourOfEndOfTimePeriod = vd.hour
348                obj.minuteOfEndOfTimePeriod = vd.minute
349                obj.secondOfEndOfTimePeriod = vd.second
350        else:
351            msg = "Reference date must be a datetime.datetime or np.datetime64 object."
352            raise TypeError(msg)

Reference Date. NOTE: This is a datetime.datetime object.

class ProductionStatus:
355class ProductionStatus:
356    """[Production Status of Processed Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-3.shtml)"""
357
358    def __get__(self, obj, objtype=None):
359        return Grib2Metadata(obj.section1[11], table="1.3")
360
361    def __set__(self, obj, value):
362        obj.section1[11] = value
class TypeOfData:
365class TypeOfData:
366    """[Type of Processed Data in this GRIB message](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table1-4.shtml)"""
367
368    def __get__(self, obj, objtype=None):
369        return Grib2Metadata(obj.section1[12], table="1.4")
370
371    def __set__(self, obj, value):
372        obj.section1[12] = value
class GridDefinitionSection:
383class GridDefinitionSection:
384    """
385    GRIB2 Section 3, [Grid Definition Section](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_sect3.shtml)
386    """
387
388    def __get__(self, obj, objtype=None):
389        return obj.section3[0:5]
390
391    def __set__(self, obj, value):
392        raise RuntimeError

GRIB2 Section 3, Grid Definition Section

class SourceOfGridDefinition:
395class SourceOfGridDefinition:
396    """[Source of Grid Definition](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-0.shtml)"""
397
398    def __get__(self, obj, objtype=None):
399        return Grib2Metadata(obj.section3[0], table="3.0")
400
401    def __set__(self, obj, value):
402        raise RuntimeError
class NumberOfDataPoints:
405class NumberOfDataPoints:
406    """Number of Data Points"""
407
408    def __get__(self, obj, objtype=None):
409        return obj.section3[1]
410
411    def __set__(self, obj, value):
412        raise RuntimeError

Number of Data Points

class InterpretationOfListOfNumbers:
415class InterpretationOfListOfNumbers:
416    """Interpretation of List of Numbers"""
417
418    def __get__(self, obj, objtype=None):
419        return Grib2Metadata(obj.section3[3], table="3.11")
420
421    def __set__(self, obj, value):
422        raise RuntimeError

Interpretation of List of Numbers

class GridDefinitionTemplateNumber:
425class GridDefinitionTemplateNumber:
426    """[Grid Definition Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-1.shtml)"""
427
428    def __get__(self, obj, objtype=None):
429        return Grib2Metadata(obj.section3[4], table="3.1")
430
431    def __set__(self, obj, value):
432        raise RuntimeError
class GridDefinitionTemplate:
435class GridDefinitionTemplate:
436    """Grid definition template"""
437
438    def __get__(self, obj, objtype=None):
439        return obj.section3[5:]
440
441    def __set__(self, obj, value):
442        raise RuntimeError

Grid definition template

class EarthParams:
445class EarthParams:
446    """Metadata about the shape of the Earth"""
447
448    def __get__(self, obj, objtype=None):
449        if obj.section3[5] in {50, 51, 52, 1200}:
450            return None
451        return tables.get_table("earth_params")[str(obj.section3[5])]
452
453    def __set__(self, obj, value):
454        raise RuntimeError

Metadata about the shape of the Earth

class DxSign:
457class DxSign:
458    """Sign of Grid Length in X-Direction"""
459
460    def __get__(self, obj, objtype=None):
461        if obj.section3[4] in {0, 1, 203, 205, 32768, 32769} and obj.section3[17] > obj.section3[20]:
462            return -1.0
463        return 1.0
464
465    def __set__(self, obj, value):
466        raise RuntimeError

Sign of Grid Length in X-Direction

class DySign:
469class DySign:
470    """Sign of Grid Length in Y-Direction"""
471
472    def __get__(self, obj, objtype=None):
473        if obj.section3[4] in {0, 1, 203, 205, 32768, 32769} and obj.section3[16] > obj.section3[19]:
474            return -1.0
475        return 1.0
476
477    def __set__(self, obj, value):
478        raise RuntimeError

Sign of Grid Length in Y-Direction

class LLScaleFactor:
481class LLScaleFactor:
482    """Scale Factor for Lats/Lons"""
483
484    def __get__(self, obj, objtype=None):
485        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
486            llscalefactor = float(obj.section3[14])
487            if llscalefactor == 0:
488                return 1
489            return llscalefactor
490        return 1
491
492    def __set__(self, obj, value):
493        raise RuntimeError

Scale Factor for Lats/Lons

class LLDivisor:
496class LLDivisor:
497    """Divisor Value for scaling Lats/Lons"""
498
499    def __get__(self, obj, objtype=None):
500        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
501            lldivisor = float(obj.section3[15])
502            if lldivisor <= 0:
503                return 1.0e6
504            return lldivisor
505        return 1.0e6
506
507    def __set__(self, obj, value):
508        raise RuntimeError

Divisor Value for scaling Lats/Lons

class XYDivisor:
511class XYDivisor:
512    """Divisor Value for scaling grid lengths"""
513
514    def __get__(self, obj, objtype=None):
515        if obj.section3[4] in {0, 1, 40, 41, 203, 205, 32768, 32769}:
516            return obj._lldivisor
517        return 1.0e3
518
519    def __set__(self, obj, value):
520        raise RuntimeError

Divisor Value for scaling grid lengths

class ShapeOfEarth:
523class ShapeOfEarth:
524    """[Shape of the Reference System](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-2.shtml)"""
525
526    def __get__(self, obj, objtype=None):
527        return Grib2Metadata(obj.section3[5], table="3.2")
528
529    def __set__(self, obj, value):
530        obj.section3[5] = value
class EarthShape:
533class EarthShape:
534    """Description of the shape of the Earth"""
535
536    def __get__(self, obj, objtype=None):
537        return obj._earthparams["shape"]
538
539    def __set__(self, obj, value):
540        raise RuntimeError

Description of the shape of the Earth

class EarthRadius:
543class EarthRadius:
544    """Radius of the Earth (Assumes "spherical")"""
545
546    def __get__(self, obj, objtype=None):
547        ep = obj._earthparams
548        if ep["shape"] == "spherical":
549            if ep["radius"] is None:
550                return obj.section3[7] / (10.0 ** obj.section3[6])
551            else:
552                return ep["radius"]
553        elif ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
554            return None
555
556    def __set__(self, obj, value):
557        raise RuntimeError

Radius of the Earth (Assumes "spherical")

class EarthMajorAxis:
560class EarthMajorAxis:
561    """Major Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")"""
562
563    def __get__(self, obj, objtype=None):
564        ep = obj._earthparams
565        if ep["shape"] == "spherical":
566            return None
567        elif ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
568            if ep["major_axis"] is None and ep["minor_axis"] is None:
569                return obj.section3[9] / (10.0 ** obj.section3[8])
570            else:
571                return ep["major_axis"]
572
573    def __set__(self, obj, value):
574        raise RuntimeError

Major Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")

class EarthMinorAxis:
577class EarthMinorAxis:
578    """Minor Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")"""
579
580    def __get__(self, obj, objtype=None):
581        ep = obj._earthparams
582        if ep["shape"] == "spherical":
583            return None
584        if ep["shape"] in {"ellipsoid", "oblateSpheriod"}:
585            if ep["major_axis"] is None and ep["minor_axis"] is None:
586                return obj.section3[11] / (10.0 ** obj.section3[10])
587            else:
588                return ep["minor_axis"]
589
590    def __set__(self, obj, value):
591        raise RuntimeError

Minor Axis of the Earth (Assumes "oblate spheroid" or "ellipsoid")

class Nx:
594class Nx:
595    """Number of grid points in the X-direction (generally East-West)"""
596
597    def __get__(self, obj, objtype=None):
598        return obj.section3[12]
599
600    def __set__(self, obj, value):
601        obj.section3[12] = value
602        obj.section3[1] = value * obj.section3[13]

Number of grid points in the X-direction (generally East-West)

class Ny:
605class Ny:
606    """Number of grid points in the Y-direction (generally North-South)"""
607
608    def __get__(self, obj, objtype=None):
609        return obj.section3[13]
610
611    def __set__(self, obj, value):
612        obj.section3[13] = value
613        obj.section3[1] = value * obj.section3[12]

Number of grid points in the Y-direction (generally North-South)

class ScanModeFlags:
616class ScanModeFlags:
617    """[Scanning Mode](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-4.shtml)"""
618
619    _key = {
620        0: 18,
621        1: 18,
622        10: 15,
623        20: 17,
624        30: 17,
625        31: 17,
626        40: 18,
627        41: 18,
628        90: 16,
629        110: 15,
630        203: 18,
631        204: 18,
632        205: 18,
633        32768: 18,
634        32769: 18,
635    }
636
637    def __get__(self, obj, objtype=None):
638        if obj.gdtn == 50:
639            return [None, None, None, None]
640        else:
641            return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)[0:8]
642
643    def __set__(self, obj, value):
644        obj.section3[self._key[obj.gdtn] + 5] = value
class ResolutionAndComponentFlags:
647class ResolutionAndComponentFlags:
648    """[Resolution and Component Flags](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-3.shtml)"""
649
650    _key = {
651        0: 13,
652        1: 13,
653        10: 11,
654        20: 11,
655        30: 11,
656        31: 11,
657        40: 13,
658        41: 13,
659        90: 11,
660        110: 11,
661        203: 13,
662        204: 13,
663        205: 13,
664        32768: 13,
665        32769: 13,
666    }
667
668    def __get__(self, obj, objtype=None):
669        if obj.gdtn == 50:
670            return [None for i in range(8)]
671        else:
672            return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)
673
674    def __set__(self, obj, value):
675        obj.section3[self._key[obj.gdtn] + 5] = value
class LatitudeFirstGridpoint:
678class LatitudeFirstGridpoint:
679    """Latitude of first gridpoint"""
680
681    _key = {
682        0: 11,
683        1: 11,
684        10: 9,
685        20: 9,
686        30: 9,
687        31: 9,
688        40: 11,
689        41: 11,
690        110: 9,
691        203: 11,
692        204: 11,
693        205: 11,
694        32768: 11,
695        32769: 11,
696    }
697
698    def __get__(self, obj, objtype=None):
699        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
700
701    def __set__(self, obj, value):
702        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Latitude of first gridpoint

class LongitudeFirstGridpoint:
705class LongitudeFirstGridpoint:
706    """Longitude of first gridpoint"""
707
708    _key = {
709        0: 12,
710        1: 12,
711        10: 10,
712        20: 10,
713        30: 10,
714        31: 10,
715        40: 12,
716        41: 12,
717        110: 10,
718        203: 12,
719        204: 12,
720        205: 12,
721        32768: 12,
722        32769: 12,
723    }
724
725    def __get__(self, obj, objtype=None):
726        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
727
728    def __set__(self, obj, value):
729        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Longitude of first gridpoint

class LatitudeLastGridpoint:
732class LatitudeLastGridpoint:
733    """Latitude of last gridpoint"""
734
735    _key = {
736        0: 14,
737        1: 14,
738        10: 13,
739        40: 14,
740        41: 14,
741        203: 14,
742        204: 14,
743        205: 14,
744        32768: 14,
745        32769: 19,
746    }
747
748    def __get__(self, obj, objtype=None):
749        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
750
751    def __set__(self, obj, value):
752        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Latitude of last gridpoint

class LongitudeLastGridpoint:
755class LongitudeLastGridpoint:
756    """Longitude of last gridpoint"""
757
758    _key = {
759        0: 15,
760        1: 15,
761        10: 14,
762        40: 15,
763        41: 15,
764        203: 15,
765        204: 15,
766        205: 15,
767        32768: 15,
768        32769: 20,
769    }
770
771    def __get__(self, obj, objtype=None):
772        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
773
774    def __set__(self, obj, value):
775        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Longitude of last gridpoint

class LatitudeCenterGridpoint:
778class LatitudeCenterGridpoint:
779    """Latitude of center gridpoint"""
780
781    _key = {32768: 14, 32769: 14}
782
783    def __get__(self, obj, objtype=None):
784        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
785
786    def __set__(self, obj, value):
787        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Latitude of center gridpoint

class LongitudeCenterGridpoint:
790class LongitudeCenterGridpoint:
791    """Longitude of center gridpoint"""
792
793    _key = {32768: 15, 32769: 15}
794
795    def __get__(self, obj, objtype=None):
796        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
797
798    def __set__(self, obj, value):
799        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Longitude of center gridpoint

class GridlengthXDirection:
802class GridlengthXDirection:
803    """Grid lenth in the X-Direction"""
804
805    _key = {
806        0: 16,
807        1: 16,
808        10: 17,
809        20: 14,
810        30: 14,
811        31: 14,
812        40: 16,
813        41: 16,
814        203: 16,
815        204: 16,
816        205: 16,
817        32768: 16,
818        32769: 16,
819    }
820
821    def __get__(self, obj, objtype=None):
822        return (obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._xydivisor) * obj._dxsign
823
824    def __set__(self, obj, value):
825        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._xydivisor / obj._llscalefactor)

Grid lenth in the X-Direction

class GridlengthYDirection:
828class GridlengthYDirection:
829    """Grid lenth in the Y-Direction"""
830
831    _key = {
832        0: 17,
833        1: 17,
834        10: 18,
835        20: 15,
836        30: 15,
837        31: 15,
838        203: 17,
839        204: 17,
840        205: 17,
841        32768: 17,
842        32769: 17,
843    }
844
845    def __get__(self, obj, objtype=None):
846        if obj.gdtn in {40, 41}:
847            return obj.gridlengthXDirection
848        else:
849            return (obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._xydivisor) * obj._dysign
850
851    def __set__(self, obj, value):
852        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._xydivisor / obj._llscalefactor)

Grid lenth in the Y-Direction

class NumberOfParallels:
855class NumberOfParallels:
856    """Number of parallels between a pole and the equator"""
857
858    _key = {40: 17, 41: 17}
859
860    def __get__(self, obj, objtype=None):
861        return obj.section3[self._key[obj.gdtn] + 5]
862
863    def __set__(self, obj, value):
864        raise RuntimeError

Number of parallels between a pole and the equator

class LatitudeSouthernPole:
867class LatitudeSouthernPole:
868    """Latitude of the Southern Pole for a Rotated Lat/Lon Grid"""
869
870    _key = {1: 19, 30: 20, 31: 20, 41: 19}
871
872    def __get__(self, obj, objtype=None):
873        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
874
875    def __set__(self, obj, value):
876        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Latitude of the Southern Pole for a Rotated Lat/Lon Grid

class LongitudeSouthernPole:
879class LongitudeSouthernPole:
880    """Longitude of the Southern Pole for a Rotated Lat/Lon Grid"""
881
882    _key = {1: 20, 30: 21, 31: 21, 41: 20}
883
884    def __get__(self, obj, objtype=None):
885        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
886
887    def __set__(self, obj, value):
888        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Longitude of the Southern Pole for a Rotated Lat/Lon Grid

class AnglePoleRotation:
891class AnglePoleRotation:
892    """Angle of Pole Rotation for a Rotated Lat/Lon Grid"""
893
894    _key = {1: 21, 41: 21}
895
896    def __get__(self, obj, objtype=None):
897        return obj.section3[self._key[obj.gdtn] + 5]
898
899    def __set__(self, obj, value):
900        obj.section3[self._key[obj.gdtn] + 5] = int(value)

Angle of Pole Rotation for a Rotated Lat/Lon Grid

class LatitudeTrueScale:
903class LatitudeTrueScale:
904    """Latitude at which grid lengths are specified"""
905
906    _key = {10: 12, 20: 12, 30: 12, 31: 12}
907
908    def __get__(self, obj, objtype=None):
909        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
910
911    def __set__(self, obj, value):
912        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Latitude at which grid lengths are specified

class GridOrientation:
915class GridOrientation:
916    """Longitude at which the grid is oriented"""
917
918    _key = {10: 16, 20: 13, 30: 13, 31: 13}
919
920    def __get__(self, obj, objtype=None):
921        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
922
923    def __set__(self, obj, value):
924        if obj.gdtn == 10 and (value < 0 or value > 90):
925            raise ValueError("Grid orientation is limited to range of 0 to 90 degrees.")
926        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Longitude at which the grid is oriented

class ProjectionCenterFlag:
929class ProjectionCenterFlag:
930    """[Projection Center](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table3-5.shtml)"""
931
932    _key = {20: 16, 30: 16, 31: 16}
933
934    def __get__(self, obj, objtype=None):
935        return utils.int2bin(obj.section3[self._key[obj.gdtn] + 5], output=list)[0]
936
937    def __set__(self, obj, value):
938        obj.section3[self._key[obj.gdtn] + 5] = value
class StandardLatitude1:
941class StandardLatitude1:
942    """First Standard Latitude (from the pole at which the secant cone cuts the sphere)"""
943
944    _key = {30: 18, 31: 18}
945
946    def __get__(self, obj, objtype=None):
947        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
948
949    def __set__(self, obj, value):
950        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

First Standard Latitude (from the pole at which the secant cone cuts the sphere)

class StandardLatitude2:
953class StandardLatitude2:
954    """Second Standard Latitude (from the pole at which the secant cone cuts the sphere)"""
955
956    _key = {30: 19, 31: 19}
957
958    def __get__(self, obj, objtype=None):
959        return obj._llscalefactor * obj.section3[self._key[obj.gdtn] + 5] / obj._lldivisor
960
961    def __set__(self, obj, value):
962        obj.section3[self._key[obj.gdtn] + 5] = int(value * obj._lldivisor / obj._llscalefactor)

Second Standard Latitude (from the pole at which the secant cone cuts the sphere)

class SpectralFunctionParameters:
965class SpectralFunctionParameters:
966    """Spectral Function Parameters"""
967
968    def __get__(self, obj, objtype=None):
969        return obj.section3[0:3]
970
971    def __set__(self, obj, value):
972        obj.section3[0:3] = value[0:3]

Spectral Function Parameters

class ProjParameters:
 975class ProjParameters:
 976    """PROJ Parameters to define the reference system"""
 977
 978    def __get__(self, obj, objtype=None):
 979        projparams = {}
 980        projparams["a"] = 1.0
 981        projparams["b"] = 1.0
 982        if obj.earthRadius is not None:
 983            projparams["a"] = float(obj.earthRadius)
 984            projparams["b"] = float(obj.earthRadius)
 985        else:
 986            if obj.earthMajorAxis is not None:
 987                projparams["a"] = float(obj.earthMajorAxis)
 988            if obj.earthMajorAxis is not None:
 989                projparams["b"] = float(obj.earthMinorAxis)
 990        if obj.gdtn == 0:
 991            projparams["proj"] = "longlat"
 992        elif obj.gdtn == 1:
 993            projparams["o_proj"] = "longlat"
 994            projparams["proj"] = "ob_tran"
 995            projparams["o_lat_p"] = float(-1.0 * obj.latitudeSouthernPole)
 996            projparams["o_lon_p"] = float(obj.anglePoleRotation)
 997            projparams["lon_0"] = float(obj.longitudeSouthernPole)
 998        elif obj.gdtn == 10:
 999            projparams["proj"] = "merc"
1000            projparams["lat_ts"] = float(obj.latitudeTrueScale)
1001            projparams["lon_0"] = 0.0
1002        elif obj.gdtn == 20:
1003            if obj.projectionCenterFlag == 0:
1004                lat0 = 90.0
1005            elif obj.projectionCenterFlag == 1:
1006                lat0 = -90.0
1007            projparams["proj"] = "stere"
1008            projparams["lat_ts"] = float(obj.latitudeTrueScale)
1009            projparams["lat_0"] = lat0
1010            projparams["lon_0"] = float(obj.gridOrientation)
1011        elif obj.gdtn == 30:
1012            projparams["proj"] = "lcc"
1013            projparams["lat_1"] = float(obj.standardLatitude1)
1014            projparams["lat_2"] = float(obj.standardLatitude2)
1015            projparams["lat_0"] = float(obj.latitudeTrueScale)
1016            projparams["lon_0"] = float(obj.gridOrientation)
1017        elif obj.gdtn == 31:
1018            projparams["proj"] = "aea"
1019            projparams["lat_1"] = float(obj.standardLatitude1)
1020            projparams["lat_2"] = float(obj.standardLatitude2)
1021            projparams["lat_0"] = float(obj.latitudeTrueScale)
1022            projparams["lon_0"] = float(obj.gridOrientation)
1023        elif obj.gdtn == 40:
1024            projparams["proj"] = "eqc"
1025        elif obj.gdtn == 32769:
1026            projparams["proj"] = "aeqd"
1027            projparams["lon_0"] = float(obj.longitudeCenterGridpoint)
1028            projparams["lat_0"] = float(obj.latitudeCenterGridpoint)
1029        return projparams
1030
1031    def __set__(self, obj, value):
1032        raise RuntimeError

PROJ Parameters to define the reference system

@dataclass(init=False)
class GridDefinitionTemplate0:
1035@dataclass(init=False)
1036class GridDefinitionTemplate0:
1037    """[Grid Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-0.shtml)"""
1038
1039    _len = 19
1040    _num = 0
1041    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1042    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1043    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1044    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1045    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1046    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1047
1048    @classmethod
1049    def _attrs(cls):
1050        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

@dataclass(init=False)
class GridDefinitionTemplate1:
1053@dataclass(init=False)
1054class GridDefinitionTemplate1:
1055    """[Grid Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-1.shtml)"""
1056
1057    _len = 22
1058    _num = 1
1059    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1060    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1061    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1062    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1063    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1064    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1065    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1066    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1067    anglePoleRotation: float = field(init=False, repr=False, default=AnglePoleRotation())
1068
1069    @classmethod
1070    def _attrs(cls):
1071        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

latitudeSouthernPole: float

Latitude of the Southern Pole for a Rotated Lat/Lon Grid

longitudeSouthernPole: float

Longitude of the Southern Pole for a Rotated Lat/Lon Grid

anglePoleRotation: float

Angle of Pole Rotation for a Rotated Lat/Lon Grid

@dataclass(init=False)
class GridDefinitionTemplate10:
1074@dataclass(init=False)
1075class GridDefinitionTemplate10:
1076    """[Grid Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-10.shtml)"""
1077
1078    _len = 19
1079    _num = 10
1080    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1081    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1082    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1083    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1084    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1085    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1086    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1087    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1088    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1089
1090    @classmethod
1091    def _attrs(cls):
1092        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeTrueScale: float

Latitude at which grid lengths are specified

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

gridOrientation: float

Longitude at which the grid is oriented

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

projParameters: dict

PROJ Parameters to define the reference system

@dataclass(init=False)
class GridDefinitionTemplate20:
1095@dataclass(init=False)
1096class GridDefinitionTemplate20:
1097    """[Grid Definition Template 20](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-20.shtml)"""
1098
1099    _len = 18
1100    _num = 20
1101    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1102    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1103    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1104    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1105    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1106    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1107    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1108    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1109
1110    @classmethod
1111    def _attrs(cls):
1112        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeTrueScale: float

Latitude at which grid lengths are specified

gridOrientation: float

Longitude at which the grid is oriented

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

projectionCenterFlag: list
projParameters: dict

PROJ Parameters to define the reference system

@dataclass(init=False)
class GridDefinitionTemplate30:
1115@dataclass(init=False)
1116class GridDefinitionTemplate30:
1117    """[Grid Definition Template 30](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-30.shtml)"""
1118
1119    _len = 22
1120    _num = 30
1121    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1122    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1123    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1124    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1125    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1126    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1127    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1128    standardLatitude1: float = field(init=False, repr=False, default=StandardLatitude1())
1129    standardLatitude2: float = field(init=False, repr=False, default=StandardLatitude2())
1130    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1131    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1132    projParameters: dict = field(init=False, repr=False, default=ProjParameters())
1133
1134    @classmethod
1135    def _attrs(cls):
1136        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeTrueScale: float

Latitude at which grid lengths are specified

gridOrientation: float

Longitude at which the grid is oriented

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

projectionCenterFlag: list
standardLatitude1: float

First Standard Latitude (from the pole at which the secant cone cuts the sphere)

standardLatitude2: float

Second Standard Latitude (from the pole at which the secant cone cuts the sphere)

latitudeSouthernPole: float

Latitude of the Southern Pole for a Rotated Lat/Lon Grid

longitudeSouthernPole: float

Longitude of the Southern Pole for a Rotated Lat/Lon Grid

projParameters: dict

PROJ Parameters to define the reference system

@dataclass(init=False)
class GridDefinitionTemplate31:
1139@dataclass(init=False)
1140class GridDefinitionTemplate31:
1141    """[Grid Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-31.shtml)"""
1142
1143    _len = 22
1144    _num = 31
1145    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1146    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1147    latitudeTrueScale: float = field(init=False, repr=False, default=LatitudeTrueScale())
1148    gridOrientation: float = field(init=False, repr=False, default=GridOrientation())
1149    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1150    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1151    projectionCenterFlag: list = field(init=False, repr=False, default=ProjectionCenterFlag())
1152    standardLatitude1: float = field(init=False, repr=False, default=StandardLatitude1())
1153    standardLatitude2: float = field(init=False, repr=False, default=StandardLatitude2())
1154    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1155    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1156
1157    @classmethod
1158    def _attrs(cls):
1159        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeTrueScale: float

Latitude at which grid lengths are specified

gridOrientation: float

Longitude at which the grid is oriented

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

projectionCenterFlag: list
standardLatitude1: float

First Standard Latitude (from the pole at which the secant cone cuts the sphere)

standardLatitude2: float

Second Standard Latitude (from the pole at which the secant cone cuts the sphere)

latitudeSouthernPole: float

Latitude of the Southern Pole for a Rotated Lat/Lon Grid

longitudeSouthernPole: float

Longitude of the Southern Pole for a Rotated Lat/Lon Grid

@dataclass(init=False)
class GridDefinitionTemplate40:
1162@dataclass(init=False)
1163class GridDefinitionTemplate40:
1164    """[Grid Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-40.shtml)"""
1165
1166    _len = 19
1167    _num = 40
1168    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1169    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1170    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1171    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1172    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1173    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1174    numberOfParallels: int = field(init=False, repr=False, default=NumberOfParallels())
1175
1176    @classmethod
1177    def _attrs(cls):
1178        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

numberOfParallels: int

Number of parallels between a pole and the equator

@dataclass(init=False)
class GridDefinitionTemplate41:
1181@dataclass(init=False)
1182class GridDefinitionTemplate41:
1183    """[Grid Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-41.shtml)"""
1184
1185    _len = 22
1186    _num = 41
1187    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1188    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1189    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1190    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1191    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1192    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1193    numberOfParallels: int = field(init=False, repr=False, default=NumberOfParallels())
1194    latitudeSouthernPole: float = field(init=False, repr=False, default=LatitudeSouthernPole())
1195    longitudeSouthernPole: float = field(init=False, repr=False, default=LongitudeSouthernPole())
1196    anglePoleRotation: float = field(init=False, repr=False, default=AnglePoleRotation())
1197
1198    @classmethod
1199    def _attrs(cls):
1200        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

numberOfParallels: int

Number of parallels between a pole and the equator

latitudeSouthernPole: float

Latitude of the Southern Pole for a Rotated Lat/Lon Grid

longitudeSouthernPole: float

Longitude of the Southern Pole for a Rotated Lat/Lon Grid

anglePoleRotation: float

Angle of Pole Rotation for a Rotated Lat/Lon Grid

@dataclass(init=False)
class GridDefinitionTemplate50:
1203@dataclass(init=False)
1204class GridDefinitionTemplate50:
1205    """[Grid Definition Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-50.shtml)"""
1206
1207    _len = 5
1208    _num = 50
1209    spectralFunctionParameters: list = field(init=False, repr=False, default=SpectralFunctionParameters())
1210
1211    @classmethod
1212    def _attrs(cls):
1213        return list(cls.__dataclass_fields__.keys())
spectralFunctionParameters: list

Spectral Function Parameters

@dataclass(init=False)
class GridDefinitionTemplate32768:
1216@dataclass(init=False)
1217class GridDefinitionTemplate32768:
1218    """[Grid Definition Template 32768](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-32768.shtml)"""
1219
1220    _len = 19
1221    _num = 32768
1222    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1223    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1224    latitudeCenterGridpoint: float = field(init=False, repr=False, default=LatitudeCenterGridpoint())
1225    longitudeCenterGridpoint: float = field(init=False, repr=False, default=LongitudeCenterGridpoint())
1226    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1227    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1228
1229    @classmethod
1230    def _attrs(cls):
1231        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeCenterGridpoint: float

Latitude of center gridpoint

longitudeCenterGridpoint: float

Longitude of center gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

@dataclass(init=False)
class GridDefinitionTemplate32769:
1234@dataclass(init=False)
1235class GridDefinitionTemplate32769:
1236    """[Grid Definition Template 32769](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp3-32769.shtml)"""
1237
1238    _len = 19
1239    _num = 32769
1240    latitudeFirstGridpoint: float = field(init=False, repr=False, default=LatitudeFirstGridpoint())
1241    longitudeFirstGridpoint: float = field(init=False, repr=False, default=LongitudeFirstGridpoint())
1242    latitudeCenterGridpoint: float = field(init=False, repr=False, default=LatitudeCenterGridpoint())
1243    longitudeCenterGridpoint: float = field(init=False, repr=False, default=LongitudeCenterGridpoint())
1244    gridlengthXDirection: float = field(init=False, repr=False, default=GridlengthXDirection())
1245    gridlengthYDirection: float = field(init=False, repr=False, default=GridlengthYDirection())
1246    latitudeLastGridpoint: float = field(init=False, repr=False, default=LatitudeLastGridpoint())
1247    longitudeLastGridpoint: float = field(init=False, repr=False, default=LongitudeLastGridpoint())
1248
1249    @classmethod
1250    def _attrs(cls):
1251        return list(cls.__dataclass_fields__.keys())
latitudeFirstGridpoint: float

Latitude of first gridpoint

longitudeFirstGridpoint: float

Longitude of first gridpoint

latitudeCenterGridpoint: float

Latitude of center gridpoint

longitudeCenterGridpoint: float

Longitude of center gridpoint

gridlengthXDirection: float

Grid lenth in the X-Direction

gridlengthYDirection: float

Grid lenth in the Y-Direction

latitudeLastGridpoint: float

Latitude of last gridpoint

longitudeLastGridpoint: float

Longitude of last gridpoint

def gdt_class_by_gdtn(gdtn: int):
1269def gdt_class_by_gdtn(gdtn: int):
1270    """
1271    Provides a Grid Definition Template class via the template number
1272
1273    Parameters
1274    ----------
1275    gdtn
1276        Grid definition template number.
1277
1278    Returns
1279    -------
1280    gdt_class_by_gdtn
1281        Grid definition template class object (not an instance).
1282    """
1283    return _gdt_by_gdtn[gdtn]

Provides a Grid Definition Template class via the template number

Parameters
  • gdtn: Grid definition template number.
Returns
  • gdt_class_by_gdtn: Grid definition template class object (not an instance).
class ProductDefinitionTemplateNumber:
1289class ProductDefinitionTemplateNumber:
1290    """[Product Definition Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-0.shtml)"""
1291
1292    def __get__(self, obj, objtype=None):
1293        return Grib2Metadata(obj.section4[1], table="4.0")
1294
1295    def __set__(self, obj, value):
1296        raise RuntimeError
class ProductDefinitionTemplate:
1300class ProductDefinitionTemplate:
1301    """Product Definition Template"""
1302
1303    def __get__(self, obj, objtype=None):
1304        return obj.section4[2:]
1305
1306    def __set__(self, obj, value):
1307        raise RuntimeError

Product Definition Template

class ParameterCategory:
1310class ParameterCategory:
1311    """[Parameter Category](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-1.shtml)"""
1312
1313    _key = defaultdict(lambda: 0)
1314
1315    def __get__(self, obj, objtype=None):
1316        return obj.section4[0 + 2]
1317
1318    def __set__(self, obj, value):
1319        obj.section4[self._key[obj.pdtn] + 2] = value
class ParameterNumber:
1322class ParameterNumber:
1323    """[Parameter Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-2.shtml)"""
1324
1325    _key = defaultdict(lambda: 1)
1326
1327    def __get__(self, obj, objtype=None):
1328        return obj.section4[1 + 2]
1329
1330    def __set__(self, obj, value):
1331        obj.section4[self._key[obj.pdtn] + 2] = value
class ParameterUnits:
1334class ParameterUnits:
1335    """Native units as described by the GRIB2 Discipline, Parameter Category, and Parameter Number"""
1336
1337    def __get__(self, obj, objtype=None):
1338        return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[1]
1339
1340    def __set__(self, obj, value):
1341        raise RuntimeError(
1342            "Cannot set the units of the message.  Instead set shortName OR set the appropriate discipline, parameterCategory, and parameterNumber.  The units will be set automatically from these other attributes."
1343        )

Native units as described by the GRIB2 Discipline, Parameter Category, and Parameter Number

class VarInfo:
1346class VarInfo:
1347    """
1348    Variable Information.
1349
1350    These are the metadata returned for a specific variable according to
1351    discipline, parameter category, and parameter number.
1352    """
1353
1354    def __get__(self, obj, objtype=None):
1355        return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)
1356
1357    def __set__(self, obj, value):
1358        raise RuntimeError

Variable Information.

These are the metadata returned for a specific variable according to discipline, parameter category, and parameter number.

class FullName:
1361class FullName:
1362    """Full name of the Variable."""
1363
1364    def __get__(self, obj, objtype=None):
1365        full_name = []
1366
1367        # Get aerosol type from table 4.233
1368        if not hasattr(obj, "typeOfAerosol"):
1369            return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[0]
1370        elif obj.typeOfAerosol is not None:
1371            aero_type = str(obj.typeOfAerosol.value)
1372            if aero_type in tables.table_4_233:
1373                full_name.append(tables.table_4_233[aero_type][0])
1374
1375            # Get base name from GRIB2 table
1376            base_name = tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[0]
1377            full_name.append(base_name)
1378
1379            # Add optical properties with wavelengths if present
1380            if hasattr(obj, "scaledValueOfFirstWavelength"):
1381                optical_type = str(obj.parameterNumber)
1382                first_wl = obj.scaledValueOfFirstWavelength
1383                second_wl = getattr(obj, "scaledValueOfSecondWavelength", None)
1384
1385                # Special case for AE between 440-870nm
1386                if optical_type == "111" and first_wl == 440 and second_wl == 870:
1387                    full_name.append("at 440-870nm")
1388
1389                # Handle wavelength-specific optical properties
1390                elif optical_type in ["102", "103", "104", "105", "106"]:
1391                    wavelength = f"{first_wl}nm"
1392                    if second_wl:
1393                        wavelength = f"{first_wl}-{second_wl}nm"
1394                    full_name.append(f"at {wavelength}")
1395
1396            final = " ".join(full_name)
1397
1398            return final.replace("Aerosol Aerosol", "Aerosol")
1399
1400    def __set__(self, obj, value):
1401        raise RuntimeError(
1402            "Cannot set the fullName of the message. Instead set shortName OR set the appropriate discipline, "
1403            "parameterCategory, and parameterNumber. The fullName will be set automatically from these other attributes."
1404        )

Full name of the Variable.

class Units:
1407class Units:
1408    """Units of the Variable."""
1409
1410    def __get__(self, obj, objtype=None):
1411        units = obj.parameterUnits
1412        if obj.pdtn in {2}:
1413            if obj.typeOfDerivedForecast.value in {2, 3, 4}:
1414                units = f"delta_{obj.parameterUnits}"
1415        elif obj.pdtn in {5, 9}:
1416            units = "%"
1417        return units
1418
1419    def __set__(self, obj, value):
1420        raise RuntimeError(
1421            "Cannot set the units of the message.  Instead set shortName OR set the appropriate discipline, parameterCategory, and parameterNumber.  The units will be set automatically from these other attributes."
1422        )

Units of the Variable.

class ShortName:
1425class ShortName:
1426    """Short name of the variable (i.e. the variable abbreviation)."""
1427
1428    def __get__(self, obj, objtype=None):
1429        if obj._isAerosol:
1430            return tables._build_aerosol_shortname(obj)
1431        elif obj._isChemical:
1432            return tables._build_chemical_shortname(obj)
1433        else:
1434            return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[2]
1435
1436    def __set__(self, obj, value):
1437        metadata = tables.get_metadata_from_shortname(value)
1438        if len(metadata) > 1:
1439            raise ValueError(
1440                f"shortName={value} is ambiguous within the GRIB2 standard and you have to set instead with discipline, parameterCategory, and parameterNumber.\n{metadata}"
1441            )
1442        for attr, val in metadata[0].items():
1443            if attr in ["fullName", "units"]:
1444                continue
1445            setattr(obj, attr, val)

Short name of the variable (i.e. the variable abbreviation).

class TypeOfGeneratingProcess:
1448class TypeOfGeneratingProcess:
1449    """[Type of Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-3.shtml)"""
1450
1451    _key = defaultdict(lambda: 2, {48: 13})
1452
1453    def __get__(self, obj, objtype=None):
1454        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.3")
1455
1456    def __set__(self, obj, value):
1457        obj.section4[self._key[obj.pdtn] + 2] = value
class BackgroundGeneratingProcessIdentifier:
1460class BackgroundGeneratingProcessIdentifier:
1461    """Background Generating Process Identifier"""
1462
1463    _key = defaultdict(lambda: 3, {48: 14})
1464
1465    def __get__(self, obj, objtype=None):
1466        return obj.section4[self._key[obj.pdtn] + 2]
1467
1468    def __set__(self, obj, value):
1469        obj.section4[self._key[obj.pdtn] + 2] = value

Background Generating Process Identifier

class GeneratingProcess:
1472class GeneratingProcess:
1473    """[Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablea.html)"""
1474
1475    _key = defaultdict(lambda: 4, {48: 15})
1476
1477    def __get__(self, obj, objtype=None):
1478        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="generating_process")
1479
1480    def __set__(self, obj, value):
1481        obj.section4[self._key[obj.pdtn] + 2] = value
class HoursAfterDataCutoff:
1484class HoursAfterDataCutoff:
1485    """Hours of observational data cutoff after reference time."""
1486
1487    _key = defaultdict(lambda: 5, {48: 16})
1488
1489    def __get__(self, obj, objtype=None):
1490        return obj.section4[self._key[obj.pdtn] + 2]
1491
1492    def __set__(self, obj, value):
1493        obj.section4[self._key[obj.pdtn] + 2] = value

Hours of observational data cutoff after reference time.

class MinutesAfterDataCutoff:
1496class MinutesAfterDataCutoff:
1497    """Minutes of observational data cutoff after reference time."""
1498
1499    _key = defaultdict(lambda: 6, {48: 17})
1500
1501    def __get__(self, obj, objtype=None):
1502        return obj.section4[self._key[obj.pdtn] + 2]
1503
1504    def __set__(self, obj, value):
1505        obj.section4[self._key[obj.pdtn] + 2] = value

Minutes of observational data cutoff after reference time.

class UnitOfForecastTime:
1508class UnitOfForecastTime:
1509    """[Units of Forecast Time](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
1510
1511    _key = defaultdict(lambda: 7, {48: 18})
1512
1513    def __get__(self, obj, objtype=None):
1514        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.4")
1515
1516    def __set__(self, obj, value):
1517        obj.section4[self._key[obj.pdtn] + 2] = value
class ValueOfForecastTime:
1520class ValueOfForecastTime:
1521    """Value of forecast time in units defined by `UnitofForecastTime`."""
1522
1523    _key = defaultdict(lambda: 8, {48: 19})
1524
1525    def __get__(self, obj, objtype=None):
1526        return obj.section4[self._key[obj.pdtn] + 2]
1527
1528    def __set__(self, obj, value):
1529        obj.section4[self._key[obj.pdtn] + 2] = value

Value of forecast time in units defined by UnitofForecastTime.

class LeadTime:
1532class LeadTime:
1533    """Forecast Lead Time. NOTE: This is a `datetime.timedelta` object."""
1534
1535    _key = ValueOfForecastTime._key
1536
1537    def __get__(self, obj, objtype=None):
1538        return utils.get_leadtime(obj.section4[1], obj.section4[2:]) + obj.duration
1539
1540    def __set__(self, obj, value):
1541        if isinstance(value, np.timedelta64):
1542            # Allows setting from xarray
1543            value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
1544        # First update validDate if necessary.
1545        # IMPORTANT: Update validDate components when message is time interval
1546        if obj.pdtn in _timeinterval_pdtns:
1547            vd = obj.refDate + value
1548            obj.yearOfEndOfTimePeriod = vd.year
1549            obj.monthOfEndOfTimePeriod = vd.month
1550            obj.dayOfEndOfTimePeriod = vd.day
1551            obj.hourOfEndOfTimePeriod = vd.hour
1552            obj.minuteOfEndOfTimePeriod = vd.minute
1553            obj.secondOfEndOfTimePeriod = vd.second
1554        # Update leadTime component in section4
1555        value -= obj.duration
1556        obj.section4[self._key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)

Forecast Lead Time. NOTE: This is a datetime.timedelta object.

class FixedSfc1Info:
1559class FixedSfc1Info:
1560    """Information of the first fixed surface via [table 4.5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1561
1562    _key = defaultdict(lambda: 9, {48: 20})
1563
1564    def __get__(self, obj, objtype=None):
1565        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1566            return [None, None]
1567        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1568
1569    def __set__(self, obj, value):
1570        raise NotImplementedError

Information of the first fixed surface via table 4.5

class FixedSfc2Info:
1573class FixedSfc2Info:
1574    """Information of the second fixed surface via [table 4.5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1575
1576    _key = defaultdict(lambda: 12, {48: 23})
1577
1578    def __get__(self, obj, objtype=None):
1579        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1580            return [None, None]
1581        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1582
1583    def __set__(self, obj, value):
1584        raise NotImplementedError

Information of the second fixed surface via table 4.5

class TypeOfFirstFixedSurface:
1587class TypeOfFirstFixedSurface:
1588    """[Type of First Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1589
1590    _key = defaultdict(
1591        lambda: 9,
1592        {
1593            40: 10,
1594            41: 10,
1595            42: 10,
1596            43: 10,
1597            44: 10,
1598            45: 10,
1599            46: 10,
1600            47: 10,
1601            48: 20,
1602            49: 20,
1603            57: 10,
1604            58: 10,
1605            67: 10,
1606            68: 10,
1607            76: 10,
1608            77: 10,
1609            78: 10,
1610            79: 10,
1611            80: 20,
1612            81: 20,
1613            82: 20,
1614            83: 20,
1615            84: 20,
1616            85: 20,
1617        },
1618    )
1619
1620    def __get__(self, obj, objtype=None):
1621        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1622
1623    def __set__(self, obj, value):
1624        obj.section4[self._key[obj.pdtn] + 2] = value
class ScaleFactorOfFirstFixedSurface:
1627class ScaleFactorOfFirstFixedSurface:
1628    """Scale Factor of First Fixed Surface"""
1629
1630    _key = defaultdict(
1631        lambda: 10,
1632        {
1633            40: 11,
1634            41: 11,
1635            42: 11,
1636            43: 11,
1637            44: 11,
1638            45: 11,
1639            46: 11,
1640            47: 11,
1641            48: 21,
1642            49: 21,
1643            57: 11,
1644            58: 11,
1645            67: 11,
1646            68: 11,
1647            76: 11,
1648            77: 11,
1649            78: 11,
1650            79: 11,
1651            80: 21,
1652            81: 21,
1653            82: 21,
1654            83: 21,
1655            84: 21,
1656            85: 21,
1657        },
1658    )
1659
1660    def __get__(self, obj, objtype=None):
1661        return obj.section4[self._key[obj.pdtn] + 2]
1662
1663    def __set__(self, obj, value):
1664        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of First Fixed Surface

class ScaledValueOfFirstFixedSurface:
1667class ScaledValueOfFirstFixedSurface:
1668    """Scaled Value Of First Fixed Surface"""
1669
1670    _key = defaultdict(
1671        lambda: 11,
1672        {
1673            40: 12,
1674            41: 12,
1675            42: 12,
1676            43: 12,
1677            44: 12,
1678            45: 12,
1679            46: 12,
1680            47: 12,
1681            48: 22,
1682            49: 22,
1683            57: 12,
1684            58: 12,
1685            67: 12,
1686            68: 12,
1687            76: 12,
1688            77: 12,
1689            78: 12,
1690            79: 12,
1691            80: 22,
1692            81: 22,
1693            82: 22,
1694            83: 22,
1695            84: 22,
1696            85: 22,
1697        },
1698    )
1699
1700    def __get__(self, obj, objtype=None):
1701        return obj.section4[self._key[obj.pdtn] + 2]
1702
1703    def __set__(self, obj, value):
1704        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value Of First Fixed Surface

class UnitOfFirstFixedSurface:
1707class UnitOfFirstFixedSurface:
1708    """Units of First Fixed Surface"""
1709
1710    def __get__(self, obj, objtype=None):
1711        return obj._fixedsfc1info[1]
1712
1713    def __set__(self, obj, value):
1714        pass

Units of First Fixed Surface

class ValueOfFirstFixedSurface:
1717class ValueOfFirstFixedSurface:
1718    """Value of First Fixed Surface"""
1719
1720    def __get__(self, obj, objtype=None):
1721        scale_factor = getattr(obj, "scaleFactorOfFirstFixedSurface")
1722        scaled_value = getattr(obj, "scaledValueOfFirstFixedSurface")
1723        if scale_factor < 0:
1724            return 0.0
1725        else:
1726            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1727
1728    def __set__(self, obj, value):
1729        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1730        setattr(obj, "scaleFactorOfFirstFixedSurface", scale_factor)
1731        setattr(obj, "scaledValueOfFirstFixedSurface", scaled_value)

Value of First Fixed Surface

class TypeOfSecondFixedSurface:
1734class TypeOfSecondFixedSurface:
1735    """[Type of Second Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1736
1737    _key = defaultdict(
1738        lambda: 12,
1739        {
1740            40: 13,
1741            41: 13,
1742            42: 13,
1743            43: 13,
1744            44: 13,
1745            45: 13,
1746            46: 13,
1747            47: 13,
1748            48: 23,
1749            49: 23,
1750            57: 13,
1751            58: 13,
1752            67: 13,
1753            68: 13,
1754            76: 13,
1755            77: 13,
1756            78: 13,
1757            79: 13,
1758            80: 23,
1759            81: 23,
1760            82: 23,
1761            83: 23,
1762            84: 23,
1763            85: 23,
1764        },
1765    )
1766
1767    def __get__(self, obj, objtype=None):
1768        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1769
1770    def __set__(self, obj, value):
1771        obj.section4[self._key[obj.pdtn] + 2] = value
class ScaleFactorOfSecondFixedSurface:
1774class ScaleFactorOfSecondFixedSurface:
1775    """Scale Factor of Second Fixed Surface"""
1776
1777    _key = defaultdict(
1778        lambda: 13,
1779        {
1780            40: 14,
1781            41: 14,
1782            42: 14,
1783            43: 14,
1784            44: 14,
1785            45: 14,
1786            46: 14,
1787            47: 14,
1788            48: 24,
1789            49: 24,
1790            57: 14,
1791            58: 14,
1792            67: 14,
1793            68: 14,
1794            76: 14,
1795            77: 14,
1796            78: 14,
1797            79: 14,
1798            80: 24,
1799            81: 24,
1800            82: 24,
1801            83: 24,
1802            84: 24,
1803            85: 24,
1804        },
1805    )
1806
1807    def __get__(self, obj, objtype=None):
1808        return obj.section4[self._key[obj.pdtn] + 2]
1809
1810    def __set__(self, obj, value):
1811        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of Second Fixed Surface

class ScaledValueOfSecondFixedSurface:
1814class ScaledValueOfSecondFixedSurface:
1815    """Scaled Value Of Second Fixed Surface"""
1816
1817    _key = defaultdict(
1818        lambda: 14,
1819        {
1820            40: 15,
1821            41: 15,
1822            42: 15,
1823            43: 15,
1824            44: 15,
1825            45: 15,
1826            46: 15,
1827            47: 15,
1828            48: 25,
1829            49: 25,
1830            57: 15,
1831            58: 15,
1832            67: 15,
1833            68: 15,
1834            76: 15,
1835            77: 15,
1836            78: 15,
1837            79: 15,
1838            80: 25,
1839            81: 25,
1840            82: 25,
1841            83: 25,
1842            84: 25,
1843            85: 25,
1844        },
1845    )
1846
1847    def __get__(self, obj, objtype=None):
1848        return obj.section4[self._key[obj.pdtn] + 2]
1849
1850    def __set__(self, obj, value):
1851        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value Of Second Fixed Surface

class UnitOfSecondFixedSurface:
1854class UnitOfSecondFixedSurface:
1855    """Units of Second Fixed Surface"""
1856
1857    def __get__(self, obj, objtype=None):
1858        return obj._fixedsfc2info[1]
1859
1860    def __set__(self, obj, value):
1861        pass

Units of Second Fixed Surface

class ValueOfSecondFixedSurface:
1864class ValueOfSecondFixedSurface:
1865    """Value of Second Fixed Surface"""
1866
1867    def __get__(self, obj, objtype=None):
1868        scale_factor = getattr(obj, "scaleFactorOfSecondFixedSurface")
1869        scaled_value = getattr(obj, "scaledValueOfSecondFixedSurface")
1870        if scale_factor < 0:
1871            return 0.0
1872        else:
1873            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1874
1875    def __set__(self, obj, value):
1876        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1877        setattr(obj, "scaleFactorOfSecondFixedSurface", scale_factor)
1878        setattr(obj, "scaledValueOfSecondFixedSurface", scaled_value)

Value of Second Fixed Surface

class Level:
1881class Level:
1882    """Level (same as provided by [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Level.c))"""
1883
1884    def __get__(self, obj, objtype=None):
1885        return tables.get_wgrib2_level_string(obj.pdtn, obj.section4[2:])
1886
1887    def __set__(self, obj, value):
1888        pass

Level (same as provided by wgrib2)

class TypeOfEnsembleForecast:
1891class TypeOfEnsembleForecast:
1892    """[Type of Ensemble Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-6.shtml)"""
1893
1894    _key = {
1895        1: 15,
1896        11: 15,
1897        41: 16,
1898        43: 19,
1899        45: 16,
1900        47: 16,
1901        49: 26,
1902        81: 26,
1903        83: 26,
1904        84: 26,
1905        85: 26,
1906    }
1907
1908    def __get__(self, obj, objtype=None):
1909        pdtn = obj.section4[1]
1910        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.6")
1911
1912    def __set__(self, obj, value):
1913        pdtn = obj.section4[1]
1914        obj.section4[self._key[pdtn] + 2] = value
class PerturbationNumber:
1917class PerturbationNumber:
1918    """Ensemble Perturbation Number"""
1919
1920    _key = {
1921        1: 16,
1922        11: 16,
1923        41: 17,
1924        43: 20,
1925        45: 17,
1926        47: 17,
1927        49: 27,
1928        81: 27,
1929        83: 27,
1930        84: 27,
1931        85: 27,
1932    }
1933
1934    def __get__(self, obj, objtype=None):
1935        pdtn = obj.section4[1]
1936        return obj.section4[self._key[pdtn] + 2]
1937
1938    def __set__(self, obj, value):
1939        pdtn = obj.section4[1]
1940        obj.section4[self._key[pdtn] + 2] = value

Ensemble Perturbation Number

class NumberOfEnsembleForecasts:
1943class NumberOfEnsembleForecasts:
1944    """Total Number of Ensemble Forecasts"""
1945
1946    _key = {
1947        1: 17,
1948        2: 16,
1949        11: 17,
1950        12: 16,
1951        41: 18,
1952        43: 21,
1953        45: 18,
1954        47: 18,
1955        49: 28,
1956        81: 28,
1957        83: 28,
1958        84: 28,
1959        85: 28,
1960    }
1961
1962    def __get__(self, obj, objtype=None):
1963        pdtn = obj.section4[1]
1964        return obj.section4[self._key[pdtn] + 2]
1965
1966    def __set__(self, obj, value):
1967        pdtn = obj.section4[1]
1968        obj.section4[self._key[pdtn] + 2] = value

Total Number of Ensemble Forecasts

class TypeOfDerivedForecast:
1971class TypeOfDerivedForecast:
1972    """[Type of Derived Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-7.shtml)"""
1973
1974    _key = {2: 15, 12: 15}
1975
1976    def __get__(self, obj, objtype=None):
1977        pdtn = obj.section4[1]
1978        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.7")
1979
1980    def __set__(self, obj, value):
1981        pdtn = obj.section4[1]
1982        obj.section4[self._key[pdtn] + 2] = value
class ForecastProbabilityNumber:
1985class ForecastProbabilityNumber:
1986    """Forecast Probability Number"""
1987
1988    _key = {5: 15, 9: 15}
1989
1990    def __get__(self, obj, objtype=None):
1991        pdtn = obj.section4[1]
1992        return obj.section4[self._key[pdtn] + 2]
1993
1994    def __set__(self, obj, value):
1995        pdtn = obj.section4[1]
1996        obj.section4[self._key[pdtn] + 2] = value

Forecast Probability Number

class TotalNumberOfForecastProbabilities:
1999class TotalNumberOfForecastProbabilities:
2000    """Total Number of Forecast Probabilities"""
2001
2002    _key = {5: 16, 9: 16}
2003
2004    def __get__(self, obj, objtype=None):
2005        pdtn = obj.section4[1]
2006        return obj.section4[self._key[pdtn] + 2]
2007
2008    def __set__(self, obj, value):
2009        pdtn = obj.section4[1]
2010        obj.section4[self._key[pdtn] + 2] = value

Total Number of Forecast Probabilities

class TypeOfProbability:
2013class TypeOfProbability:
2014    """[Type of Probability](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-9.shtml)"""
2015
2016    _key = {5: 17, 9: 17}
2017
2018    def __get__(self, obj, objtype=None):
2019        pdtn = obj.section4[1]
2020        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.9")
2021
2022    def __set__(self, obj, value):
2023        pdtn = obj.section4[1]
2024        obj.section4[self._key[pdtn] + 2] = value
class ScaleFactorOfThresholdLowerLimit:
2027class ScaleFactorOfThresholdLowerLimit:
2028    """Scale Factor of Threshold Lower Limit"""
2029
2030    _key = {5: 18, 9: 18}
2031
2032    def __get__(self, obj, objtype=None):
2033        pdtn = obj.section4[1]
2034        return obj.section4[self._key[pdtn] + 2]
2035
2036    def __set__(self, obj, value):
2037        pdtn = obj.section4[1]
2038        obj.section4[self._key[pdtn] + 2] = value

Scale Factor of Threshold Lower Limit

class ScaledValueOfThresholdLowerLimit:
2041class ScaledValueOfThresholdLowerLimit:
2042    """Scaled Value of Threshold Lower Limit"""
2043
2044    _key = {5: 19, 9: 19}
2045
2046    def __get__(self, obj, objtype=None):
2047        pdtn = obj.section4[1]
2048        return obj.section4[self._key[pdtn] + 2]
2049
2050    def __set__(self, obj, value):
2051        pdtn = obj.section4[1]
2052        obj.section4[self._key[pdtn] + 2] = value

Scaled Value of Threshold Lower Limit

class ScaleFactorOfThresholdUpperLimit:
2055class ScaleFactorOfThresholdUpperLimit:
2056    """Scale Factor of Threshold Upper Limit"""
2057
2058    _key = {5: 20, 9: 20}
2059
2060    def __get__(self, obj, objtype=None):
2061        pdtn = obj.section4[1]
2062        return obj.section4[self._key[pdtn] + 2]
2063
2064    def __set__(self, obj, value):
2065        pdtn = obj.section4[1]
2066        obj.section4[self._key[pdtn] + 2] = value

Scale Factor of Threshold Upper Limit

class ScaledValueOfThresholdUpperLimit:
2069class ScaledValueOfThresholdUpperLimit:
2070    """Scaled Value of Threshold Upper Limit"""
2071
2072    _key = {5: 21, 9: 21}
2073
2074    def __get__(self, obj, objtype=None):
2075        pdtn = obj.section4[1]
2076        return obj.section4[self._key[pdtn] + 2]
2077
2078    def __set__(self, obj, value):
2079        pdtn = obj.section4[1]
2080        obj.section4[self._key[pdtn] + 2] = value

Scaled Value of Threshold Upper Limit

class ThresholdLowerLimit:
2083class ThresholdLowerLimit:
2084    """Threshold Lower Limit"""
2085
2086    def __get__(self, obj, objtype=None):
2087        scale_factor = getattr(obj, "scaleFactorOfThresholdLowerLimit")
2088        scaled_value = getattr(obj, "scaledValueOfThresholdLowerLimit")
2089        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2090            return 0.0
2091        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2092        return value
2093
2094    def __set__(self, obj, value):
2095        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2096        setattr(obj, "scaleFactorOfThresholdLowerLimit", scale_factor)
2097        setattr(obj, "scaledValueOfThresholdLowerLimit", scaled_value)

Threshold Lower Limit

class ThresholdUpperLimit:
2100class ThresholdUpperLimit:
2101    """Threshold Upper Limit"""
2102
2103    def __get__(self, obj, objtype=None):
2104        scale_factor = getattr(obj, "scaleFactorOfThresholdUpperLimit")
2105        scaled_value = getattr(obj, "scaledValueOfThresholdUpperLimit")
2106        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2107            return 0.0
2108        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2109        return value
2110
2111    def __set__(self, obj, value):
2112        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2113        setattr(obj, "scaleFactorOfThresholdUpperLimit", scale_factor)
2114        setattr(obj, "scaledValueOfThresholdUpperLimit", scaled_value)

Threshold Upper Limit

class Threshold:
2117class Threshold:
2118    """Threshold string (same as [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Prob.c))"""
2119
2120    def __get__(self, obj, objtype=None):
2121        return utils.get_wgrib2_prob_string(*obj.section4[17 + 2 : 22 + 2])
2122
2123    def __set__(self, obj, value):
2124        pass

Threshold string (same as wgrib2)

class PercentileValue:
2127class PercentileValue:
2128    """Percentile Value"""
2129
2130    _key = {6: 15, 10: 15}
2131
2132    def __get__(self, obj, objtype=None):
2133        pdtn = obj.section4[1]
2134        return obj.section4[self._key[pdtn] + 2]
2135
2136    def __set__(self, obj, value):
2137        pdtn = obj.section4[1]
2138        obj.section4[self._key[pdtn] + 2] = value

Percentile Value

class YearOfEndOfTimePeriod:
2141class YearOfEndOfTimePeriod:
2142    """Year of End of Forecast Time Period"""
2143
2144    _key = {8: 15, 9: 22, 10: 16, 11: 18, 12: 17, 42: 16, 43: 22, 46: 16, 82: 26}
2145
2146    def __get__(self, obj, objtype=None):
2147        pdtn = obj.section4[1]
2148        return obj.section4[self._key[pdtn] + 2]
2149
2150    def __set__(self, obj, value):
2151        pdtn = obj.section4[1]
2152        obj.section4[self._key[pdtn] + 2] = value

Year of End of Forecast Time Period

class MonthOfEndOfTimePeriod:
2155class MonthOfEndOfTimePeriod:
2156    """Month Year of End of Forecast Time Period"""
2157
2158    _key = {8: 16, 9: 23, 10: 17, 11: 19, 12: 18, 42: 17, 43: 23, 46: 17, 82: 27}
2159
2160    def __get__(self, obj, objtype=None):
2161        pdtn = obj.section4[1]
2162        return obj.section4[self._key[pdtn] + 2]
2163
2164    def __set__(self, obj, value):
2165        pdtn = obj.section4[1]
2166        obj.section4[self._key[pdtn] + 2] = value

Month Year of End of Forecast Time Period

class DayOfEndOfTimePeriod:
2169class DayOfEndOfTimePeriod:
2170    """Day Year of End of Forecast Time Period"""
2171
2172    _key = {8: 17, 9: 24, 10: 18, 11: 20, 12: 19, 42: 18, 43: 24, 46: 18, 82: 28}
2173
2174    def __get__(self, obj, objtype=None):
2175        pdtn = obj.section4[1]
2176        return obj.section4[self._key[pdtn] + 2]
2177
2178    def __set__(self, obj, value):
2179        pdtn = obj.section4[1]
2180        obj.section4[self._key[pdtn] + 2] = value

Day Year of End of Forecast Time Period

class HourOfEndOfTimePeriod:
2183class HourOfEndOfTimePeriod:
2184    """Hour Year of End of Forecast Time Period"""
2185
2186    _key = {8: 18, 9: 25, 10: 19, 11: 21, 12: 20, 42: 19, 43: 25, 46: 19, 82: 29}
2187
2188    def __get__(self, obj, objtype=None):
2189        pdtn = obj.section4[1]
2190        return obj.section4[self._key[pdtn] + 2]
2191
2192    def __set__(self, obj, value):
2193        pdtn = obj.section4[1]
2194        obj.section4[self._key[pdtn] + 2] = value

Hour Year of End of Forecast Time Period

class MinuteOfEndOfTimePeriod:
2197class MinuteOfEndOfTimePeriod:
2198    """Minute Year of End of Forecast Time Period"""
2199
2200    _key = {8: 19, 9: 26, 10: 20, 11: 22, 12: 21, 42: 20, 43: 26, 46: 20, 82: 30}
2201
2202    def __get__(self, obj, objtype=None):
2203        pdtn = obj.section4[1]
2204        return obj.section4[self._key[pdtn] + 2]
2205
2206    def __set__(self, obj, value):
2207        pdtn = obj.section4[1]
2208        obj.section4[self._key[pdtn] + 2] = value

Minute Year of End of Forecast Time Period

class SecondOfEndOfTimePeriod:
2211class SecondOfEndOfTimePeriod:
2212    """Second Year of End of Forecast Time Period"""
2213
2214    _key = {8: 20, 9: 27, 10: 21, 11: 23, 12: 22, 42: 21, 43: 27, 46: 21, 82: 31}
2215
2216    def __get__(self, obj, objtype=None):
2217        pdtn = obj.section4[1]
2218        return obj.section4[self._key[pdtn] + 2]
2219
2220    def __set__(self, obj, value):
2221        pdtn = obj.section4[1]
2222        obj.section4[self._key[pdtn] + 2] = value

Second Year of End of Forecast Time Period

class Duration:
2225class Duration:
2226    """Duration of time period. NOTE: This is a `datetime.timedelta` object."""
2227
2228    def __get__(self, obj, objtype=None):
2229        return utils.get_duration(obj.section4[1], obj.section4[2:])
2230
2231    def __set__(self, obj, value):
2232        if obj.pdtn in _continuous_pdtns:
2233            pass
2234        elif obj.pdtn in _timeinterval_pdtns:
2235            lt_orig = obj.leadTime
2236            _key = TimeRangeOfStatisticalProcess._key
2237            if isinstance(value, np.timedelta64):
2238                # Allows setting from xarray
2239                value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
2240            obj.section4[_key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)
2241            obj.leadTime = lt_orig
2242            # IMPORTANT: Update validDate components when message is time interval
2243            # if obj.pdtn in _timeinterval_pdtns:
2244            #    print(obj.refDate, value, obj.leadTime)
2245            #    vd = obj.refDate + value + obj.leadTime
2246            #    obj.yearOfEndOfTimePeriod = vd.year
2247            #    obj.monthOfEndOfTimePeriod = vd.month
2248            #    obj.dayOfEndOfTimePeriod = vd.day
2249            #    obj.hourOfEndOfTimePeriod = vd.hour
2250            #    obj.minuteOfEndOfTimePeriod = vd.minute
2251            #    obj.secondOfEndOfTimePeriod = vd.second

Duration of time period. NOTE: This is a datetime.timedelta object.

class ValidDate:
2254class ValidDate:
2255    """Valid Date of the forecast. NOTE: This is a `datetime.datetime` object."""
2256
2257    _key = {
2258        8: slice(15, 21),
2259        9: slice(22, 28),
2260        10: slice(16, 22),
2261        11: slice(18, 24),
2262        12: slice(17, 23),
2263    }
2264
2265    def __get__(self, obj, objtype=None):
2266        pdtn = obj.section4[1]
2267        try:
2268            s = slice(self._key[pdtn].start + 2, self._key[pdtn].stop + 2)
2269            return datetime.datetime(*obj.section4[s])
2270        except KeyError:
2271            return obj.refDate + obj.leadTime
2272
2273    def __set__(self, obj, value):
2274        warnings.warn("validDate attribute is read-only.")

Valid Date of the forecast. NOTE: This is a datetime.datetime object.

class NumberOfTimeRanges:
2277class NumberOfTimeRanges:
2278    """Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field"""
2279
2280    _key = {8: 21, 9: 28, 10: 22, 11: 24, 12: 23, 42: 22, 43: 28, 46: 27}
2281
2282    def __get__(self, obj, objtype=None):
2283        pdtn = obj.section4[1]
2284        return obj.section4[self._key[pdtn] + 2]
2285
2286    def __set__(self, obj, value):
2287        pdtn = obj.section4[1]
2288        obj.section4[self._key[pdtn] + 2] = value

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

class NumberOfMissingValues:
2291class NumberOfMissingValues:
2292    """Total number of data values missing in statistical process"""
2293
2294    _key = {8: 22, 9: 29, 10: 23, 11: 25, 12: 24, 42: 23, 43: 29, 46: 28}
2295
2296    def __get__(self, obj, objtype=None):
2297        pdtn = obj.section4[1]
2298        return obj.section4[self._key[pdtn] + 2]
2299
2300    def __set__(self, obj, value):
2301        pdtn = obj.section4[1]
2302        obj.section4[self._key[pdtn] + 2] = value

Total number of data values missing in statistical process

class StatisticalProcess:
2305class StatisticalProcess:
2306    """[Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-10.shtml)"""
2307
2308    _key = {
2309        8: 23,
2310        9: 30,
2311        10: 24,
2312        11: 26,
2313        12: 25,
2314        15: 15,
2315        42: 24,
2316        43: 30,
2317        46: 30,
2318        47: 30,
2319        49: 30,
2320        80: 30,
2321        81: 30,
2322        82: 30,
2323        83: 30,
2324        84: 30,
2325        85: 30,
2326    }
2327
2328    def __get__(self, obj, objtype=None):
2329        pdtn = obj.section4[1]
2330        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.10")
2331
2332    def __set__(self, obj, value):
2333        pdtn = obj.section4[1]
2334        obj.section4[self._key[pdtn] + 2] = value
class TypeOfTimeIncrementOfStatisticalProcess:
2337class TypeOfTimeIncrementOfStatisticalProcess:
2338    """[Type of Time Increment of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2339
2340    _key = {
2341        4: 31,
2342        8: 24,
2343        9: 31,
2344        10: 25,
2345        11: 27,
2346        12: 26,
2347        42: 25,
2348        43: 31,
2349        46: 31,
2350        47: 31,
2351        49: 31,
2352        80: 31,
2353        81: 31,
2354        82: 31,
2355        83: 31,
2356        84: 31,
2357        85: 31,
2358    }
2359
2360    def __get__(self, obj, objtype=None):
2361        pdtn = obj.section4[1]
2362        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.11")
2363
2364    def __set__(self, obj, value):
2365        pdtn = obj.section4[1]
2366        obj.section4[self._key[pdtn] + 2] = value
class UnitOfTimeRangeOfStatisticalProcess:
2369class UnitOfTimeRangeOfStatisticalProcess:
2370    """[Unit of Time Range of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2371
2372    _key = {
2373        4: 32,
2374        8: 25,
2375        9: 32,
2376        10: 26,
2377        11: 28,
2378        12: 27,
2379        42: 26,
2380        43: 32,
2381        46: 32,
2382        47: 32,
2383        49: 32,
2384        80: 32,
2385        81: 32,
2386        82: 32,
2387        83: 32,
2388        84: 32,
2389        85: 32,
2390    }
2391
2392    def __get__(self, obj, objtype=None):
2393        pdtn = obj.section4[1]
2394        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2395
2396    def __set__(self, obj, value):
2397        pdtn = obj.section4[1]
2398        obj.section4[self._key[pdtn] + 2] = value
class TimeRangeOfStatisticalProcess:
2401class TimeRangeOfStatisticalProcess:
2402    """Time Range of Statistical Process"""
2403
2404    _key = {
2405        4: 33,
2406        8: 26,
2407        9: 33,
2408        10: 27,
2409        11: 29,
2410        12: 28,
2411        42: 27,
2412        43: 33,
2413        46: 33,
2414        47: 33,
2415        49: 33,
2416        80: 33,
2417        81: 33,
2418        82: 33,
2419        83: 33,
2420        84: 33,
2421        85: 33,
2422    }
2423
2424    def __get__(self, obj, objtype=None):
2425        pdtn = obj.section4[1]
2426        return obj.section4[self._key[pdtn] + 2]
2427
2428    def __set__(self, obj, value):
2429        pdtn = obj.section4[1]
2430        obj.section4[self._key[pdtn] + 2] = value

Time Range of Statistical Process

class UnitOfTimeRangeOfSuccessiveFields:
2433class UnitOfTimeRangeOfSuccessiveFields:
2434    """[Unit of Time Range of Successive Fields](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
2435
2436    _key = {
2437        4: 34,
2438        8: 27,
2439        9: 34,
2440        10: 28,
2441        11: 30,
2442        12: 29,
2443        42: 28,
2444        43: 34,
2445        46: 34,
2446        47: 34,
2447        49: 34,
2448        80: 34,
2449        81: 34,
2450        82: 34,
2451        83: 34,
2452        84: 34,
2453        85: 34,
2454    }
2455
2456    def __get__(self, obj, objtype=None):
2457        pdtn = obj.section4[1]
2458        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2459
2460    def __set__(self, obj, value):
2461        pdtn = obj.section4[1]
2462        obj.section4[self._key[pdtn] + 2] = value
class TimeIncrementOfSuccessiveFields:
2465class TimeIncrementOfSuccessiveFields:
2466    """Time Increment of Successive Fields"""
2467
2468    _key = {
2469        4: 35,
2470        8: 28,
2471        9: 35,
2472        10: 29,
2473        11: 31,
2474        12: 30,
2475        42: 29,
2476        43: 35,
2477        46: 67,
2478        47: 67,
2479        49: 67,
2480        80: 35,
2481        81: 35,
2482        82: 35,
2483        83: 35,
2484        84: 35,
2485        85: 35,
2486    }
2487
2488    def __get__(self, obj, objtype=None):
2489        pdtn = obj.section4[1]
2490        return obj.section4[self._key[pdtn] + 2]
2491
2492    def __set__(self, obj, value):
2493        pdtn = obj.section4[1]
2494        obj.section4[self._key[pdtn] + 2] = value

Time Increment of Successive Fields

class TypeOfStatisticalProcessing:
2497class TypeOfStatisticalProcessing:
2498    """[Type of Statistical Processing](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-15.shtml)"""
2499
2500    _key = {15: 16}
2501
2502    def __get__(self, obj, objtype=None):
2503        pdtn = obj.section4[1]
2504        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.15")
2505
2506    def __set__(self, obj, value):
2507        pdtn = obj.section4[1]
2508        obj.section4[self._key[pdtn] + 2] = value
class NumberOfDataPointsForSpatialProcessing:
2511class NumberOfDataPointsForSpatialProcessing:
2512    """Number of Data Points for Spatial Processing"""
2513
2514    _key = {15: 17}
2515
2516    def __get__(self, obj, objtype=None):
2517        pdtn = obj.section4[1]
2518        return obj.section4[self._key[pdtn] + 2]
2519
2520    def __set__(self, obj, value):
2521        pdtn = obj.section4[1]
2522        obj.section4[self._key[pdtn] + 2] = value

Number of Data Points for Spatial Processing

class NumberOfContributingSpectralBands:
2525class NumberOfContributingSpectralBands:
2526    """Number of Contributing Spectral Bands (NB)"""
2527
2528    _key = {32: 9}
2529
2530    def __get__(self, obj, objtype=None):
2531        pdtn = obj.section4[1]
2532        return obj.section4[self._key[pdtn] + 2]
2533
2534    def __set__(self, obj, value):
2535        pdtn = obj.section4[1]
2536        obj.section4[self._key[pdtn] + 2] = value

Number of Contributing Spectral Bands (NB)

class SatelliteSeries:
2539class SatelliteSeries:
2540    """Satellte Series of band nb, where nb=1,NB if NB > 0"""
2541
2542    _key = {32: 10}
2543
2544    def __get__(self, obj, objtype=None):
2545        pdtn = obj.section4[1]
2546        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2547
2548    def __set__(self, obj, value):
2549        pass

Satellte Series of band nb, where nb=1,NB if NB > 0

class SatelliteNumber:
2552class SatelliteNumber:
2553    """Satellte Number of band nb, where nb=1,NB if NB > 0"""
2554
2555    _key = {32: 11}
2556
2557    def __get__(self, obj, objtype=None):
2558        pdtn = obj.section4[1]
2559        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2560
2561    def __set__(self, obj, value):
2562        pass

Satellte Number of band nb, where nb=1,NB if NB > 0

class InstrumentType:
2565class InstrumentType:
2566    """Instrument Type of band nb, where nb=1,NB if NB > 0"""
2567
2568    _key = {32: 12}
2569
2570    def __get__(self, obj, objtype=None):
2571        pdtn = obj.section4[1]
2572        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2573
2574    def __set__(self, obj, value):
2575        pass

Instrument Type of band nb, where nb=1,NB if NB > 0

class ScaleFactorOfCentralWaveNumber:
2578class ScaleFactorOfCentralWaveNumber:
2579    """Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0"""
2580
2581    _key = {32: 13}
2582
2583    def __get__(self, obj, objtype=None):
2584        pdtn = obj.section4[1]
2585        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2586
2587    def __set__(self, obj, value):
2588        pass

Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0

class ScaledValueOfCentralWaveNumber:
2591class ScaledValueOfCentralWaveNumber:
2592    """Scaled Value Of Central WaveNumber of band NB"""
2593
2594    _key = {32: 14}
2595
2596    def __get__(self, obj, objtype=None):
2597        pdtn = obj.section4[1]
2598        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2599
2600    def __set__(self, obj, value):
2601        pass

Scaled Value Of Central WaveNumber of band NB

class CetralWaveNumber:
2604class CetralWaveNumber:
2605    """Central WaveNumber of band NB"""
2606
2607    def __get__(self, obj, objtype=None):
2608        scale_factor = getattr(obj, "scaleFactorOfCentralWaveNumber")
2609        scaled_value = getattr(obj, "scaledValueOfCentralWaveNumber")
2610        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2611
2612    def __set__(self, obj, value):
2613        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2614        setattr(obj, "scaleFactorOfCentralWaveNumber", scale_factor)
2615        setattr(obj, "scaledValueOfCentralWaveNumber", scaled_value)

Central WaveNumber of band NB

class TypeOfAerosol:
2618class TypeOfAerosol:
2619    """[Type of Aerosol](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-233.shtml)"""
2620
2621    _key = {
2622        44: 5,
2623        45: 5,
2624        46: 2,
2625        47: 2,
2626        48: 2,
2627        49: 2,
2628        50: 5,
2629        80: 2,
2630        81: 2,
2631        82: 2,
2632        83: 2,
2633        84: 2,
2634        85: 2,
2635    }
2636
2637    def __get__(self, obj, objtype=None):
2638        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.233")
2639
2640    def __set__(self, obj, value):
2641        obj.section4[self._key[obj.pdtn] + 2] = value
class TypeOfIntervalForAerosolSize:
2644class TypeOfIntervalForAerosolSize:
2645    """[Type of Interval for Aerosol Size](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2646
2647    _key = {
2648        44: 6,
2649        45: 6,
2650        46: 3,
2651        47: 3,
2652        48: 3,
2653        49: 3,
2654        50: 6,
2655        80: 3,
2656        81: 3,
2657        82: 3,
2658        83: 3,
2659        84: 3,
2660        85: 3,
2661    }
2662
2663    def __get__(self, obj, objtype=None):
2664        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2665
2666    def __set__(self, obj, value):
2667        obj.section4[self._key[obj.pdtn] + 2] = value
class ScaleFactorOfFirstSize:
2670class ScaleFactorOfFirstSize:
2671    """Scale Factor of First Size"""
2672
2673    _key = {
2674        44: 7,
2675        45: 7,
2676        46: 4,
2677        47: 4,
2678        48: 4,
2679        49: 4,
2680        50: 7,
2681        80: 4,
2682        81: 4,
2683        82: 4,
2684        83: 4,
2685        84: 4,
2686        85: 4,
2687    }
2688
2689    def __get__(self, obj, objtype=None):
2690        return obj.section4[self._key[obj.pdtn] + 2]
2691
2692    def __set__(self, obj, value):
2693        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of First Size

class ScaledValueOfFirstSize:
2696class ScaledValueOfFirstSize:
2697    """Scaled Value of First Size"""
2698
2699    _key = {
2700        44: 8,
2701        45: 8,
2702        46: 5,
2703        47: 5,
2704        48: 5,
2705        49: 5,
2706        50: 8,
2707        80: 5,
2708        81: 5,
2709        82: 5,
2710        83: 5,
2711        84: 5,
2712        85: 5,
2713    }
2714
2715    def __get__(self, obj, objtype=None):
2716        return obj.section4[self._key[obj.pdtn] + 2]
2717
2718    def __set__(self, obj, value):
2719        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of First Size

class FirstSizeOfAerosol:
2722class FirstSizeOfAerosol:
2723    """First size of Aerosol"""
2724
2725    def __get__(self, obj, objtype=None):
2726        scale_factor = getattr(obj, "scaleFactorOfFirstSize")
2727        scaled_value = getattr(obj, "scaledValueOfFirstSize")
2728        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2729
2730    def __set__(self, obj, value):
2731        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2732        setattr(obj, "scaleFactorOfFirstSize", scale_factor)
2733        setattr(obj, "scaledValueOfFirstSize", scaled_value)

First size of Aerosol

class ScaleFactorOfSecondSize:
2736class ScaleFactorOfSecondSize:
2737    """Scale Factor of Second Size"""
2738
2739    _key = {
2740        44: 9,
2741        45: 9,
2742        46: 6,
2743        47: 6,
2744        48: 6,
2745        49: 6,
2746        50: 9,
2747        80: 6,
2748        81: 6,
2749        82: 6,
2750        83: 6,
2751        84: 6,
2752        85: 6,
2753    }
2754
2755    def __get__(self, obj, objtype=None):
2756        return obj.section4[self._key[obj.pdtn] + 2]
2757
2758    def __set__(self, obj, value):
2759        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of Second Size

class ScaledValueOfSecondSize:
2762class ScaledValueOfSecondSize:
2763    """Scaled Value of Second Size"""
2764
2765    _key = {
2766        44: 10,
2767        45: 10,
2768        46: 7,
2769        47: 7,
2770        48: 7,
2771        49: 7,
2772        50: 10,
2773        80: 7,
2774        81: 7,
2775        82: 7,
2776        83: 7,
2777        84: 7,
2778        85: 7,
2779    }
2780
2781    def __get__(self, obj, objtype=None):
2782        return obj.section4[self._key[obj.pdtn] + 2]
2783
2784    def __set__(self, obj, value):
2785        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of Second Size

class SecondSizeOfAerosol:
2788class SecondSizeOfAerosol:
2789    """Second size of Aerosol"""
2790
2791    def __get__(self, obj, objtype=None):
2792        scale_factor = getattr(obj, "scaleFactorOfSecondSize")
2793        scaled_value = getattr(obj, "scaledValueOfSecondSize")
2794        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2795
2796    def __set__(self, obj, value):
2797        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2798        setattr(obj, "scaleFactorOfSecondSize", scale_factor)
2799        setattr(obj, "scaledValueOfSecondSize", scaled_value)

Second size of Aerosol

class TypeOfIntervalForAerosolWavelength:
2802class TypeOfIntervalForAerosolWavelength:
2803    """[Type of Interval for Aerosol Wavelength](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2804
2805    _key = {48: 8}
2806
2807    def __get__(self, obj, objtype=None):
2808        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2809
2810    def __set__(self, obj, value):
2811        obj.section4[self._key[obj.pdtn] + 2] = value
class ScaleFactorOfFirstWavelength:
2814class ScaleFactorOfFirstWavelength:
2815    """Scale Factor of First Wavelength"""
2816
2817    _key = {48: 9}
2818
2819    def __get__(self, obj, objtype=None):
2820        return obj.section4[self._key[obj.pdtn] + 2]
2821
2822    def __set__(self, obj, value):
2823        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of First Wavelength

class ScaledValueOfFirstWavelength:
2826class ScaledValueOfFirstWavelength:
2827    """Scaled Value of First Wavelength"""
2828
2829    _key = {48: 10}
2830
2831    def __get__(self, obj, objtype=None):
2832        return obj.section4[self._key[obj.pdtn] + 2]
2833
2834    def __set__(self, obj, value):
2835        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of First Wavelength

class FirstWavelength:
2838class FirstWavelength:
2839    """First Wavelength"""
2840
2841    def __get__(self, obj, objtype=None):
2842        scale_factor = getattr(obj, "scaleFactorOfFirstWavelength")
2843        scaled_value = getattr(obj, "scaledValueOfFirstWavelength")
2844        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2845
2846    def __set__(self, obj, value):
2847        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2848        setattr(obj, "scaleFactorOfFirstWavelength", scale_factor)
2849        setattr(obj, "scaledValueOfFirstWavelength", scaled_value)

First Wavelength

class ScaleFactorOfSecondWavelength:
2852class ScaleFactorOfSecondWavelength:
2853    """Scale Factor of Second Wavelength"""
2854
2855    _key = {48: 11}
2856
2857    def __get__(self, obj, objtype=None):
2858        return obj.section4[self._key[obj.pdtn] + 2]
2859
2860    def __set__(self, obj, value):
2861        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of Second Wavelength

class ScaledValueOfSecondWavelength:
2864class ScaledValueOfSecondWavelength:
2865    """Scaled Value of Second Wavelength"""
2866
2867    _key = {48: 12}
2868
2869    def __get__(self, obj, objtype=None):
2870        return obj.section4[self._key[obj.pdtn] + 2]
2871
2872    def __set__(self, obj, value):
2873        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of Second Wavelength

class SecondWavelength:
2876class SecondWavelength:
2877    """Second Wavelength"""
2878
2879    def __get__(self, obj, objtype=None):
2880        scale_factor = getattr(obj, "scaleFactorOfSecondWavelength")
2881        scaled_value = getattr(obj, "scaledValueOfSecondWavelength")
2882        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2883
2884    def __set__(self, obj, value):
2885        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2886        setattr(obj, "scaleFactorOfSecondWavelength", scale_factor)
2887        setattr(obj, "scaledValueOfSecondWavelength", scaled_value)

Second Wavelength

class SourceSinkIndicator:
2890class SourceSinkIndicator:
2891    """[Source/Sink Indicator](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-238.shtml)"""
2892
2893    _key = {76: 10, 77: 10, 78: 10, 79: 10, 80: 3, 81: 3, 82: 3, 83: 3, 84: 3, 85: 3}
2894
2895    def __get__(self, obj, objtype=None):
2896        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.238")
2897
2898    def __set__(self, obj, value):
2899        obj.section4[self._key[obj.pdtn] + 2] = value
class ConstituentType:
2902class ConstituentType:
2903    """[Constituent Type](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-230.shtml)"""
2904
2905    _key = defaultdict(lambda: 9)
2906
2907    def __get__(self, obj, objtype=None):
2908        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.230")
2909
2910    def __set__(self, obj, value):
2911        obj.section4[self._key[obj.pdtn] + 2] = value
@dataclass(init=False)
class ProductDefinitionTemplateBase:
2919@dataclass(init=False)
2920class ProductDefinitionTemplateBase:
2921    """Base attributes for Product Definition Templates"""
2922
2923    _varinfo: list = field(init=False, repr=False, default=VarInfo())
2924    fullName: str = field(init=False, repr=False, default=FullName())
2925    units: str = field(init=False, repr=False, default=Units())
2926    shortName: str = field(init=False, repr=False, default=ShortName())
2927    leadTime: datetime.timedelta = field(init=False, repr=False, default=LeadTime())
2928    duration: datetime.timedelta = field(init=False, repr=False, default=Duration())
2929    validDate: datetime.datetime = field(init=False, repr=False, default=ValidDate())
2930    level: str = field(init=False, repr=False, default=Level())
2931    # Begin template here...
2932    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
2933    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
2934    parameterUnits: int = field(init=False, repr=False, default=ParameterUnits())
2935    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
2936    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
2937    backgroundGeneratingProcessIdentifier: int = field(init=False, repr=False, default=BackgroundGeneratingProcessIdentifier())
2938    hoursAfterDataCutoff: int = field(init=False, repr=False, default=HoursAfterDataCutoff())
2939    minutesAfterDataCutoff: int = field(init=False, repr=False, default=MinutesAfterDataCutoff())
2940    unitOfForecastTime: Grib2Metadata = field(init=False, repr=False, default=UnitOfForecastTime())
2941    valueOfForecastTime: int = field(init=False, repr=False, default=ValueOfForecastTime())
2942
2943    @classmethod
2944    def _attrs(cls):
2945        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]

Base attributes for Product Definition Templates

fullName: str

Full name of the Variable.

units: str

Units of the Variable.

shortName: str

Short name of the variable (i.e. the variable abbreviation).

leadTime: datetime.timedelta

Forecast Lead Time. NOTE: This is a datetime.timedelta object.

duration: datetime.timedelta

Duration of time period. NOTE: This is a datetime.timedelta object.

validDate: datetime.datetime

Valid Date of the forecast. NOTE: This is a datetime.datetime object.

level: str

Level (same as provided by wgrib2)

parameterCategory: int
parameterNumber: int
parameterUnits: int

Native units as described by the GRIB2 Discipline, Parameter Category, and Parameter Number

typeOfGeneratingProcess: Grib2Metadata
generatingProcess: Grib2Metadata
backgroundGeneratingProcessIdentifier: int

Background Generating Process Identifier

hoursAfterDataCutoff: int

Hours of observational data cutoff after reference time.

minutesAfterDataCutoff: int

Minutes of observational data cutoff after reference time.

valueOfForecastTime: int

Value of forecast time in units defined by UnitofForecastTime.

@dataclass(init=False)
class ProductDefinitionTemplateSurface:
2948@dataclass(init=False)
2949class ProductDefinitionTemplateSurface:
2950    """Surface attributes for Product Definition Templates"""
2951
2952    _fixedsfc1info: list = field(init=False, repr=False, default=FixedSfc1Info())
2953    _fixedsfc2info: list = field(init=False, repr=False, default=FixedSfc2Info())
2954    typeOfFirstFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfFirstFixedSurface())
2955    scaleFactorOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfFirstFixedSurface())
2956    scaledValueOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfFirstFixedSurface())
2957    typeOfSecondFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfSecondFixedSurface())
2958    scaleFactorOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfSecondFixedSurface())
2959    scaledValueOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfSecondFixedSurface())
2960    unitOfFirstFixedSurface: str = field(init=False, repr=False, default=UnitOfFirstFixedSurface())
2961    valueOfFirstFixedSurface: int = field(init=False, repr=False, default=ValueOfFirstFixedSurface())
2962    unitOfSecondFixedSurface: str = field(init=False, repr=False, default=UnitOfSecondFixedSurface())
2963    valueOfSecondFixedSurface: int = field(init=False, repr=False, default=ValueOfSecondFixedSurface())
2964
2965    @classmethod
2966    def _attrs(cls):
2967        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]

Surface attributes for Product Definition Templates

typeOfFirstFixedSurface: Grib2Metadata
scaleFactorOfFirstFixedSurface: int

Scale Factor of First Fixed Surface

scaledValueOfFirstFixedSurface: int

Scaled Value Of First Fixed Surface

typeOfSecondFixedSurface: Grib2Metadata
scaleFactorOfSecondFixedSurface: int

Scale Factor of Second Fixed Surface

scaledValueOfSecondFixedSurface: int

Scaled Value Of Second Fixed Surface

unitOfFirstFixedSurface: str

Units of First Fixed Surface

valueOfFirstFixedSurface: int

Value of First Fixed Surface

unitOfSecondFixedSurface: str

Units of Second Fixed Surface

valueOfSecondFixedSurface: int

Value of Second Fixed Surface

@dataclass(init=False)
class ProductDefinitionTemplate0(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2970@dataclass(init=False)
2971class ProductDefinitionTemplate0(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2972    """[Product Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml)"""
2973
2974    _len = 15
2975    _num = 0
2976
2977    @classmethod
2978    def _attrs(cls):
2979        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
@dataclass(init=False)
class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2982@dataclass(init=False)
2983class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2984    """[Product Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-1.shtml)"""
2985
2986    _len = 18
2987    _num = 1
2988    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
2989    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
2990    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2991
2992    @classmethod
2993    def _attrs(cls):
2994        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate2(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2997@dataclass(init=False)
2998class ProductDefinitionTemplate2(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2999    """[Product Definition Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-2.shtml)"""
3000
3001    _len = 17
3002    _num = 2
3003    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3004    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3005
3006    @classmethod
3007    def _attrs(cls):
3008        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfDerivedForecast: Grib2Metadata
numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate5(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3011@dataclass(init=False)
3012class ProductDefinitionTemplate5(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3013    """[Product Definition Template 5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-5.shtml)"""
3014
3015    _len = 22
3016    _num = 5
3017    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3018    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3019    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3020    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3021    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3022    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3023    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3024    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3025    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3026    threshold: str = field(init=False, repr=False, default=Threshold())
3027
3028    @classmethod
3029    def _attrs(cls):
3030        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
forecastProbabilityNumber: int

Forecast Probability Number

totalNumberOfForecastProbabilities: int

Total Number of Forecast Probabilities

typeOfProbability: Grib2Metadata
scaleFactorOfThresholdLowerLimit: float

Scale Factor of Threshold Lower Limit

scaledValueOfThresholdLowerLimit: float

Scaled Value of Threshold Lower Limit

scaleFactorOfThresholdUpperLimit: float

Scale Factor of Threshold Upper Limit

scaledValueOfThresholdUpperLimit: float

Scaled Value of Threshold Upper Limit

thresholdLowerLimit: float

Threshold Lower Limit

thresholdUpperLimit: float

Threshold Upper Limit

threshold: str

Threshold string (same as wgrib2)

@dataclass(init=False)
class ProductDefinitionTemplate6(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3033@dataclass(init=False)
3034class ProductDefinitionTemplate6(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3035    """[Product Definition Template 6](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-6.shtml)"""
3036
3037    _len = 16
3038    _num = 6
3039    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3040
3041    @classmethod
3042    def _attrs(cls):
3043        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
percentileValue: int

Percentile Value

@dataclass(init=False)
class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3046@dataclass(init=False)
3047class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3048    """[Product Definition Template 8](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-8.shtml)"""
3049
3050    _len = 29
3051    _num = 8
3052    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3053    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3054    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3055    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3056    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3057    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3058    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3059    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3060    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3061    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3062    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3063    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3064    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3065    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3066
3067    @classmethod
3068    def _attrs(cls):
3069        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate9(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3072@dataclass(init=False)
3073class ProductDefinitionTemplate9(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3074    """[Product Definition Template 9](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-9.shtml)"""
3075
3076    _len = 36
3077    _num = 9
3078    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3079    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3080    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3081    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3082    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3083    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3084    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3085    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3086    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3087    threshold: str = field(init=False, repr=False, default=Threshold())
3088    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3089    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3090    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3091    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3092    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3093    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3094    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3095    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3096    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3097    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3098    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3099    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3100    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3101    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3102
3103    @classmethod
3104    def _attrs(cls):
3105        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
forecastProbabilityNumber: int

Forecast Probability Number

totalNumberOfForecastProbabilities: int

Total Number of Forecast Probabilities

typeOfProbability: Grib2Metadata
scaleFactorOfThresholdLowerLimit: float

Scale Factor of Threshold Lower Limit

scaledValueOfThresholdLowerLimit: float

Scaled Value of Threshold Lower Limit

scaleFactorOfThresholdUpperLimit: float

Scale Factor of Threshold Upper Limit

scaledValueOfThresholdUpperLimit: float

Scaled Value of Threshold Upper Limit

thresholdLowerLimit: float

Threshold Lower Limit

thresholdUpperLimit: float

Threshold Upper Limit

threshold: str

Threshold string (same as wgrib2)

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate10(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3108@dataclass(init=False)
3109class ProductDefinitionTemplate10(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3110    """[Product Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-10.shtml)"""
3111
3112    _len = 30
3113    _num = 10
3114    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3115    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3116    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3117    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3118    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3119    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3120    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3121    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3122    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3123    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3124    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3125    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3126    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3127    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3128    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3129
3130    @classmethod
3131    def _attrs(cls):
3132        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
percentileValue: int

Percentile Value

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate11(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3135@dataclass(init=False)
3136class ProductDefinitionTemplate11(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3137    """[Product Definition Template 11](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-11.shtml)"""
3138
3139    _len = 32
3140    _num = 11
3141    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3142    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3143    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3144    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3145    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3146    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3147    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3148    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3149    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3150    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3151    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3152    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3153    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3154    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3155    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3156    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3157    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3158
3159    @classmethod
3160    def _attrs(cls):
3161        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate12(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3164@dataclass(init=False)
3165class ProductDefinitionTemplate12(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3166    """[Product Definition Template 12](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-12.shtml)"""
3167
3168    _len = 31
3169    _num = 12
3170    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3171    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3172    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3173    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3174    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3175    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3176    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3177    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3178    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3179    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3180    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3181    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3182    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3183    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3184    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3185    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3186
3187    @classmethod
3188    def _attrs(cls):
3189        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfDerivedForecast: Grib2Metadata
numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate13(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3192@dataclass(init=False)
3193class ProductDefinitionTemplate13(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3194    """[Product Definition Template 13](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-13.shtml)"""
3195
3196    _len = 18
3197    _num = 13
3198    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3199    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3200    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3201    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3202    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3203    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3204    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3205    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3206
3207    @classmethod
3208    def _attrs(cls):
3209        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
statisticalProcess: Grib2Metadata
typeOfStatisticalProcessing: Grib2Metadata
numberOfDataPointsForSpatialProcessing: int

Number of Data Points for Spatial Processing

typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate14(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3212@dataclass(init=False)
3213class ProductDefinitionTemplate14(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3214    """[Product Definition Template 14](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-14.shtml)"""
3215
3216    _len = 18
3217    _num = 14
3218    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3219    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3220    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3221    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3222    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3223    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3224    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3225    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3226
3227    @classmethod
3228    def _attrs(cls):
3229        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
statisticalProcess: Grib2Metadata
typeOfStatisticalProcessing: Grib2Metadata
numberOfDataPointsForSpatialProcessing: int

Number of Data Points for Spatial Processing

typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate15(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3232@dataclass(init=False)
3233class ProductDefinitionTemplate15(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3234    """[Product Definition Template 15](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-15.shtml)"""
3235
3236    _len = 18
3237    _num = 15
3238    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3239    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3240    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3241
3242    @classmethod
3243    def _attrs(cls):
3244        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
statisticalProcess: Grib2Metadata
typeOfStatisticalProcessing: Grib2Metadata
numberOfDataPointsForSpatialProcessing: int

Number of Data Points for Spatial Processing

@dataclass(init=False)
class ProductDefinitionTemplate31:
3264@dataclass(init=False)
3265class ProductDefinitionTemplate31:
3266    """[Product Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-31.shtml)"""
3267
3268    _len = 5
3269    _num = 31
3270    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
3271    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
3272    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
3273    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
3274    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3275    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3276    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3277    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3278    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3279    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3280
3281    @classmethod
3282    def _attrs(cls):
3283        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
parameterCategory: int
parameterNumber: int
typeOfGeneratingProcess: Grib2Metadata
generatingProcess: Grib2Metadata
numberOfContributingSpectralBands: int

Number of Contributing Spectral Bands (NB)

satelliteSeries: list

Satellte Series of band nb, where nb=1,NB if NB > 0

satelliteNumber: list

Satellte Number of band nb, where nb=1,NB if NB > 0

instrumentType: list

Instrument Type of band nb, where nb=1,NB if NB > 0

scaleFactorOfCentralWaveNumber: list

Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0

scaledValueOfCentralWaveNumber: list

Scaled Value Of Central WaveNumber of band NB

@dataclass(init=False)
class ProductDefinitionTemplate32(ProductDefinitionTemplateBase):
3286@dataclass(init=False)
3287class ProductDefinitionTemplate32(ProductDefinitionTemplateBase):
3288    """[Product Definition Template 32](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-32.shtml)"""
3289
3290    _len = 10
3291    _num = 32
3292    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3293    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3294    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3295    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3296    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3297    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3298
3299    @classmethod
3300    def _attrs(cls):
3301        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
numberOfContributingSpectralBands: int

Number of Contributing Spectral Bands (NB)

satelliteSeries: list

Satellte Series of band nb, where nb=1,NB if NB > 0

satelliteNumber: list

Satellte Number of band nb, where nb=1,NB if NB > 0

instrumentType: list

Instrument Type of band nb, where nb=1,NB if NB > 0

scaleFactorOfCentralWaveNumber: list

Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0

scaledValueOfCentralWaveNumber: list

Scaled Value Of Central WaveNumber of band NB

@dataclass(init=False)
class ProductDefinitionTemplate44(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3382@dataclass(init=False)
3383class ProductDefinitionTemplate44(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3384    """[Product Definition Template 4.44](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-44.shtml)"""
3385
3386    _len = 25
3387    _num = 44
3388    # Aerosol parameters
3389    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3390    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3391    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3392    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3393    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3394    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3395    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3396    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3397
3398    @classmethod
3399    def _attrs(cls):
3400        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

@dataclass(init=False)
class ProductDefinitionTemplate45(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3403@dataclass(init=False)
3404class ProductDefinitionTemplate45(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3405    """[Product Definition Template 4.45](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-45.shtml)"""
3406
3407    _len = 28
3408    _num = 45
3409    # Aerosol parameters
3410    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3411    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3412    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3413    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3414    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3415    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3416    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3417    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3418
3419    # Ensemble parameters
3420    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3421    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3422    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3423
3424    @classmethod
3425    def _attrs(cls):
3426        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate50(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3429@dataclass(init=False)
3430class ProductDefinitionTemplate50(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3431    """[Product Definition Template 4.50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-50.shtml)"""
3432
3433    _len = 25
3434    _num = 50
3435    # Aerosol parameters
3436    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3437    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3438    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3439    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3440    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3441    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3442    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3443    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3444
3445    @classmethod
3446    def _attrs(cls):
3447        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

@dataclass(init=False)
class ProductDefinitionTemplate46(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3450@dataclass(init=False)
3451class ProductDefinitionTemplate46(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3452    """[Product Definition Template 4.46](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-46.shtml)"""
3453
3454    _len = 38  # Total number of octets
3455    _num = 46
3456
3457    # Aerosol-specific parameters
3458    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3459    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3460    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3461    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3462    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3463    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3464    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3465    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3466
3467    # Time interval parameters
3468    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3469    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3470    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3471    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3472    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3473    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3474    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3475    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3476
3477    # Statistical processing parameters
3478    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3479    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3480    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3481    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3482    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3483    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3484    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3485
3486    @classmethod
3487    def _attrs(cls):
3488        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

typeOfStatisticalProcessing: Grib2Metadata
numberOfDataPointsForSpatialProcessing: int

Number of Data Points for Spatial Processing

typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate47(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3491@dataclass(init=False)
3492class ProductDefinitionTemplate47(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3493    """[Product Definition Template 4.47](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-47.shtml)"""
3494
3495    _len = 41  # Total number of octets for base template
3496    _num = 47
3497
3498    # Aerosol parameters
3499    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3500    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3501    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3502    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3503    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3504    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3505    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3506    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3507
3508    # Ensemble parameters
3509    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3510    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3511    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3512
3513    # Time interval parameters
3514    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3515    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3516    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3517    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3518    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3519    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3520    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3521    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3522
3523    # Statistical processing parameters
3524    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3525    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3526    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3527    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3528    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3529    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3530    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3531
3532    @classmethod
3533    def _attrs(cls):
3534        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

typeOfStatisticalProcessing: Grib2Metadata
numberOfDataPointsForSpatialProcessing: int

Number of Data Points for Spatial Processing

typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate48(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3537@dataclass(init=False)
3538class ProductDefinitionTemplate48(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3539    """[Product Definition Template 48](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-48.shtml)"""
3540
3541    _len = 26
3542    _num = 48
3543    # Aerosol parameters
3544    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3545    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3546    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3547    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3548    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3549    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3550    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3551    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3552
3553    # Wavelength parameters
3554    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3555    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3556    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3557    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3558    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3559    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3560    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3561
3562    @classmethod
3563    def _attrs(cls):
3564        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

@dataclass(init=False)
class ProductDefinitionTemplate49(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3567@dataclass(init=False)
3568class ProductDefinitionTemplate49(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3569    """[Product Definition Template 4.49](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-49.shtml)"""
3570
3571    _len = 28
3572    _num = 49
3573
3574    # Aerosol parameters
3575    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3576    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3577    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3578    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3579    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3580    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3581    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3582    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3583
3584    # Wavelength parameters
3585    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3586    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3587    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3588    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3589    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3590    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3591    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3592
3593    # Ensemble parameters
3594    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3595    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3596    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate80(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3599@dataclass(init=False)
3600class ProductDefinitionTemplate80(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3601    """[Product Definition Template 4.80](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-80.shtml)"""
3602
3603    _len = 26
3604    _num = 80
3605
3606    # Aerosol parameters
3607    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3608    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3609    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3610    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3611    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3612    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3613    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3614    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3615    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3616
3617    # Wavelength parameters
3618    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3619    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3620    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3621    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3622    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3623    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3624    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

@dataclass(init=False)
class ProductDefinitionTemplate81(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3627@dataclass(init=False)
3628class ProductDefinitionTemplate81(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3629    """[Product Definition Template 4.81](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-81.shtml)"""
3630
3631    _len = 31
3632    _num = 81
3633
3634    # Aerosol parameters
3635    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3636    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3637    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3638    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3639    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3640    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3641    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3642    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3643    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3644
3645    # Wavelength parameters
3646    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3647    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3648    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3649    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3650    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3651    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3652    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3653
3654    # Ensemble parameters
3655    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3656    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3657    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate82(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3660@dataclass(init=False)
3661class ProductDefinitionTemplate82(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3662    """[Product Definition Template 4.82](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-82.shtml)"""
3663
3664    _len = 41
3665    _num = 82
3666
3667    # Aerosol parameters
3668    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3669    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3670    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3671    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3672    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3673    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3674    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3675    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3676    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3677
3678    # Wavelength parameters
3679    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3680    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3681    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3682    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3683    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3684    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3685    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3686
3687    # Time interval parameters
3688    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3689    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3690    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3691    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3692    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3693    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3694    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3695    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3696
3697    # Statistical processing parameters
3698    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3699    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3700    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3701    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3702    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3703    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3704    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3705    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate83(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3708@dataclass(init=False)
3709class ProductDefinitionTemplate83(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3710    """[Product Definition Template 4.83](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-83.shtml)"""
3711
3712    _len = 44
3713    _num = 83
3714
3715    # Aerosol parameters
3716    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3717    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3718    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3719    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3720    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3721    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3722    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3723    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3724    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3725
3726    # Wavelength parameters
3727    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3728    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3729    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3730    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3731    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3732    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3733    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3734
3735    # Ensemble parameters
3736    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3737    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3738    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3739
3740    # Time interval parameters
3741    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3742    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3743    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3744    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3745    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3746    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3747    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3748    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

@dataclass(init=False)
class ProductDefinitionTemplate84(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3751@dataclass(init=False)
3752class ProductDefinitionTemplate84(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3753    """[Product Definition Template 4.84](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-84.shtml)"""
3754
3755    _len = 44
3756    _num = 84
3757
3758    # Aerosol parameters
3759    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3760    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3761    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3762    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3763    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3764    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3765    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3766    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3767    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3768
3769    # Wavelength parameters
3770    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3771    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3772    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3773    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3774    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3775    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3776    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3777
3778    # Ensemble parameters
3779    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3780    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3781    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3782
3783    # Time interval parameters
3784    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3785    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3786    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3787    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3788    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3789    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3790
3791    # Statistical processing parameters
3792    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3793    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3794    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3795    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3796    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3797    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3798    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3799    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate85(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3802@dataclass(init=False)
3803class ProductDefinitionTemplate85(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3804    """[Product Definition Template 4.85](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-85.shtml)"""
3805
3806    _len = 33
3807    _num = 85
3808
3809    # Aerosol parameters
3810    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3811    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3812    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3813    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3814    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3815    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3816    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3817    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3818    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3819
3820    # Wavelength parameters
3821    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3822    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3823    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3824    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3825    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3826    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3827    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3828
3829    # Ensemble parameters
3830    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3831    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3832    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
sourceSinkIndicator: Grib2Metadata
typeOfIntervalForAerosolSize: Grib2Metadata
scaleFactorOfFirstSize: int

Scale Factor of First Size

scaledValueOfFirstSize: int

Scaled Value of First Size

firstSizeOfAerosol: float

First size of Aerosol

scaleFactorOfSecondSize: int

Scale Factor of Second Size

scaledValueOfSecondSize: int

Scaled Value of Second Size

secondSizeOfAerosol: float

Second size of Aerosol

typeOfIntervalForAerosolWavelength: Grib2Metadata
scaleFactorOfFirstWavelength: int

Scale Factor of First Wavelength

scaledValueOfFirstWavelength: int

Scaled Value of First Wavelength

firstWavelength: float

First Wavelength

scaleFactorOfSecondWavelength: int

Scale Factor of Second Wavelength

scaledValueOfSecondWavelength: int

Scaled Value of Second Wavelength

secondWavelength: float

Second Wavelength

typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3835@dataclass(init=False)
3836class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3837    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3838
3839    _len = 16
3840    _num = 40
3841    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
constituentType: Grib2Metadata
@dataclass(init=False)
class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3844@dataclass(init=False)
3845class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3846    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3847
3848    _len = 19
3849    _num = 41
3850    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3851    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3852    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3853    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
constituentType: Grib2Metadata
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3856@dataclass(init=False)
3857class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3858    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
3859
3860    _len = 30
3861    _num = 42
3862    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3863    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3864    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3865    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3866    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3867    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3868    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3869    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3870    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3871    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3872    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3873    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3874    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3875    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3876    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
constituentType: Grib2Metadata
yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3879@dataclass(init=False)
3880class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3881    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
3882
3883    _len = 33
3884    _num = 43
3885    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3886    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3887    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3888    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3889    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3890    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3891    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3892    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3893    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3894    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3895    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3896    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3897    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3898    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3899    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3900    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3901    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3902    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
constituentType: Grib2Metadata
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3905@dataclass(init=False)
3906class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3907    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
3908
3909    _len = 17
3910    _num = 76
3911    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3912    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
constituentType: Grib2Metadata
sourceSinkIndicator: Grib2Metadata
@dataclass(init=False)
class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3915@dataclass(init=False)
3916class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3917    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
3918
3919    _len = 20
3920    _num = 77
3921    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3922    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3923    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3924    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3925    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
constituentType: Grib2Metadata
sourceSinkIndicator: Grib2Metadata
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

@dataclass(init=False)
class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3928@dataclass(init=False)
3929class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3930    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
3931
3932    _len = 31
3933    _num = 78
3934    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3935    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3936    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3937    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3938    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3939    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3940    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3941    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3942    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3943    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3944    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3945    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3946    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3947    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3948    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3949    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
constituentType: Grib2Metadata
sourceSinkIndicator: Grib2Metadata
yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

@dataclass(init=False)
class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3952@dataclass(init=False)
3953class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3954    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
3955
3956    _len = 34
3957    _num = 79
3958    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3959    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3960    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3961    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3962    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3963    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3964    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3965    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3966    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3967    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3968    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3969    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3970    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3971    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3972    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3973    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3974    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3975    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3976    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
constituentType: Grib2Metadata
sourceSinkIndicator: Grib2Metadata
typeOfEnsembleForecast: Grib2Metadata
perturbationNumber: int

Ensemble Perturbation Number

numberOfEnsembleForecasts: int

Total Number of Ensemble Forecasts

yearOfEndOfTimePeriod: int

Year of End of Forecast Time Period

monthOfEndOfTimePeriod: int

Month Year of End of Forecast Time Period

dayOfEndOfTimePeriod: int

Day Year of End of Forecast Time Period

hourOfEndOfTimePeriod: int

Hour Year of End of Forecast Time Period

minuteOfEndOfTimePeriod: int

Minute Year of End of Forecast Time Period

secondOfEndOfTimePeriod: int

Second Year of End of Forecast Time Period

numberOfTimeRanges: int

Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field

numberOfMissingValues: int

Total number of data values missing in statistical process

statisticalProcess: Grib2Metadata
typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata
unitOfTimeRangeOfStatisticalProcess: Grib2Metadata
timeRangeOfStatisticalProcess: int

Time Range of Statistical Process

unitOfTimeRangeOfSuccessiveFields: Grib2Metadata
timeIncrementOfSuccessiveFields: int

Time Increment of Successive Fields

def pdt_class_by_pdtn(pdtn: int):
4161def pdt_class_by_pdtn(pdtn: int):
4162    """
4163    Provide a Product Definition Template class via the template number.
4164
4165    Parameters
4166    ----------
4167    pdtn
4168        Product definition template number.
4169
4170    Returns
4171    -------
4172    pdt_class_by_pdtn
4173        Product definition template class object (not an instance).
4174    """
4175    return _pdt_by_pdtn[pdtn]

Provide a Product Definition Template class via the template number.

Parameters
  • pdtn: Product definition template number.
Returns
  • pdt_class_by_pdtn: Product definition template class object (not an instance).
class NumberOfPackedValues:
4181class NumberOfPackedValues:
4182    """Number of Packed Values"""
4183
4184    def __get__(self, obj, objtype=None):
4185        return obj.section5[0]
4186
4187    def __set__(self, obj, value):
4188        pass

Number of Packed Values

class DataRepresentationTemplateNumber:
4191class DataRepresentationTemplateNumber:
4192    """[Data Representation Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-0.shtml)"""
4193
4194    def __get__(self, obj, objtype=None):
4195        return Grib2Metadata(obj.section5[1], table="5.0")
4196
4197    def __set__(self, obj, value):
4198        pass
class DataRepresentationTemplate:
4201class DataRepresentationTemplate:
4202    """Data Representation Template"""
4203
4204    def __get__(self, obj, objtype=None):
4205        return obj.section5[2:]
4206
4207    def __set__(self, obj, value):
4208        raise NotImplementedError

Data Representation Template

class RefValue:
4211class RefValue:
4212    """Reference Value (represented as an IEEE 32-bit floating point value)"""
4213
4214    def __get__(self, obj, objtype=None):
4215        return utils.ieee_int_to_float(obj.section5[0 + 2])
4216
4217    def __set__(self, obj, value):
4218        pass

Reference Value (represented as an IEEE 32-bit floating point value)

class BinScaleFactor:
4221class BinScaleFactor:
4222    """Binary Scale Factor"""
4223
4224    def __get__(self, obj, objtype=None):
4225        return obj.section5[1 + 2]
4226
4227    def __set__(self, obj, value):
4228        obj.section5[1 + 2] = value

Binary Scale Factor

class DecScaleFactor:
4231class DecScaleFactor:
4232    """Decimal Scale Factor"""
4233
4234    def __get__(self, obj, objtype=None):
4235        return obj.section5[2 + 2]
4236
4237    def __set__(self, obj, value):
4238        obj.section5[2 + 2] = value

Decimal Scale Factor

class NBitsPacking:
4241class NBitsPacking:
4242    """Minimum number of bits for packing"""
4243
4244    def __get__(self, obj, objtype=None):
4245        return obj.section5[3 + 2]
4246
4247    def __set__(self, obj, value):
4248        obj.section5[3 + 2] = value

Minimum number of bits for packing

class TypeOfValues:
4251class TypeOfValues:
4252    """[Type of Original Field Values](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)"""
4253
4254    def __get__(self, obj, objtype=None):
4255        return Grib2Metadata(obj.section5[4 + 2], table="5.1")
4256
4257    def __set__(self, obj, value):
4258        obj.section5[4 + 2] = value
class GroupSplittingMethod:
4261class GroupSplittingMethod:
4262    """[Group Splitting Method](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-4.shtml)"""
4263
4264    def __get__(self, obj, objtype=None):
4265        return Grib2Metadata(obj.section5[5 + 2], table="5.4")
4266
4267    def __set__(self, obj, value):
4268        obj.section5[5 + 2] = value
class TypeOfMissingValueManagement:
4271class TypeOfMissingValueManagement:
4272    """[Type of Missing Value Management](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-5.shtml)"""
4273
4274    def __get__(self, obj, objtype=None):
4275        return Grib2Metadata(obj.section5[6 + 2], table="5.5")
4276
4277    def __set__(self, obj, value):
4278        obj.section5[6 + 2] = value
class PriMissingValue:
4281class PriMissingValue:
4282    """Primary Missing Value"""
4283
4284    def __get__(self, obj, objtype=None):
4285        if obj.typeOfValues == 0:
4286            return utils.ieee_int_to_float(obj.section5[7 + 2]) if obj.section5[6 + 2] in {1, 2} and obj.section5[7 + 2] != 255 else None
4287        elif obj.typeOfValues == 1:
4288            return obj.section5[7 + 2] if obj.section5[6 + 2] in [1, 2] else None
4289
4290    def __set__(self, obj, value):
4291        if obj.typeOfValues == 0:
4292            obj.section5[7 + 2] = utils.ieee_float_to_int(value)
4293        elif self.typeOfValues == 1:
4294            obj.section5[7 + 2] = int(value)
4295        obj.section5[6 + 2] = 1

Primary Missing Value

class SecMissingValue:
4298class SecMissingValue:
4299    """Secondary Missing Value"""
4300
4301    def __get__(self, obj, objtype=None):
4302        if obj.typeOfValues == 0:
4303            return utils.ieee_int_to_float(obj.section5[8 + 2]) if obj.section5[6 + 2] in {1, 2} and obj.section5[8 + 2] != 255 else None
4304        elif obj.typeOfValues == 1:
4305            return obj.section5[8 + 2] if obj.section5[6 + 2] in {1, 2} else None
4306
4307    def __set__(self, obj, value):
4308        if obj.typeOfValues == 0:
4309            obj.section5[8 + 2] = utils.ieee_float_to_int(value)
4310        elif self.typeOfValues == 1:
4311            obj.section5[8 + 2] = int(value)
4312        obj.section5[6 + 2] = 2

Secondary Missing Value

class NGroups:
4315class NGroups:
4316    """Number of Groups"""
4317
4318    def __get__(self, obj, objtype=None):
4319        return obj.section5[9 + 2]
4320
4321    def __set__(self, obj, value):
4322        pass

Number of Groups

class RefGroupWidth:
4325class RefGroupWidth:
4326    """Reference Group Width"""
4327
4328    def __get__(self, obj, objtype=None):
4329        return obj.section5[10 + 2]
4330
4331    def __set__(self, obj, value):
4332        pass

Reference Group Width

class NBitsGroupWidth:
4335class NBitsGroupWidth:
4336    """Number of bits for Group Width"""
4337
4338    def __get__(self, obj, objtype=None):
4339        return obj.section5[11 + 2]
4340
4341    def __set__(self, obj, value):
4342        pass

Number of bits for Group Width

class RefGroupLength:
4345class RefGroupLength:
4346    """Reference Group Length"""
4347
4348    def __get__(self, obj, objtype=None):
4349        return obj.section5[12 + 2]
4350
4351    def __set__(self, obj, value):
4352        pass

Reference Group Length

class GroupLengthIncrement:
4355class GroupLengthIncrement:
4356    """Group Length Increment"""
4357
4358    def __get__(self, obj, objtype=None):
4359        return obj.section5[13 + 2]
4360
4361    def __set__(self, obj, value):
4362        pass

Group Length Increment

class LengthOfLastGroup:
4365class LengthOfLastGroup:
4366    """Length of Last Group"""
4367
4368    def __get__(self, obj, objtype=None):
4369        return obj.section5[14 + 2]
4370
4371    def __set__(self, obj, value):
4372        pass

Length of Last Group

class NBitsScaledGroupLength:
4375class NBitsScaledGroupLength:
4376    """Number of bits of Scaled Group Length"""
4377
4378    def __get__(self, obj, objtype=None):
4379        return obj.section5[15 + 2]
4380
4381    def __set__(self, obj, value):
4382        pass

Number of bits of Scaled Group Length

class SpatialDifferenceOrder:
4385class SpatialDifferenceOrder:
4386    """[Spatial Difference Order](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-6.shtml)"""
4387
4388    def __get__(self, obj, objtype=None):
4389        return Grib2Metadata(obj.section5[16 + 2], table="5.6")
4390
4391    def __set__(self, obj, value):
4392        obj.section5[16 + 2] = value
class NBytesSpatialDifference:
4395class NBytesSpatialDifference:
4396    """Number of bytes for Spatial Differencing"""
4397
4398    def __get__(self, obj, objtype=None):
4399        return obj.section5[17 + 2]
4400
4401    def __set__(self, obj, value):
4402        pass

Number of bytes for Spatial Differencing

class Precision:
4405class Precision:
4406    """[Precision for IEEE Floating Point Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-7.shtml)"""
4407
4408    def __get__(self, obj, objtype=None):
4409        return Grib2Metadata(obj.section5[0 + 2], table="5.7")
4410
4411    def __set__(self, obj, value):
4412        obj.section5[0 + 2] = value
class TypeOfCompression:
4415class TypeOfCompression:
4416    """[Type of Compression](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-40.shtml)"""
4417
4418    def __get__(self, obj, objtype=None):
4419        return Grib2Metadata(obj.section5[5 + 2], table="5.40")
4420
4421    def __set__(self, obj, value):
4422        obj.section5[5 + 2] = value
class TargetCompressionRatio:
4425class TargetCompressionRatio:
4426    """Target Compression Ratio"""
4427
4428    def __get__(self, obj, objtype=None):
4429        return obj.section5[6 + 2]
4430
4431    def __set__(self, obj, value):
4432        pass

Target Compression Ratio

class RealOfCoefficient:
4435class RealOfCoefficient:
4436    """Real of Coefficient"""
4437
4438    def __get__(self, obj, objtype=None):
4439        return utils.ieee_int_to_float(obj.section5[4 + 2])
4440
4441    def __set__(self, obj, value):
4442        obj.section5[4 + 2] = utils.ieee_float_to_int(float(value))

Real of Coefficient

class CompressionOptionsMask:
4445class CompressionOptionsMask:
4446    """Compression Options Mask for AEC/CCSDS"""
4447
4448    def __get__(self, obj, objtype=None):
4449        return obj.section5[5 + 2]
4450
4451    def __set__(self, obj, value):
4452        obj.section5[5 + 2] = value

Compression Options Mask for AEC/CCSDS

class BlockSize:
4455class BlockSize:
4456    """Block Size for AEC/CCSDS"""
4457
4458    def __get__(self, obj, objtype=None):
4459        return obj.section5[6 + 2]
4460
4461    def __set__(self, obj, value):
4462        obj.section5[6 + 2] = value

Block Size for AEC/CCSDS

class RefSampleInterval:
4465class RefSampleInterval:
4466    """Reference Sample Interval for AEC/CCSDS"""
4467
4468    def __get__(self, obj, objtype=None):
4469        return obj.section5[7 + 2]
4470
4471    def __set__(self, obj, value):
4472        obj.section5[7 + 2] = value

Reference Sample Interval for AEC/CCSDS

@dataclass(init=False)
class DataRepresentationTemplate0:
4475@dataclass(init=False)
4476class DataRepresentationTemplate0:
4477    """[Data Representation Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml)"""
4478
4479    _len = 5
4480    _num = 0
4481    _packingScheme = "simple"
4482    refValue: float = field(init=False, repr=False, default=RefValue())
4483    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4484    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4485    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4486
4487    @classmethod
4488    def _attrs(cls):
4489        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

@dataclass(init=False)
class DataRepresentationTemplate2:
4492@dataclass(init=False)
4493class DataRepresentationTemplate2:
4494    """[Data Representation Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-2.shtml)"""
4495
4496    _len = 16
4497    _num = 2
4498    _packingScheme = "complex"
4499    refValue: float = field(init=False, repr=False, default=RefValue())
4500    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4501    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4502    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4503    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4504    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4505    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4506    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4507    nGroups: int = field(init=False, repr=False, default=NGroups())
4508    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4509    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4510    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4511    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4512    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4513    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4514
4515    @classmethod
4516    def _attrs(cls):
4517        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

groupSplittingMethod: Grib2Metadata
typeOfMissingValueManagement: Grib2Metadata
priMissingValue: Union[float, int]

Primary Missing Value

secMissingValue: Union[float, int]

Secondary Missing Value

nGroups: int

Number of Groups

refGroupWidth: int

Reference Group Width

nBitsGroupWidth: int

Number of bits for Group Width

refGroupLength: int

Reference Group Length

groupLengthIncrement: int

Group Length Increment

lengthOfLastGroup: int

Length of Last Group

nBitsScaledGroupLength: int

Number of bits of Scaled Group Length

@dataclass(init=False)
class DataRepresentationTemplate3:
4520@dataclass(init=False)
4521class DataRepresentationTemplate3:
4522    """[Data Representation Template 3](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-3.shtml)"""
4523
4524    _len = 18
4525    _num = 3
4526    _packingScheme = "complex-spdiff"
4527    refValue: float = field(init=False, repr=False, default=RefValue())
4528    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4529    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4530    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4531    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4532    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4533    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4534    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4535    nGroups: int = field(init=False, repr=False, default=NGroups())
4536    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4537    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4538    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4539    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4540    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4541    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4542    spatialDifferenceOrder: Grib2Metadata = field(init=False, repr=False, default=SpatialDifferenceOrder())
4543    nBytesSpatialDifference: int = field(init=False, repr=False, default=NBytesSpatialDifference())
4544
4545    @classmethod
4546    def _attrs(cls):
4547        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

groupSplittingMethod: Grib2Metadata
typeOfMissingValueManagement: Grib2Metadata
priMissingValue: Union[float, int]

Primary Missing Value

secMissingValue: Union[float, int]

Secondary Missing Value

nGroups: int

Number of Groups

refGroupWidth: int

Reference Group Width

nBitsGroupWidth: int

Number of bits for Group Width

refGroupLength: int

Reference Group Length

groupLengthIncrement: int

Group Length Increment

lengthOfLastGroup: int

Length of Last Group

nBitsScaledGroupLength: int

Number of bits of Scaled Group Length

spatialDifferenceOrder: Grib2Metadata
nBytesSpatialDifference: int

Number of bytes for Spatial Differencing

@dataclass(init=False)
class DataRepresentationTemplate4:
4550@dataclass(init=False)
4551class DataRepresentationTemplate4:
4552    """[Data Representation Template 4](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-4.shtml)"""
4553
4554    _len = 1
4555    _num = 4
4556    _packingScheme = "ieee-float"
4557    precision: Grib2Metadata = field(init=False, repr=False, default=Precision())
4558
4559    @classmethod
4560    def _attrs(cls):
4561        return list(cls.__dataclass_fields__.keys())
@dataclass(init=False)
class DataRepresentationTemplate40:
4564@dataclass(init=False)
4565class DataRepresentationTemplate40:
4566    """[Data Representation Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-40.shtml)"""
4567
4568    _len = 7
4569    _num = 40
4570    _packingScheme = "jpeg"
4571    refValue: float = field(init=False, repr=False, default=RefValue())
4572    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4573    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4574    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4575    typeOfCompression: Grib2Metadata = field(init=False, repr=False, default=TypeOfCompression())
4576    targetCompressionRatio: int = field(init=False, repr=False, default=TargetCompressionRatio())
4577
4578    @classmethod
4579    def _attrs(cls):
4580        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

typeOfCompression: Grib2Metadata
targetCompressionRatio: int

Target Compression Ratio

@dataclass(init=False)
class DataRepresentationTemplate41:
4583@dataclass(init=False)
4584class DataRepresentationTemplate41:
4585    """[Data Representation Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-41.shtml)"""
4586
4587    _len = 5
4588    _num = 41
4589    _packingScheme = "png"
4590    refValue: float = field(init=False, repr=False, default=RefValue())
4591    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4592    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4593    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4594
4595    @classmethod
4596    def _attrs(cls):
4597        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

@dataclass(init=False)
class DataRepresentationTemplate42:
4600@dataclass(init=False)
4601class DataRepresentationTemplate42:
4602    """[Data Representation Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-42.shtml)"""
4603
4604    _len = 8
4605    _num = 42
4606    _packingScheme = "aec"
4607    refValue: float = field(init=False, repr=False, default=RefValue())
4608    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4609    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4610    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4611    compressionOptionsMask: int = field(init=False, repr=False, default=CompressionOptionsMask())
4612    blockSize: int = field(init=False, repr=False, default=BlockSize())
4613    refSampleInterval: int = field(init=False, repr=False, default=RefSampleInterval())
4614
4615    @classmethod
4616    def _attrs(cls):
4617        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

compressionOptionsMask: int

Compression Options Mask for AEC/CCSDS

blockSize: int

Block Size for AEC/CCSDS

refSampleInterval: int

Reference Sample Interval for AEC/CCSDS

@dataclass(init=False)
class DataRepresentationTemplate50:
4620@dataclass(init=False)
4621class DataRepresentationTemplate50:
4622    """[Data Representation Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-50.shtml)"""
4623
4624    _len = 5
4625    _num = 0
4626    _packingScheme = "spectral-simple"
4627    refValue: float = field(init=False, repr=False, default=RefValue())
4628    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4629    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4630    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4631    realOfCoefficient: float = field(init=False, repr=False, default=RealOfCoefficient())
4632
4633    @classmethod
4634    def _attrs(cls):
4635        return list(cls.__dataclass_fields__.keys())
refValue: float

Reference Value (represented as an IEEE 32-bit floating point value)

binScaleFactor: int

Binary Scale Factor

decScaleFactor: int

Decimal Scale Factor

nBitsPacking: int

Minimum number of bits for packing

realOfCoefficient: float

Real of Coefficient

def drt_class_by_drtn(drtn: int):
4650def drt_class_by_drtn(drtn: int):
4651    """
4652    Provide a Data Representation Template class via the template number.
4653
4654    Parameters
4655    ----------
4656    drtn
4657        Data Representation template number.
4658
4659    Returns
4660    -------
4661    drt_class_by_drtn
4662        Data Representation template class object (not an instance).
4663    """
4664    return _drt_by_drtn[drtn]

Provide a Data Representation Template class via the template number.

Parameters
  • drtn: Data Representation template number.
Returns
  • drt_class_by_drtn: Data Representation template class object (not an instance).