Top_MSG_BT108

../../_images/Top_MSG_BT108-NoneNoneit2012_10_17_12_00_00vt2012_10_18_00_00_00.png

How to use this plot

Make sure you have the required datafields (msg_brightness_temperature_108)

You can use it as is by appending this code into your mswms_settings.py:

from mslib.mswms.mpl_hsec_styles import HS_Meteosat_BT108_01
register_horizontal_layers = [] if not register_horizontal_layers else register_horizontal_layers
register_horizontal_layers.append((HS_Meteosat_BT108_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 Top_MSG_BT108 import HS_Meteosat_BT108_01
register_horizontal_layers = [] if not register_horizontal_layers else register_horizontal_layers
register_horizontal_layers.append((HS_Meteosat_BT108_01, [next(iter(data))]))
Plot Code
"""
    This file is part of MSS.

    :copyright: Copyright 2021-2024 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 logging
import warnings
import numpy as np
import matplotlib.pyplot as plt
import mpl_toolkits.axes_grid1.inset_locator
import matplotlib.colors
import mpl_toolkits.basemap
from matplotlib import patheffects
from mslib.mswms.mpl_hsec import MPLBasemapHorizontalSectionStyle
from mslib.mswms.utils import make_cbar_labels_readable
import mslib.mswms.generics as generics
from mslib.utils import thermolib
from mslib.utils.units import convert_to

class HS_Meteosat_BT108_01(MPLBasemapHorizontalSectionStyle):
    """
    Meteosat brightness temperature
    """
    name = "MSG_BT108"
    title = "Brightness Temperature 10.8um (K)"

    # Variables with the highest number of dimensions first (otherwise
    # MFDatasetCommonDims will throw an exception)!
    required_datafields = [
        ("sfc", "msg_brightness_temperature_108", "K")]

    def _plot_style(self):
        """
        """
        bm = self.bm
        ax = self.bm.ax
        data = self.data

        cmin = 230
        cmax = 300
        # thick_contours = np.arange(cmin, cmax, 6)
        # thin_contours = [c for c in np.arange(cmin, cmax, 2) \
        #                  if c not in thick_contours]

        tempC = data["msg_brightness_temperature_108"]

        logging.debug("Min: %.2f K, Max: %.2f K", tempC.min(), tempC.max())

        tc = bm.contourf(self.lonmesh, self.latmesh, tempC,
                         np.arange(cmin, cmax, 2), cmap=plt.cm.gray_r, extend="both")
        self.add_colorbar(tc, "Brightness Temperature (K)")

        # Colors in python2.6/site-packages/matplotlib/colors.py
        # cs = bm.contour(self.lonmesh, self.latmesh, tempC,
        #                 [0], colors="red", linewidths=4)
        # cs = bm.contour(self.lonmesh, self.latmesh, tempC,
        #                 thick_contours, colors="saddlebrown", linewidths=2)
        # ax.clabel(cs, fontsize=14, fmt='%.0f')
        # cs = bm.contour(self.lonmesh, self.latmesh, tempC,
        #                 thin_contours, colors="saddlebrown", linewidths=1)

        titlestring = "10.8 um Brightness Temperature (K)"
        titlestring += f"\nValid: {self.valid_time.strftime('%a %Y-%m-%d %H:%M UTC')}"

        if not self.noframe:
            ax.set_title(titlestring,
                         horizontalalignment='left', x=0, fontsize=14)
        else:
            ax.text(bm.llcrnrx, bm.llcrnry, titlestring,
                    fontsize=10, bbox=dict(facecolor='white', alpha=0.6))