# Buggy code
def world_to_pixel(self, coordinate, origin=0):
    """
    Convert a world (data) coordinate to a pixel coordinate by using
    `~astropy.wcs.WCS.wcs_world2pix`.

    Parameters
    ----------
    coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseFrame`
        The coordinate object to convert to pixel coordinates.

    origin : int
        Origin of the top-left corner. i.e. count from 0 or 1.
        Normally, origin should be 0 when passing numpy indices, or 1 if
        passing values from FITS header or map attributes.
        See `~astropy.wcs.WCS.wcs_world2pix` for more information.

    Returns
    -------
    x : `~astropy.units.Quantity`
        Pixel coordinate on the CTYPE1 axis.

    y : `~astropy.units.Quantity`
        Pixel coordinate on the CTYPE2 axis.
    """
    if not isinstance(coordinate, (SkyCoord, astropy.coordinates.BaseCoordinateFrame)):
        raise ValueError(
            "world_to_pixel takes a Astropy coordinate frame or SkyCoord instance."
        )

    native_frame = coordinate.transform_to(self.coordinate_frame)
    lon, lat = u.Quantity(self._get_lon_lat(native_frame)).to(u.deg)
    x, y = self.wcs.wcs_world2pix(lon, lat, origin)

    return PixelPair(x * u.pixel, y * u.pixel)


# Traceback (ValueError)
Traceback (most recent call last):
File "/Users/dstansby/github/sunpy/test.py", line 27, in <module>
print(m.bottom_left_coord)
File "/Users/dstansby/github/sunpy/sunpy/map/mapbase.py", line 719, in bottom_left_coord
return self.pixel_to_world(0*u.pix, 0*u.pix)
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/units/decorators.py", line 251, in wrapper
return_ = wrapped_function(*func_args, **func_kwargs)
File "/Users/dstansby/github/sunpy/sunpy/map/mapbase.py", line 1146, in pixel_to_world
return SkyCoord(x, y, frame=self.coordinate_frame)
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/coordinates/sky_coordinate.py", line 314, in __init__
skycoord_kwargs, components, info = _parse_coordinate_data(
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/coordinates/sky_coordinate_parsers.py", line 301, in _parse_coordinate_data
_components[frame_attr_name] = attr_class(arg, unit=unit)
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/coordinates/angles.py", line 536, in __new__
self._validate_angles()
File "/Users/dstansby/miniconda3/envs/dev/lib/python3.9/site-packages/astropy/coordinates/angles.py", line 557, in _validate_angles
raise ValueError('Latitude angle(s) must be within -90 deg <= angle <= 90 deg, '
ValueError: Latitude angle(s) must be within -90 deg <= angle <= 90 deg, got 359.9997222222222 deg

# Fixed code
def world_to_pixel(self, coordinate, origin=None):
    """
    Convert a world (data) coordinate to a pixel coordinate.

    Parameters
    ----------
    coordinate : `~astropy.coordinates.SkyCoord` or `~astropy.coordinates.BaseFrame`
        The coordinate object to convert to pixel coordinates.

    origin : int
        Deprecated.

        Origin of the top-left corner. i.e. count from 0 or 1.
        Normally, origin should be 0 when passing numpy indices, or 1 if
        passing values from FITS header or map attributes.

    Returns
    -------
    x : `~astropy.units.Quantity`
        Pixel coordinate on the CTYPE1 axis.

    y : `~astropy.units.Quantity`
        Pixel coordinate on the CTYPE2 axis.
    """
    self._check_origin(origin)
    x, y = self.wcs.world_to_pixel(coordinate)
    if origin == 1:
        x += 1
        y += 1

    return PixelPair(x * u.pixel, y * u.pixel)