# BC1054 Black Carbon Monitor

The BC1054 is a multi-wavelength aethalometer that measures black carbon concentrations at ten different wavelengths.

::: AeroViz.rawDataReader.script.BC1054.Reader

## Data Format

- File format: CSV file
- Sampling frequency: 1 minute
- File naming pattern: `*.csv`
- Data structure:
    - Datetime index
    - BC1-BC10 columns with units (ng/m³)
    - Status column for instrument state

## Measurement Parameters

The BC1054 provides black carbon measurements at ten wavelengths:

| Column | Wavelength | Description |
|--------|------------|-------------|
| BC1 | 370 nm | UV channel |
| BC2 | 430 nm | Violet channel |
| BC3 | 470 nm | Blue channel |
| BC4 | 525 nm | Green channel |
| BC5 | 565 nm | Yellow-Green channel |
| BC6 | 590 nm | Yellow channel |
| BC7 | 660 nm | Red channel |
| BC8 | 700 nm | Deep Red channel |
| BC9 | 880 nm | Near-IR channel (reference) |
| BC10 | 950 nm | IR channel |

## Data Processing

### Data Reading

- Processes CSV files with datetime index
- Standardizes column names (removes spaces and units)
- Maps to consistent BC1-BC10 format
- Includes Status column for quality control
- Handles duplicate timestamps

### Quality Control

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

```
+-----------------------------------------------------------------------+
|                            _QC() Pipeline                             |
+-----------------------------------------------------------------------+
|                                                                       |
|  [Pre-process] Remove consecutive duplicate rows                      |
|       |        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 | Digital Sensor Link Failure |
| 4 | Tape Move Failure |
| 8 | Maintenance |
| 16 | Flow Failure |
| 32 | Automatic Tape Advance |
| 64 | Detector Failure |
| 256 | Sensor Range |
| 512 | Nozzle Move Failure |
| 1024 | SPI Link Failure |
| 2048 | Calibration Audit |
| 65536 | Tape Move |

## Output Data

The processed data contains the following columns:

| Column | Unit | Description |
|--------|------|-------------|
| BC1-BC10 | ng/m³ | Black carbon at 10 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_bc1054_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 multi-wavelength measurements
- Enables detailed source apportionment with 10 channels
- Consecutive duplicate rows are removed during QC
- Automatic tape advance system
