Пример #1
0
def test_interp_data(expected_test_data):
    """Test interpolating UTC time from ECMWF_MACC data."""
    data = ecmwf_macc.ECMWF_MACC(expected_test_data)
    test9am = data.interp_data(
        38, -122, datetime.datetime(2012, 11, 1, 9, 0, 0), 'aod550')
    assert np.isclose(test9am, data.data.variables['aod550'][2, 17, 79])
    test12pm = data.interp_data(
        38, -122, datetime.datetime(2012, 11, 1, 12, 0, 0), 'aod550')
    assert np.isclose(test12pm, data.data.variables['aod550'][3, 17, 79])
    test113301 = data.interp_data(
        38, -122, datetime.datetime(2012, 11, 1, 11, 33, 1), 'aod550')
    expected = test9am + (2 + (33 + 1 / 60) / 60) / 3 * (test12pm - test9am)
    assert np.isclose(test113301, expected)  # 0.15515305836696536
Пример #2
0
def test_get_nearest_indices():
    """Test getting indices given latitude, longitude from ECMWF_MACC data."""
    data = ecmwf_macc.ECMWF_MACC(os.path.join(DATADIR, TESTDATA))
    ilat, ilon = data.get_nearest_indices(38, -122)
    assert ilat == 17
    assert ilon == 79
Пример #3
0
def test_get_nearest_indices(expected_test_data):
    """Test getting indices given latitude, longitude from ECMWF_MACC data."""
    data = ecmwf_macc.ECMWF_MACC(expected_test_data)
    ilat, ilon = data.get_nearest_indices(38, -122)
    assert ilat == 17
    assert ilon == 79