s2-tools
Version:
A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.
230 lines • 9.34 kB
TypeScript
import type { Reader } from '../../..';
/**
* Returns a template generator for the given template number
* @param template Template number
* @returns Template generator
*/
export declare function getGrib2Template5(template: number): typeof grib2Template50;
/**
* # Data Representation Template 5.0 - Grid point data - simple packing
*
* [Read more...](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-0.shtml)
* @param section
*
* ## Notes
* - Negative values of E or D shall be represented according to Regulation [92.1.5](https://codes.ecmwf.int/grib/format/grib2/regulations/).
* @returns - description of how to decode simple unpacked data
*/
export declare function grib2Template50(section: Reader): {
/** Reference value (R) (IEEE 32-bit floating-point value) */
referenceValue: number;
/** Binary scale factor (E) */
binaryScaleFactor: number;
/** Decimal scale factor (D) */
decimalScaleFactor: number;
/** Number of bits used for each packed value for simple packing, or for each group reference value for complex packing or spatial differencing */
numberOfBits: number;
/** Type of original field values (see Code [Table 5.1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)) */
originalType: {
code: number;
description: string;
};
};
/** Complex packing return type */
export type ComplexPackingTemplate = ReturnType<typeof grib2Template52>;
/**
* Data Representation Template 5.2 – Complex packing (no spatial differencing).
*
* Reads and parses the metadata fields defined by GRIB2 Template 5.2.
* For most templates, details of the packing process are described in Regulation 92.9.4.
* @see {@link https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-2.shtml Template 5.2 documentation}
* @see {@link https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp7-2.shtml Data template 7.2 for complementary info}
* @param section - Binary reader providing access to the section data.
* @returns Object containing the fields of Template 5.2.
*/
export declare function grib2Template52(section: Reader): {
/** Reference value (R) (IEEE 32-bit floating-point). Octets 12–15 in the GRIB2 documentation. */
referenceValue: number;
/** Binary scale factor (E). Octets 16–17. */
binaryScaleFactor: number;
/** Decimal scale factor (D). Octets 18–19. */
decimalScaleFactor: number;
/**
* Number of bits per packed value for simple packing, or per group reference for
* complex packing. Octet 20 in the documentation.
*/
numberOfBits: number;
/** Type of original field values. See Code Table 5.1. Octet 21. */
originalType: {
code: number;
description: string;
};
/** Group splitting method used. See Code Table 5.4. Octet 22. */
groupSplittingMethod: {
code: number;
description: string;
};
/** Missing value management. See Code Table 5.5. Octet 23. */
missingValueManagement: {
code: number;
description: string;
};
/** Primary missing value substitute. Octets 24–27. */
primaryMissingValueSubstitute: number;
/** Secondary missing value substitute. Octets 28–31. */
secondaryMissingValueSubstitute: number;
/** Number of groups of data values (NG). Octets 32–35. */
numberOfGroups: number;
/**
* Reference for group widths. Octet 36.
* The group width is the number of bits used for every value in a group.
*/
referenceForGroupWidths: number;
/** Number of bits used for the group widths (after subtracting the reference value). Octet 37. */
groupWidthsBits: number;
/**
* Reference for group lengths. Octets 38–41.
* The group length (L) is the number of values in a group.
*/
referenceForGroupLengths: number;
/**
* Length increment for group lengths. Octet 42.
* Used in the formula: Lₙ = ref + Kₙ × len_inc.
*/
groupLengthFactor: number;
/**
* True length of the last group. Octets 43–46.
* A special-case group length if the sequence doesn’t fit the formula.
*/
trueLengthOfLastGroup: number;
/**
* Number of bits used for scaled group lengths (after subtracting ref
* and dividing by the length increment). Octet 47.
*/
nBitsGroupLength: number;
};
/** Complex packing and spatial differencing return type */
export type ComplexSpatialPackingTemplate = ReturnType<typeof grib2Template53>;
/**
* Data Representation Template 5.3 – Complex packing and spatial differencing.
*
* Reads and parses the metadata fields defined by GRIB2 Template 5.3.
* For most templates, details of the packing process are described in Regulation 92.9.4.
* See also:
* - [GRIB2 Template 5.3 documentation](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-3.shtml)
* - [Data template 7.3 and associated notes](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp7-3.shtml)
* - Spatial differencing (Regulation 92.9.4).
* @param section - Binary reader providing access to the section data
* @returns Object containing the fields of Template 5.3
*/
export declare function grib2Template53(section: Reader): {
/**
* Reference value (R) (IEEE 32-bit floating-point).
* Octets 12–15 in the GRIB2 documentation.
*/
referenceValue: number;
/** Binary scale factor (E). Octets 16–17. */
binaryScaleFactor: number;
/** Decimal scale factor (D). Octets 18–19. */
decimalScaleFactor: number;
/**
* Number of bits per packed value for simple packing,
* or per group reference for complex packing.
* Octet 20 in the documentation.
*/
numberOfBits: number;
/** Type of original field values. See Code Table 5.1. Octet 21. */
originalType: {
code: number;
description: string;
};
/** Group splitting method used. See Code Table 5.4. Octet 22. */
groupSplittingMethod: {
code: number;
description: string;
};
/** Missing value management. See Code Table 5.5. Octet 23. */
missingValueManagement: {
code: number;
description: string;
};
/** Primary missing value substitute. Octets 24–27. */
primaryMissingValueSubstitute: number;
/** Secondary missing value substitute. Octets 28–31. */
secondaryMissingValueSubstitute: number;
/** Number of groups of data values (NG). Octets 32–35. */
numberOfGroups: number;
/**
* Reference for group widths. Octet 36.
* The group width is the number of bits used for every value in a group.
*/
referenceForGroupWidths: number;
/**
* Number of bits used for the group widths (after subtracting the reference value).
* Octet 37.
*/
groupWidthsBits: number;
/**
* Reference for group lengths. Octets 38–41.
* The group length (L) is the number of values in a group.
*/
referenceForGroupLengths: number;
/**
* Length increment for group lengths. Octet 42.
* Used in the formula: Lₙ = ref + Kₙ × len_inc.
*/
groupLengthFactor: number;
/**
* True length of the last group. Octets 43–46.
* A special-case group length if the sequence doesn’t fit the formula.
*/
trueLengthOfLastGroup: number;
/**
* Number of bits used for scaled group lengths (after subtracting ref
* and dividing by the length increment). Octet 47.
*/
nBitsGroupLength: number;
/** Order of spatial difference. See Code Table 5.6. Octet 48. */
orderOfSpatialDifference: {
code: number;
description: string;
};
/**
* Number of extra descriptor octets needed for spatial differencing
* (octets 6–ww in data template 7.3). Octet 49.
*/
extraDescriptorOctets: number;
};
/**
* Data Representation Template 5.40
*
* [Read more...](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-40.shtml)
* @param section - The raw section data to parse
* @returns - Parsed Data Representation Information
*/
export declare function grib2Template540(section: Reader): {
/** Reference value (R) (IEEE 32-bit floating-point value) */
referenceValue: number;
/** Binary scale factor (E) */
binaryScaleFactor: number;
/** Decimal scale factor (D) */
decimalScaleFactor: number;
/** Number of bits used for each packed value for simple packing, or for each group reference value for complex packing or spatial differencing */
numberOfBits: number;
/** Type of original field values (see Code [Table 5.1](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-1.shtml)) */
originalType: {
code: number;
description: string;
};
/** Type of Compression used. (see [Code Table 5.40](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_table5-40.shtml)) */
compressionType: {
code: number;
description: string;
};
/**
* Target compression ratio, M:1 (with respect to the bit-depth specified in octet 20),
* when octet 22 indicates Lossy Compression. Otherwise, set to missing.
*/
compressionRatio: number;
};
//# sourceMappingURL=templates.d.ts.map