Beispiel #1
0
def build_weather_csv(
    json_full_path,
    asos_base_url,
    base_url_2,
    econet_data,
    visited_gages_path,
    start=0,
    end_index=100,
):
    directory = os.fsencode(json_full_path)
    sorted_list = sorted(os.listdir(directory))
    for i in range(start, end_index):
        file = sorted_list[i]
        filename = os.fsdecode(file)
        get_weather_data(
            os.path.join(json_full_path, filename),
            econet_data,
            asos_base_url,
            visited_gages_path,
        )
        process_asos_data(
            os.path.join(json_full_path, filename),
            base_url_2,
            visited_gages_path,
        )
Beispiel #2
0
 def test_get_weather_data(self):
     url = (
         "https://mesonet.agron.iastate.edu/cgi-bin/request/asos.py?"
         "station={}&data=tmpf&data=p01m&year1=2019&month1=1&day1=1&year2=2019&month2=1&"
         "day2=2&tz=Etc%2FUTC&format=onlycomma&latlon=no&missing=M&trace=T&direct=no&report_type=1&report_type=2"
     )
     print(url)
     get_weather_data(os.path.join(self.test_data_path, "full_out.json"),
                      {}, url)
     self.assertEqual(1, 1)