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"] = float(0.5 * (obj.longitudeFirstGridpoint + obj.longitudeLastGridpoint))
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        return obj.parameterUnits if obj.pdtn not in {5, 9} else "%"
1411
1412    def __set__(self, obj, value):
1413        raise RuntimeError(
1414            "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."
1415        )
1416
1417
1418class ShortName:
1419    """Short name of the variable (i.e. the variable abbreviation)."""
1420
1421    def __get__(self, obj, objtype=None):
1422        if obj._isAerosol:
1423            return tables._build_aerosol_shortname(obj)
1424        elif obj._isChemical:
1425            return tables._build_chemical_shortname(obj)
1426        else:
1427            return tables.get_varinfo_from_table(obj.section0[2], *obj.section4[2:4], isNDFD=obj._isNDFD)[2]
1428
1429    def __set__(self, obj, value):
1430        metadata = tables.get_metadata_from_shortname(value)
1431        if len(metadata) > 1:
1432            raise ValueError(
1433                f"shortName={value} is ambiguous within the GRIB2 standard and you have to set instead with discipline, parameterCategory, and parameterNumber.\n{metadata}"
1434            )
1435        for attr, val in metadata[0].items():
1436            if attr in ["fullName", "units"]:
1437                continue
1438            setattr(obj, attr, val)
1439
1440
1441class TypeOfGeneratingProcess:
1442    """[Type of Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-3.shtml)"""
1443
1444    _key = defaultdict(lambda: 2, {48: 13})
1445
1446    def __get__(self, obj, objtype=None):
1447        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.3")
1448
1449    def __set__(self, obj, value):
1450        obj.section4[self._key[obj.pdtn] + 2] = value
1451
1452
1453class BackgroundGeneratingProcessIdentifier:
1454    """Background Generating Process Identifier"""
1455
1456    _key = defaultdict(lambda: 3, {48: 14})
1457
1458    def __get__(self, obj, objtype=None):
1459        return obj.section4[self._key[obj.pdtn] + 2]
1460
1461    def __set__(self, obj, value):
1462        obj.section4[self._key[obj.pdtn] + 2] = value
1463
1464
1465class GeneratingProcess:
1466    """[Generating Process](https://www.nco.ncep.noaa.gov/pmb/docs/on388/tablea.html)"""
1467
1468    _key = defaultdict(lambda: 4, {48: 15})
1469
1470    def __get__(self, obj, objtype=None):
1471        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="generating_process")
1472
1473    def __set__(self, obj, value):
1474        obj.section4[self._key[obj.pdtn] + 2] = value
1475
1476
1477class HoursAfterDataCutoff:
1478    """Hours of observational data cutoff after reference time."""
1479
1480    _key = defaultdict(lambda: 5, {48: 16})
1481
1482    def __get__(self, obj, objtype=None):
1483        return obj.section4[self._key[obj.pdtn] + 2]
1484
1485    def __set__(self, obj, value):
1486        obj.section4[self._key[obj.pdtn] + 2] = value
1487
1488
1489class MinutesAfterDataCutoff:
1490    """Minutes of observational data cutoff after reference time."""
1491
1492    _key = defaultdict(lambda: 6, {48: 17})
1493
1494    def __get__(self, obj, objtype=None):
1495        return obj.section4[self._key[obj.pdtn] + 2]
1496
1497    def __set__(self, obj, value):
1498        obj.section4[self._key[obj.pdtn] + 2] = value
1499
1500
1501class UnitOfForecastTime:
1502    """[Units of Forecast Time](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
1503
1504    _key = defaultdict(lambda: 7, {48: 18})
1505
1506    def __get__(self, obj, objtype=None):
1507        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.4")
1508
1509    def __set__(self, obj, value):
1510        obj.section4[self._key[obj.pdtn] + 2] = value
1511
1512
1513class ValueOfForecastTime:
1514    """Value of forecast time in units defined by `UnitofForecastTime`."""
1515
1516    _key = defaultdict(lambda: 8, {48: 19})
1517
1518    def __get__(self, obj, objtype=None):
1519        return obj.section4[self._key[obj.pdtn] + 2]
1520
1521    def __set__(self, obj, value):
1522        obj.section4[self._key[obj.pdtn] + 2] = value
1523
1524
1525class LeadTime:
1526    """Forecast Lead Time. NOTE: This is a `datetime.timedelta` object."""
1527
1528    _key = ValueOfForecastTime._key
1529
1530    def __get__(self, obj, objtype=None):
1531        return utils.get_leadtime(obj.section4[1], obj.section4[2:]) + obj.duration
1532
1533    def __set__(self, obj, value):
1534        if isinstance(value, np.timedelta64):
1535            # Allows setting from xarray
1536            value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
1537        # First update validDate if necessary.
1538        # IMPORTANT: Update validDate components when message is time interval
1539        if obj.pdtn in _timeinterval_pdtns:
1540            vd = obj.refDate + value
1541            obj.yearOfEndOfTimePeriod = vd.year
1542            obj.monthOfEndOfTimePeriod = vd.month
1543            obj.dayOfEndOfTimePeriod = vd.day
1544            obj.hourOfEndOfTimePeriod = vd.hour
1545            obj.minuteOfEndOfTimePeriod = vd.minute
1546            obj.secondOfEndOfTimePeriod = vd.second
1547        # Update leadTime component in section4
1548        value -= obj.duration
1549        obj.section4[self._key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)
1550
1551
1552class FixedSfc1Info:
1553    """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)"""
1554
1555    _key = defaultdict(lambda: 9, {48: 20})
1556
1557    def __get__(self, obj, objtype=None):
1558        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1559            return [None, None]
1560        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1561
1562    def __set__(self, obj, value):
1563        raise NotImplementedError
1564
1565
1566class FixedSfc2Info:
1567    """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)"""
1568
1569    _key = defaultdict(lambda: 12, {48: 23})
1570
1571    def __get__(self, obj, objtype=None):
1572        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1573            return [None, None]
1574        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1575
1576    def __set__(self, obj, value):
1577        raise NotImplementedError
1578
1579
1580class TypeOfFirstFixedSurface:
1581    """[Type of First Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1582
1583    _key = defaultdict(
1584        lambda: 9,
1585        {
1586            40: 10,
1587            41: 10,
1588            42: 10,
1589            43: 10,
1590            44: 10,
1591            45: 10,
1592            46: 10,
1593            47: 10,
1594            48: 20,
1595            49: 20,
1596            57: 10,
1597            58: 10,
1598            67: 10,
1599            68: 10,
1600            76: 10,
1601            77: 10,
1602            78: 10,
1603            79: 10,
1604            80: 20,
1605            81: 20,
1606            82: 20,
1607            83: 20,
1608            84: 20,
1609            85: 20,
1610        },
1611    )
1612
1613    def __get__(self, obj, objtype=None):
1614        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1615
1616    def __set__(self, obj, value):
1617        obj.section4[self._key[obj.pdtn] + 2] = value
1618
1619
1620class ScaleFactorOfFirstFixedSurface:
1621    """Scale Factor of First Fixed Surface"""
1622
1623    _key = defaultdict(
1624        lambda: 10,
1625        {
1626            40: 11,
1627            41: 11,
1628            42: 11,
1629            43: 11,
1630            44: 11,
1631            45: 11,
1632            46: 11,
1633            47: 11,
1634            48: 21,
1635            49: 21,
1636            57: 11,
1637            58: 11,
1638            67: 11,
1639            68: 11,
1640            76: 11,
1641            77: 11,
1642            78: 11,
1643            79: 11,
1644            80: 21,
1645            81: 21,
1646            82: 21,
1647            83: 21,
1648            84: 21,
1649            85: 21,
1650        },
1651    )
1652
1653    def __get__(self, obj, objtype=None):
1654        return obj.section4[self._key[obj.pdtn] + 2]
1655
1656    def __set__(self, obj, value):
1657        obj.section4[self._key[obj.pdtn] + 2] = value
1658
1659
1660class ScaledValueOfFirstFixedSurface:
1661    """Scaled Value Of First Fixed Surface"""
1662
1663    _key = defaultdict(
1664        lambda: 11,
1665        {
1666            40: 12,
1667            41: 12,
1668            42: 12,
1669            43: 12,
1670            44: 12,
1671            45: 12,
1672            46: 12,
1673            47: 12,
1674            48: 22,
1675            49: 22,
1676            57: 12,
1677            58: 12,
1678            67: 12,
1679            68: 12,
1680            76: 12,
1681            77: 12,
1682            78: 12,
1683            79: 12,
1684            80: 22,
1685            81: 22,
1686            82: 22,
1687            83: 22,
1688            84: 22,
1689            85: 22,
1690        },
1691    )
1692
1693    def __get__(self, obj, objtype=None):
1694        return obj.section4[self._key[obj.pdtn] + 2]
1695
1696    def __set__(self, obj, value):
1697        obj.section4[self._key[obj.pdtn] + 2] = value
1698
1699
1700class UnitOfFirstFixedSurface:
1701    """Units of First Fixed Surface"""
1702
1703    def __get__(self, obj, objtype=None):
1704        return obj._fixedsfc1info[1]
1705
1706    def __set__(self, obj, value):
1707        pass
1708
1709
1710class ValueOfFirstFixedSurface:
1711    """Value of First Fixed Surface"""
1712
1713    def __get__(self, obj, objtype=None):
1714        scale_factor = getattr(obj, "scaleFactorOfFirstFixedSurface")
1715        scaled_value = getattr(obj, "scaledValueOfFirstFixedSurface")
1716        if scale_factor < 0:
1717            return 0.0
1718        else:
1719            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1720
1721    def __set__(self, obj, value):
1722        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1723        setattr(obj, "scaleFactorOfFirstFixedSurface", scale_factor)
1724        setattr(obj, "scaledValueOfFirstFixedSurface", scaled_value)
1725
1726
1727class TypeOfSecondFixedSurface:
1728    """[Type of Second Fixed Surface](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-5.shtml)"""
1729
1730    _key = defaultdict(
1731        lambda: 12,
1732        {
1733            40: 13,
1734            41: 13,
1735            42: 13,
1736            43: 13,
1737            44: 13,
1738            45: 13,
1739            46: 13,
1740            47: 13,
1741            48: 23,
1742            49: 23,
1743            57: 13,
1744            58: 13,
1745            67: 13,
1746            68: 13,
1747            76: 13,
1748            77: 13,
1749            78: 13,
1750            79: 13,
1751            80: 23,
1752            81: 23,
1753            82: 23,
1754            83: 23,
1755            84: 23,
1756            85: 23,
1757        },
1758    )
1759
1760    def __get__(self, obj, objtype=None):
1761        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.5")
1762
1763    def __set__(self, obj, value):
1764        obj.section4[self._key[obj.pdtn] + 2] = value
1765
1766
1767class ScaleFactorOfSecondFixedSurface:
1768    """Scale Factor of Second Fixed Surface"""
1769
1770    _key = defaultdict(
1771        lambda: 13,
1772        {
1773            40: 14,
1774            41: 14,
1775            42: 14,
1776            43: 14,
1777            44: 14,
1778            45: 14,
1779            46: 14,
1780            47: 14,
1781            48: 24,
1782            49: 24,
1783            57: 14,
1784            58: 14,
1785            67: 14,
1786            68: 14,
1787            76: 14,
1788            77: 14,
1789            78: 14,
1790            79: 14,
1791            80: 24,
1792            81: 24,
1793            82: 24,
1794            83: 24,
1795            84: 24,
1796            85: 24,
1797        },
1798    )
1799
1800    def __get__(self, obj, objtype=None):
1801        return obj.section4[self._key[obj.pdtn] + 2]
1802
1803    def __set__(self, obj, value):
1804        obj.section4[self._key[obj.pdtn] + 2] = value
1805
1806
1807class ScaledValueOfSecondFixedSurface:
1808    """Scaled Value Of Second Fixed Surface"""
1809
1810    _key = defaultdict(
1811        lambda: 14,
1812        {
1813            40: 15,
1814            41: 15,
1815            42: 15,
1816            43: 15,
1817            44: 15,
1818            45: 15,
1819            46: 15,
1820            47: 15,
1821            48: 25,
1822            49: 25,
1823            57: 15,
1824            58: 15,
1825            67: 15,
1826            68: 15,
1827            76: 15,
1828            77: 15,
1829            78: 15,
1830            79: 15,
1831            80: 25,
1832            81: 25,
1833            82: 25,
1834            83: 25,
1835            84: 25,
1836            85: 25,
1837        },
1838    )
1839
1840    def __get__(self, obj, objtype=None):
1841        return obj.section4[self._key[obj.pdtn] + 2]
1842
1843    def __set__(self, obj, value):
1844        obj.section4[self._key[obj.pdtn] + 2] = value
1845
1846
1847class UnitOfSecondFixedSurface:
1848    """Units of Second Fixed Surface"""
1849
1850    def __get__(self, obj, objtype=None):
1851        return obj._fixedsfc2info[1]
1852
1853    def __set__(self, obj, value):
1854        pass
1855
1856
1857class ValueOfSecondFixedSurface:
1858    """Value of Second Fixed Surface"""
1859
1860    def __get__(self, obj, objtype=None):
1861        scale_factor = getattr(obj, "scaleFactorOfSecondFixedSurface")
1862        scaled_value = getattr(obj, "scaledValueOfSecondFixedSurface")
1863        if scale_factor < 0:
1864            return 0.0
1865        else:
1866            return float(Decimal(int(scaled_value)) / (10**scale_factor))
1867
1868    def __set__(self, obj, value):
1869        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
1870        setattr(obj, "scaleFactorOfSecondFixedSurface", scale_factor)
1871        setattr(obj, "scaledValueOfSecondFixedSurface", scaled_value)
1872
1873
1874class Level:
1875    """Level (same as provided by [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Level.c))"""
1876
1877    def __get__(self, obj, objtype=None):
1878        return tables.get_wgrib2_level_string(obj.pdtn, obj.section4[2:])
1879
1880    def __set__(self, obj, value):
1881        pass
1882
1883
1884class TypeOfEnsembleForecast:
1885    """[Type of Ensemble Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-6.shtml)"""
1886
1887    _key = {
1888        1: 15,
1889        11: 15,
1890        41: 16,
1891        43: 19,
1892        45: 16,
1893        47: 16,
1894        49: 26,
1895        81: 26,
1896        83: 26,
1897        84: 26,
1898        85: 26,
1899    }
1900
1901    def __get__(self, obj, objtype=None):
1902        pdtn = obj.section4[1]
1903        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.6")
1904
1905    def __set__(self, obj, value):
1906        pdtn = obj.section4[1]
1907        obj.section4[self._key[pdtn] + 2] = value
1908
1909
1910class PerturbationNumber:
1911    """Ensemble Perturbation Number"""
1912
1913    _key = {
1914        1: 16,
1915        11: 16,
1916        41: 17,
1917        43: 20,
1918        45: 17,
1919        47: 17,
1920        49: 27,
1921        81: 27,
1922        83: 27,
1923        84: 27,
1924        85: 27,
1925    }
1926
1927    def __get__(self, obj, objtype=None):
1928        pdtn = obj.section4[1]
1929        return obj.section4[self._key[pdtn] + 2]
1930
1931    def __set__(self, obj, value):
1932        pdtn = obj.section4[1]
1933        obj.section4[self._key[pdtn] + 2] = value
1934
1935
1936class NumberOfEnsembleForecasts:
1937    """Total Number of Ensemble Forecasts"""
1938
1939    _key = {
1940        1: 17,
1941        2: 16,
1942        11: 17,
1943        12: 16,
1944        41: 18,
1945        43: 21,
1946        45: 18,
1947        47: 18,
1948        49: 28,
1949        81: 28,
1950        83: 28,
1951        84: 28,
1952        85: 28,
1953    }
1954
1955    def __get__(self, obj, objtype=None):
1956        pdtn = obj.section4[1]
1957        return obj.section4[self._key[pdtn] + 2]
1958
1959    def __set__(self, obj, value):
1960        pdtn = obj.section4[1]
1961        obj.section4[self._key[pdtn] + 2] = value
1962
1963
1964class TypeOfDerivedForecast:
1965    """[Type of Derived Forecast](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-7.shtml)"""
1966
1967    _key = {2: 15, 12: 15}
1968
1969    def __get__(self, obj, objtype=None):
1970        pdtn = obj.section4[1]
1971        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.7")
1972
1973    def __set__(self, obj, value):
1974        pdtn = obj.section4[1]
1975        obj.section4[self._key[pdtn] + 2] = value
1976
1977
1978class ForecastProbabilityNumber:
1979    """Forecast Probability Number"""
1980
1981    _key = {5: 15, 9: 15}
1982
1983    def __get__(self, obj, objtype=None):
1984        pdtn = obj.section4[1]
1985        return obj.section4[self._key[pdtn] + 2]
1986
1987    def __set__(self, obj, value):
1988        pdtn = obj.section4[1]
1989        obj.section4[self._key[pdtn] + 2] = value
1990
1991
1992class TotalNumberOfForecastProbabilities:
1993    """Total Number of Forecast Probabilities"""
1994
1995    _key = {5: 16, 9: 16}
1996
1997    def __get__(self, obj, objtype=None):
1998        pdtn = obj.section4[1]
1999        return obj.section4[self._key[pdtn] + 2]
2000
2001    def __set__(self, obj, value):
2002        pdtn = obj.section4[1]
2003        obj.section4[self._key[pdtn] + 2] = value
2004
2005
2006class TypeOfProbability:
2007    """[Type of Probability](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-9.shtml)"""
2008
2009    _key = {5: 17, 9: 17}
2010
2011    def __get__(self, obj, objtype=None):
2012        pdtn = obj.section4[1]
2013        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.9")
2014
2015    def __set__(self, obj, value):
2016        pdtn = obj.section4[1]
2017        obj.section4[self._key[pdtn] + 2] = value
2018
2019
2020class ScaleFactorOfThresholdLowerLimit:
2021    """Scale Factor of Threshold Lower Limit"""
2022
2023    _key = {5: 18, 9: 18}
2024
2025    def __get__(self, obj, objtype=None):
2026        pdtn = obj.section4[1]
2027        return obj.section4[self._key[pdtn] + 2]
2028
2029    def __set__(self, obj, value):
2030        pdtn = obj.section4[1]
2031        obj.section4[self._key[pdtn] + 2] = value
2032
2033
2034class ScaledValueOfThresholdLowerLimit:
2035    """Scaled Value of Threshold Lower Limit"""
2036
2037    _key = {5: 19, 9: 19}
2038
2039    def __get__(self, obj, objtype=None):
2040        pdtn = obj.section4[1]
2041        return obj.section4[self._key[pdtn] + 2]
2042
2043    def __set__(self, obj, value):
2044        pdtn = obj.section4[1]
2045        obj.section4[self._key[pdtn] + 2] = value
2046
2047
2048class ScaleFactorOfThresholdUpperLimit:
2049    """Scale Factor of Threshold Upper Limit"""
2050
2051    _key = {5: 20, 9: 20}
2052
2053    def __get__(self, obj, objtype=None):
2054        pdtn = obj.section4[1]
2055        return obj.section4[self._key[pdtn] + 2]
2056
2057    def __set__(self, obj, value):
2058        pdtn = obj.section4[1]
2059        obj.section4[self._key[pdtn] + 2] = value
2060
2061
2062class ScaledValueOfThresholdUpperLimit:
2063    """Scaled Value of Threshold Upper Limit"""
2064
2065    _key = {5: 21, 9: 21}
2066
2067    def __get__(self, obj, objtype=None):
2068        pdtn = obj.section4[1]
2069        return obj.section4[self._key[pdtn] + 2]
2070
2071    def __set__(self, obj, value):
2072        pdtn = obj.section4[1]
2073        obj.section4[self._key[pdtn] + 2] = value
2074
2075
2076class ThresholdLowerLimit:
2077    """Threshold Lower Limit"""
2078
2079    def __get__(self, obj, objtype=None):
2080        scale_factor = getattr(obj, "scaleFactorOfThresholdLowerLimit")
2081        scaled_value = getattr(obj, "scaledValueOfThresholdLowerLimit")
2082        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2083            return 0.0
2084        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2085        return value
2086
2087    def __set__(self, obj, value):
2088        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2089        setattr(obj, "scaleFactorOfThresholdLowerLimit", scale_factor)
2090        setattr(obj, "scaledValueOfThresholdLowerLimit", scaled_value)
2091
2092
2093class ThresholdUpperLimit:
2094    """Threshold Upper Limit"""
2095
2096    def __get__(self, obj, objtype=None):
2097        scale_factor = getattr(obj, "scaleFactorOfThresholdUpperLimit")
2098        scaled_value = getattr(obj, "scaledValueOfThresholdUpperLimit")
2099        if scale_factor in {-2147483647, -127} or scaled_value in {-2147483647, 255}:
2100            return 0.0
2101        value = float(Decimal(int(scaled_value)) / (10**scale_factor))
2102        return value
2103
2104    def __set__(self, obj, value):
2105        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2106        setattr(obj, "scaleFactorOfThresholdUpperLimit", scale_factor)
2107        setattr(obj, "scaledValueOfThresholdUpperLimit", scaled_value)
2108
2109
2110class Threshold:
2111    """Threshold string (same as [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Prob.c))"""
2112
2113    def __get__(self, obj, objtype=None):
2114        return utils.get_wgrib2_prob_string(*obj.section4[17 + 2 : 22 + 2])
2115
2116    def __set__(self, obj, value):
2117        pass
2118
2119
2120class PercentileValue:
2121    """Percentile Value"""
2122
2123    _key = {6: 15, 10: 15}
2124
2125    def __get__(self, obj, objtype=None):
2126        pdtn = obj.section4[1]
2127        return obj.section4[self._key[pdtn] + 2]
2128
2129    def __set__(self, obj, value):
2130        pdtn = obj.section4[1]
2131        obj.section4[self._key[pdtn] + 2] = value
2132
2133
2134class YearOfEndOfTimePeriod:
2135    """Year of End of Forecast Time Period"""
2136
2137    _key = {8: 15, 9: 22, 10: 16, 11: 18, 12: 17, 42: 16, 43: 22, 46: 16, 82: 26}
2138
2139    def __get__(self, obj, objtype=None):
2140        pdtn = obj.section4[1]
2141        return obj.section4[self._key[pdtn] + 2]
2142
2143    def __set__(self, obj, value):
2144        pdtn = obj.section4[1]
2145        obj.section4[self._key[pdtn] + 2] = value
2146
2147
2148class MonthOfEndOfTimePeriod:
2149    """Month Year of End of Forecast Time Period"""
2150
2151    _key = {8: 16, 9: 23, 10: 17, 11: 19, 12: 18, 42: 17, 43: 23, 46: 17, 82: 27}
2152
2153    def __get__(self, obj, objtype=None):
2154        pdtn = obj.section4[1]
2155        return obj.section4[self._key[pdtn] + 2]
2156
2157    def __set__(self, obj, value):
2158        pdtn = obj.section4[1]
2159        obj.section4[self._key[pdtn] + 2] = value
2160
2161
2162class DayOfEndOfTimePeriod:
2163    """Day Year of End of Forecast Time Period"""
2164
2165    _key = {8: 17, 9: 24, 10: 18, 11: 20, 12: 19, 42: 18, 43: 24, 46: 18, 82: 28}
2166
2167    def __get__(self, obj, objtype=None):
2168        pdtn = obj.section4[1]
2169        return obj.section4[self._key[pdtn] + 2]
2170
2171    def __set__(self, obj, value):
2172        pdtn = obj.section4[1]
2173        obj.section4[self._key[pdtn] + 2] = value
2174
2175
2176class HourOfEndOfTimePeriod:
2177    """Hour Year of End of Forecast Time Period"""
2178
2179    _key = {8: 18, 9: 25, 10: 19, 11: 21, 12: 20, 42: 19, 43: 25, 46: 19, 82: 29}
2180
2181    def __get__(self, obj, objtype=None):
2182        pdtn = obj.section4[1]
2183        return obj.section4[self._key[pdtn] + 2]
2184
2185    def __set__(self, obj, value):
2186        pdtn = obj.section4[1]
2187        obj.section4[self._key[pdtn] + 2] = value
2188
2189
2190class MinuteOfEndOfTimePeriod:
2191    """Minute Year of End of Forecast Time Period"""
2192
2193    _key = {8: 19, 9: 26, 10: 20, 11: 22, 12: 21, 42: 20, 43: 26, 46: 20, 82: 30}
2194
2195    def __get__(self, obj, objtype=None):
2196        pdtn = obj.section4[1]
2197        return obj.section4[self._key[pdtn] + 2]
2198
2199    def __set__(self, obj, value):
2200        pdtn = obj.section4[1]
2201        obj.section4[self._key[pdtn] + 2] = value
2202
2203
2204class SecondOfEndOfTimePeriod:
2205    """Second Year of End of Forecast Time Period"""
2206
2207    _key = {8: 20, 9: 27, 10: 21, 11: 23, 12: 22, 42: 21, 43: 27, 46: 21, 82: 31}
2208
2209    def __get__(self, obj, objtype=None):
2210        pdtn = obj.section4[1]
2211        return obj.section4[self._key[pdtn] + 2]
2212
2213    def __set__(self, obj, value):
2214        pdtn = obj.section4[1]
2215        obj.section4[self._key[pdtn] + 2] = value
2216
2217
2218class Duration:
2219    """Duration of time period. NOTE: This is a `datetime.timedelta` object."""
2220
2221    def __get__(self, obj, objtype=None):
2222        return utils.get_duration(obj.section4[1], obj.section4[2:])
2223
2224    def __set__(self, obj, value):
2225        if obj.pdtn in _continuous_pdtns:
2226            pass
2227        elif obj.pdtn in _timeinterval_pdtns:
2228            lt_orig = obj.leadTime
2229            _key = TimeRangeOfStatisticalProcess._key
2230            if isinstance(value, np.timedelta64):
2231                # Allows setting from xarray
2232                value = datetime.timedelta(seconds=int(value / np.timedelta64(1, "s")))
2233            obj.section4[_key[obj.pdtn] + 2] = int(value.total_seconds() / 3600)
2234            obj.leadTime = lt_orig
2235            # IMPORTANT: Update validDate components when message is time interval
2236            # if obj.pdtn in _timeinterval_pdtns:
2237            #    print(obj.refDate, value, obj.leadTime)
2238            #    vd = obj.refDate + value + obj.leadTime
2239            #    obj.yearOfEndOfTimePeriod = vd.year
2240            #    obj.monthOfEndOfTimePeriod = vd.month
2241            #    obj.dayOfEndOfTimePeriod = vd.day
2242            #    obj.hourOfEndOfTimePeriod = vd.hour
2243            #    obj.minuteOfEndOfTimePeriod = vd.minute
2244            #    obj.secondOfEndOfTimePeriod = vd.second
2245
2246
2247class ValidDate:
2248    """Valid Date of the forecast. NOTE: This is a `datetime.datetime` object."""
2249
2250    _key = {
2251        8: slice(15, 21),
2252        9: slice(22, 28),
2253        10: slice(16, 22),
2254        11: slice(18, 24),
2255        12: slice(17, 23),
2256    }
2257
2258    def __get__(self, obj, objtype=None):
2259        pdtn = obj.section4[1]
2260        try:
2261            s = slice(self._key[pdtn].start + 2, self._key[pdtn].stop + 2)
2262            return datetime.datetime(*obj.section4[s])
2263        except KeyError:
2264            return obj.refDate + obj.leadTime
2265
2266    def __set__(self, obj, value):
2267        warnings.warn("validDate attribute is read-only.")
2268
2269
2270class NumberOfTimeRanges:
2271    """Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field"""
2272
2273    _key = {8: 21, 9: 28, 10: 22, 11: 24, 12: 23, 42: 22, 43: 28, 46: 27}
2274
2275    def __get__(self, obj, objtype=None):
2276        pdtn = obj.section4[1]
2277        return obj.section4[self._key[pdtn] + 2]
2278
2279    def __set__(self, obj, value):
2280        pdtn = obj.section4[1]
2281        obj.section4[self._key[pdtn] + 2] = value
2282
2283
2284class NumberOfMissingValues:
2285    """Total number of data values missing in statistical process"""
2286
2287    _key = {8: 22, 9: 29, 10: 23, 11: 25, 12: 24, 42: 23, 43: 29, 46: 28}
2288
2289    def __get__(self, obj, objtype=None):
2290        pdtn = obj.section4[1]
2291        return obj.section4[self._key[pdtn] + 2]
2292
2293    def __set__(self, obj, value):
2294        pdtn = obj.section4[1]
2295        obj.section4[self._key[pdtn] + 2] = value
2296
2297
2298class StatisticalProcess:
2299    """[Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-10.shtml)"""
2300
2301    _key = {
2302        8: 23,
2303        9: 30,
2304        10: 24,
2305        11: 26,
2306        12: 25,
2307        15: 15,
2308        42: 24,
2309        43: 30,
2310        46: 30,
2311        47: 30,
2312        49: 30,
2313        80: 30,
2314        81: 30,
2315        82: 30,
2316        83: 30,
2317        84: 30,
2318        85: 30,
2319    }
2320
2321    def __get__(self, obj, objtype=None):
2322        pdtn = obj.section4[1]
2323        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.10")
2324
2325    def __set__(self, obj, value):
2326        pdtn = obj.section4[1]
2327        obj.section4[self._key[pdtn] + 2] = value
2328
2329
2330class TypeOfTimeIncrementOfStatisticalProcess:
2331    """[Type of Time Increment of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2332
2333    _key = {
2334        4: 31,
2335        8: 24,
2336        9: 31,
2337        10: 25,
2338        11: 27,
2339        12: 26,
2340        42: 25,
2341        43: 31,
2342        46: 31,
2343        47: 31,
2344        49: 31,
2345        80: 31,
2346        81: 31,
2347        82: 31,
2348        83: 31,
2349        84: 31,
2350        85: 31,
2351    }
2352
2353    def __get__(self, obj, objtype=None):
2354        pdtn = obj.section4[1]
2355        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.11")
2356
2357    def __set__(self, obj, value):
2358        pdtn = obj.section4[1]
2359        obj.section4[self._key[pdtn] + 2] = value
2360
2361
2362class UnitOfTimeRangeOfStatisticalProcess:
2363    """[Unit of Time Range of Statistical Process](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-11.shtml)"""
2364
2365    _key = {
2366        4: 32,
2367        8: 25,
2368        9: 32,
2369        10: 26,
2370        11: 28,
2371        12: 27,
2372        42: 26,
2373        43: 32,
2374        46: 32,
2375        47: 32,
2376        49: 32,
2377        80: 32,
2378        81: 32,
2379        82: 32,
2380        83: 32,
2381        84: 32,
2382        85: 32,
2383    }
2384
2385    def __get__(self, obj, objtype=None):
2386        pdtn = obj.section4[1]
2387        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2388
2389    def __set__(self, obj, value):
2390        pdtn = obj.section4[1]
2391        obj.section4[self._key[pdtn] + 2] = value
2392
2393
2394class TimeRangeOfStatisticalProcess:
2395    """Time Range of Statistical Process"""
2396
2397    _key = {
2398        4: 33,
2399        8: 26,
2400        9: 33,
2401        10: 27,
2402        11: 29,
2403        12: 28,
2404        42: 27,
2405        43: 33,
2406        46: 33,
2407        47: 33,
2408        49: 33,
2409        80: 33,
2410        81: 33,
2411        82: 33,
2412        83: 33,
2413        84: 33,
2414        85: 33,
2415    }
2416
2417    def __get__(self, obj, objtype=None):
2418        pdtn = obj.section4[1]
2419        return obj.section4[self._key[pdtn] + 2]
2420
2421    def __set__(self, obj, value):
2422        pdtn = obj.section4[1]
2423        obj.section4[self._key[pdtn] + 2] = value
2424
2425
2426class UnitOfTimeRangeOfSuccessiveFields:
2427    """[Unit of Time Range of Successive Fields](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-4.shtml)"""
2428
2429    _key = {
2430        4: 34,
2431        8: 27,
2432        9: 34,
2433        10: 28,
2434        11: 30,
2435        12: 29,
2436        42: 28,
2437        43: 34,
2438        46: 34,
2439        47: 34,
2440        49: 34,
2441        80: 34,
2442        81: 34,
2443        82: 34,
2444        83: 34,
2445        84: 34,
2446        85: 34,
2447    }
2448
2449    def __get__(self, obj, objtype=None):
2450        pdtn = obj.section4[1]
2451        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.4")
2452
2453    def __set__(self, obj, value):
2454        pdtn = obj.section4[1]
2455        obj.section4[self._key[pdtn] + 2] = value
2456
2457
2458class TimeIncrementOfSuccessiveFields:
2459    """Time Increment of Successive Fields"""
2460
2461    _key = {
2462        4: 35,
2463        8: 28,
2464        9: 35,
2465        10: 29,
2466        11: 31,
2467        12: 30,
2468        42: 29,
2469        43: 35,
2470        46: 67,
2471        47: 67,
2472        49: 67,
2473        80: 35,
2474        81: 35,
2475        82: 35,
2476        83: 35,
2477        84: 35,
2478        85: 35,
2479    }
2480
2481    def __get__(self, obj, objtype=None):
2482        pdtn = obj.section4[1]
2483        return obj.section4[self._key[pdtn] + 2]
2484
2485    def __set__(self, obj, value):
2486        pdtn = obj.section4[1]
2487        obj.section4[self._key[pdtn] + 2] = value
2488
2489
2490class TypeOfStatisticalProcessing:
2491    """[Type of Statistical Processing](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-15.shtml)"""
2492
2493    _key = {15: 16}
2494
2495    def __get__(self, obj, objtype=None):
2496        pdtn = obj.section4[1]
2497        return Grib2Metadata(obj.section4[self._key[pdtn] + 2], table="4.15")
2498
2499    def __set__(self, obj, value):
2500        pdtn = obj.section4[1]
2501        obj.section4[self._key[pdtn] + 2] = value
2502
2503
2504class NumberOfDataPointsForSpatialProcessing:
2505    """Number of Data Points for Spatial Processing"""
2506
2507    _key = {15: 17}
2508
2509    def __get__(self, obj, objtype=None):
2510        pdtn = obj.section4[1]
2511        return obj.section4[self._key[pdtn] + 2]
2512
2513    def __set__(self, obj, value):
2514        pdtn = obj.section4[1]
2515        obj.section4[self._key[pdtn] + 2] = value
2516
2517
2518class NumberOfContributingSpectralBands:
2519    """Number of Contributing Spectral Bands (NB)"""
2520
2521    _key = {32: 9}
2522
2523    def __get__(self, obj, objtype=None):
2524        pdtn = obj.section4[1]
2525        return obj.section4[self._key[pdtn] + 2]
2526
2527    def __set__(self, obj, value):
2528        pdtn = obj.section4[1]
2529        obj.section4[self._key[pdtn] + 2] = value
2530
2531
2532class SatelliteSeries:
2533    """Satellte Series of band nb, where nb=1,NB if NB > 0"""
2534
2535    _key = {32: 10}
2536
2537    def __get__(self, obj, objtype=None):
2538        pdtn = obj.section4[1]
2539        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2540
2541    def __set__(self, obj, value):
2542        pass
2543
2544
2545class SatelliteNumber:
2546    """Satellte Number of band nb, where nb=1,NB if NB > 0"""
2547
2548    _key = {32: 11}
2549
2550    def __get__(self, obj, objtype=None):
2551        pdtn = obj.section4[1]
2552        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2553
2554    def __set__(self, obj, value):
2555        pass
2556
2557
2558class InstrumentType:
2559    """Instrument Type of band nb, where nb=1,NB if NB > 0"""
2560
2561    _key = {32: 12}
2562
2563    def __get__(self, obj, objtype=None):
2564        pdtn = obj.section4[1]
2565        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2566
2567    def __set__(self, obj, value):
2568        pass
2569
2570
2571class ScaleFactorOfCentralWaveNumber:
2572    """Scale Factor Of Central WaveNumber of band nb, where nb=1,NB if NB > 0"""
2573
2574    _key = {32: 13}
2575
2576    def __get__(self, obj, objtype=None):
2577        pdtn = obj.section4[1]
2578        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2579
2580    def __set__(self, obj, value):
2581        pass
2582
2583
2584class ScaledValueOfCentralWaveNumber:
2585    """Scaled Value Of Central WaveNumber of band NB"""
2586
2587    _key = {32: 14}
2588
2589    def __get__(self, obj, objtype=None):
2590        pdtn = obj.section4[1]
2591        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2592
2593    def __set__(self, obj, value):
2594        pass
2595
2596
2597class CetralWaveNumber:
2598    """Central WaveNumber of band NB"""
2599
2600    def __get__(self, obj, objtype=None):
2601        scale_factor = getattr(obj, "scaleFactorOfCentralWaveNumber")
2602        scaled_value = getattr(obj, "scaledValueOfCentralWaveNumber")
2603        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2604
2605    def __set__(self, obj, value):
2606        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2607        setattr(obj, "scaleFactorOfCentralWaveNumber", scale_factor)
2608        setattr(obj, "scaledValueOfCentralWaveNumber", scaled_value)
2609
2610
2611class TypeOfAerosol:
2612    """[Type of Aerosol](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-233.shtml)"""
2613
2614    _key = {
2615        44: 5,
2616        45: 5,
2617        46: 2,
2618        47: 2,
2619        48: 2,
2620        49: 2,
2621        50: 5,
2622        80: 2,
2623        81: 2,
2624        82: 2,
2625        83: 2,
2626        84: 2,
2627        85: 2,
2628    }
2629
2630    def __get__(self, obj, objtype=None):
2631        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.233")
2632
2633    def __set__(self, obj, value):
2634        obj.section4[self._key[obj.pdtn] + 2] = value
2635
2636
2637class TypeOfIntervalForAerosolSize:
2638    """[Type of Interval for Aerosol Size](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2639
2640    _key = {
2641        44: 6,
2642        45: 6,
2643        46: 3,
2644        47: 3,
2645        48: 3,
2646        49: 3,
2647        50: 6,
2648        80: 3,
2649        81: 3,
2650        82: 3,
2651        83: 3,
2652        84: 3,
2653        85: 3,
2654    }
2655
2656    def __get__(self, obj, objtype=None):
2657        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2658
2659    def __set__(self, obj, value):
2660        obj.section4[self._key[obj.pdtn] + 2] = value
2661
2662
2663class ScaleFactorOfFirstSize:
2664    """Scale Factor of First Size"""
2665
2666    _key = {
2667        44: 7,
2668        45: 7,
2669        46: 4,
2670        47: 4,
2671        48: 4,
2672        49: 4,
2673        50: 7,
2674        80: 4,
2675        81: 4,
2676        82: 4,
2677        83: 4,
2678        84: 4,
2679        85: 4,
2680    }
2681
2682    def __get__(self, obj, objtype=None):
2683        return obj.section4[self._key[obj.pdtn] + 2]
2684
2685    def __set__(self, obj, value):
2686        obj.section4[self._key[obj.pdtn] + 2] = value
2687
2688
2689class ScaledValueOfFirstSize:
2690    """Scaled Value of First Size"""
2691
2692    _key = {
2693        44: 8,
2694        45: 8,
2695        46: 5,
2696        47: 5,
2697        48: 5,
2698        49: 5,
2699        50: 8,
2700        80: 5,
2701        81: 5,
2702        82: 5,
2703        83: 5,
2704        84: 5,
2705        85: 5,
2706    }
2707
2708    def __get__(self, obj, objtype=None):
2709        return obj.section4[self._key[obj.pdtn] + 2]
2710
2711    def __set__(self, obj, value):
2712        obj.section4[self._key[obj.pdtn] + 2] = value
2713
2714
2715class FirstSizeOfAerosol:
2716    """First size of Aerosol"""
2717
2718    def __get__(self, obj, objtype=None):
2719        scale_factor = getattr(obj, "scaleFactorOfFirstSize")
2720        scaled_value = getattr(obj, "scaledValueOfFirstSize")
2721        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2722
2723    def __set__(self, obj, value):
2724        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2725        setattr(obj, "scaleFactorOfFirstSize", scale_factor)
2726        setattr(obj, "scaledValueOfFirstSize", scaled_value)
2727
2728
2729class ScaleFactorOfSecondSize:
2730    """Scale Factor of Second Size"""
2731
2732    _key = {
2733        44: 9,
2734        45: 9,
2735        46: 6,
2736        47: 6,
2737        48: 6,
2738        49: 6,
2739        50: 9,
2740        80: 6,
2741        81: 6,
2742        82: 6,
2743        83: 6,
2744        84: 6,
2745        85: 6,
2746    }
2747
2748    def __get__(self, obj, objtype=None):
2749        return obj.section4[self._key[obj.pdtn] + 2]
2750
2751    def __set__(self, obj, value):
2752        obj.section4[self._key[obj.pdtn] + 2] = value
2753
2754
2755class ScaledValueOfSecondSize:
2756    """Scaled Value of Second Size"""
2757
2758    _key = {
2759        44: 10,
2760        45: 10,
2761        46: 7,
2762        47: 7,
2763        48: 7,
2764        49: 7,
2765        50: 10,
2766        80: 7,
2767        81: 7,
2768        82: 7,
2769        83: 7,
2770        84: 7,
2771        85: 7,
2772    }
2773
2774    def __get__(self, obj, objtype=None):
2775        return obj.section4[self._key[obj.pdtn] + 2]
2776
2777    def __set__(self, obj, value):
2778        obj.section4[self._key[obj.pdtn] + 2] = value
2779
2780
2781class SecondSizeOfAerosol:
2782    """Second size of Aerosol"""
2783
2784    def __get__(self, obj, objtype=None):
2785        scale_factor = getattr(obj, "scaleFactorOfSecondSize")
2786        scaled_value = getattr(obj, "scaledValueOfSecondSize")
2787        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2788
2789    def __set__(self, obj, value):
2790        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2791        setattr(obj, "scaleFactorOfSecondSize", scale_factor)
2792        setattr(obj, "scaledValueOfSecondSize", scaled_value)
2793
2794
2795class TypeOfIntervalForAerosolWavelength:
2796    """[Type of Interval for Aerosol Wavelength](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-91.shtml)"""
2797
2798    _key = {48: 8}
2799
2800    def __get__(self, obj, objtype=None):
2801        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.91")
2802
2803    def __set__(self, obj, value):
2804        obj.section4[self._key[obj.pdtn] + 2] = value
2805
2806
2807class ScaleFactorOfFirstWavelength:
2808    """Scale Factor of First Wavelength"""
2809
2810    _key = {48: 9}
2811
2812    def __get__(self, obj, objtype=None):
2813        return obj.section4[self._key[obj.pdtn] + 2]
2814
2815    def __set__(self, obj, value):
2816        obj.section4[self._key[obj.pdtn] + 2] = value
2817
2818
2819class ScaledValueOfFirstWavelength:
2820    """Scaled Value of First Wavelength"""
2821
2822    _key = {48: 10}
2823
2824    def __get__(self, obj, objtype=None):
2825        return obj.section4[self._key[obj.pdtn] + 2]
2826
2827    def __set__(self, obj, value):
2828        obj.section4[self._key[obj.pdtn] + 2] = value
2829
2830
2831class FirstWavelength:
2832    """First Wavelength"""
2833
2834    def __get__(self, obj, objtype=None):
2835        scale_factor = getattr(obj, "scaleFactorOfFirstWavelength")
2836        scaled_value = getattr(obj, "scaledValueOfFirstWavelength")
2837        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2838
2839    def __set__(self, obj, value):
2840        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2841        setattr(obj, "scaleFactorOfFirstWavelength", scale_factor)
2842        setattr(obj, "scaledValueOfFirstWavelength", scaled_value)
2843
2844
2845class ScaleFactorOfSecondWavelength:
2846    """Scale Factor of Second Wavelength"""
2847
2848    _key = {48: 11}
2849
2850    def __get__(self, obj, objtype=None):
2851        return obj.section4[self._key[obj.pdtn] + 2]
2852
2853    def __set__(self, obj, value):
2854        obj.section4[self._key[obj.pdtn] + 2] = value
2855
2856
2857class ScaledValueOfSecondWavelength:
2858    """Scaled Value of Second Wavelength"""
2859
2860    _key = {48: 12}
2861
2862    def __get__(self, obj, objtype=None):
2863        return obj.section4[self._key[obj.pdtn] + 2]
2864
2865    def __set__(self, obj, value):
2866        obj.section4[self._key[obj.pdtn] + 2] = value
2867
2868
2869class SecondWavelength:
2870    """Second Wavelength"""
2871
2872    def __get__(self, obj, objtype=None):
2873        scale_factor = getattr(obj, "scaleFactorOfSecondWavelength")
2874        scaled_value = getattr(obj, "scaledValueOfSecondWavelength")
2875        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2876
2877    def __set__(self, obj, value):
2878        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2879        setattr(obj, "scaleFactorOfSecondWavelength", scale_factor)
2880        setattr(obj, "scaledValueOfSecondWavelength", scaled_value)
2881
2882
2883class SourceSinkIndicator:
2884    """[Source/Sink Indicator](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-238.shtml)"""
2885
2886    _key = {76: 10, 77: 10, 78: 10, 79: 10, 80: 3, 81: 3, 82: 3, 83: 3, 84: 3, 85: 3}
2887
2888    def __get__(self, obj, objtype=None):
2889        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.238")
2890
2891    def __set__(self, obj, value):
2892        obj.section4[self._key[obj.pdtn] + 2] = value
2893
2894
2895class ConstituentType:
2896    """[Constituent Type](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-230.shtml)"""
2897
2898    _key = defaultdict(lambda: 9)
2899
2900    def __get__(self, obj, objtype=None):
2901        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.230")
2902
2903    def __set__(self, obj, value):
2904        obj.section4[self._key[obj.pdtn] + 2] = value
2905
2906
2907"""
2908GRIB2 Section 4, Product Definition Template Classes
2909"""
2910
2911
2912@dataclass(init=False)
2913class ProductDefinitionTemplateBase:
2914    """Base attributes for Product Definition Templates"""
2915
2916    _varinfo: list = field(init=False, repr=False, default=VarInfo())
2917    fullName: str = field(init=False, repr=False, default=FullName())
2918    units: str = field(init=False, repr=False, default=Units())
2919    shortName: str = field(init=False, repr=False, default=ShortName())
2920    leadTime: datetime.timedelta = field(init=False, repr=False, default=LeadTime())
2921    duration: datetime.timedelta = field(init=False, repr=False, default=Duration())
2922    validDate: datetime.datetime = field(init=False, repr=False, default=ValidDate())
2923    level: str = field(init=False, repr=False, default=Level())
2924    # Begin template here...
2925    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
2926    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
2927    parameterUnits: int = field(init=False, repr=False, default=ParameterUnits())
2928    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
2929    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
2930    backgroundGeneratingProcessIdentifier: int = field(init=False, repr=False, default=BackgroundGeneratingProcessIdentifier())
2931    hoursAfterDataCutoff: int = field(init=False, repr=False, default=HoursAfterDataCutoff())
2932    minutesAfterDataCutoff: int = field(init=False, repr=False, default=MinutesAfterDataCutoff())
2933    unitOfForecastTime: Grib2Metadata = field(init=False, repr=False, default=UnitOfForecastTime())
2934    valueOfForecastTime: int = field(init=False, repr=False, default=ValueOfForecastTime())
2935
2936    @classmethod
2937    def _attrs(cls):
2938        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2939
2940
2941@dataclass(init=False)
2942class ProductDefinitionTemplateSurface:
2943    """Surface attributes for Product Definition Templates"""
2944
2945    _fixedsfc1info: list = field(init=False, repr=False, default=FixedSfc1Info())
2946    _fixedsfc2info: list = field(init=False, repr=False, default=FixedSfc2Info())
2947    typeOfFirstFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfFirstFixedSurface())
2948    scaleFactorOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfFirstFixedSurface())
2949    scaledValueOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfFirstFixedSurface())
2950    typeOfSecondFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfSecondFixedSurface())
2951    scaleFactorOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfSecondFixedSurface())
2952    scaledValueOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfSecondFixedSurface())
2953    unitOfFirstFixedSurface: str = field(init=False, repr=False, default=UnitOfFirstFixedSurface())
2954    valueOfFirstFixedSurface: int = field(init=False, repr=False, default=ValueOfFirstFixedSurface())
2955    unitOfSecondFixedSurface: str = field(init=False, repr=False, default=UnitOfSecondFixedSurface())
2956    valueOfSecondFixedSurface: int = field(init=False, repr=False, default=ValueOfSecondFixedSurface())
2957
2958    @classmethod
2959    def _attrs(cls):
2960        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2961
2962
2963@dataclass(init=False)
2964class ProductDefinitionTemplate0(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2965    """[Product Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml)"""
2966
2967    _len = 15
2968    _num = 0
2969
2970    @classmethod
2971    def _attrs(cls):
2972        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2973
2974
2975@dataclass(init=False)
2976class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2977    """[Product Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-1.shtml)"""
2978
2979    _len = 18
2980    _num = 1
2981    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
2982    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
2983    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2984
2985    @classmethod
2986    def _attrs(cls):
2987        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
2988
2989
2990@dataclass(init=False)
2991class ProductDefinitionTemplate2(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2992    """[Product Definition Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-2.shtml)"""
2993
2994    _len = 17
2995    _num = 2
2996    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
2997    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2998
2999    @classmethod
3000    def _attrs(cls):
3001        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3002
3003
3004@dataclass(init=False)
3005class ProductDefinitionTemplate5(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3006    """[Product Definition Template 5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-5.shtml)"""
3007
3008    _len = 22
3009    _num = 5
3010    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3011    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3012    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3013    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3014    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3015    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3016    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3017    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3018    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3019    threshold: str = field(init=False, repr=False, default=Threshold())
3020
3021    @classmethod
3022    def _attrs(cls):
3023        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3024
3025
3026@dataclass(init=False)
3027class ProductDefinitionTemplate6(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3028    """[Product Definition Template 6](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-6.shtml)"""
3029
3030    _len = 16
3031    _num = 6
3032    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3033
3034    @classmethod
3035    def _attrs(cls):
3036        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3037
3038
3039@dataclass(init=False)
3040class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3041    """[Product Definition Template 8](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-8.shtml)"""
3042
3043    _len = 29
3044    _num = 8
3045    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3046    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3047    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3048    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3049    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3050    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3051    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3052    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3053    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3054    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3055    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3056    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3057    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3058    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3059
3060    @classmethod
3061    def _attrs(cls):
3062        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3063
3064
3065@dataclass(init=False)
3066class ProductDefinitionTemplate9(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3067    """[Product Definition Template 9](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-9.shtml)"""
3068
3069    _len = 36
3070    _num = 9
3071    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3072    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3073    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3074    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3075    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3076    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3077    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3078    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3079    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3080    threshold: str = field(init=False, repr=False, default=Threshold())
3081    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3082    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3083    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3084    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3085    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3086    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3087    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3088    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3089    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3090    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3091    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3092    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3093    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3094    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3095
3096    @classmethod
3097    def _attrs(cls):
3098        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3099
3100
3101@dataclass(init=False)
3102class ProductDefinitionTemplate10(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3103    """[Product Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-10.shtml)"""
3104
3105    _len = 30
3106    _num = 10
3107    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3108    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3109    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3110    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3111    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3112    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3113    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3114    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3115    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3116    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3117    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3118    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3119    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3120    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3121    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3122
3123    @classmethod
3124    def _attrs(cls):
3125        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3126
3127
3128@dataclass(init=False)
3129class ProductDefinitionTemplate11(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3130    """[Product Definition Template 11](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-11.shtml)"""
3131
3132    _len = 32
3133    _num = 11
3134    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3135    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3136    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3137    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3138    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3139    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3140    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3141    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3142    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3143    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3144    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3145    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3146    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3147    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3148    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3149    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3150    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3151
3152    @classmethod
3153    def _attrs(cls):
3154        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3155
3156
3157@dataclass(init=False)
3158class ProductDefinitionTemplate12(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3159    """[Product Definition Template 12](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-12.shtml)"""
3160
3161    _len = 31
3162    _num = 12
3163    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3164    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3165    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3166    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3167    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3168    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3169    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3170    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3171    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3172    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3173    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3174    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3175    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3176    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3177    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3178    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3179
3180    @classmethod
3181    def _attrs(cls):
3182        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3183
3184
3185@dataclass(init=False)
3186class ProductDefinitionTemplate13(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3187    """[Product Definition Template 13](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-13.shtml)"""
3188
3189    _len = 18
3190    _num = 13
3191    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3192    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3193    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3194    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3195    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3196    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3197    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3198    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3199
3200    @classmethod
3201    def _attrs(cls):
3202        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3203
3204
3205@dataclass(init=False)
3206class ProductDefinitionTemplate14(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3207    """[Product Definition Template 14](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-14.shtml)"""
3208
3209    _len = 18
3210    _num = 14
3211    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3212    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3213    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3214    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3215    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3216    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3217    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3218    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3219
3220    @classmethod
3221    def _attrs(cls):
3222        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3223
3224
3225@dataclass(init=False)
3226class ProductDefinitionTemplate15(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3227    """[Product Definition Template 15](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-15.shtml)"""
3228
3229    _len = 18
3230    _num = 15
3231    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3232    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3233    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3234
3235    @classmethod
3236    def _attrs(cls):
3237        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3238
3239
3240# @dataclass(init=False)
3241# class ProductDefinitionTemplate20(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3242#     """[Product Definition Template 20](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-20.shtml)"""
3243#     __slots__ = ('section4',)
3244#     _len = 19
3245#     _num = 20
3246
3247#     typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3248#     unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3249#     timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3250#     unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3251#     timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3252#     statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3253#     spatialProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfSpatialProcessing())
3254#     numberOfPointsUsed: int = field(init=False, repr=False, default=NumberOfPointsUsed())
3255
3256
3257@dataclass(init=False)
3258class ProductDefinitionTemplate31:
3259    """[Product Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-31.shtml)"""
3260
3261    _len = 5
3262    _num = 31
3263    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
3264    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
3265    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
3266    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
3267    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3268    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3269    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3270    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3271    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3272    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3273
3274    @classmethod
3275    def _attrs(cls):
3276        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3277
3278
3279@dataclass(init=False)
3280class ProductDefinitionTemplate32(ProductDefinitionTemplateBase):
3281    """[Product Definition Template 32](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-32.shtml)"""
3282
3283    _len = 10
3284    _num = 32
3285    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3286    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3287    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3288    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3289    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3290    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3291
3292    @classmethod
3293    def _attrs(cls):
3294        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3295
3296
3297# @dataclass(init=False)
3298# class ProductDefinitionTemplate33(ProductDefinitionTemplateBase):
3299#     """[Product Definition Template 33] - Individual ensemble forecast, control and perturbed at intervals"""
3300#     _len = None  # Length depends on number of spectral bands
3301#     _num = 33
3302#     # Note: parameterCategory through valueOfForecastTime inherited from base class
3303#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3304#     # Spectral band fields - these will need special handling since they repeat
3305#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3306#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3307#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3308#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3309#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3310#     # Continue with remaining fields
3311#     typeOfEnsembleForecast: Grib2Metadata = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3312#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3313#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3314#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3315#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3316#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3317#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3318#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3319#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3320#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3321#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())
3322# @dataclass(init=False)
3323# class ProductDefinitionTemplate34(ProductDefinitionTemplateBase):
3324#     """[Product Definition Template 34] - Individual ensemble forecast, control and perturbed at intervals - chemical"""
3325#     _len = None  # Length depends on number of spectral bands
3326#     _num = 34
3327#     constituentType: int = field(init=False,repr=False,default=ConstituentType())
3328#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3329#     # For each band nb=1 to NB:
3330#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3331#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3332#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3333#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3334#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3335#     # After spectral bands:
3336#     typeOfEnsembleForecast: int = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3337#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3338#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3339#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3340#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3341#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3342#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3343#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3344#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3345#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3346#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())
3347
3348# @dataclass(init=False)
3349# class ProductDefinitionTemplate35(ProductDefinitionTemplateBase):
3350#     """[Product Definition Template 35] - Individual ensemble forecast, control and perturbed at intervals - aerosol"""
3351#     _len = None  # Length depends on number of spectral bands
3352#     _num = 35
3353#     aerosolType: int = field(init=False,repr=False,default=AerosolType())
3354#     numberOfContributingSpectralBands: int = field(init=False,repr=False,default=NumberOfContributingSpectralBands())
3355#     # For each band nb=1 to NB:
3356#     satelliteSeries: list = field(init=False,repr=False,default=SatelliteSeries())
3357#     satelliteNumber: list = field(init=False,repr=False,default=SatelliteNumber())
3358#     instrumentTypes: list = field(init=False,repr=False,default=InstrumentTypes())
3359#     scaleFactorOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaleFactorOfCentralWaveNumber())
3360#     scaledValueOfCentralWaveNumber: list = field(init=False,repr=False,default=ScaledValueOfCentralWaveNumber())
3361#     # After spectral bands:
3362#     typeOfEnsembleForecast: int = field(init=False,repr=False,default=TypeOfEnsembleForecast())
3363#     perturbationNumber: int = field(init=False,repr=False,default=PerturbationNumber())
3364#     numberOfForecastsInEnsemble: int = field(init=False,repr=False,default=NumberOfForecastsInEnsemble())
3365#     yearOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=YearOfEndOfOverallTimeInterval())
3366#     monthOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MonthOfEndOfOverallTimeInterval())
3367#     dayOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=DayOfEndOfOverallTimeInterval())
3368#     hourOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=HourOfEndOfOverallTimeInterval())
3369#     minuteOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=MinuteOfEndOfOverallTimeInterval())
3370#     secondOfEndOfOverallTimeInterval: int = field(init=False,repr=False,default=SecondOfEndOfOverallTimeInterval())
3371#     numberOfTimeRange: int = field(init=False,repr=False,default=NumberOfTimeRange())
3372#     numberOfMissingInStatisticalProcess: int = field(init=False,repr=False,default=NumberOfMissingInStatisticalProcess())@dataclass(init=False)
3373
3374
3375@dataclass(init=False)
3376class ProductDefinitionTemplate44(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3377    """[Product Definition Template 4.44](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-44.shtml)"""
3378
3379    _len = 25
3380    _num = 44
3381    # Aerosol parameters
3382    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3383    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3384    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3385    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3386    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3387    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3388    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3389    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3390
3391    @classmethod
3392    def _attrs(cls):
3393        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3394
3395
3396@dataclass(init=False)
3397class ProductDefinitionTemplate45(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3398    """[Product Definition Template 4.45](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-45.shtml)"""
3399
3400    _len = 28
3401    _num = 45
3402    # Aerosol parameters
3403    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3404    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3405    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3406    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3407    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3408    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3409    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3410    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3411
3412    # Ensemble parameters
3413    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3414    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3415    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3416
3417    @classmethod
3418    def _attrs(cls):
3419        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3420
3421
3422@dataclass(init=False)
3423class ProductDefinitionTemplate50(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3424    """[Product Definition Template 4.50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-50.shtml)"""
3425
3426    _len = 25
3427    _num = 50
3428    # Aerosol parameters
3429    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3430    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3431    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3432    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3433    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3434    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3435    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3436    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3437
3438    @classmethod
3439    def _attrs(cls):
3440        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3441
3442
3443@dataclass(init=False)
3444class ProductDefinitionTemplate46(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3445    """[Product Definition Template 4.46](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-46.shtml)"""
3446
3447    _len = 38  # Total number of octets
3448    _num = 46
3449
3450    # Aerosol-specific parameters
3451    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3452    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3453    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3454    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3455    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3456    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3457    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3458    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3459
3460    # Time interval parameters
3461    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3462    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3463    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3464    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3465    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3466    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3467    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3468    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3469
3470    # Statistical processing parameters
3471    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3472    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3473    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3474    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3475    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3476    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3477    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3478
3479    @classmethod
3480    def _attrs(cls):
3481        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3482
3483
3484@dataclass(init=False)
3485class ProductDefinitionTemplate47(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3486    """[Product Definition Template 4.47](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-47.shtml)"""
3487
3488    _len = 41  # Total number of octets for base template
3489    _num = 47
3490
3491    # Aerosol parameters
3492    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3493    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3494    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3495    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3496    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3497    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3498    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3499    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3500
3501    # Ensemble parameters
3502    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3503    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3504    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3505
3506    # Time interval parameters
3507    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3508    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3509    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3510    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3511    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3512    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3513    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3514    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3515
3516    # Statistical processing parameters
3517    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3518    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3519    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3520    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3521    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3522    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3523    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3524
3525    @classmethod
3526    def _attrs(cls):
3527        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3528
3529
3530@dataclass(init=False)
3531class ProductDefinitionTemplate48(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3532    """[Product Definition Template 48](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-48.shtml)"""
3533
3534    _len = 26
3535    _num = 48
3536    # Aerosol parameters
3537    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3538    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3539    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3540    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3541    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3542    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3543    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3544    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3545
3546    # Wavelength parameters
3547    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3548    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3549    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3550    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3551    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3552    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3553    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3554
3555    @classmethod
3556    def _attrs(cls):
3557        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
3558
3559
3560@dataclass(init=False)
3561class ProductDefinitionTemplate49(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3562    """[Product Definition Template 4.49](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-49.shtml)"""
3563
3564    _len = 28
3565    _num = 49
3566
3567    # Aerosol parameters
3568    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3569    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3570    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3571    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3572    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3573    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3574    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3575    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3576
3577    # Wavelength parameters
3578    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3579    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3580    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3581    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3582    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3583    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3584    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3585
3586    # Ensemble parameters
3587    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3588    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3589    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3590
3591
3592@dataclass(init=False)
3593class ProductDefinitionTemplate80(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3594    """[Product Definition Template 4.80](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-80.shtml)"""
3595
3596    _len = 26
3597    _num = 80
3598
3599    # Aerosol parameters
3600    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3601    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3602    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3603    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3604    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3605    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3606    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3607    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3608    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3609
3610    # Wavelength parameters
3611    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3612    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3613    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3614    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3615    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3616    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3617    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3618
3619
3620@dataclass(init=False)
3621class ProductDefinitionTemplate81(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3622    """[Product Definition Template 4.81](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-81.shtml)"""
3623
3624    _len = 31
3625    _num = 81
3626
3627    # Aerosol parameters
3628    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3629    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3630    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3631    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3632    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3633    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3634    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3635    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3636    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3637
3638    # Wavelength parameters
3639    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3640    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3641    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3642    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3643    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3644    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3645    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3646
3647    # Ensemble parameters
3648    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3649    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3650    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3651
3652
3653@dataclass(init=False)
3654class ProductDefinitionTemplate82(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3655    """[Product Definition Template 4.82](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-82.shtml)"""
3656
3657    _len = 41
3658    _num = 82
3659
3660    # Aerosol parameters
3661    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3662    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3663    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3664    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3665    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3666    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3667    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3668    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3669    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3670
3671    # Wavelength parameters
3672    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3673    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3674    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3675    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3676    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3677    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3678    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3679
3680    # Time interval parameters
3681    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3682    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3683    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3684    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3685    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3686    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3687    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3688    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3689
3690    # Statistical processing parameters
3691    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3692    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3693    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3694    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3695    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3696    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3697    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3698    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3699
3700
3701@dataclass(init=False)
3702class ProductDefinitionTemplate83(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3703    """[Product Definition Template 4.83](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-83.shtml)"""
3704
3705    _len = 44
3706    _num = 83
3707
3708    # Aerosol parameters
3709    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3710    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3711    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3712    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3713    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3714    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3715    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3716    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3717    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3718
3719    # Wavelength parameters
3720    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3721    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3722    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3723    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3724    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3725    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3726    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3727
3728    # Ensemble parameters
3729    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3730    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3731    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3732
3733    # Time interval parameters
3734    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3735    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3736    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3737    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3738    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3739    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3740    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3741    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3742
3743
3744@dataclass(init=False)
3745class ProductDefinitionTemplate84(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3746    """[Product Definition Template 4.84](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-84.shtml)"""
3747
3748    _len = 44
3749    _num = 84
3750
3751    # Aerosol parameters
3752    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3753    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3754    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3755    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3756    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3757    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3758    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3759    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3760    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3761
3762    # Wavelength parameters
3763    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3764    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3765    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3766    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3767    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3768    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3769    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3770
3771    # Ensemble parameters
3772    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3773    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3774    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3775
3776    # Time interval parameters
3777    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3778    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3779    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3780    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3781    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3782    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3783
3784    # Statistical processing parameters
3785    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3786    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3787    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3788    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3789    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3790    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3791    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3792    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3793
3794
3795@dataclass(init=False)
3796class ProductDefinitionTemplate85(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3797    """[Product Definition Template 4.85](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-85.shtml)"""
3798
3799    _len = 33
3800    _num = 85
3801
3802    # Aerosol parameters
3803    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3804    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3805    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3806    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3807    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3808    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3809    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3810    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3811    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3812
3813    # Wavelength parameters
3814    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3815    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3816    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3817    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3818    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3819    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3820    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3821
3822    # Ensemble parameters
3823    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3824    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3825    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3826
3827
3828@dataclass(init=False)
3829class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3830    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3831
3832    _len = 16
3833    _num = 40
3834    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3835
3836
3837@dataclass(init=False)
3838class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3839    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3840
3841    _len = 19
3842    _num = 41
3843    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3844    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3845    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3846    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3847
3848
3849@dataclass(init=False)
3850class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3851    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
3852
3853    _len = 30
3854    _num = 42
3855    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3856    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3857    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3858    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3859    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3860    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3861    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3862    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3863    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3864    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3865    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3866    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3867    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3868    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3869    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3870
3871
3872@dataclass(init=False)
3873class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3874    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
3875
3876    _len = 33
3877    _num = 43
3878    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3879    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3880    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3881    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3882    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3883    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3884    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3885    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3886    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3887    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3888    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3889    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3890    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3891    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3892    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3893    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3894    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3895    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3896
3897
3898@dataclass(init=False)
3899class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3900    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
3901
3902    _len = 17
3903    _num = 76
3904    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3905    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3906
3907
3908@dataclass(init=False)
3909class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3910    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
3911
3912    _len = 20
3913    _num = 77
3914    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3915    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3916    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3917    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3918    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3919
3920
3921@dataclass(init=False)
3922class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3923    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
3924
3925    _len = 31
3926    _num = 78
3927    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3928    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3929    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3930    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3931    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3932    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3933    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3934    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3935    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3936    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3937    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3938    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3939    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3940    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3941    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3942    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3943
3944
3945@dataclass(init=False)
3946class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3947    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
3948
3949    _len = 34
3950    _num = 79
3951    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3952    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3953    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3954    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3955    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3956    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3957    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3958    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3959    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3960    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3961    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3962    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3963    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3964    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3965    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3966    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3967    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3968    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3969    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3970
3971
3972@dataclass(init=False)
3973class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3974    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3975
3976    _len = 16
3977    _num = 40
3978    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3979
3980
3981@dataclass(init=False)
3982class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3983    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3984
3985    _len = 19
3986    _num = 41
3987    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3988    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3989    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3990    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3991
3992
3993@dataclass(init=False)
3994class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3995    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
3996
3997    _len = 30
3998    _num = 42
3999    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4000    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4001    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4002    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4003    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4004    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4005    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4006    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4007    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4008    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4009    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4010    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4011    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4012    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4013    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4014
4015
4016@dataclass(init=False)
4017class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4018    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
4019
4020    _len = 33
4021    _num = 43
4022    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4023    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4024    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4025    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4026    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4027    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4028    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4029    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4030    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4031    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4032    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4033    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4034    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4035    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4036    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4037    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4038    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4039    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4040
4041
4042@dataclass(init=False)
4043class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4044    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
4045
4046    _len = 17
4047    _num = 76
4048    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4049    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4050
4051
4052@dataclass(init=False)
4053class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4054    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
4055
4056    _len = 20
4057    _num = 77
4058    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4059    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4060    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4061    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4062    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4063
4064
4065@dataclass(init=False)
4066class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4067    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
4068
4069    _len = 31
4070    _num = 78
4071    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4072    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4073    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4074    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4075    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4076    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4077    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4078    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4079    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4080    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4081    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4082    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4083    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4084    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4085    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4086    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4087
4088
4089@dataclass(init=False)
4090class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
4091    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
4092
4093    _len = 34
4094    _num = 79
4095    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
4096    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
4097    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
4098    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
4099    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
4100    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
4101    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
4102    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
4103    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
4104    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
4105    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
4106    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
4107    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
4108    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
4109    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
4110    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
4111    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
4112    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
4113    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
4114
4115
4116_pdt_by_pdtn = {
4117    0: ProductDefinitionTemplate0,
4118    1: ProductDefinitionTemplate1,
4119    2: ProductDefinitionTemplate2,
4120    5: ProductDefinitionTemplate5,
4121    6: ProductDefinitionTemplate6,
4122    8: ProductDefinitionTemplate8,
4123    9: ProductDefinitionTemplate9,
4124    10: ProductDefinitionTemplate10,
4125    11: ProductDefinitionTemplate11,
4126    12: ProductDefinitionTemplate12,
4127    15: ProductDefinitionTemplate15,
4128    31: ProductDefinitionTemplate31,
4129    32: ProductDefinitionTemplate32,
4130    40: ProductDefinitionTemplate40,
4131    41: ProductDefinitionTemplate41,
4132    42: ProductDefinitionTemplate42,
4133    43: ProductDefinitionTemplate43,
4134    44: ProductDefinitionTemplate44,
4135    45: ProductDefinitionTemplate45,
4136    46: ProductDefinitionTemplate46,
4137    47: ProductDefinitionTemplate47,
4138    48: ProductDefinitionTemplate48,
4139    49: ProductDefinitionTemplate49,
4140    50: ProductDefinitionTemplate50,
4141    76: ProductDefinitionTemplate76,
4142    77: ProductDefinitionTemplate77,
4143    78: ProductDefinitionTemplate78,
4144    79: ProductDefinitionTemplate79,
4145    80: ProductDefinitionTemplate80,
4146    81: ProductDefinitionTemplate81,
4147    82: ProductDefinitionTemplate82,
4148    83: ProductDefinitionTemplate83,
4149    84: ProductDefinitionTemplate84,
4150    85: ProductDefinitionTemplate85,
4151}
4152
4153
4154def pdt_class_by_pdtn(pdtn: int):
4155    """
4156    Provide a Product Definition Template class via the template number.
4157
4158    Parameters
4159    ----------
4160    pdtn
4161        Product definition template number.
4162
4163    Returns
4164    -------
4165    pdt_class_by_pdtn
4166        Product definition template class object (not an instance).
4167    """
4168    return _pdt_by_pdtn[pdtn]
4169
4170
4171# ----------------------------------------------------------------------------------------
4172# Descriptor Classes for Section 5 metadata.
4173# ----------------------------------------------------------------------------------------
4174class NumberOfPackedValues:
4175    """Number of Packed Values"""
4176
4177    def __get__(self, obj, objtype=None):
4178        return obj.section5[0]
4179
4180    def __set__(self, obj, value):
4181        pass
4182
4183
4184class DataRepresentationTemplateNumber:
4185    """[Data Representation Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-0.shtml)"""
4186
4187    def __get__(self, obj, objtype=None):
4188        return Grib2Metadata(obj.section5[1], table="5.0")
4189
4190    def __set__(self, obj, value):
4191        pass
4192
4193
4194class DataRepresentationTemplate:
4195    """Data Representation Template"""
4196
4197    def __get__(self, obj, objtype=None):
4198        return obj.section5[2:]
4199
4200    def __set__(self, obj, value):
4201        raise NotImplementedError
4202
4203
4204class RefValue:
4205    """Reference Value (represented as an IEEE 32-bit floating point value)"""
4206
4207    def __get__(self, obj, objtype=None):
4208        return utils.ieee_int_to_float(obj.section5[0 + 2])
4209
4210    def __set__(self, obj, value):
4211        pass
4212
4213
4214class BinScaleFactor:
4215    """Binary Scale Factor"""
4216
4217    def __get__(self, obj, objtype=None):
4218        return obj.section5[1 + 2]
4219
4220    def __set__(self, obj, value):
4221        obj.section5[1 + 2] = value
4222
4223
4224class DecScaleFactor:
4225    """Decimal Scale Factor"""
4226
4227    def __get__(self, obj, objtype=None):
4228        return obj.section5[2 + 2]
4229
4230    def __set__(self, obj, value):
4231        obj.section5[2 + 2] = value
4232
4233
4234class NBitsPacking:
4235    """Minimum number of bits for packing"""
4236
4237    def __get__(self, obj, objtype=None):
4238        return obj.section5[3 + 2]
4239
4240    def __set__(self, obj, value):
4241        obj.section5[3 + 2] = value
4242
4243
4244class TypeOfValues:
4245    """[Type of Original Field Values](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)"""
4246
4247    def __get__(self, obj, objtype=None):
4248        return Grib2Metadata(obj.section5[4 + 2], table="5.1")
4249
4250    def __set__(self, obj, value):
4251        obj.section5[4 + 2] = value
4252
4253
4254class GroupSplittingMethod:
4255    """[Group Splitting Method](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-4.shtml)"""
4256
4257    def __get__(self, obj, objtype=None):
4258        return Grib2Metadata(obj.section5[5 + 2], table="5.4")
4259
4260    def __set__(self, obj, value):
4261        obj.section5[5 + 2] = value
4262
4263
4264class TypeOfMissingValueManagement:
4265    """[Type of Missing Value Management](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-5.shtml)"""
4266
4267    def __get__(self, obj, objtype=None):
4268        return Grib2Metadata(obj.section5[6 + 2], table="5.5")
4269
4270    def __set__(self, obj, value):
4271        obj.section5[6 + 2] = value
4272
4273
4274class PriMissingValue:
4275    """Primary Missing Value"""
4276
4277    def __get__(self, obj, objtype=None):
4278        if obj.typeOfValues == 0:
4279            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
4280        elif obj.typeOfValues == 1:
4281            return obj.section5[7 + 2] if obj.section5[6 + 2] in [1, 2] else None
4282
4283    def __set__(self, obj, value):
4284        if obj.typeOfValues == 0:
4285            obj.section5[7 + 2] = utils.ieee_float_to_int(value)
4286        elif self.typeOfValues == 1:
4287            obj.section5[7 + 2] = int(value)
4288        obj.section5[6 + 2] = 1
4289
4290
4291class SecMissingValue:
4292    """Secondary Missing Value"""
4293
4294    def __get__(self, obj, objtype=None):
4295        if obj.typeOfValues == 0:
4296            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
4297        elif obj.typeOfValues == 1:
4298            return obj.section5[8 + 2] if obj.section5[6 + 2] in {1, 2} else None
4299
4300    def __set__(self, obj, value):
4301        if obj.typeOfValues == 0:
4302            obj.section5[8 + 2] = utils.ieee_float_to_int(value)
4303        elif self.typeOfValues == 1:
4304            obj.section5[8 + 2] = int(value)
4305        obj.section5[6 + 2] = 2
4306
4307
4308class NGroups:
4309    """Number of Groups"""
4310
4311    def __get__(self, obj, objtype=None):
4312        return obj.section5[9 + 2]
4313
4314    def __set__(self, obj, value):
4315        pass
4316
4317
4318class RefGroupWidth:
4319    """Reference Group Width"""
4320
4321    def __get__(self, obj, objtype=None):
4322        return obj.section5[10 + 2]
4323
4324    def __set__(self, obj, value):
4325        pass
4326
4327
4328class NBitsGroupWidth:
4329    """Number of bits for Group Width"""
4330
4331    def __get__(self, obj, objtype=None):
4332        return obj.section5[11 + 2]
4333
4334    def __set__(self, obj, value):
4335        pass
4336
4337
4338class RefGroupLength:
4339    """Reference Group Length"""
4340
4341    def __get__(self, obj, objtype=None):
4342        return obj.section5[12 + 2]
4343
4344    def __set__(self, obj, value):
4345        pass
4346
4347
4348class GroupLengthIncrement:
4349    """Group Length Increment"""
4350
4351    def __get__(self, obj, objtype=None):
4352        return obj.section5[13 + 2]
4353
4354    def __set__(self, obj, value):
4355        pass
4356
4357
4358class LengthOfLastGroup:
4359    """Length of Last Group"""
4360
4361    def __get__(self, obj, objtype=None):
4362        return obj.section5[14 + 2]
4363
4364    def __set__(self, obj, value):
4365        pass
4366
4367
4368class NBitsScaledGroupLength:
4369    """Number of bits of Scaled Group Length"""
4370
4371    def __get__(self, obj, objtype=None):
4372        return obj.section5[15 + 2]
4373
4374    def __set__(self, obj, value):
4375        pass
4376
4377
4378class SpatialDifferenceOrder:
4379    """[Spatial Difference Order](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-6.shtml)"""
4380
4381    def __get__(self, obj, objtype=None):
4382        return Grib2Metadata(obj.section5[16 + 2], table="5.6")
4383
4384    def __set__(self, obj, value):
4385        obj.section5[16 + 2] = value
4386
4387
4388class NBytesSpatialDifference:
4389    """Number of bytes for Spatial Differencing"""
4390
4391    def __get__(self, obj, objtype=None):
4392        return obj.section5[17 + 2]
4393
4394    def __set__(self, obj, value):
4395        pass
4396
4397
4398class Precision:
4399    """[Precision for IEEE Floating Point Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-7.shtml)"""
4400
4401    def __get__(self, obj, objtype=None):
4402        return Grib2Metadata(obj.section5[0 + 2], table="5.7")
4403
4404    def __set__(self, obj, value):
4405        obj.section5[0 + 2] = value
4406
4407
4408class TypeOfCompression:
4409    """[Type of Compression](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-40.shtml)"""
4410
4411    def __get__(self, obj, objtype=None):
4412        return Grib2Metadata(obj.section5[5 + 2], table="5.40")
4413
4414    def __set__(self, obj, value):
4415        obj.section5[5 + 2] = value
4416
4417
4418class TargetCompressionRatio:
4419    """Target Compression Ratio"""
4420
4421    def __get__(self, obj, objtype=None):
4422        return obj.section5[6 + 2]
4423
4424    def __set__(self, obj, value):
4425        pass
4426
4427
4428class RealOfCoefficient:
4429    """Real of Coefficient"""
4430
4431    def __get__(self, obj, objtype=None):
4432        return utils.ieee_int_to_float(obj.section5[4 + 2])
4433
4434    def __set__(self, obj, value):
4435        obj.section5[4 + 2] = utils.ieee_float_to_int(float(value))
4436
4437
4438class CompressionOptionsMask:
4439    """Compression Options Mask for AEC/CCSDS"""
4440
4441    def __get__(self, obj, objtype=None):
4442        return obj.section5[5 + 2]
4443
4444    def __set__(self, obj, value):
4445        obj.section5[5 + 2] = value
4446
4447
4448class BlockSize:
4449    """Block Size for AEC/CCSDS"""
4450
4451    def __get__(self, obj, objtype=None):
4452        return obj.section5[6 + 2]
4453
4454    def __set__(self, obj, value):
4455        obj.section5[6 + 2] = value
4456
4457
4458class RefSampleInterval:
4459    """Reference Sample Interval for AEC/CCSDS"""
4460
4461    def __get__(self, obj, objtype=None):
4462        return obj.section5[7 + 2]
4463
4464    def __set__(self, obj, value):
4465        obj.section5[7 + 2] = value
4466
4467
4468@dataclass(init=False)
4469class DataRepresentationTemplate0:
4470    """[Data Representation Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml)"""
4471
4472    _len = 5
4473    _num = 0
4474    _packingScheme = "simple"
4475    refValue: float = field(init=False, repr=False, default=RefValue())
4476    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4477    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4478    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4479
4480    @classmethod
4481    def _attrs(cls):
4482        return list(cls.__dataclass_fields__.keys())
4483
4484
4485@dataclass(init=False)
4486class DataRepresentationTemplate2:
4487    """[Data Representation Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-2.shtml)"""
4488
4489    _len = 16
4490    _num = 2
4491    _packingScheme = "complex"
4492    refValue: float = field(init=False, repr=False, default=RefValue())
4493    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4494    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4495    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4496    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4497    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4498    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4499    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4500    nGroups: int = field(init=False, repr=False, default=NGroups())
4501    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4502    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4503    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4504    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4505    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4506    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4507
4508    @classmethod
4509    def _attrs(cls):
4510        return list(cls.__dataclass_fields__.keys())
4511
4512
4513@dataclass(init=False)
4514class DataRepresentationTemplate3:
4515    """[Data Representation Template 3](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-3.shtml)"""
4516
4517    _len = 18
4518    _num = 3
4519    _packingScheme = "complex-spdiff"
4520    refValue: float = field(init=False, repr=False, default=RefValue())
4521    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4522    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4523    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4524    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4525    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4526    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4527    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4528    nGroups: int = field(init=False, repr=False, default=NGroups())
4529    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4530    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4531    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4532    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4533    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4534    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4535    spatialDifferenceOrder: Grib2Metadata = field(init=False, repr=False, default=SpatialDifferenceOrder())
4536    nBytesSpatialDifference: int = field(init=False, repr=False, default=NBytesSpatialDifference())
4537
4538    @classmethod
4539    def _attrs(cls):
4540        return list(cls.__dataclass_fields__.keys())
4541
4542
4543@dataclass(init=False)
4544class DataRepresentationTemplate4:
4545    """[Data Representation Template 4](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-4.shtml)"""
4546
4547    _len = 1
4548    _num = 4
4549    _packingScheme = "ieee-float"
4550    precision: Grib2Metadata = field(init=False, repr=False, default=Precision())
4551
4552    @classmethod
4553    def _attrs(cls):
4554        return list(cls.__dataclass_fields__.keys())
4555
4556
4557@dataclass(init=False)
4558class DataRepresentationTemplate40:
4559    """[Data Representation Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-40.shtml)"""
4560
4561    _len = 7
4562    _num = 40
4563    _packingScheme = "jpeg"
4564    refValue: float = field(init=False, repr=False, default=RefValue())
4565    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4566    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4567    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4568    typeOfCompression: Grib2Metadata = field(init=False, repr=False, default=TypeOfCompression())
4569    targetCompressionRatio: int = field(init=False, repr=False, default=TargetCompressionRatio())
4570
4571    @classmethod
4572    def _attrs(cls):
4573        return list(cls.__dataclass_fields__.keys())
4574
4575
4576@dataclass(init=False)
4577class DataRepresentationTemplate41:
4578    """[Data Representation Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-41.shtml)"""
4579
4580    _len = 5
4581    _num = 41
4582    _packingScheme = "png"
4583    refValue: float = field(init=False, repr=False, default=RefValue())
4584    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4585    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4586    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4587
4588    @classmethod
4589    def _attrs(cls):
4590        return list(cls.__dataclass_fields__.keys())
4591
4592
4593@dataclass(init=False)
4594class DataRepresentationTemplate42:
4595    """[Data Representation Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-42.shtml)"""
4596
4597    _len = 8
4598    _num = 42
4599    _packingScheme = "aec"
4600    refValue: float = field(init=False, repr=False, default=RefValue())
4601    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4602    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4603    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4604    compressionOptionsMask: int = field(init=False, repr=False, default=CompressionOptionsMask())
4605    blockSize: int = field(init=False, repr=False, default=BlockSize())
4606    refSampleInterval: int = field(init=False, repr=False, default=RefSampleInterval())
4607
4608    @classmethod
4609    def _attrs(cls):
4610        return list(cls.__dataclass_fields__.keys())
4611
4612
4613@dataclass(init=False)
4614class DataRepresentationTemplate50:
4615    """[Data Representation Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-50.shtml)"""
4616
4617    _len = 5
4618    _num = 0
4619    _packingScheme = "spectral-simple"
4620    refValue: float = field(init=False, repr=False, default=RefValue())
4621    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4622    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4623    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4624    realOfCoefficient: float = field(init=False, repr=False, default=RealOfCoefficient())
4625
4626    @classmethod
4627    def _attrs(cls):
4628        return list(cls.__dataclass_fields__.keys())
4629
4630
4631_drt_by_drtn = {
4632    0: DataRepresentationTemplate0,
4633    2: DataRepresentationTemplate2,
4634    3: DataRepresentationTemplate3,
4635    4: DataRepresentationTemplate4,
4636    40: DataRepresentationTemplate40,
4637    41: DataRepresentationTemplate41,
4638    42: DataRepresentationTemplate42,
4639    50: DataRepresentationTemplate50,
4640}
4641
4642
4643def drt_class_by_drtn(drtn: int):
4644    """
4645    Provide a Data Representation Template class via the template number.
4646
4647    Parameters
4648    ----------
4649    drtn
4650        Data Representation template number.
4651
4652    Returns
4653    -------
4654    drt_class_by_drtn
4655        Data Representation template class object (not an instance).
4656    """
4657    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"] = float(0.5 * (obj.longitudeFirstGridpoint + obj.longitudeLastGridpoint))
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        return obj.parameterUnits if obj.pdtn not in {5, 9} else "%"
1412
1413    def __set__(self, obj, value):
1414        raise RuntimeError(
1415            "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."
1416        )

Units of the Variable.

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

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

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

Background Generating Process Identifier

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

Hours of observational data cutoff after reference time.

class MinutesAfterDataCutoff:
1490class MinutesAfterDataCutoff:
1491    """Minutes of observational data cutoff after reference time."""
1492
1493    _key = defaultdict(lambda: 6, {48: 17})
1494
1495    def __get__(self, obj, objtype=None):
1496        return obj.section4[self._key[obj.pdtn] + 2]
1497
1498    def __set__(self, obj, value):
1499        obj.section4[self._key[obj.pdtn] + 2] = value

Minutes of observational data cutoff after reference time.

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

Value of forecast time in units defined by UnitofForecastTime.

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

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

class FixedSfc1Info:
1553class FixedSfc1Info:
1554    """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)"""
1555
1556    _key = defaultdict(lambda: 9, {48: 20})
1557
1558    def __get__(self, obj, objtype=None):
1559        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1560            return [None, None]
1561        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1562
1563    def __set__(self, obj, value):
1564        raise NotImplementedError

Information of the first fixed surface via table 4.5

class FixedSfc2Info:
1567class FixedSfc2Info:
1568    """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)"""
1569
1570    _key = defaultdict(lambda: 12, {48: 23})
1571
1572    def __get__(self, obj, objtype=None):
1573        if obj.section4[self._key[obj.pdtn] + 2] == 255:
1574            return [None, None]
1575        return tables.get_value_from_table(obj.section4[self._key[obj.pdtn] + 2], "4.5")
1576
1577    def __set__(self, obj, value):
1578        raise NotImplementedError

Information of the second fixed surface via table 4.5

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

Scale Factor of First Fixed Surface

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

Scaled Value Of First Fixed Surface

class UnitOfFirstFixedSurface:
1701class UnitOfFirstFixedSurface:
1702    """Units of First Fixed Surface"""
1703
1704    def __get__(self, obj, objtype=None):
1705        return obj._fixedsfc1info[1]
1706
1707    def __set__(self, obj, value):
1708        pass

Units of First Fixed Surface

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

Value of First Fixed Surface

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

Scale Factor of Second Fixed Surface

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

Scaled Value Of Second Fixed Surface

class UnitOfSecondFixedSurface:
1848class UnitOfSecondFixedSurface:
1849    """Units of Second Fixed Surface"""
1850
1851    def __get__(self, obj, objtype=None):
1852        return obj._fixedsfc2info[1]
1853
1854    def __set__(self, obj, value):
1855        pass

Units of Second Fixed Surface

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

Value of Second Fixed Surface

class Level:
1875class Level:
1876    """Level (same as provided by [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Level.c))"""
1877
1878    def __get__(self, obj, objtype=None):
1879        return tables.get_wgrib2_level_string(obj.pdtn, obj.section4[2:])
1880
1881    def __set__(self, obj, value):
1882        pass

Level (same as provided by wgrib2)

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

Ensemble Perturbation Number

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

Total Number of Ensemble Forecasts

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

Forecast Probability Number

class TotalNumberOfForecastProbabilities:
1993class TotalNumberOfForecastProbabilities:
1994    """Total Number of Forecast Probabilities"""
1995
1996    _key = {5: 16, 9: 16}
1997
1998    def __get__(self, obj, objtype=None):
1999        pdtn = obj.section4[1]
2000        return obj.section4[self._key[pdtn] + 2]
2001
2002    def __set__(self, obj, value):
2003        pdtn = obj.section4[1]
2004        obj.section4[self._key[pdtn] + 2] = value

Total Number of Forecast Probabilities

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

Scale Factor of Threshold Lower Limit

class ScaledValueOfThresholdLowerLimit:
2035class ScaledValueOfThresholdLowerLimit:
2036    """Scaled Value of Threshold Lower Limit"""
2037
2038    _key = {5: 19, 9: 19}
2039
2040    def __get__(self, obj, objtype=None):
2041        pdtn = obj.section4[1]
2042        return obj.section4[self._key[pdtn] + 2]
2043
2044    def __set__(self, obj, value):
2045        pdtn = obj.section4[1]
2046        obj.section4[self._key[pdtn] + 2] = value

Scaled Value of Threshold Lower Limit

class ScaleFactorOfThresholdUpperLimit:
2049class ScaleFactorOfThresholdUpperLimit:
2050    """Scale Factor of Threshold Upper Limit"""
2051
2052    _key = {5: 20, 9: 20}
2053
2054    def __get__(self, obj, objtype=None):
2055        pdtn = obj.section4[1]
2056        return obj.section4[self._key[pdtn] + 2]
2057
2058    def __set__(self, obj, value):
2059        pdtn = obj.section4[1]
2060        obj.section4[self._key[pdtn] + 2] = value

Scale Factor of Threshold Upper Limit

class ScaledValueOfThresholdUpperLimit:
2063class ScaledValueOfThresholdUpperLimit:
2064    """Scaled Value of Threshold Upper Limit"""
2065
2066    _key = {5: 21, 9: 21}
2067
2068    def __get__(self, obj, objtype=None):
2069        pdtn = obj.section4[1]
2070        return obj.section4[self._key[pdtn] + 2]
2071
2072    def __set__(self, obj, value):
2073        pdtn = obj.section4[1]
2074        obj.section4[self._key[pdtn] + 2] = value

Scaled Value of Threshold Upper Limit

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

Threshold Lower Limit

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

Threshold Upper Limit

class Threshold:
2111class Threshold:
2112    """Threshold string (same as [wgrib2](https://github.com/NOAA-EMC/NCEPLIBS-wgrib2/blob/develop/wgrib2/Prob.c))"""
2113
2114    def __get__(self, obj, objtype=None):
2115        return utils.get_wgrib2_prob_string(*obj.section4[17 + 2 : 22 + 2])
2116
2117    def __set__(self, obj, value):
2118        pass

Threshold string (same as wgrib2)

class PercentileValue:
2121class PercentileValue:
2122    """Percentile Value"""
2123
2124    _key = {6: 15, 10: 15}
2125
2126    def __get__(self, obj, objtype=None):
2127        pdtn = obj.section4[1]
2128        return obj.section4[self._key[pdtn] + 2]
2129
2130    def __set__(self, obj, value):
2131        pdtn = obj.section4[1]
2132        obj.section4[self._key[pdtn] + 2] = value

Percentile Value

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

Year of End of Forecast Time Period

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

Month Year of End of Forecast Time Period

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

Day Year of End of Forecast Time Period

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

Hour Year of End of Forecast Time Period

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

Minute Year of End of Forecast Time Period

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

Second Year of End of Forecast Time Period

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

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

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

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

class NumberOfTimeRanges:
2271class NumberOfTimeRanges:
2272    """Number of time ranges specifications describing the time intervals used to calculate the statistically-processed field"""
2273
2274    _key = {8: 21, 9: 28, 10: 22, 11: 24, 12: 23, 42: 22, 43: 28, 46: 27}
2275
2276    def __get__(self, obj, objtype=None):
2277        pdtn = obj.section4[1]
2278        return obj.section4[self._key[pdtn] + 2]
2279
2280    def __set__(self, obj, value):
2281        pdtn = obj.section4[1]
2282        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:
2285class NumberOfMissingValues:
2286    """Total number of data values missing in statistical process"""
2287
2288    _key = {8: 22, 9: 29, 10: 23, 11: 25, 12: 24, 42: 23, 43: 29, 46: 28}
2289
2290    def __get__(self, obj, objtype=None):
2291        pdtn = obj.section4[1]
2292        return obj.section4[self._key[pdtn] + 2]
2293
2294    def __set__(self, obj, value):
2295        pdtn = obj.section4[1]
2296        obj.section4[self._key[pdtn] + 2] = value

Total number of data values missing in statistical process

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

Time Range of Statistical Process

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

Time Increment of Successive Fields

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

Number of Data Points for Spatial Processing

class NumberOfContributingSpectralBands:
2519class NumberOfContributingSpectralBands:
2520    """Number of Contributing Spectral Bands (NB)"""
2521
2522    _key = {32: 9}
2523
2524    def __get__(self, obj, objtype=None):
2525        pdtn = obj.section4[1]
2526        return obj.section4[self._key[pdtn] + 2]
2527
2528    def __set__(self, obj, value):
2529        pdtn = obj.section4[1]
2530        obj.section4[self._key[pdtn] + 2] = value

Number of Contributing Spectral Bands (NB)

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

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

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

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

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

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

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

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

class ScaledValueOfCentralWaveNumber:
2585class ScaledValueOfCentralWaveNumber:
2586    """Scaled Value Of Central WaveNumber of band NB"""
2587
2588    _key = {32: 14}
2589
2590    def __get__(self, obj, objtype=None):
2591        pdtn = obj.section4[1]
2592        return obj.section4[self._key[pdtn] + 2 :: 5][: obj.section4[9 + 2]]
2593
2594    def __set__(self, obj, value):
2595        pass

Scaled Value Of Central WaveNumber of band NB

class CetralWaveNumber:
2598class CetralWaveNumber:
2599    """Central WaveNumber of band NB"""
2600
2601    def __get__(self, obj, objtype=None):
2602        scale_factor = getattr(obj, "scaleFactorOfCentralWaveNumber")
2603        scaled_value = getattr(obj, "scaledValueOfCentralWaveNumber")
2604        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2605
2606    def __set__(self, obj, value):
2607        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2608        setattr(obj, "scaleFactorOfCentralWaveNumber", scale_factor)
2609        setattr(obj, "scaledValueOfCentralWaveNumber", scaled_value)

Central WaveNumber of band NB

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

Scale Factor of First Size

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

Scaled Value of First Size

class FirstSizeOfAerosol:
2716class FirstSizeOfAerosol:
2717    """First size of Aerosol"""
2718
2719    def __get__(self, obj, objtype=None):
2720        scale_factor = getattr(obj, "scaleFactorOfFirstSize")
2721        scaled_value = getattr(obj, "scaledValueOfFirstSize")
2722        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2723
2724    def __set__(self, obj, value):
2725        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2726        setattr(obj, "scaleFactorOfFirstSize", scale_factor)
2727        setattr(obj, "scaledValueOfFirstSize", scaled_value)

First size of Aerosol

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

Scale Factor of Second Size

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

Scaled Value of Second Size

class SecondSizeOfAerosol:
2782class SecondSizeOfAerosol:
2783    """Second size of Aerosol"""
2784
2785    def __get__(self, obj, objtype=None):
2786        scale_factor = getattr(obj, "scaleFactorOfSecondSize")
2787        scaled_value = getattr(obj, "scaledValueOfSecondSize")
2788        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2789
2790    def __set__(self, obj, value):
2791        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2792        setattr(obj, "scaleFactorOfSecondSize", scale_factor)
2793        setattr(obj, "scaledValueOfSecondSize", scaled_value)

Second size of Aerosol

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

Scale Factor of First Wavelength

class ScaledValueOfFirstWavelength:
2820class ScaledValueOfFirstWavelength:
2821    """Scaled Value of First Wavelength"""
2822
2823    _key = {48: 10}
2824
2825    def __get__(self, obj, objtype=None):
2826        return obj.section4[self._key[obj.pdtn] + 2]
2827
2828    def __set__(self, obj, value):
2829        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of First Wavelength

class FirstWavelength:
2832class FirstWavelength:
2833    """First Wavelength"""
2834
2835    def __get__(self, obj, objtype=None):
2836        scale_factor = getattr(obj, "scaleFactorOfFirstWavelength")
2837        scaled_value = getattr(obj, "scaledValueOfFirstWavelength")
2838        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2839
2840    def __set__(self, obj, value):
2841        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2842        setattr(obj, "scaleFactorOfFirstWavelength", scale_factor)
2843        setattr(obj, "scaledValueOfFirstWavelength", scaled_value)

First Wavelength

class ScaleFactorOfSecondWavelength:
2846class ScaleFactorOfSecondWavelength:
2847    """Scale Factor of Second Wavelength"""
2848
2849    _key = {48: 11}
2850
2851    def __get__(self, obj, objtype=None):
2852        return obj.section4[self._key[obj.pdtn] + 2]
2853
2854    def __set__(self, obj, value):
2855        obj.section4[self._key[obj.pdtn] + 2] = value

Scale Factor of Second Wavelength

class ScaledValueOfSecondWavelength:
2858class ScaledValueOfSecondWavelength:
2859    """Scaled Value of Second Wavelength"""
2860
2861    _key = {48: 12}
2862
2863    def __get__(self, obj, objtype=None):
2864        return obj.section4[self._key[obj.pdtn] + 2]
2865
2866    def __set__(self, obj, value):
2867        obj.section4[self._key[obj.pdtn] + 2] = value

Scaled Value of Second Wavelength

class SecondWavelength:
2870class SecondWavelength:
2871    """Second Wavelength"""
2872
2873    def __get__(self, obj, objtype=None):
2874        scale_factor = getattr(obj, "scaleFactorOfSecondWavelength")
2875        scaled_value = getattr(obj, "scaledValueOfSecondWavelength")
2876        return float(Decimal(int(scaled_value)) / (10**scale_factor))
2877
2878    def __set__(self, obj, value):
2879        scale_factor, scaled_value = utils.decimal_to_scaled_int(value)
2880        setattr(obj, "scaleFactorOfSecondWavelength", scale_factor)
2881        setattr(obj, "scaledValueOfSecondWavelength", scaled_value)

Second Wavelength

class SourceSinkIndicator:
2884class SourceSinkIndicator:
2885    """[Source/Sink Indicator](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-238.shtml)"""
2886
2887    _key = {76: 10, 77: 10, 78: 10, 79: 10, 80: 3, 81: 3, 82: 3, 83: 3, 84: 3, 85: 3}
2888
2889    def __get__(self, obj, objtype=None):
2890        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.238")
2891
2892    def __set__(self, obj, value):
2893        obj.section4[self._key[obj.pdtn] + 2] = value
class ConstituentType:
2896class ConstituentType:
2897    """[Constituent Type](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table4-230.shtml)"""
2898
2899    _key = defaultdict(lambda: 9)
2900
2901    def __get__(self, obj, objtype=None):
2902        return Grib2Metadata(obj.section4[self._key[obj.pdtn] + 2], table="4.230")
2903
2904    def __set__(self, obj, value):
2905        obj.section4[self._key[obj.pdtn] + 2] = value
@dataclass(init=False)
class ProductDefinitionTemplateBase:
2913@dataclass(init=False)
2914class ProductDefinitionTemplateBase:
2915    """Base attributes for Product Definition Templates"""
2916
2917    _varinfo: list = field(init=False, repr=False, default=VarInfo())
2918    fullName: str = field(init=False, repr=False, default=FullName())
2919    units: str = field(init=False, repr=False, default=Units())
2920    shortName: str = field(init=False, repr=False, default=ShortName())
2921    leadTime: datetime.timedelta = field(init=False, repr=False, default=LeadTime())
2922    duration: datetime.timedelta = field(init=False, repr=False, default=Duration())
2923    validDate: datetime.datetime = field(init=False, repr=False, default=ValidDate())
2924    level: str = field(init=False, repr=False, default=Level())
2925    # Begin template here...
2926    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
2927    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
2928    parameterUnits: int = field(init=False, repr=False, default=ParameterUnits())
2929    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
2930    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
2931    backgroundGeneratingProcessIdentifier: int = field(init=False, repr=False, default=BackgroundGeneratingProcessIdentifier())
2932    hoursAfterDataCutoff: int = field(init=False, repr=False, default=HoursAfterDataCutoff())
2933    minutesAfterDataCutoff: int = field(init=False, repr=False, default=MinutesAfterDataCutoff())
2934    unitOfForecastTime: Grib2Metadata = field(init=False, repr=False, default=UnitOfForecastTime())
2935    valueOfForecastTime: int = field(init=False, repr=False, default=ValueOfForecastTime())
2936
2937    @classmethod
2938    def _attrs(cls):
2939        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:
2942@dataclass(init=False)
2943class ProductDefinitionTemplateSurface:
2944    """Surface attributes for Product Definition Templates"""
2945
2946    _fixedsfc1info: list = field(init=False, repr=False, default=FixedSfc1Info())
2947    _fixedsfc2info: list = field(init=False, repr=False, default=FixedSfc2Info())
2948    typeOfFirstFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfFirstFixedSurface())
2949    scaleFactorOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfFirstFixedSurface())
2950    scaledValueOfFirstFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfFirstFixedSurface())
2951    typeOfSecondFixedSurface: Grib2Metadata = field(init=False, repr=False, default=TypeOfSecondFixedSurface())
2952    scaleFactorOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaleFactorOfSecondFixedSurface())
2953    scaledValueOfSecondFixedSurface: int = field(init=False, repr=False, default=ScaledValueOfSecondFixedSurface())
2954    unitOfFirstFixedSurface: str = field(init=False, repr=False, default=UnitOfFirstFixedSurface())
2955    valueOfFirstFixedSurface: int = field(init=False, repr=False, default=ValueOfFirstFixedSurface())
2956    unitOfSecondFixedSurface: str = field(init=False, repr=False, default=UnitOfSecondFixedSurface())
2957    valueOfSecondFixedSurface: int = field(init=False, repr=False, default=ValueOfSecondFixedSurface())
2958
2959    @classmethod
2960    def _attrs(cls):
2961        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):
2964@dataclass(init=False)
2965class ProductDefinitionTemplate0(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2966    """[Product Definition Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-0.shtml)"""
2967
2968    _len = 15
2969    _num = 0
2970
2971    @classmethod
2972    def _attrs(cls):
2973        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
@dataclass(init=False)
class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2976@dataclass(init=False)
2977class ProductDefinitionTemplate1(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2978    """[Product Definition Template 1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-1.shtml)"""
2979
2980    _len = 18
2981    _num = 1
2982    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
2983    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
2984    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2985
2986    @classmethod
2987    def _attrs(cls):
2988        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):
2991@dataclass(init=False)
2992class ProductDefinitionTemplate2(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
2993    """[Product Definition Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-2.shtml)"""
2994
2995    _len = 17
2996    _num = 2
2997    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
2998    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
2999
3000    @classmethod
3001    def _attrs(cls):
3002        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):
3005@dataclass(init=False)
3006class ProductDefinitionTemplate5(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3007    """[Product Definition Template 5](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-5.shtml)"""
3008
3009    _len = 22
3010    _num = 5
3011    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3012    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3013    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3014    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3015    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3016    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3017    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3018    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3019    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3020    threshold: str = field(init=False, repr=False, default=Threshold())
3021
3022    @classmethod
3023    def _attrs(cls):
3024        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):
3027@dataclass(init=False)
3028class ProductDefinitionTemplate6(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3029    """[Product Definition Template 6](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-6.shtml)"""
3030
3031    _len = 16
3032    _num = 6
3033    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3034
3035    @classmethod
3036    def _attrs(cls):
3037        return [key for key in cls.__dataclass_fields__.keys() if not key.startswith("_")]
percentileValue: int

Percentile Value

@dataclass(init=False)
class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3040@dataclass(init=False)
3041class ProductDefinitionTemplate8(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3042    """[Product Definition Template 8](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-8.shtml)"""
3043
3044    _len = 29
3045    _num = 8
3046    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3047    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3048    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3049    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3050    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3051    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3052    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3053    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3054    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3055    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3056    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3057    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3058    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3059    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3060
3061    @classmethod
3062    def _attrs(cls):
3063        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):
3066@dataclass(init=False)
3067class ProductDefinitionTemplate9(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3068    """[Product Definition Template 9](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-9.shtml)"""
3069
3070    _len = 36
3071    _num = 9
3072    forecastProbabilityNumber: int = field(init=False, repr=False, default=ForecastProbabilityNumber())
3073    totalNumberOfForecastProbabilities: int = field(init=False, repr=False, default=TotalNumberOfForecastProbabilities())
3074    typeOfProbability: Grib2Metadata = field(init=False, repr=False, default=TypeOfProbability())
3075    scaleFactorOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdLowerLimit())
3076    scaledValueOfThresholdLowerLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdLowerLimit())
3077    scaleFactorOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaleFactorOfThresholdUpperLimit())
3078    scaledValueOfThresholdUpperLimit: float = field(init=False, repr=False, default=ScaledValueOfThresholdUpperLimit())
3079    thresholdLowerLimit: float = field(init=False, repr=False, default=ThresholdLowerLimit())
3080    thresholdUpperLimit: float = field(init=False, repr=False, default=ThresholdUpperLimit())
3081    threshold: str = field(init=False, repr=False, default=Threshold())
3082    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3083    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3084    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3085    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3086    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3087    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3088    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3089    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3090    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3091    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3092    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3093    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3094    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3095    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3096
3097    @classmethod
3098    def _attrs(cls):
3099        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):
3102@dataclass(init=False)
3103class ProductDefinitionTemplate10(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3104    """[Product Definition Template 10](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-10.shtml)"""
3105
3106    _len = 30
3107    _num = 10
3108    percentileValue: int = field(init=False, repr=False, default=PercentileValue())
3109    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3110    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3111    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3112    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3113    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3114    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3115    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3116    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3117    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3118    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3119    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3120    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3121    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3122    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3123
3124    @classmethod
3125    def _attrs(cls):
3126        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):
3129@dataclass(init=False)
3130class ProductDefinitionTemplate11(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3131    """[Product Definition Template 11](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-11.shtml)"""
3132
3133    _len = 32
3134    _num = 11
3135    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3136    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3137    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3138    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3139    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3140    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3141    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3142    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3143    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3144    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3145    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3146    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3147    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3148    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3149    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3150    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3151    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3152
3153    @classmethod
3154    def _attrs(cls):
3155        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):
3158@dataclass(init=False)
3159class ProductDefinitionTemplate12(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3160    """[Product Definition Template 12](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-12.shtml)"""
3161
3162    _len = 31
3163    _num = 12
3164    typeOfDerivedForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfDerivedForecast())
3165    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3166    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3167    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3168    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3169    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3170    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3171    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3172    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3173    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3174    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3175    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3176    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3177    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3178    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3179    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3180
3181    @classmethod
3182    def _attrs(cls):
3183        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):
3186@dataclass(init=False)
3187class ProductDefinitionTemplate13(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3188    """[Product Definition Template 13](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-13.shtml)"""
3189
3190    _len = 18
3191    _num = 13
3192    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3193    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3194    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3195    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3196    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3197    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3198    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3199    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3200
3201    @classmethod
3202    def _attrs(cls):
3203        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):
3206@dataclass(init=False)
3207class ProductDefinitionTemplate14(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3208    """[Product Definition Template 14](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-14.shtml)"""
3209
3210    _len = 18
3211    _num = 14
3212    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3213    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3214    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3215    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3216    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3217    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3218    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3219    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3220
3221    @classmethod
3222    def _attrs(cls):
3223        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):
3226@dataclass(init=False)
3227class ProductDefinitionTemplate15(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3228    """[Product Definition Template 15](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-15.shtml)"""
3229
3230    _len = 18
3231    _num = 15
3232    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3233    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3234    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3235
3236    @classmethod
3237    def _attrs(cls):
3238        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:
3258@dataclass(init=False)
3259class ProductDefinitionTemplate31:
3260    """[Product Definition Template 31](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-31.shtml)"""
3261
3262    _len = 5
3263    _num = 31
3264    parameterCategory: int = field(init=False, repr=False, default=ParameterCategory())
3265    parameterNumber: int = field(init=False, repr=False, default=ParameterNumber())
3266    typeOfGeneratingProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfGeneratingProcess())
3267    generatingProcess: Grib2Metadata = field(init=False, repr=False, default=GeneratingProcess())
3268    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3269    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3270    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3271    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3272    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3273    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3274
3275    @classmethod
3276    def _attrs(cls):
3277        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):
3280@dataclass(init=False)
3281class ProductDefinitionTemplate32(ProductDefinitionTemplateBase):
3282    """[Product Definition Template 32](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-32.shtml)"""
3283
3284    _len = 10
3285    _num = 32
3286    numberOfContributingSpectralBands: int = field(init=False, repr=False, default=NumberOfContributingSpectralBands())
3287    satelliteSeries: list = field(init=False, repr=False, default=SatelliteSeries())
3288    satelliteNumber: list = field(init=False, repr=False, default=SatelliteNumber())
3289    instrumentType: list = field(init=False, repr=False, default=InstrumentType())
3290    scaleFactorOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaleFactorOfCentralWaveNumber())
3291    scaledValueOfCentralWaveNumber: list = field(init=False, repr=False, default=ScaledValueOfCentralWaveNumber())
3292
3293    @classmethod
3294    def _attrs(cls):
3295        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):
3376@dataclass(init=False)
3377class ProductDefinitionTemplate44(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3378    """[Product Definition Template 4.44](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-44.shtml)"""
3379
3380    _len = 25
3381    _num = 44
3382    # Aerosol parameters
3383    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3384    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3385    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3386    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3387    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3388    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3389    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3390    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3391
3392    @classmethod
3393    def _attrs(cls):
3394        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):
3397@dataclass(init=False)
3398class ProductDefinitionTemplate45(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3399    """[Product Definition Template 4.45](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-45.shtml)"""
3400
3401    _len = 28
3402    _num = 45
3403    # Aerosol parameters
3404    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3405    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3406    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3407    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3408    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3409    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3410    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3411    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3412
3413    # Ensemble parameters
3414    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3415    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3416    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3417
3418    @classmethod
3419    def _attrs(cls):
3420        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):
3423@dataclass(init=False)
3424class ProductDefinitionTemplate50(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3425    """[Product Definition Template 4.50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-50.shtml)"""
3426
3427    _len = 25
3428    _num = 50
3429    # Aerosol parameters
3430    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3431    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3432    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3433    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3434    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3435    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3436    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3437    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3438
3439    @classmethod
3440    def _attrs(cls):
3441        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):
3444@dataclass(init=False)
3445class ProductDefinitionTemplate46(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3446    """[Product Definition Template 4.46](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-46.shtml)"""
3447
3448    _len = 38  # Total number of octets
3449    _num = 46
3450
3451    # Aerosol-specific parameters
3452    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3453    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3454    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3455    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3456    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3457    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3458    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3459    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3460
3461    # Time interval parameters
3462    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3463    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3464    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3465    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3466    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3467    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3468    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3469    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3470
3471    # Statistical processing parameters
3472    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3473    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3474    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3475    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3476    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3477    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3478    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3479
3480    @classmethod
3481    def _attrs(cls):
3482        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):
3485@dataclass(init=False)
3486class ProductDefinitionTemplate47(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3487    """[Product Definition Template 4.47](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-47.shtml)"""
3488
3489    _len = 41  # Total number of octets for base template
3490    _num = 47
3491
3492    # Aerosol parameters
3493    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3494    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3495    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3496    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3497    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3498    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3499    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3500    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3501
3502    # Ensemble parameters
3503    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3504    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3505    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3506
3507    # Time interval parameters
3508    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3509    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3510    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3511    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3512    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3513    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3514    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3515    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3516
3517    # Statistical processing parameters
3518    typeOfStatisticalProcessing: Grib2Metadata = field(init=False, repr=False, default=TypeOfStatisticalProcessing())
3519    numberOfDataPointsForSpatialProcessing: int = field(init=False, repr=False, default=NumberOfDataPointsForSpatialProcessing())
3520    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3521    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3522    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3523    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3524    timeIncrementOfSuccessiveFields: int = field(init=False, repr=False, default=TimeIncrementOfSuccessiveFields())
3525
3526    @classmethod
3527    def _attrs(cls):
3528        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):
3531@dataclass(init=False)
3532class ProductDefinitionTemplate48(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3533    """[Product Definition Template 48](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-48.shtml)"""
3534
3535    _len = 26
3536    _num = 48
3537    # Aerosol parameters
3538    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3539    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3540    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3541    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3542    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3543    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3544    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3545    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3546
3547    # Wavelength parameters
3548    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3549    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3550    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3551    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3552    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3553    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3554    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3555
3556    @classmethod
3557    def _attrs(cls):
3558        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):
3561@dataclass(init=False)
3562class ProductDefinitionTemplate49(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3563    """[Product Definition Template 4.49](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-49.shtml)"""
3564
3565    _len = 28
3566    _num = 49
3567
3568    # Aerosol parameters
3569    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3570    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3571    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3572    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3573    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3574    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3575    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3576    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3577
3578    # Wavelength parameters
3579    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3580    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3581    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3582    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3583    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3584    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3585    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3586
3587    # Ensemble parameters
3588    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3589    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3590    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):
3593@dataclass(init=False)
3594class ProductDefinitionTemplate80(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3595    """[Product Definition Template 4.80](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-80.shtml)"""
3596
3597    _len = 26
3598    _num = 80
3599
3600    # Aerosol parameters
3601    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3602    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3603    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3604    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3605    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3606    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3607    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3608    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3609    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3610
3611    # Wavelength parameters
3612    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3613    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3614    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3615    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3616    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3617    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3618    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):
3621@dataclass(init=False)
3622class ProductDefinitionTemplate81(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3623    """[Product Definition Template 4.81](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-81.shtml)"""
3624
3625    _len = 31
3626    _num = 81
3627
3628    # Aerosol parameters
3629    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3630    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3631    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3632    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3633    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3634    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3635    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3636    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3637    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3638
3639    # Wavelength parameters
3640    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3641    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3642    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3643    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3644    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3645    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3646    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3647
3648    # Ensemble parameters
3649    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3650    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3651    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):
3654@dataclass(init=False)
3655class ProductDefinitionTemplate82(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3656    """[Product Definition Template 4.82](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-82.shtml)"""
3657
3658    _len = 41
3659    _num = 82
3660
3661    # Aerosol parameters
3662    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3663    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3664    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3665    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3666    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3667    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3668    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3669    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3670    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3671
3672    # Wavelength parameters
3673    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3674    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3675    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3676    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3677    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3678    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3679    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3680
3681    # Time interval parameters
3682    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3683    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3684    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3685    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3686    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3687    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3688    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3689    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3690
3691    # Statistical processing parameters
3692    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3693    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3694    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3695    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3696    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3697    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3698    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3699    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):
3702@dataclass(init=False)
3703class ProductDefinitionTemplate83(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3704    """[Product Definition Template 4.83](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-83.shtml)"""
3705
3706    _len = 44
3707    _num = 83
3708
3709    # Aerosol parameters
3710    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3711    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3712    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3713    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3714    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3715    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3716    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3717    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3718    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3719
3720    # Wavelength parameters
3721    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3722    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3723    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3724    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3725    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3726    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3727    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3728
3729    # Ensemble parameters
3730    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3731    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3732    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3733
3734    # Time interval parameters
3735    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3736    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3737    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3738    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3739    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3740    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3741    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3742    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):
3745@dataclass(init=False)
3746class ProductDefinitionTemplate84(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3747    """[Product Definition Template 4.84](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-84.shtml)"""
3748
3749    _len = 44
3750    _num = 84
3751
3752    # Aerosol parameters
3753    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3754    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3755    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3756    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3757    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3758    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3759    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3760    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3761    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3762
3763    # Wavelength parameters
3764    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3765    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3766    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3767    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3768    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3769    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3770    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3771
3772    # Ensemble parameters
3773    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3774    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3775    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3776
3777    # Time interval parameters
3778    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3779    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3780    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3781    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3782    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3783    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3784
3785    # Statistical processing parameters
3786    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3787    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3788    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3789    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3790    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3791    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3792    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3793    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):
3796@dataclass(init=False)
3797class ProductDefinitionTemplate85(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3798    """[Product Definition Template 4.85](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-85.shtml)"""
3799
3800    _len = 33
3801    _num = 85
3802
3803    # Aerosol parameters
3804    typeOfAerosol: Grib2Metadata = field(init=False, repr=False, default=TypeOfAerosol())
3805    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3806    typeOfIntervalForAerosolSize: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolSize())
3807    scaleFactorOfFirstSize: int = field(init=False, repr=False, default=ScaleFactorOfFirstSize())
3808    scaledValueOfFirstSize: int = field(init=False, repr=False, default=ScaledValueOfFirstSize())
3809    firstSizeOfAerosol: float = field(init=False, repr=False, default=FirstSizeOfAerosol())
3810    scaleFactorOfSecondSize: int = field(init=False, repr=False, default=ScaleFactorOfSecondSize())
3811    scaledValueOfSecondSize: int = field(init=False, repr=False, default=ScaledValueOfSecondSize())
3812    secondSizeOfAerosol: float = field(init=False, repr=False, default=SecondSizeOfAerosol())
3813
3814    # Wavelength parameters
3815    typeOfIntervalForAerosolWavelength: Grib2Metadata = field(init=False, repr=False, default=TypeOfIntervalForAerosolWavelength())
3816    scaleFactorOfFirstWavelength: int = field(init=False, repr=False, default=ScaleFactorOfFirstWavelength())
3817    scaledValueOfFirstWavelength: int = field(init=False, repr=False, default=ScaledValueOfFirstWavelength())
3818    firstWavelength: float = field(init=False, repr=False, default=FirstWavelength())
3819    scaleFactorOfSecondWavelength: int = field(init=False, repr=False, default=ScaleFactorOfSecondWavelength())
3820    scaledValueOfSecondWavelength: int = field(init=False, repr=False, default=ScaledValueOfSecondWavelength())
3821    secondWavelength: float = field(init=False, repr=False, default=SecondWavelength())
3822
3823    # Ensemble parameters
3824    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3825    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3826    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):
3829@dataclass(init=False)
3830class ProductDefinitionTemplate40(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3831    """[Product Definition Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-40.shtml)"""
3832
3833    _len = 16
3834    _num = 40
3835    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
constituentType: Grib2Metadata
@dataclass(init=False)
class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3838@dataclass(init=False)
3839class ProductDefinitionTemplate41(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3840    """[Product Definition Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-41.shtml)"""
3841
3842    _len = 19
3843    _num = 41
3844    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3845    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3846    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3847    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):
3850@dataclass(init=False)
3851class ProductDefinitionTemplate42(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3852    """[Product Definition Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-42.shtml)"""
3853
3854    _len = 30
3855    _num = 42
3856    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3857    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3858    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3859    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3860    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3861    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3862    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3863    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3864    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3865    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3866    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3867    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3868    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3869    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3870    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):
3873@dataclass(init=False)
3874class ProductDefinitionTemplate43(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3875    """[Product Definition Template 43](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-43.shtml)"""
3876
3877    _len = 33
3878    _num = 43
3879    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3880    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3881    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3882    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3883    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3884    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3885    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3886    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3887    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3888    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3889    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3890    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3891    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3892    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3893    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3894    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3895    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3896    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):
3899@dataclass(init=False)
3900class ProductDefinitionTemplate76(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3901    """[Product Definition Template 4.76](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-76.shtml)"""
3902
3903    _len = 17
3904    _num = 76
3905    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3906    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
constituentType: Grib2Metadata
sourceSinkIndicator: Grib2Metadata
@dataclass(init=False)
class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3909@dataclass(init=False)
3910class ProductDefinitionTemplate77(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3911    """[Product Definition Template 4.77](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-77.shtml)"""
3912
3913    _len = 20
3914    _num = 77
3915    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3916    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3917    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3918    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3919    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):
3922@dataclass(init=False)
3923class ProductDefinitionTemplate78(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3924    """[Product Definition Template 4.78](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-78.shtml)"""
3925
3926    _len = 31
3927    _num = 78
3928    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3929    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3930    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3931    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3932    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3933    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3934    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3935    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3936    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3937    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3938    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3939    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3940    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3941    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3942    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3943    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):
3946@dataclass(init=False)
3947class ProductDefinitionTemplate79(ProductDefinitionTemplateBase, ProductDefinitionTemplateSurface):
3948    """[Product Definition Template 4.79](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp4-79.shtml)"""
3949
3950    _len = 34
3951    _num = 79
3952    constituentType: Grib2Metadata = field(init=False, repr=False, default=ConstituentType())
3953    sourceSinkIndicator: Grib2Metadata = field(init=False, repr=False, default=SourceSinkIndicator())
3954    typeOfEnsembleForecast: Grib2Metadata = field(init=False, repr=False, default=TypeOfEnsembleForecast())
3955    perturbationNumber: int = field(init=False, repr=False, default=PerturbationNumber())
3956    numberOfEnsembleForecasts: int = field(init=False, repr=False, default=NumberOfEnsembleForecasts())
3957    yearOfEndOfTimePeriod: int = field(init=False, repr=False, default=YearOfEndOfTimePeriod())
3958    monthOfEndOfTimePeriod: int = field(init=False, repr=False, default=MonthOfEndOfTimePeriod())
3959    dayOfEndOfTimePeriod: int = field(init=False, repr=False, default=DayOfEndOfTimePeriod())
3960    hourOfEndOfTimePeriod: int = field(init=False, repr=False, default=HourOfEndOfTimePeriod())
3961    minuteOfEndOfTimePeriod: int = field(init=False, repr=False, default=MinuteOfEndOfTimePeriod())
3962    secondOfEndOfTimePeriod: int = field(init=False, repr=False, default=SecondOfEndOfTimePeriod())
3963    numberOfTimeRanges: int = field(init=False, repr=False, default=NumberOfTimeRanges())
3964    numberOfMissingValues: int = field(init=False, repr=False, default=NumberOfMissingValues())
3965    statisticalProcess: Grib2Metadata = field(init=False, repr=False, default=StatisticalProcess())
3966    typeOfTimeIncrementOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=TypeOfTimeIncrementOfStatisticalProcess())
3967    unitOfTimeRangeOfStatisticalProcess: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfStatisticalProcess())
3968    timeRangeOfStatisticalProcess: int = field(init=False, repr=False, default=TimeRangeOfStatisticalProcess())
3969    unitOfTimeRangeOfSuccessiveFields: Grib2Metadata = field(init=False, repr=False, default=UnitOfTimeRangeOfSuccessiveFields())
3970    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):
4155def pdt_class_by_pdtn(pdtn: int):
4156    """
4157    Provide a Product Definition Template class via the template number.
4158
4159    Parameters
4160    ----------
4161    pdtn
4162        Product definition template number.
4163
4164    Returns
4165    -------
4166    pdt_class_by_pdtn
4167        Product definition template class object (not an instance).
4168    """
4169    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:
4175class NumberOfPackedValues:
4176    """Number of Packed Values"""
4177
4178    def __get__(self, obj, objtype=None):
4179        return obj.section5[0]
4180
4181    def __set__(self, obj, value):
4182        pass

Number of Packed Values

class DataRepresentationTemplateNumber:
4185class DataRepresentationTemplateNumber:
4186    """[Data Representation Template Number](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-0.shtml)"""
4187
4188    def __get__(self, obj, objtype=None):
4189        return Grib2Metadata(obj.section5[1], table="5.0")
4190
4191    def __set__(self, obj, value):
4192        pass
class DataRepresentationTemplate:
4195class DataRepresentationTemplate:
4196    """Data Representation Template"""
4197
4198    def __get__(self, obj, objtype=None):
4199        return obj.section5[2:]
4200
4201    def __set__(self, obj, value):
4202        raise NotImplementedError

Data Representation Template

class RefValue:
4205class RefValue:
4206    """Reference Value (represented as an IEEE 32-bit floating point value)"""
4207
4208    def __get__(self, obj, objtype=None):
4209        return utils.ieee_int_to_float(obj.section5[0 + 2])
4210
4211    def __set__(self, obj, value):
4212        pass

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

class BinScaleFactor:
4215class BinScaleFactor:
4216    """Binary Scale Factor"""
4217
4218    def __get__(self, obj, objtype=None):
4219        return obj.section5[1 + 2]
4220
4221    def __set__(self, obj, value):
4222        obj.section5[1 + 2] = value

Binary Scale Factor

class DecScaleFactor:
4225class DecScaleFactor:
4226    """Decimal Scale Factor"""
4227
4228    def __get__(self, obj, objtype=None):
4229        return obj.section5[2 + 2]
4230
4231    def __set__(self, obj, value):
4232        obj.section5[2 + 2] = value

Decimal Scale Factor

class NBitsPacking:
4235class NBitsPacking:
4236    """Minimum number of bits for packing"""
4237
4238    def __get__(self, obj, objtype=None):
4239        return obj.section5[3 + 2]
4240
4241    def __set__(self, obj, value):
4242        obj.section5[3 + 2] = value

Minimum number of bits for packing

class TypeOfValues:
4245class TypeOfValues:
4246    """[Type of Original Field Values](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)"""
4247
4248    def __get__(self, obj, objtype=None):
4249        return Grib2Metadata(obj.section5[4 + 2], table="5.1")
4250
4251    def __set__(self, obj, value):
4252        obj.section5[4 + 2] = value
class GroupSplittingMethod:
4255class GroupSplittingMethod:
4256    """[Group Splitting Method](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-4.shtml)"""
4257
4258    def __get__(self, obj, objtype=None):
4259        return Grib2Metadata(obj.section5[5 + 2], table="5.4")
4260
4261    def __set__(self, obj, value):
4262        obj.section5[5 + 2] = value
class TypeOfMissingValueManagement:
4265class TypeOfMissingValueManagement:
4266    """[Type of Missing Value Management](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-5.shtml)"""
4267
4268    def __get__(self, obj, objtype=None):
4269        return Grib2Metadata(obj.section5[6 + 2], table="5.5")
4270
4271    def __set__(self, obj, value):
4272        obj.section5[6 + 2] = value
class PriMissingValue:
4275class PriMissingValue:
4276    """Primary Missing Value"""
4277
4278    def __get__(self, obj, objtype=None):
4279        if obj.typeOfValues == 0:
4280            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
4281        elif obj.typeOfValues == 1:
4282            return obj.section5[7 + 2] if obj.section5[6 + 2] in [1, 2] else None
4283
4284    def __set__(self, obj, value):
4285        if obj.typeOfValues == 0:
4286            obj.section5[7 + 2] = utils.ieee_float_to_int(value)
4287        elif self.typeOfValues == 1:
4288            obj.section5[7 + 2] = int(value)
4289        obj.section5[6 + 2] = 1

Primary Missing Value

class SecMissingValue:
4292class SecMissingValue:
4293    """Secondary Missing Value"""
4294
4295    def __get__(self, obj, objtype=None):
4296        if obj.typeOfValues == 0:
4297            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
4298        elif obj.typeOfValues == 1:
4299            return obj.section5[8 + 2] if obj.section5[6 + 2] in {1, 2} else None
4300
4301    def __set__(self, obj, value):
4302        if obj.typeOfValues == 0:
4303            obj.section5[8 + 2] = utils.ieee_float_to_int(value)
4304        elif self.typeOfValues == 1:
4305            obj.section5[8 + 2] = int(value)
4306        obj.section5[6 + 2] = 2

Secondary Missing Value

class NGroups:
4309class NGroups:
4310    """Number of Groups"""
4311
4312    def __get__(self, obj, objtype=None):
4313        return obj.section5[9 + 2]
4314
4315    def __set__(self, obj, value):
4316        pass

Number of Groups

class RefGroupWidth:
4319class RefGroupWidth:
4320    """Reference Group Width"""
4321
4322    def __get__(self, obj, objtype=None):
4323        return obj.section5[10 + 2]
4324
4325    def __set__(self, obj, value):
4326        pass

Reference Group Width

class NBitsGroupWidth:
4329class NBitsGroupWidth:
4330    """Number of bits for Group Width"""
4331
4332    def __get__(self, obj, objtype=None):
4333        return obj.section5[11 + 2]
4334
4335    def __set__(self, obj, value):
4336        pass

Number of bits for Group Width

class RefGroupLength:
4339class RefGroupLength:
4340    """Reference Group Length"""
4341
4342    def __get__(self, obj, objtype=None):
4343        return obj.section5[12 + 2]
4344
4345    def __set__(self, obj, value):
4346        pass

Reference Group Length

class GroupLengthIncrement:
4349class GroupLengthIncrement:
4350    """Group Length Increment"""
4351
4352    def __get__(self, obj, objtype=None):
4353        return obj.section5[13 + 2]
4354
4355    def __set__(self, obj, value):
4356        pass

Group Length Increment

class LengthOfLastGroup:
4359class LengthOfLastGroup:
4360    """Length of Last Group"""
4361
4362    def __get__(self, obj, objtype=None):
4363        return obj.section5[14 + 2]
4364
4365    def __set__(self, obj, value):
4366        pass

Length of Last Group

class NBitsScaledGroupLength:
4369class NBitsScaledGroupLength:
4370    """Number of bits of Scaled Group Length"""
4371
4372    def __get__(self, obj, objtype=None):
4373        return obj.section5[15 + 2]
4374
4375    def __set__(self, obj, value):
4376        pass

Number of bits of Scaled Group Length

class SpatialDifferenceOrder:
4379class SpatialDifferenceOrder:
4380    """[Spatial Difference Order](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-6.shtml)"""
4381
4382    def __get__(self, obj, objtype=None):
4383        return Grib2Metadata(obj.section5[16 + 2], table="5.6")
4384
4385    def __set__(self, obj, value):
4386        obj.section5[16 + 2] = value
class NBytesSpatialDifference:
4389class NBytesSpatialDifference:
4390    """Number of bytes for Spatial Differencing"""
4391
4392    def __get__(self, obj, objtype=None):
4393        return obj.section5[17 + 2]
4394
4395    def __set__(self, obj, value):
4396        pass

Number of bytes for Spatial Differencing

class Precision:
4399class Precision:
4400    """[Precision for IEEE Floating Point Data](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-7.shtml)"""
4401
4402    def __get__(self, obj, objtype=None):
4403        return Grib2Metadata(obj.section5[0 + 2], table="5.7")
4404
4405    def __set__(self, obj, value):
4406        obj.section5[0 + 2] = value
class TypeOfCompression:
4409class TypeOfCompression:
4410    """[Type of Compression](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-40.shtml)"""
4411
4412    def __get__(self, obj, objtype=None):
4413        return Grib2Metadata(obj.section5[5 + 2], table="5.40")
4414
4415    def __set__(self, obj, value):
4416        obj.section5[5 + 2] = value
class TargetCompressionRatio:
4419class TargetCompressionRatio:
4420    """Target Compression Ratio"""
4421
4422    def __get__(self, obj, objtype=None):
4423        return obj.section5[6 + 2]
4424
4425    def __set__(self, obj, value):
4426        pass

Target Compression Ratio

class RealOfCoefficient:
4429class RealOfCoefficient:
4430    """Real of Coefficient"""
4431
4432    def __get__(self, obj, objtype=None):
4433        return utils.ieee_int_to_float(obj.section5[4 + 2])
4434
4435    def __set__(self, obj, value):
4436        obj.section5[4 + 2] = utils.ieee_float_to_int(float(value))

Real of Coefficient

class CompressionOptionsMask:
4439class CompressionOptionsMask:
4440    """Compression Options Mask for AEC/CCSDS"""
4441
4442    def __get__(self, obj, objtype=None):
4443        return obj.section5[5 + 2]
4444
4445    def __set__(self, obj, value):
4446        obj.section5[5 + 2] = value

Compression Options Mask for AEC/CCSDS

class BlockSize:
4449class BlockSize:
4450    """Block Size for AEC/CCSDS"""
4451
4452    def __get__(self, obj, objtype=None):
4453        return obj.section5[6 + 2]
4454
4455    def __set__(self, obj, value):
4456        obj.section5[6 + 2] = value

Block Size for AEC/CCSDS

class RefSampleInterval:
4459class RefSampleInterval:
4460    """Reference Sample Interval for AEC/CCSDS"""
4461
4462    def __get__(self, obj, objtype=None):
4463        return obj.section5[7 + 2]
4464
4465    def __set__(self, obj, value):
4466        obj.section5[7 + 2] = value

Reference Sample Interval for AEC/CCSDS

@dataclass(init=False)
class DataRepresentationTemplate0:
4469@dataclass(init=False)
4470class DataRepresentationTemplate0:
4471    """[Data Representation Template 0](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml)"""
4472
4473    _len = 5
4474    _num = 0
4475    _packingScheme = "simple"
4476    refValue: float = field(init=False, repr=False, default=RefValue())
4477    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4478    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4479    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4480
4481    @classmethod
4482    def _attrs(cls):
4483        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:
4486@dataclass(init=False)
4487class DataRepresentationTemplate2:
4488    """[Data Representation Template 2](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-2.shtml)"""
4489
4490    _len = 16
4491    _num = 2
4492    _packingScheme = "complex"
4493    refValue: float = field(init=False, repr=False, default=RefValue())
4494    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4495    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4496    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4497    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4498    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4499    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4500    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4501    nGroups: int = field(init=False, repr=False, default=NGroups())
4502    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4503    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4504    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4505    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4506    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4507    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4508
4509    @classmethod
4510    def _attrs(cls):
4511        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:
4514@dataclass(init=False)
4515class DataRepresentationTemplate3:
4516    """[Data Representation Template 3](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-3.shtml)"""
4517
4518    _len = 18
4519    _num = 3
4520    _packingScheme = "complex-spdiff"
4521    refValue: float = field(init=False, repr=False, default=RefValue())
4522    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4523    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4524    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4525    groupSplittingMethod: Grib2Metadata = field(init=False, repr=False, default=GroupSplittingMethod())
4526    typeOfMissingValueManagement: Grib2Metadata = field(init=False, repr=False, default=TypeOfMissingValueManagement())
4527    priMissingValue: Union[float, int] = field(init=False, repr=False, default=PriMissingValue())
4528    secMissingValue: Union[float, int] = field(init=False, repr=False, default=SecMissingValue())
4529    nGroups: int = field(init=False, repr=False, default=NGroups())
4530    refGroupWidth: int = field(init=False, repr=False, default=RefGroupWidth())
4531    nBitsGroupWidth: int = field(init=False, repr=False, default=NBitsGroupWidth())
4532    refGroupLength: int = field(init=False, repr=False, default=RefGroupLength())
4533    groupLengthIncrement: int = field(init=False, repr=False, default=GroupLengthIncrement())
4534    lengthOfLastGroup: int = field(init=False, repr=False, default=LengthOfLastGroup())
4535    nBitsScaledGroupLength: int = field(init=False, repr=False, default=NBitsScaledGroupLength())
4536    spatialDifferenceOrder: Grib2Metadata = field(init=False, repr=False, default=SpatialDifferenceOrder())
4537    nBytesSpatialDifference: int = field(init=False, repr=False, default=NBytesSpatialDifference())
4538
4539    @classmethod
4540    def _attrs(cls):
4541        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:
4544@dataclass(init=False)
4545class DataRepresentationTemplate4:
4546    """[Data Representation Template 4](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-4.shtml)"""
4547
4548    _len = 1
4549    _num = 4
4550    _packingScheme = "ieee-float"
4551    precision: Grib2Metadata = field(init=False, repr=False, default=Precision())
4552
4553    @classmethod
4554    def _attrs(cls):
4555        return list(cls.__dataclass_fields__.keys())
@dataclass(init=False)
class DataRepresentationTemplate40:
4558@dataclass(init=False)
4559class DataRepresentationTemplate40:
4560    """[Data Representation Template 40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-40.shtml)"""
4561
4562    _len = 7
4563    _num = 40
4564    _packingScheme = "jpeg"
4565    refValue: float = field(init=False, repr=False, default=RefValue())
4566    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4567    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4568    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4569    typeOfCompression: Grib2Metadata = field(init=False, repr=False, default=TypeOfCompression())
4570    targetCompressionRatio: int = field(init=False, repr=False, default=TargetCompressionRatio())
4571
4572    @classmethod
4573    def _attrs(cls):
4574        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:
4577@dataclass(init=False)
4578class DataRepresentationTemplate41:
4579    """[Data Representation Template 41](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-41.shtml)"""
4580
4581    _len = 5
4582    _num = 41
4583    _packingScheme = "png"
4584    refValue: float = field(init=False, repr=False, default=RefValue())
4585    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4586    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4587    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4588
4589    @classmethod
4590    def _attrs(cls):
4591        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:
4594@dataclass(init=False)
4595class DataRepresentationTemplate42:
4596    """[Data Representation Template 42](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-42.shtml)"""
4597
4598    _len = 8
4599    _num = 42
4600    _packingScheme = "aec"
4601    refValue: float = field(init=False, repr=False, default=RefValue())
4602    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4603    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4604    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4605    compressionOptionsMask: int = field(init=False, repr=False, default=CompressionOptionsMask())
4606    blockSize: int = field(init=False, repr=False, default=BlockSize())
4607    refSampleInterval: int = field(init=False, repr=False, default=RefSampleInterval())
4608
4609    @classmethod
4610    def _attrs(cls):
4611        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:
4614@dataclass(init=False)
4615class DataRepresentationTemplate50:
4616    """[Data Representation Template 50](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-50.shtml)"""
4617
4618    _len = 5
4619    _num = 0
4620    _packingScheme = "spectral-simple"
4621    refValue: float = field(init=False, repr=False, default=RefValue())
4622    binScaleFactor: int = field(init=False, repr=False, default=BinScaleFactor())
4623    decScaleFactor: int = field(init=False, repr=False, default=DecScaleFactor())
4624    nBitsPacking: int = field(init=False, repr=False, default=NBitsPacking())
4625    realOfCoefficient: float = field(init=False, repr=False, default=RealOfCoefficient())
4626
4627    @classmethod
4628    def _attrs(cls):
4629        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):
4644def drt_class_by_drtn(drtn: int):
4645    """
4646    Provide a Data Representation Template class via the template number.
4647
4648    Parameters
4649    ----------
4650    drtn
4651        Data Representation template number.
4652
4653    Returns
4654    -------
4655    drt_class_by_drtn
4656        Data Representation template class object (not an instance).
4657    """
4658    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).