# AE43 Aethalometer

The AE43 is a multi-wavelength aethalometer used for measuring black carbon aerosol concentrations in the atmosphere.

::: AeroViz.rawDataReader.script.AE43.Reader

## Data Format

- File format: CSV file
- Sampling frequency: 1 minute
- File naming pattern: `[!ST|!CT|!FV]*[!log]_AE43*.dat`
- Timestamp column: StartTime
- Configuration tracking: Uses SetupID for configuration management

## Measurement Parameters

The AE43 provides black carbon concentration measurements at seven wavelengths:

| Column | Wavelength | Description |
|--------|------------|-------------|
| BC1 | 370 nm | UV channel |
| BC2 | 470 nm | Blue channel |
| BC3 | 520 nm | Green channel |
| BC4 | 590 nm | Yellow channel |
| BC5 | 660 nm | Red channel |
| BC6 | 880 nm | Near-IR channel (reference) |
| BC7 | 950 nm | IR channel |

## Data Processing

### Data Reading

- Parses timestamps from the StartTime column
- Automatically identifies and selects the latest configuration data (SetupID)
- Extracts black carbon concentration data for seven wavelengths
- Groups data by SetupID to handle configuration changes
- Includes Status column for quality control

### Quality Control

The AE43 reader uses the declarative **QCFlagBuilder** system with the following rules:

```
+-----------------------------------------------------------------------+
|                            _QC() Pipeline                             |
+-----------------------------------------------------------------------+
|                                                                       |
|  [Pre-process] Calculate absorption coefficients, AAE, eBC            |
|       |        (Uses AE33 coefficients)                               |
|       v                                                               |
|  +---------------------+    +---------------------+                   |
|  | Rule: Status Error  |    | Rule: Invalid BC    |                   |
|  +---------------------+    +---------------------+                   |
|  | Bitwise status      |    | BC <= 0 OR          |                   |
|  | code filtering      |    | BC > 20000 ng/m³    |                   |
|  +---------------------+    +---------------------+                   |
|           |                          |                                |
|           v                          v                                |
|  +---------------------+    +---------------------+                   |
|  | Rule: Invalid AAE   |    | Rule: Insufficient  |                   |
|  +---------------------+    +---------------------+                   |
|  | AAE < -2.0 OR       |    | < 50% hourly data   |                   |
|  | AAE > -0.7          |    | completeness        |                   |
|  +---------------------+    +---------------------+                   |
|                                                                       |
+-----------------------------------------------------------------------+
```

#### QC Rules Applied

| Rule | Condition | Description |
|------|-----------|-------------|
| **Status Error** | Bitwise status code check | Invalid instrument status codes detected |
| **Invalid BC** | BC ≤ 0 OR BC > 20000 ng/m³ | BC concentration outside valid range |
| **Invalid AAE** | AAE < -2.0 OR AAE > -0.7 | Angstrom exponent outside valid range |
| **Insufficient** | < 50% hourly data | Less than 50% hourly data completeness |

#### Error Status Codes

| Code | Description |
|------|-------------|
| 1 | Tape advance, fast calibration, warm-up |
| 2 | First measurement – obtaining ATN0 |
| 3 | Stopped |
| 4 | Flow low/high by more than 0.5 LPM |
| 16 | Calibrating LED |
| 32 | Calibration error (at least one channel OK) |
| 384 | Tape error (tape not moving, end of tape) |
| 1024 | Stability test |
| 2048 | Clean air test |
| 4096 | Optical test |

## Output Data

The processed data contains the following columns:

| Column | Unit | Description |
|--------|------|-------------|
| BC1-BC7 | ng/m³ | Black carbon at 7 wavelengths |
| abs_370-950 | Mm⁻¹ | Absorption coefficients |
| abs_550 | Mm⁻¹ | Interpolated absorption at 550nm |
| AAE | - | Absorption Angstrom Exponent |
| eBC | ng/m³ | Equivalent black carbon |

!!! note "QC_Flag Handling"

    - The intermediate file (`_read_ae43_qc.pkl/csv`) contains the `QC_Flag` column
    - The final output has invalid data set to NaN and `QC_Flag` column removed

## Notes

- The AE43 provides real-time black carbon concentration measurements
- Uses AE33 absorption coefficients for calculations
- Automatically handles configuration changes and duplicate timestamps
- Maintains data integrity across configuration changes using SetupID
