use of org.apache.sis.referencing.operation.transform.TransferFunction in project sis by apache.
the class GCOM_C method transferFunction.
/**
* Builds the function converting values from their packed formats in the variable to "real" values.
* This method is invoked only if {@link #validRange(Variable)} returned a non-null value.
*
* @param data the variable from which to determine the transfer function.
* @return a transfer function built from the attributes defined in the given variable.
*/
@Override
public TransferFunction transferFunction(final Variable data) {
final TransferFunction tr = super.transferFunction(data);
if (tr.isIdentity()) {
final double slope = data.getAttributeAsNumber("Slope");
final double offset = data.getAttributeAsNumber("Offset");
if (Double.isFinite(slope))
tr.setScale(slope);
if (Double.isFinite(offset))
tr.setOffset(offset);
}
return tr;
}
Aggregations