setup:
    interpolation_grid_min: 0
    interpolation_grid_max: 31000
    interpolation_grid_inc: 10
    max_gap_fill: 50
global_attrs:
    title: ${main.campaign} level 2 sounding data
#    source: "{input_file}"
    version: "{version}"
    history: "created with {package} ({version}) on {date}"
#    description: ???
#    campaign_id: ${main.campaign_id}
#    platform: ${main.platform}
#    instrument: "Radiosonde RS41-SGP by Vaisala"
#    doi: ???
#    featureType: "trajectory"
#    acknowledgement: ???
#    references: ???
#    Conventions: "CF-1.7"

coordinates:
    sounding:
        dimension: ${runtime.sounding_dim}
    alt:
        dimension: ${runtime.level_dim}
        attrs:
            units: "m"
        encodings:
            dtype: "int16"
        internal_varname: "alt"
    nv:
        dimension: 2
variables:
    alt:
        attrs:
            standard_name: "geopotential_height"
            long_name: "geopotential height retrieved from PTU"
            units: "m"
            axis: "Z"
            positive: "up"
            bounds: "alt_bnds"
        encodings:
            dtype: "int8"
            _FillValue: False
        coordinates:
            - alt
        internal_varname: "altitude"
        level1_varname: "height"
    alt_bnds:
        attrs:
            comment: "(lower bound, upper bound]"
        encodings:
            dtype: "int8"
            _FillValue: False
        coordinates:
            - alt
            - nv
        internal_varname: "alt_bnds"
    launch_time:
        attrs:
            standard_name: "time"
            long_name: "time at which the sounding started"
        encodings:
            dtype: "float64"
            units: "seconds since 2020-01-01"
            calendar: "proleptic_gregorian"
        coordinates:
            - sounding
        internal_varname : "launch_time"
    platform:
        attrs:
            long_name: "platform identifier"
            coordinates: "launch_time"
            flag_meanings: "BCO Meteor"
            flag_values: "[1, 2]"
            units: "1"
        encodings:
            dtype: "int8"
        coordinates:
            - sounding
        internal_varname: "platform"
    ascent_flag:
        attrs:
            long_name: "indicator of vertical flight direction"
            flag_meanings: "ascending descending"
            flag_values: "[1,0]"
            valid_range: "[ 0,1 ]"
            coordinates: "launch_time"
        encodings:
            dtype: "int8"
        coordinates:
            - sounding
        internal_varname: "ascent_flag"
    sounding:
        attrs:
            cf_role: "trajecotry_id"
            long_name: "sounding identifier"
            description: "unique string describing the soundings origin (PLATFORM_SND-DIRECTION_LAT_LON_TIME)"
        encodings:
            dtype: "str"
        format: ${main.platform}__{direction}__{lat:3.2f}_{lon:4.2f}__%Y%m%d%H%M
        coordinates:
            - sounding
        internal_varname: "sounding"
    flight_time:
        attrs:
            standard_name: "time"
            long_name: "time at pressure level"
            coordinates: "lon lat alt launch_time sounding"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
        encodings:
            units: "seconds since 2020-01-01"
            calendar: "proleptic_gregorian"
            dtype: "float64"
        coordinates:
            - sounding
            - alt
        internal_varname : "flight_time"
    p:
        attrs:
            standard_name: "air_pressure"
            long_name: "pressure"
            units: "Pa"
            coordinates: "lon lat alt flight_time launch_time sounding"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "pressure"
    lat:
        attrs:
            standard_name: "latitude"
            long_name: "latitude"
            axis: "Y"
            units: "degrees_north"
            ancillary_variables: "N_gps m_gps"
            cell_methods: "alt: mean (interval: 10 m comment: m_gps)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "latitude"
    lon:
        attrs:
            standard_name: "latitude"
            long_name: "latitude"
            axis: "X"
            units: "degrees_north"
            ancillary_variables: "N_gps m_gps"
            cell_methods: "alt: mean (interval: 10 m comment: m_gps)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "longitude"
    dz:
        attrs:
            long_name: "ascent/descent rate of measuring device"
            description: "calculated from interpolated geopotential height changes (artifical rate)"
            units: "m/s"
            coordinates: "lon lat alt flight_time launch_time sounding"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname : "ascent_rate"
    ta:
        attrs:
            standard_name: "air_temperature"
            long_name: "dry bulb temperature"
            units: "K"
            coordinates: "lon lat alt flight_time launch_time sounding"
            cell_methods: "alt: point (derived from averaged theta)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname : "temperature"
    dp:
        attrs:
            standard_name: "dew_point_temperature"
            long_name: "dew point temperature"
            units: "K"
            coordinates: "lon lat flight_time launch_time"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "dewpoint"
    wspd:
        attrs:
            standard_name: "wind_speed"
            long_name: "wind speed"
            units: "m/s"
            cell_methods: "alt: point (derived from averaged u, v)"
            coordinates: "launch_time flight_time lon lat"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "wind_speed"
    u:
        attrs:
            standard_name: "eastward_wind"
            long_name: "u-component of the wind"
            units: "m/s"
            ancillary_variables: "N_gps m_gps"
            cell_methods: "alt: mean (interval: 10 m comment: m_gps)"
            coordinates: "launch_time flight_time lon lat"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "wind_u"
    v:
        attrs:
            standard_name: "northward_wind"
            long_name: "v-component of the wind"
            units: "m/s"
            ancillary_variables: "N_gps m_gps"
            cell_methods: "alt: mean (interval: 10 m comment: m_gps)"
            coordinates: "launch_time flight_time lon lat"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "wind_v"
    mr:
        attrs:
            standard_name: "humidity_mixing_ratio"
            long_name: "water vapor mixing ratio"
            units: "kg/kg"
            ancillary_variables: "N_ptu"
            cell_methods: "alt: point (derived from averaged q)"
            coordinates: "launch_time flight_time lon lat p"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname : "mixing_ratio"
    theta:
        attrs:
            standard_name: "air_potential_temperature"
            long_name: "potential temperature"
            units: "K"
            coordinates: "lon lat flight_time launch_time"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "theta"
    q:
        attrs:
            standard_name: "specific_humidity"
            long_name: "specific humidity"
            units: "kg/kg"
            ancillary_variables: "N_ptu m_ptu"
            cell_methods: "alt: mean (interval: 10 m comment: m_ptu)"
            coordinates: "launch_time flight_time lon lat p"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "specific_humidity"
    wdir:
        attrs:
            standard_name: "wind_from_direction"
            long_name: "wind direction"
            units: "degree"
            coordinates: "launch_time flight_time lon lat"
            cell_methods: "alt: point (derived from averaged u, v)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "wind_direction"
    rh:
        attrs:
            standard_name: "relative_humidity"
            long_name: "relative humidity"
            units: "1"
            coordinates: "lon lat flight_time launch_time"
            cell_methods: "alt: point (derived from averaged q, T, p)"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname : "relative_humidity"
    N_ptu:
        attrs:
            standard_name: "number_of_observations"
            description: "number of observations used to derive level 2 PTU-data average"
            units: "1"
            coordinates: "lon lat flight_time launch_time"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "N_ptu"
    N_gps:
        attrs:
            standard_name: "number_of_observations"
            description: "number of observations used to derive level 2 GPS-data average"
            units: "1"
            coordinates: "lon lat flight_time launch_time"
        encodings:
            dtype: "float32"
        coordinates:
            - sounding
            - alt
        internal_varname: "N_gps"
    m_ptu:
        attrs:
            long_name: "bin method"
            description: "method used to derive level 2 PTU-data average"
            flag_meanings: "no_data interpolation averaging"
            flag_values: "[ 0, 1, 2 ]"
            coordinates: "lon lat flight_time launch_time"
        encodings:
            dtype: "int8"
        coordinates:
            - sounding
            - alt
        internal_varname: "m_ptu"
    m_gps:
        attrs:
            long_name: "bin method"
            description: "method used to derive level 2 GPS-data average"
            flag_meanings: "no_data interpolation averaging"
            flag_values: "[ 0, 1, 2 ]"
            coordinates: "lon lat flight_time launch_time"
        encodings:
            dtype: "int8"
        coordinates:
            - sounding
            - alt
        internal_varname: "m_gps"
