---
title: "Logger Data Calculations"
url: "https://help.esdat.net/en/article/logger-data-calculations"
language: "en"
last_updated: "2026-10-21T06:11:27.681Z"
---

# Logger Data Calculations

Calculated Parameters can be added to a Logger Event, as shown below.

  

![](https://cdn-assets.productfruits.com/0d72918f-eef4-4650-af47-a4c72b7e3f3d)

Calculations can reference Parameters in the same Logger Event, or from a different Logger Event (the date ranges must overlap). A common use case for this scenario is to correct a downhole groundwater pressure sensor against a seperate barometric pressure sensor.

The script below shows an example script to calculate water depth using the sensor depth (below top of casing) and a dowhole sensor corrected for barometric pressure changes. Any valid Typescript calculation can be used, as different logger device manufactorers provide different methods for the calculation.

![](https://cdn-assets.productfruits.com/a4c1b2d0-ab2d-4996-b395-fb0e611f8d20)

The script shown above is reproduced below.

```
function calculate(
  targetTime: Date,
  readings: InterpolatedReadings,
  allReadings: SensorDataGroup
): CalculatedValue | null {

  const downhole_pressure_psi = readings['downhole pressure psi']
  const barometric_pressure_psi = readings['barometric pressure']
  const depth_of_sensor_bTOC = 3.2
  let estimated_water_above_sensor = null

  if (    downhole_pressure_psi !== null &&   barometric_pressure_psi !== null   ) 
    {
      //replace the calculation below as needed, incorporating barometric efficiency for the well and sensor constants
      estimated_water_above_sensor = ((downhole_pressure_psi - barometric_pressure_psi)/1.012)*0.70307
    }

  if (estimated_water_above_sensor !== null ) 
  {
    const estimated_water_depth_bTOC =  depth_of_sensor_bTOC -  estimated_water_above_sensor
    return {
      TimeStamp: targetTime,
      Measurement: estimated_water_depth_bTOC,
    }
  } else
  {
    return null;
  }

}
```

  

By specifiying that the output from the calculation is an estimated groundwater depth, the result will be automatically calibrated to match manual dip readings measured for the piezometer.

![](https://cdn-assets.productfruits.com/69bf9041-4abf-48ac-99c9-9c3ccf52fd84)

  

  

  

The dip-corrected groundwater depths can then be output as a groundwater elevation via a simple subsequent calculated parameter.

![](https://cdn-assets.productfruits.com/96681908-ed1c-4a6b-9cdf-3b491bd91558)
