---
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: HALO
flight_id: HALO-20240821a
takeoff: "2024-08-21 12:30:00Z"
landing: "2024-08-21 21:30:00Z"
departure_airport: GVAC
arrival_airport: GVAC
crew:
  - name: Cathy Hohenegger
    job: PI
  - name: Silke Gross
    job: WALES
  - name: Tobias Koelling
    job: HAMP
  - name: Helene Gloeckner
    job: Dropsondes
  - name: Kevin Wolf
    job: Smart/VELOX
  - name: Zekican Demiralay
    job: SpecMACS
  - name: Divya Praturi
    job: Scientist
  - name: Julia Windmiller
    job: Ground contact
categories: [c_north, c_mid, c_south, meteor, c_atr]
orphan: true
---

{logo}`PERCUSION`

# Flight plan - {front}`flight_id`

```{badges}
```

## Crew

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

```{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, 19, 0, 0, 0)
issued_time_str = issued_time.strftime('%Y-%m-%d')

flight_time = datetime(2024, 8, 21, 12, 0, 0)
flight_time_str = flight_time.strftime('%Y-%m-%d')
flight_index = f"HALO-{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)
radius = 130e3
atr_radius = 70e3

airport=sal

mindelo = LatLon(lat=16.8778, lon=-24.995,label= "mindelo")
north_in = LatLon(lat=15.00, lon=-26.71,label= "north_in")
north_out = LatLon(lat=16.8778, lon=-26.71,label= "north_out")
south_tp = LatLon(lat=3., lon=-26.71,label= "south_tp")

c_extra = LatLon(13.7,-26.71, "c_extra")
c_south = LatLon(5.5, -26.71, "c_south")
c_north=LatLon(11.1,-26.71,"c_north")
c_mid=LatLon(8.3,-26.71,"c_mid")

leg_south = [
    airport, 
    north_in,
    c_extra,
    c_north,
    c_mid,
    c_south,
    south_tp
]

leg_circles = [
     IntoCircle(c_south, radius, 360),
         IntoCircle(c_mid, radius, 360),
    IntoCircle(c_north, radius, 360),
    IntoCircle(c_extra, radius, 360),
]

leg_home = [
     north_out,
     airport
]  

path = leg_south+leg_circles+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, [sal,north_in,c_extra,c_north,c_mid,c_south,south_tp,north_out])).set_index("label")
```

```{code-cell} python3
:tags: [hide-input]
from orcestra.flightplan import export_flightplan

export_flightplan("HALO-20240821a", path)
```
