How to use this plot
Make sure you have the required datafields (air_pressure, eastward_wind, northward_wind)
You can use it as is by appending this code into your mswms_settings.py:


from mslib.mswms.mpl_lsec_styles import LS_HorizontalVelocityStyle_01
register_linear_layers = [] if not register_linear_layers else register_linear_layers
register_linear_layers.append((LS_HorizontalVelocityStyle_01, [next(iter(data))]))

If you want to modify the plot
1. Download this file
2. Put this file into your mswms_settings.py directory, e.g. ~/mss
3. Append this code into your mswms_settings.py:


from Linear_LS_HV01 import LS_HorizontalVelocityStyle_01
register_linear_layers = [] if not register_linear_layers else register_linear_layers
register_linear_layers.append((LS_HorizontalVelocityStyle_01, [next(iter(data))]))

Linear_LS_HV01.py
"""
    This file is part of MSS.

    :copyright: Copyright 2021-2022 by the MSS team, see AUTHORS.
    :license: APACHE-2.0, see LICENSE for details.

    Licensed under the Apache License, Version 2.0 (the "License");
    you may not use this file except in compliance with the License.
    You may obtain a copy of the License at

       http://www.apache.org/licenses/LICENSE-2.0

    Unless required by applicable law or agreed to in writing, software
    distributed under the License is distributed on an "AS IS" BASIS,
    WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
    See the License for the specific language governing permissions and
    limitations under the License.
"""

import numpy as np
from mslib.mswms.mpl_lsec import AbstractLinearSectionStyle
import mslib.utils.thermolib as thermolib
from mslib.utils.units import convert_to

class LS_HorizontalVelocityStyle_01(AbstractLinearSectionStyle):
    """
    Linear plot of horizontal velocity.
    """

    name = "LS_HV01"
    title = "Horizontal Wind (m/s) Linear Plot"
    abstract = "Horizontal wind speed (m/s)"

    # Variables with the highest number of dimensions first (otherwise
    # MFDatasetCommonDims will throw an exception)!
    required_datafields = [
        ("ml", "air_pressure", "Pa"),
        ("ml", "eastward_wind", "m/s"),
        ("ml", "northward_wind", "m/s")]

    def _prepare_datafields(self):
        """
        Computes total horizontal wind speed.
        """
        self.data["horizontal_wind"] = np.hypot(
            self.data["eastward_wind"], self.data["northward_wind"])
        self.variable = "horizontal_wind"
        self.y_values = self.data[self.variable]
        self.unit = "m/s"