def lon360to180(lon):
    """Convert longitude from (0, 360) to (-180, 180)
    """
    if np.any(lon > 360.0) or np.any(lon < 0.0):
        print("Warning: lon outside expected range")
        lon = wraplon(lon)
    #lon[lon > 180.0] -= 360.0
    #lon180 = (lon+180) - np.floor((lon+180)/360)*360 - 180
    lon = lon - (lon.astype(int)/180)*360.0
    return lon
Convert longitude from (0, 360) to (-180, 180)