# Buggy code
def _build(self):
    """Build the plot by calling needed plotting methods as necessary."""
    lon, lat, data = self.plotdata

    # Use the cartopy map projection to transform station locations to the map and
    # then refine the number of stations plotted by setting a radius
    if self.parent._proj_obj == ccrs.PlateCarree():
        scale = 1.0
    else:
        scale = 100000.0
    point_locs = self.parent._proj_obj.transform_points(ccrs.PlateCarree(), lon, lat)
    subset = reduce_point_density(point_locs, self.reduce_points * scale)

    self.handle = StationPlot(
        self.parent.ax,
        lon[subset],
        lat[subset],
        clip_on=True,
        transform=ccrs.PlateCarree(),
        fontsize=10,
    )

    for i, ob_type in enumerate(self.fields):
        field_kwargs = {}
        if len(self.locations) > 1:
            location = self.locations[i]
        else:
            location = self.locations[0]
        if len(self.colors) > 1:
            field_kwargs["color"] = self.colors[i]
        else:
            field_kwargs["color"] = self.colors[0]
        if len(self.formats) > 1:
            field_kwargs["formatter"] = self.formats[i]
        else:
            field_kwargs["formatter"] = self.formats[0]
        if len(self.plot_units) > 1:
            field_kwargs["plot_units"] = self.plot_units[i]
        else:
            field_kwargs["plot_units"] = self.plot_units[0]
        if hasattr(self.data, "units") and (field_kwargs["plot_units"] is not None):
            parameter = data[ob_type][subset].values * units(self.data.units[ob_type])
        else:
            parameter = data[ob_type][subset]
        if field_kwargs["formatter"] is not None:
            mapper = getattr(wx_symbols, str(field_kwargs["formatter"]), None)
            if mapper is not None:
                field_kwargs.pop("formatter")
                self.handle.plot_symbol(location, parameter, mapper, **field_kwargs)
            else:
                if self.formats[i] == "text":
                    self.handle.plot_text(
                        location, data[ob_type][subset], color=field_kwargs["color"]
                    )
                else:
                    self.handle.plot_parameter(
                        location, data[ob_type][subset], **field_kwargs
                    )
        else:
            field_kwargs.pop("formatter")
            self.handle.plot_parameter(location, parameter, **field_kwargs)

    if self.vector_field[0] is not None:
        vector_kwargs = {}
        vector_kwargs["color"] = self.vector_field_color
        vector_kwargs["plot_units"] = self.vector_plot_units
        if hasattr(self.data, "units") and (vector_kwargs["plot_units"] is not None):
            u = data[self.vector_field[0]][subset].values * units(
                self.data.units[self.vector_field[0]]
            )
            v = data[self.vector_field[1]][subset].values * units(
                self.data.units[self.vector_field[1]]
            )
        else:
            vector_kwargs.pop("plot_units")
            u = data[self.vector_field[0]][subset]
            v = data[self.vector_field[1]][subset]
        if self.vector_field_length is not None:
            vector_kwargs["length"] = self.vector_field_length
        self.handle.plot_barb(u, v, **vector_kwargs)


# Traceback (ValueError)
---------------------------------------------------------------------------
ValueError                                Traceback (most recent call last)
<ipython-input-6-df2b7c9f2f48> in <module>
25 pc.panels = [panel]
26
---> 27 pc.show()

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/declarative.py in show(self)
566     def show(self):
567         """Show the constructed graphic on the screen."""
--> 568         self.draw()
569         plt.show()
570

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/declarative.py in draw(self)
553         for panel in self.panels:
554             with panel.hold_trait_notifications():
--> 555                 panel.draw()
556
557     def save(self, *args, **kwargs):

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/declarative.py in draw(self)
744             for p in self.plots:
745                 with p.hold_trait_notifications():
--> 746                     p.draw()
747
748             # Add all of the maps

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/declarative.py in draw(self)
1532         if self._need_redraw:
1533             if getattr(self, 'handle', None) is None:
-> 1534                 self._build()
1535             self._need_redraw = False
1536

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/declarative.py in _build(self)
1592                     else:
1593                         self.handle.plot_parameter(location, data[ob_type][subset],
-> 1594                                                    **field_kwargs)
1595             else:
1596                 field_kwargs.pop('formatter')

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/station_plot.py in plot_parameter(self, location, parameter, formatter, **kwargs)
199         # If plot_units specified, convert the data to those units
200         plotting_units = kwargs.pop('plot_units', None)
--> 201         parameter = self._scalar_plotting_units(parameter, plotting_units)
202         if hasattr(parameter, 'units'):
203             parameter = parameter.magnitude

~/miniconda3/envs/new_main/lib/python3.7/site-packages/metpy/plots/station_plot.py in _scalar_plotting_units(scalar_value, plotting_units)
349                 scalar_value = scalar_value.to(plotting_units)
350             else:
--> 351                 raise ValueError('To convert to plotting units, units must be attached to '
352                                  'scalar value being converted.')
353         return scalar_value

ValueError: To convert to plotting units, units must be attached to scalar value being converted.
/Users/kgoebber/miniconda3/envs/new_main/lib/python3.7/site-packages/cartopy/mpl/geoaxes.py:388: MatplotlibDeprecationWarning:
The 'inframe' parameter of draw() was deprecated in Matplotlib 3.3 and will be removed two minor releases later. Use Axes.redraw_in_frame() instead. If any parameter follows 'inframe', they should be passed as keyword, not positionally.
inframe=inframe)

# Fixed code
def _build(self):
    """Build the plot by calling needed plotting methods as necessary."""
    lon, lat, data = self.plotdata

    # Use the cartopy map projection to transform station locations to the map and
    # then refine the number of stations plotted by setting a radius
    if self.parent._proj_obj == ccrs.PlateCarree():
        scale = 1.0
    else:
        scale = 100000.0
    point_locs = self.parent._proj_obj.transform_points(ccrs.PlateCarree(), lon, lat)
    subset = reduce_point_density(point_locs, self.reduce_points * scale)

    self.handle = StationPlot(
        self.parent.ax,
        lon[subset],
        lat[subset],
        clip_on=True,
        transform=ccrs.PlateCarree(),
        fontsize=10,
    )

    for i, ob_type in enumerate(self.fields):
        field_kwargs = {}
        if len(self.locations) > 1:
            location = self.locations[i]
        else:
            location = self.locations[0]
        if len(self.colors) > 1:
            field_kwargs["color"] = self.colors[i]
        else:
            field_kwargs["color"] = self.colors[0]
        if len(self.formats) > 1:
            field_kwargs["formatter"] = self.formats[i]
        else:
            field_kwargs["formatter"] = self.formats[0]
        if len(self.plot_units) > 1:
            field_kwargs["plot_units"] = self.plot_units[i]
        else:
            field_kwargs["plot_units"] = self.plot_units[0]
        if hasattr(self.data, "units") and (field_kwargs["plot_units"] is not None):
            parameter = data[ob_type][subset].values * units(self.data.units[ob_type])
        else:
            parameter = data[ob_type][subset]
        if field_kwargs["formatter"] is not None:
            mapper = getattr(wx_symbols, str(field_kwargs["formatter"]), None)
            if mapper is not None:
                field_kwargs.pop("formatter")
                self.handle.plot_symbol(location, parameter, mapper, **field_kwargs)
            else:
                if self.formats[i] == "text":
                    self.handle.plot_text(
                        location, parameter, color=field_kwargs["color"]
                    )
                else:
                    self.handle.plot_parameter(location, parameter, **field_kwargs)
        else:
            field_kwargs.pop("formatter")
            self.handle.plot_parameter(location, parameter, **field_kwargs)

    if self.vector_field[0] is not None:
        vector_kwargs = {}
        vector_kwargs["color"] = self.vector_field_color
        vector_kwargs["plot_units"] = self.vector_plot_units
        if hasattr(self.data, "units") and (vector_kwargs["plot_units"] is not None):
            u = data[self.vector_field[0]][subset].values * units(
                self.data.units[self.vector_field[0]]
            )
            v = data[self.vector_field[1]][subset].values * units(
                self.data.units[self.vector_field[1]]
            )
        else:
            vector_kwargs.pop("plot_units")
            u = data[self.vector_field[0]][subset]
            v = data[self.vector_field[1]][subset]
        if self.vector_field_length is not None:
            vector_kwargs["length"] = self.vector_field_length
        self.handle.plot_barb(u, v, **vector_kwargs)