Project

General

Profile

Add a random extra metadata to each message of a GRIB file?

Added by Bang AA over 3 years ago

I wonder, is there a tool to allow one add an extra metadata to each message of a GRIB file?
For example: from grib_dump of a GRIB file, I have:

``` #============== MESSAGE 6 ( length=976330 ) ==============
GRIB {
editionNumber = 1;
table2Version = 2; # Rome (RSMC) (common/c-1.table)
centre = 80;
generatingProcessIdentifier = 131; # None Wind speed m s**-1 (grib1/2.0.2.table)
indicatorOfParameter = 32; # Fixed height above ground height in meters (2 octets) (grib1/3.table)
indicatorOfTypeOfLevel = 105;
level = 10; # Average (reference time + P1 to reference time + P2) (grib1/5.table)
timeRangeIndicator = 3; # Unknown code table entry ()
subCentre = 98;
paramId = 500025;
#-READ ONLY- cfNameECMF = unknown;
#-READ ONLY- cfName = unknown;
#-READ ONLY- cfVarNameECMF = ws;
#-READ ONLY- cfVarName = ws;
#-READ ONLY- units = m s**-1;
#-READ ONLY- nameECMF = Wind speed;
#-READ ONLY- name = Wind speed (SP_10M);
decimalScaleFactor = 0;
dataDate = 20201026;
dataTime = 0; # Hour (stepUnits.table)
stepUnits = 1;
stepRange = 0;
startStep = 0;
endStep = 0;
#-READ ONLY- marsParam = 32.2;
shortName = sp_10m;
GDSPresent = 1;
bitmapPresent = 1;
numberOfVerticalCoordinateValues = 0;
Ni = 928;
Nj = 448;
latitudeOfFirstGridPointInDegrees = 60;
longitudeOfFirstGridPointInDegrees = 18;
earthIsOblate = 0;
uvRelativeToGrid = 0;
latitudeOfLastGridPointInDegrees = 32;
longitudeOfLastGridPointInDegrees = 40;
iScansNegatively = 0;
jScansPositively = 0;
jPointsAreConsecutive = 0;
#-READ ONLY
alternativeRowScanning = 0;
jDirectionIncrementInDegrees = 0.063;
iDirectionIncrementInDegrees = 0.063;
#-READ ONLY- numberOfDataPoints = 415744;
#-READ ONLY- numberOfValues = 308091;
missingValue = 9999;
tableReference = 0;
#-READ ONLY- binaryScaleFactor = 19;
#-READ ONLY
referenceValue = 0.529586;
sphericalHarmonics = 0;
complexPacking = 0;
integerPointValues = 0;
additionalFlagPresent = 0;
packingType = grid_simple;
bitsPerValue = 24;
values(415744) = {
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999,
9999, 9999, 9999, 9999, 9999
... 415644 more values
}
#-READ ONLY- numberOfCodedValues = 308091;
#-READ ONLY- maximum = 17.9256;
#-READ ONLY- minimum = 0.529586;
#-READ ONLY- average = 5.81554;
#-READ ONLY- numberOfMissing = 107653;
#-READ ONLY- standardDeviation = 3.87567;
#-READ ONLY- skewness = 0.861793;
#-READ ONLY- kurtosis = 0.237433;
#-READ ONLY
isConstant = 0;
gridType = regular_ll;
#-READ ONLY- getNumberOfValues = 415744;
}
```

There are 100 messages from this GRIB file. I want to add an extra metadata `processingLevel=x` with values for x from 1:100 (each message has an unique number).


Replies (2)

RE: Add a random extra metadata to each message of a GRIB file? - Added by Ralf Mueller over 3 years ago

hi Bang!

all elements of the GRIB standard are pre-defined by WMO. I see no options to add something random there - in-fact GRIB aims to avoid all sorts of user-definied stuff to allow every one to read the files.

Moreover the meta-data of a file is not directly store IN the file. instead only a reference is stored, which indicated the readable meta data in the corresponding GRIB backend library installation (usually grib_api or eccodes)

cheers
ralf

RE: Add a random extra metadata to each message of a GRIB file? - Added by Milton Donte over 3 years ago

Ralf Mueller wrote:

hi Bang!

all elements of the GRIB standard are pre-defined by WMO. I see no options to add something random there - in-fact GRIB aims to avoid all sorts of user-definied stuff to allow every one to read the files.

Moreover the meta-data of a file is not directly store IN the file. instead only a reference is stored, which indicated the readable run 3 meta data in the corresponding GRIB backend library installation (usually grib_api or eccodes)

cheers
ralf

Worked perfectly, thanks alot :))
Donte :)

    (1-2/2)