Convert Datatype |

### Convert Datatype Operator

The Toolbox is able to read in various supported data products, abstract the complete dataset and meta-data internally and write the data to various file formats using the plug-in writer modules. Internally, the data is stored in a Generic Product Model (GPM) and organized in a similar structure as its external representation the BEAM-DIMAP file format. The BEAM-DIMAP format consists of an XML file containing meta-data and a file folder containing image bands in flat binary files.
The Convert Datatype Operator performs gain conversion. The data will be formatted to be able to adjust for the dynamic range of the data in the following ways:

- no value scaling (truncation)
- linear scaling using slope and intercept: new value = slope * old value + intercept
- ‘clipped’ histogram, keeping only the middle 95% of the histogram, leaving 2.5% off of each end
- modified clipping that removes the bottom 2.5% of the histogram, and values with 10 or fewer occurrences from the top
- logarithmic scaling using slope and intercept: new value = 10**(slope * old value + intercept)

This will make it possible to be able to convert between the following data types:

- 8-bit integer
- 16-bit integer
- 32-bit integer
- 8-bit unsigned integer
- 16-bit unsigned integer
- 32-bit unsigned integer
- 32-bit float
- 64-bit float

Such conversions can be used to decrease the file size of a product, by converting to a smaller data type. For example, converting from a 16-bit encoding to an 8-bit encoding would roughly cut the file size in half, as each pixel only takes up half as much space on the hard drive. Obviously, it also cuts down the precision of the observed values, in this case by a factor of 28 or 256, as we lose 8 bits of precision. In general, the tool scales values between the newly selected type's minimum and maximum values, so a value of 127 in a signed 8-bit encoding would become 256 in an unsigned 8-bit encoding, as that is the maximum value in both cases.