# RT-PCE Data Products Documentation

This document describes the two categories of output from the BDSmart_rtPCE
real-time/post-processing precise clock estimation system:
**state files** and **product files**.

---

GPS week to calendar date mapping:

| GPS Week | DOW | File Tag | Calendar Date | DOY |
|----------|-----|----------|---------------|-----|
| 2425 | 4 | 24254 | 2026-07-02 | 183 |
| 2425 | 5 | 24255 | 2026-07-03 | 184 |
| 2425 | 6 | 24256 | 2026-07-04 | 185 |

---

## State Files (Covariance / Internal State)

### File Format

- Container: HDF5 (`.h5`), compressed with gzip (`.gz`)
- Reading: decompress with `gunzip` first, then open with `h5py` or `h5dump`
- Internal compression: deflate level 1

### Internal Structure

```
/meta/                    Metadata group
  version                 File format version (int32)
  maxrcv                  Max receivers = 150
  maxsat                  Max satellites = 110
  sat_id                  Satellite ID list (110,) S4
  rcv_name                Receiver name list (150,) S32
  state_type_code         State type codes (9,) int32
  state_type_name         State type names (9,) S20
  gzip_on_close           Gzip on file close flag (1=yes)
  hdf5_deflate_level      HDF5 internal compression level
  packed_order            Packing order (0=row-major)
  real_storage_bytes      Storage precision (4=float32)

/pce/
/pce_fast/
/upd/
```

Each group contains the following arrays:

| Array | Description | Dtype |
|-------|-------------|-------|
| `cov_offset` | Covariance column offset index (N_epoch+1,) | uint64 |
| `cov_packed` | Packed upper-triangular covariance elements | float32 |
| `state_value` | State estimate values | float32 |
| `state_var` | State estimate variances | float32 |
| `state_type` | State type code for each state | int32 |
| `state_rcv` | Receiver index for each state | int32 |
| `state_sat` | Satellite index for each state | int32 |
| `state_global` | Global index for each state | int32 |
| `state_offset` | State offset index (N_epoch+1,) | uint64 |
| `epoch_time` | Epoch time (GPS seconds) | float64 |
| `epoch_sys` | Epoch time system identifier | int32 |

The `/upd/` group additionally contains an `upd_type` array.

### State Types

| Code | Name | Description |
|------|------|-------------|
| 1 | PCE_DTR | Receiver clock offset (slow) |
| 2 | PCE_DTS | Satellite clock offset (slow) |
| 3 | PCE_ZWD | Zenith wet delay |
| 4 | PCE_AMB | Carrier-phase ambiguity |
| 5 | PCE_FAST_DTR | Receiver clock offset (fast) |
| 6 | PCE_FAST_DTS | Satellite clock offset (fast) |
| 11 | UPD_SAT | Satellite uncalibrated phase delay |
| 12 | UPD_RCV | Receiver uncalibrated phase delay |

### Satellites & Stations

- **Satellites**: 110 total — GPS (G01-G32), Galileo (E01-E36), BDS-3 (C01-C42)
- **Stations**: ~140, including IGS MGEX global stations and China regional densification stations

### Covariance Storage Notes

`cov_packed` is stored in block-compressed form. Elements between `cov_offset[i]`
and `cov_offset[i+1]` belong to the covariance block of the i-th epoch.
Values are stored as float32 (`real_storage_bytes = 4`).

### Data Integrity Checklist

1. HDF5 magic number must be `89 48 44 46 0d 0a 1a 0a`
2. `cov_offset` must be monotonically non-decreasing
3. `epoch_time` must be monotonically non-decreasing
4. `cov_packed` must not contain NaN or Inf
5. All values in `state_var` must be >= 0
6. The DOY in the filename must match the time span covered by `epoch_time`

---

## Contacts

| Role | Name | Email |
|------|------|-------|
| Algorithms & Software | Yang Li | liyang203@mails.ucas.ac.cn |
| Products & Distribution | Ningbo Wang | wangningbo@aoe.ac.cn |
