---
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: King Air
flight_id: KA-20240820a
takeoff: "2024-08-20 13:50:00Z"
landing: "2024-08-20 17:20:00Z"
departure_airport: GVNP
arrival_airport: GVNP
crew:
  - name: Robert Oscar David
    job: PI
  - name: Sorin Ghemulet
    job: Instrument operator
  - name: Alex Vlad
    job: Instrument operator
categories: [ec_under, ec_track, in_cloud, spiral_mindelo, insitu_aerosol]
orphan: true
---

{logo}`CELLO`

# Flight plan - {front}`flight_id`

```{badges}
```

## Crew

The flight is planned to take off at {front}`takeoff`. 

Flying WP1 -> WP3 at FL030 (in-cloud if possible) and meet EC and ATR at 15:50 UTC.

Spiral ascent over Mindelo supersite.


```{crew}
```

## Flight plan

```{code-cell} python3
:tags: [hide-input]

from orcestra.flightplan import sal, bco, LatLon, IntoCircle, path_preview, plot_cwv
from datetime import datetime
import intake
import easygems.healpix as egh

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

# Define dates for forecast initialization and flight

issued_time = datetime(2024, 8, 20, 0, 0, 0)
issued_time_str = issued_time.strftime('%Y-%m-%d')

flight_time = datetime(2024, 8, 20, 12, 0, 0)
flight_time_str = flight_time.strftime('%Y-%m-%d')
flight_index = f"KA-{flight_time.strftime('%Y%m%d')}a"

print("Initalization date of IFS forecast: " + issued_time_str + "\nFlight date: " + flight_time_str + "\nFlight index: " + flight_index)

airport = LatLon(lat=14.945, lon=-23.4863889, label='RAI')
north_ec = LatLon(lat=18.978419, lon=-24.783502, label='north_ec')
earthcare = LatLon(lat=18.137417, lon=-24.951843, label='earthcare')
south_ec = LatLon(lat=17.360981, lon=-25.106269, label='south_ec')
mindelo = LatLon(lat=16.877772, lon=-24.995374, label='mindelo')
atr = LatLon(lat=18.14975, lon=-24.94933056, label='atr@ec')

leg_out = [
     airport,
     north_ec
]

leg_calval = [
     north_ec,
     atr,
     earthcare,
     south_ec
]

leg_mindelo_spiral = [
     south_ec,
     mindelo
]

leg_home = [
     mindelo,
     airport
]

path = leg_out + leg_calval + leg_mindelo_spiral + leg_home 

cat = intake.open_catalog("https://tcodata.mpimet.mpg.de/internal.yaml")
ds = cat.HIFS(datetime=issued_time).to_dask().pipe(egh.attach_coords)
cwv_flight_time = ds["tcwv"].sel(time=flight_time, method = "nearest")

ax = path_preview(path)
plot_cwv(cwv_flight_time)



```

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

pd.DataFrame.from_records(map(asdict, [north_ec, earthcare, south_ec, mindelo])).set_index("label")
```

