# MA350 Aethalometer

The MA350 is an advanced aethalometer that measures black carbon concentrations at multiple wavelengths and provides source apportionment between fossil fuel and biomass burning sources.

::: AeroViz.rawDataReader.script.MA350.Reader

## Data Format

- File format: CSV file
- Sampling frequency: 1 minute
- File naming pattern: `*.csv`
- Data structure:
    - Datetime index from 'Date / time local' column
    - BC measurements at multiple wavelengths
    - Source apportionment data
    - Derived parameters

## Measurement Parameters

The MA350 provides black carbon measurements at five wavelengths:

| Column | Wavelength | Description |
|--------|------------|-------------|
| BC1 | 375 nm | UV channel |
| BC2 | 470 nm | Blue channel |
| BC3 | 528 nm | Green channel |
| BC4 | 625 nm | Red channel |
| BC5 | 880 nm | Near-IR channel (reference) |

## Data Processing

### Data Reading

- Processes CSV files with specific header structure
- Standardizes column names
- Maps wavelength-specific measurements
- Handles datetime parsing
- Converts measurements to numeric format

### Quality Control

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

```
+-----------------------------------------------------------------------+
|                            _QC() Pipeline                             |
+-----------------------------------------------------------------------+
|                                                                       |
|  [Pre-process] Calculate absorption coefficients, AAE, eBC            |
|       |                                                               |
|       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 | Power Failure |
| 2 | Start up |
| 4 | Tape advance |
| 16 | Optical saturation |
| 32 | Sample timing error |
| 128 | Flow unstable |
| 256 | Pump drive limit |
| 2048 | System busy |
| 8192 | Tape jam |
| 16384 | Tape at end |
| 32768 | Tape not ready |
| 65536 | Tape transport not ready |
| 262144 | Invalid date/time |
| 524288 | Tape error |

## Output Data

The processed data contains the following columns:

| Column | Unit | Description |
|--------|------|-------------|
| BC1-BC5 | ng/m³ | Black carbon at 5 wavelengths |
| abs_375-880 | 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_ma350_qc.pkl/csv`) contains the `QC_Flag` column
    - The final output has invalid data set to NaN and `QC_Flag` column removed

## Notes

- Provides real-time source apportionment
- Distinguishes between fossil fuel and biomass burning
- Multi-wavelength measurement capability (5 channels)
- Advanced data quality control with QCFlagBuilder
