コード例 #1
0
ファイル: plotting.py プロジェクト: UniOfLeicester/plotdarn
def vector(dtime, mlat, mlon, boundary, latmin=50, coeffs=None, ang=None, mag=None, plottype='LOS'):
    if plottype == 'FIT':
        ang, mag = fitted_vecs(coeffs, mlat, mlon, dtime, latmin)
        ang = np.array(ang)
        mag = np.array(mag)
    mlts = convert.mlon_to_mlt(mlon, dtime)
    x, y = convert.mlat_mlt_to_xy(mlat, mlts)
    inside = points_inside_boundary(x, y, boundary[0], boundary[1])
    mapper = linear_cmap(field_name='m', palette=palettes.Viridis256, low=0, high=1000)
    scaled_mag = scale_velocity(mag)
    converted_angles = convert.xy_angle_to_origin(x, y, ang)
    inside_source = ColumnDataSource(dict(x=x[inside], y=y[inside], m=mag[inside], le=scaled_mag[inside],
                                          an=converted_angles[inside], mlon=mlon[inside], mlat=mlat[inside],
                                          mlt=mlts[inside], ang=ang[inside]))
    outside = np.logical_not(inside)
    outside_source = ColumnDataSource(dict(x=x[outside], y=y[outside], m=mag[outside], le=scaled_mag[outside],
                                           an=converted_angles[outside], mlon=mlon[outside], mlat=mlat[outside],
                                           mlt=mlts[outside], ang=ang[outside]))
    return inside_source, outside_source, mapper
コード例 #2
0
def test_convert_left_quad_180():
    res = convert.xy_angle_to_origin(-2, 2, 180)
    assert res == 135  # 90 + 45
コード例 #3
0
def test_convert_angle_0():
    res = convert.xy_angle_to_origin(2, 2, 0)
    assert res == 225  # (180 + 45)
コード例 #4
0
def test_convert_angle_minus160():
    res = convert.xy_angle_to_origin(2, 2, -160)
    assert res == 25
コード例 #5
0
def test_convert_angle_160():
    res = convert.xy_angle_to_origin(2, 2, 160)
    assert res == 65
コード例 #6
0
def test_convert_angle_1xy_180():
    res = convert.xy_angle_to_origin(1, 1, 180)
    assert res == 45
コード例 #7
0
def test_convert_angle_180():
    x = 2
    y = 2
    angle = 180
    res = convert.xy_angle_to_origin(x, y, angle)
    assert res == 45