UNPKG

gis-tools-ts

Version:

A collection of geospatial tools primarily designed for WGS84, Web Mercator, and S2.

299 lines 12.9 kB
import type { Reader } from '../../../index.js'; /** * Returns a template generator for the given template number * @param template Template number * @returns Template generator */ export declare function getGrib2Template5(template: number): typeof grib2Template50 | typeof grib2Template550 | typeof grib2Template551; /** * # 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; }; /** * # Data Representation Template 5.50 - Spectral data - simple packing * * [Read more...](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-50.shtml) * @param section * * ## Notes * - Removal of the real part of (0.0) coefficient from packed data is intended to reduce the * variability of the coefficients, in order to improve packing accuracy. * - For some spectral representations, the (0.0) coefficient represents the mean value of the * parameter represented. * - 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 grib2Template550(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)) */ realPartCoefficientType: number; }; /** * # Data Representation Template 5.51 - Spectral data - complex packing * * [Read more...](https://www.nco.ncep.noaa.gov/pmb/docs/grib2/grib2_doc/grib2_temp5-51.shtml) * @param section * * ## Notes * - The unpacked subset is a set of values defined in the same way as the full set of values * (on a spectrum limited to Js, Ks and Ms ), but on which scaling and packing are not applied. * Associated values are stored in octets 6 onwards of section 7. * - The remaining coefficients are multiplied by `(n x (n+1))p` , scaled and packed. The operator * associated with this multiplication is derived from the Laplacian operator on the sphere. * - The retrieval formula for a coefficient of wave number n is then: `Y = (R+X x 2e ) x 10-d x (n x(n+1))-p` * where X is the packed scaled value associated with the coefficient. * @returns - description of how to decode simple unpacked data */ export declare function grib2Template551(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; /** P ― Laplacian scaling factor (expressed in 10^-6 units) */ P: number; /** Js ― pentagonal resolution parameter of the unpacked subset (see Note1) */ Js: number; /** Ks ― pentagonal resolution parameter of the unpacked subset (see Note1) */ Ks: number; /** Ms ― pentagonal resolution parameter of the unpacked subset (see Note1) */ Ms: number; /** Ts ― total number of values in the unpacked subset (see Note1) */ Ts: number; /** Precision of the unpacked subset (see Code Table 5.7) */ precision: { code: number; description: string; }; }; /** Complex packing and spatial differencing return type */ export type ComplexSpectralPackingTemplate = ReturnType<typeof grib2Template551>; //# sourceMappingURL=templates.d.ts.map