---
jupytext:
  text_representation:
    extension: .md
    format_name: myst
    format_version: 0.12
    jupytext_version: 1.7.1
kernelspec:
  display_name: Python 3
  language: python
  name: python3
platform: ATR
flight_id: ATR-20240822a
takeoff: "2024-08-22 13:15:00Z"
landing: "2024-08-22 16:45:00Z"
departure_airport: GVAC
arrival_airport: GVAC
crew:
  - name: G Seurat
    job: Pilot
  - name: JF Bourdinot
    job: Pilot
  - name: T André
    job: Mechanics
  - name: G Vergez
    job: Expé Principal
  - name: T Jiang
    job: Expé 
  - name: Louis Jaffeux
    job: PI
  - name: K Huet
    job: LNG
  - name: H Cassan
    job: aWALI
  - name: P Coutris
    job: Microphys 1
  - name: T Latchimy
    job: Microphys 2
  - name: J Delanoë
    job: RASTA
  - name: K Huet
    job: BASTA
categories: [ec_under, c_atr]
orphan: true
---

{logo}`MAESTRO`

# Flight plan - {front}`flight_id`

```{badges}
```

## Flight plan
* The flight is planned to take off at {front}`takeoff` UTC and land at {front}`landing` UTC.
* HALO is expected to fly a circle around the ATR at about 16:10 UTC (subject to change)
* EarthCare colocation with HALO at 15:41 UTC.

```{code-cell} python3
:tags: [hide-input]
from orcestra.flightplan import sal, bco, LatLon, IntoCircle, path_preview, plot_cwv
from datetime import datetime
import intake

cat = intake.open_catalog("https://tcodata.mpimet.mpg.de/internal.yaml")

date_time = datetime(2024, 8, 20, 12, 0, 0)
date_time_str = date_time.strftime('%Y-%m-%d')
flight_time = datetime(2024, 8, 22, 12, 0, 0)

radius = 60e3 # units: km
circle_atr = LatLon(lat=14.180, lon=-23.110, label="circle_atr")
halo_circle = IntoCircle(circle_atr, radius, 360)

airport = sal
wp1 = LatLon(lat=16.204, lon=-22.480, label='wp1')
wp2 = LatLon(lat=13.891, lon=-23.166, label='wp2')
ec_meet = LatLon(lat=14.336, lon=-23.080, label='EC meeting pt')
wp3 = LatLon(lat=14.780, lon=-22.993, label='wp3')
wp4 = LatLon(lat=13.903, lon=-23.258, label='wp4')
wp5 = LatLon(lat=15.347, lon=-23.323, label='wp5')

path = [airport, wp1, wp2, ec_meet, wp3, wp4, wp5, airport]

ds = cat.HIFS(refdate=date_time_str, reftime=date_time.hour).to_dask()
cwv_flight_time = ds["tcwv"].sel(time=flight_time, method = "nearest")

ax = path_preview(path)
path_preview([circle_atr.course(0, radius), halo_circle], ax=ax)  # HACK: Add HALO circle
ax.scatter(circle_atr.lon, circle_atr.lat, color="tab:orange")
ax.text(circle_atr.lon+0.05, circle_atr.lat-0.20, color="tab:orange", s='HALO_Circle', bbox=dict(facecolor='white',edgecolor='white', boxstyle='round,pad=0.1'))
ax.set_extent([-24, -21, 13.3, 17])

plot_cwv(cwv_flight_time)


```
<!-- ![Flight Levels](./LEVELS-ATR-20240813b.jpg) -->

* SAFIRE Flight Plan submitted to Air Traffic Control (ATC)

![Page 1](./SAFIRE-ATR-20240822a.jpg)

```{code-cell} python3
:tags: [hide-input]
import pandas as pd
from dataclasses import asdict

pd.DataFrame.from_records(map(asdict, path+[circle_atr])).set_index("label")
```

## Crew

```{crew}
```