Skip to content

Conversation

@bjlittle
Copy link
Member

@bjlittle bjlittle commented Nov 16, 2023

The pull-request adds a GRIB2 file containing a single message with only metadata and no data payload.

i.e., the Data Representation Section (5) bitsPerValue=0 and the Data Section is empty.

This is a real-world example.

This test file exercises an extension to the iris_grib.message._DataProxy.__getitem__ which will now auto-generate zero data of the expected shape and dtype when bitsPerValue=0 is detected.

@bjlittle bjlittle requested a review from pp-mo November 16, 2023 14:44
@bjlittle
Copy link
Member Author

> grib_dump -O ice_severity__no_bitsPerValue.grib2
***** FILE: ice_severity__no_bitsPerValue.grib2 
#==============   MESSAGE 1 ( length=179 )                 ==============
1-4       identifier = GRIB
5-6       reserved = MISSING
7         discipline = 0 [Meteorological products (grib2/tables/4/0.0.table) ]
8         editionNumber = 2
9-16      totalLength = 179
======================   SECTION_1 ( length=21, padding=0 )    ======================
1-4       section1Length = 21
5         numberOfSection = 1
6-7       centre = 74 [U.K. Met Office - Exeter (common/c-11.table) ]
8-9       subCentre = 5
10        tablesVersion = 4 [Version implemented on 7 November 2007 (grib2/tables/1.0.table) ]
11        localTablesVersion = 0 [Unknown code table entry () ]
12        significanceOfReferenceTime = 1 [Start of forecast (grib2/tables/4/1.2.table) ]
13-14     year = 2023
15        month = 11
16        day = 6
17        hour = 6
18        minute = 0
19        second = 0
20        productionStatusOfProcessedData = 1 [Operational test products (grib2/tables/4/1.3.table) ]
21        typeOfProcessedData = 1 [Forecast products (grib2/tables/4/1.4.table) ]
======================   SECTION_3 ( length=72, padding=0 )    ======================
1-4       section3Length = 72
5         numberOfSection = 3
6         sourceOfGridDefinition = 0 [Specified in Code table 3.1 (grib2/tables/4/3.0.table) ]
7-10      numberOfDataPoints = 72721
11        numberOfOctectsForNumberOfPoints = 0
12        interpretationOfNumberOfPoints = 0 [There is no appended list (grib2/tables/4/3.11.table) ]
13-14     gridDefinitionTemplateNumber = 0 [Latitude/longitude (Also called equidistant cylindrical, or Plate Carree)  (grib2/tables/4/3.1.table) ]
15        shapeOfTheEarth = 1 [Earth assumed spherical with radius specified by data producer (grib2/tables/4/3.2.table) ]
16        scaleFactorOfRadiusOfSphericalEarth = 0
17-20     scaledValueOfRadiusOfSphericalEarth = 6371229
21        scaleFactorOfEarthMajorAxis = 0
22-25     scaledValueOfEarthMajorAxis = 0
26        scaleFactorOfEarthMinorAxis = 0
27-30     scaledValueOfEarthMinorAxis = 0
31-34     Ni = 601
35-38     Nj = 121
39-42     basicAngleOfTheInitialProductionDomain = 0
43-46     subdivisionsOfBasicAngle = MISSING
47-50     latitudeOfFirstGridPoint = 90000000
51-54     longitudeOfFirstGridPoint = 60000000
55        resolutionAndComponentFlags = 48 [00110000 (grib2/tables/4/3.3.table) ]
56-59     latitudeOfLastGridPoint = 60000000
60-63     longitudeOfLastGridPoint = 210000000
64-67     iDirectionIncrement = 250000
68-71     jDirectionIncrement = 250000
72        scanningMode = 0 [00000000 (grib2/tables/4/3.4.table) ]
======================   SECTION_4 ( length=34, padding=0 )    ======================
1-4       section4Length = 34
5         numberOfSection = 4
6-7       NV = 0
8-9       productDefinitionTemplateNumber = 0 [Analysis or forecast at a horizontal level or in a horizontal layer at a point in time (grib2/tables/4/4.0.table) ]
10        parameterCategory = 19 [Physical atmospheric properties (grib2/tables/4/4.1.0.table) ]
11        parameterNumber = 37 [Unknown code table entry (grib2/tables/4/4.2.0.19.table) ]
12        typeOfGeneratingProcess = 2 [Forecast (grib2/tables/4/4.3.table) ]
13        backgroundProcess = 1
14        generatingProcessIdentifier = 1
15-16     hoursAfterDataCutoff = 0
17        minutesAfterDataCutoff = 0
18        indicatorOfUnitOfTimeRange = 1 [Hour (grib2/tables/4/4.4.table) ]
19-22     forecastTime = 18
23        typeOfFirstFixedSurface = 100 [Isobaric surface (Pa)  (grib2/tables/4/4.5.table) ]
24        scaleFactorOfFirstFixedSurface = 0
25-28     scaledValueOfFirstFixedSurface = 30090
29        typeOfSecondFixedSurface = 255 [Missing (grib2/tables/4/4.5.table) ]
30        scaleFactorOfSecondFixedSurface = MISSING
31-34     scaledValueOfSecondFixedSurface = MISSING
======================   SECTION_5 ( length=21, padding=0 )    ======================
1-4       section5Length = 21
5         numberOfSection = 5
6-9       numberOfValues = 72721
10-11     dataRepresentationTemplateNumber = 0 [Grid point data - simple packing (grib2/tables/4/5.0.table) ]
12-15     referenceValue = 0
16-17     binaryScaleFactor = -10
18-19     decimalScaleFactor = 0
20        bitsPerValue = 0
21        typeOfOriginalFieldValues = 0 [Floating point (grib2/tables/4/5.1.table) ]
======================   SECTION_6 ( length=6, padding=0 )     ======================
1-4       section6Length = 6
5         numberOfSection = 6
6         bitMapIndicator = 255 [A bit map does not apply to this product (grib2/tables/4/6.0.table) ]
======================   SECTION_7 ( length=5, padding=0 )     ======================
1-4       section7Length = 5
5         numberOfSection = 7
======================   SECTION_8 ( length=4, padding=0 )     ======================
1-4       7777 = 7777

@pp-mo pp-mo merged commit 2470cc6 into SciTools:master Nov 16, 2023
@bjlittle
Copy link
Member Author

@pp-mo Awesome, thanks! 🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants