public class PredictorModelDifferencing extends Object implements IPredictorModel
This technique is used in several well-established raster data formats. For example, it is specified for the Gridded Binary 2 (GRIB2) data format used for meteorology data products (see GRIB 2 specification, Section 5-Template 3: "Grid point data 0 complex packing and spatial differencing"). It is also used in the TIFF specification (see TIFF Tag Predictor horizontal differencing, tag 0x013D).
Constructor and Description |
---|
PredictorModelDifferencing() |
Modifier and Type | Method and Description |
---|---|
void |
decode(int seed,
int nRows,
int nColumns,
byte[] encoding,
int offset,
int length,
int[] output)
Decodes the specified data using the predictor model to compute
output values from the specified input.
|
int |
encode(int nRows,
int nColumns,
int[] values,
byte[] output)
Encodes the specified data using the predictor model to develop
computed adjustments for the data grid.
|
PredictorModelType |
getPredictorType()
Gets the predictor type.
|
int |
getSeed()
Gets the seed value determined by the most recent call to the encoding
method.
|
boolean |
isNullDataSupported()
Indicates that the predictor model is intended to handle null values.
|
public int getSeed()
IPredictorModel
getSeed
in interface IPredictorModel
public int encode(int nRows, int nColumns, int[] values, byte[] output)
IPredictorModel
This routine returns the seed value detected in the data. This value is usually the first entry in the input value. In cases where the data contains nulls, the seed is sometimes the mean value of the non-null entries.
The length of the encoded output will be a maximum of 5 times the total number of entries in the input (it is usually much shorter than that). The encoding array should be dimensioned large enough to accept the maximum sized output.
encode
in interface IPredictorModel
nRows
- the number of rows in the raster data gridnColumns
- the number of columns in the data data gridvalues
- the input values to be encodedoutput
- the output encodingpublic void decode(int seed, int nRows, int nColumns, byte[] encoding, int offset, int length, int[] output)
IPredictorModel
decode
in interface IPredictorModel
seed
- a seed value to provide the initial value for the encodingnRows
- the number of rows in the raster data gridnColumns
- the number of columns in the raster data gridencoding
- the input values for the encoding, usually dimensions to
nRows*nColumnsoffset
- the starting offset in the encoding array from which
data is to be taken.length
- the length of the valid section of the encoding array
from which data is to be taken.output
- array to accept the output data values, dimensions to at
least nRows*nColumnspublic boolean isNullDataSupported()
IPredictorModel
isNullDataSupported
in interface IPredictorModel
public PredictorModelType getPredictorType()
IPredictorModel
getPredictorType
in interface IPredictorModel
Copyright © 2022. All rights reserved.