def test_add_data_valid_empty_query(): dates = pd.date_range("2021/08/01", "2021/08/02") site = "Tucson" with pytest.raises(Exception, match="loading from URL .+ failed") as ei: aeronet.add_data(dates, product="AOD20", siteid=site) assert "valid query but no data found" in str(ei.value.__cause__)
def test_add_data_lunar(): dates = pd.date_range("2021/08/01", "2021/08/02") df = aeronet.add_data(dates, lunar=True, daily=True) # only daily-average data at this time assert df.index.size > 0 dates = pd.date_range("2022/01/20", "2022/01/21") df = aeronet.add_data(dates, lunar=True, siteid="Tucson") assert df.index.size > 0
def test_add_data_inv(): dates = pd.date_range("2021/08/01", "2021/08/02") df = aeronet.add_data(dates, inv_type="ALM15", product="SIZ") assert df.inversion_data_quality_level.eq("lev15").all() assert df.retrieval_measurement_scan_type.eq("Almucantar").all() df = aeronet.add_data(dates, inv_type="HYB15", product="SIZ") assert df.inversion_data_quality_level.eq("lev15").all() assert df.retrieval_measurement_scan_type.eq("Hybrid").all()
def test_add_data_all_noninv(product): dates = pd.date_range("2021/08/01", "2021/08/02") site = "Mauna_Loa" df = aeronet.add_data(dates, product=product, siteid=site) assert df.index.size > 0
def test_add_data_one_site(): dates = pd.date_range("2021/08/01", "2021/08/03") df = aeronet.add_data(dates, siteid="SERC") assert df.index.size > 0 assert (df.siteid == "SERC").all() assert df.attrs["info"].startswith("AERONET Data Download")
def test_add_data_bad_siteid(): with pytest.raises(ValueError, match="invalid site"): aeronet.add_data(siteid="Rivendell")