MAVLink SCALED_PRESSURE Temperatures: Preserve the Differential Sensor Zero Marker
Compare two centidegree temperature fields in constructed SCALED_PRESSURE records, preserving unavailable differential readings before converting units.

Separate the two temperature observations before conversion
An offline drone log review may place several temperature fields into one table. Similar storage types and units can make a shared conversion routine look attractive, but a missing-value marker belongs to a particular field. MAVLink SCALED_PRESSURE provides a useful example. This tutorial compares its absolute-pressure sensor temperature with the differential-pressure sensor temperature using invented decoded integers. It does not inspect a NiVO flight, assess a pressure sensor or describe ambient weather. The objective is a reproducible report that retains the difference between a supplied numeric zero and an explicitly unavailable reading.
Keep the message name and full field paths with any exported values. A column labeled temperature without its sensor role can be difficult to interpret after a spreadsheet has combined several messages. Preserve the original log revision and decoder context as well. The helper below starts with decoded integers, so it cannot prove that a packet was valid, that the intended source sent it or that an extension field was physically present. Those questions remain part of the surrounding log review and should not be replaced by a successful unit conversion.
Read the differential marker at its own field
The MAVLink common definition gives both temperature fields signed sixteen-bit storage and centidegrees Celsius units. The temperature field describes the absolute-pressure temperature. The temperature_press_diff extension describes differential-pressure temperature and assigns zero to unavailable information. Its reporting rule represents values of zero or one centidegree as one centidegree. The helper consequently retains a raw differential zero as unavailable and converts nonzero values by dividing by one hundred. It does not apply that differential sentinel to the other temperature field, whose definition does not assign the same zero marker.
A reported differential value of one needs careful wording. Its converted numeric value is zero point zero one degrees Celsius, but the reporting convention means that the original value cannot be distinguished between zero and one centidegree from that number alone. Do not rewrite every reported one into exact zero, and do not describe the converted value as a recovered original measurement. Retain the raw integer and an explicit status. This small distinction prevents a unit conversion from hiding either missing information or the ambiguity introduced by the sender convention.

Product context only; this photograph does not depict the constructed examples in this article.
Run a bounded offline conversion that preserves raw integers
Run this Python function on the constructed tuples. It accepts exact integers within the signed sixteen-bit range and rejects booleans, text, floating-point values and missing inputs. Those restrictions define this teaching interface; they are not operating limits or a sensor acceptance range. Each output contains both raw fields. The absolute sensor value is numerically converted, while the differential result is None when its raw value is the unavailable marker. A separate status distinguishes that marker from a reported one-centidegree value and other nonzero reported values.
The first two examples hold the absolute field at zero and change only the differential field from zero to one. The third uses equal negative inputs to exercise signed conversion. They are separate invented records, not samples from an actual flight or a time series. The helper does not use the pressure readings, calculate altitude, compare calibration or issue any request to a vehicle. That scope lets another reviewer test the field-specific conversion independently before deciding how a real log table should represent source identity, timing and unresolved information.
def pressure_temperatures(temperature, temperature_press_diff):
for value in (temperature, temperature_press_diff):
if type(value) is not int or not -32768 <= value <= 32767:
raise ValueError("expected decoded int16 temperature fields")
if temperature_press_diff == 0:
status = "not_available"
differential_c = None
else:
status = "reported_one_cdegc" if temperature_press_diff == 1 else "reported"
differential_c = temperature_press_diff / 100
return {"temperature_raw": temperature,
"temperature_press_diff_raw": temperature_press_diff,
"absolute_sensor_c": temperature / 100,
"differential_status": status,
"differential_sensor_c": differential_c}
for fields in [(0, 0), (0, 1), (-1250, -1250)]:
print(pressure_temperatures(*fields))Explain zero, one and a negative reported value separately
For the first tuple, absolute_sensor_c is numeric zero and differential_sensor_c is None with status not_available. For the second, the absolute conversion remains zero while the differential conversion is zero point zero one with status reported_one_cdegc. The status is a reminder to preserve the reporting convention rather than infer an exact original zero. For the third tuple, both converted values are minus twelve point five and the differential status is reported. A negative number is not the zero sentinel, so this helper retains its sign and numerical meaning.
Keep missing and numeric values separate when preparing a table. If an export system cannot represent None, use an explicitly documented empty or missing representation and retain the status column. Replacing the unavailable result with zero would erase the very distinction the example is designed to preserve. Conversely, treating every zero in both columns as missing would delete the numeric absolute-field conversion. Neither shortcut follows the field-specific rule. A recipient should be able to reconstruct which raw value produced the displayed result without guessing from a rounded decimal or a blank cell alone.
Test boundaries without turning storage limits into sensor limits
Test signed values on both sides of zero and at the representation boundaries. A raw minus one in the differential field becomes minus one hundredth of a degree, while raw one retains its distinct reporting status. Zero remains the only unavailable marker used by this helper. Test the two fields independently as well: changing the absolute input must not alter the differential status, and changing the differential input must not alter the absolute numerical conversion. These checks catch accidental sharing of a sentinel rule or a variable between columns that otherwise look very similar.
The accepted integer range exists because the decoded storage is signed sixteen-bit, not because every value in that range is a plausible sensor reading. A range check cannot establish calibration, installation quality, thermal response or environmental representativeness. Those require their own evidence and project process. Likewise, the differential extension can be represented by a decoder without this small function establishing which bytes were present in a particular payload. Keep the original decoder and message context available when investigating availability, rather than using the converted output to invent packet details or sensor support.
Carry the observation into a clear drone-log handoff
A useful report includes the message and field names, raw integers, units, converted values, differential status and decoder revision. State which record or source supplied the observation and keep any timing analysis separate. The function does not compare samples over time, so it cannot measure warming, count dropouts or establish a trend. If another export changes a missing representation or a rounded number, compare the underlying raw values and conversion policy before describing a sensor change. That comparison preserves a concrete question another reviewer can answer from the same evidence.
The NiVO catalogue photograph provides aircraft context only. It does not depict the constructed records, a temperature test or a claimed sensor installation. The practical result of the tutorial is a pair of named numerical observations with their original representations and one field-specific availability rule intact. That is a stronger starting point for a telemetry discussion than a generic temperature column that silently merges missing and zero values. It gives a handoff team a reproducible conversion while leaving actual sensor condition, operational decisions and product-performance claims to evidence beyond this exercise.



