コード例 #1
0
def test_combine_ranked_stations(cz_candidates, naive_candidates):
    assert list(
        cz_candidates.index) == ["723890", "723896", "723895", "723840"]
    assert list(naive_candidates.index) == [
        "723890",
        "723896",
        "724815",
        "723895",
        "723965",
    ]

    combined_candidates = combine_ranked_stations(
        [cz_candidates, naive_candidates])

    assert combined_candidates.shape == (6, 15)
    assert combined_candidates["rank"].iloc[0] == 1
    assert combined_candidates["rank"].iloc[-1] == 6
    assert list(combined_candidates.index) == [
        "723890",
        "723896",
        "723895",
        "723840",
        "724815",
        "723965",
    ]
コード例 #2
0
ファイル: location.py プロジェクト: svonkleeck/eemeter
def lat_lng_to_station_using_eeweather(lat, lng, is_cz2010=False):

    ranked_stations = eeweather.rank_stations(lat,
                                              lng,
                                              match_iecc_climate_zone=True,
                                              match_iecc_moisture_regime=True,
                                              match_ba_climate_zone=True,
                                              match_ca_climate_zone=True,
                                              minimum_quality='high',
                                              is_tmy3=True,
                                              is_cz2010=is_cz2010)

    naive_ranked_stations = eeweather.rank_stations(
        lat,
        lng,
        minimum_quality='high',
        is_tmy3=True,
        is_cz2010=is_cz2010,
    )

    ranked_stations = eeweather.combine_ranked_stations(
        [ranked_stations, naive_ranked_stations])

    curr = datetime.now()
    curr = datetime(curr.year, curr.month, curr.day, tzinfo=pytz.utc)
    start = curr - timedelta(days=(365 * 5))

    primary_match_station, warning_descs = eeweather.select_station(
        ranked_stations,
        coverage_range=(start, curr),
        min_fraction_coverage=0.9,
        rank=1,
    )

    return primary_match_station.usaf_id if primary_match_station else None
コード例 #3
0
def test_combine_ranked_stations(cz_candidates, naive_candidates):
    assert list(cz_candidates.index) == [
        '723890', '747020', '723896', '723895', '723840'
    ]
    assert list(naive_candidates.index) == [
        '723890', '747020', '723896', '724815', '723895'
    ]

    combined_candidates = combine_ranked_stations(
        [cz_candidates, naive_candidates])

    assert combined_candidates.shape == (6, 15)
    assert combined_candidates['rank'].iloc[0] == 1
    assert combined_candidates['rank'].iloc[-1] == 6
    assert list(combined_candidates.index) == [
        '723890', '747020', '723896', '723895', '723840', '724815'
    ]
コード例 #4
0
def test_combine_ranked_stations_empty():
    with pytest.raises(ValueError):
        combine_ranked_stations([])