def test_web_retrieval_all_stations_crop(self): for s in self.all_stations: a = Agrimet(station=s, start_date=self.start_season, end_date=self.end_season, interval='daily') # try: a.fetch_crop_data() print('{} appears valid'.format(a.station))
def test_web_retrieval_all_stations_crop(self): fails = [] for s in self.all_stations: a = Agrimet(station=s, start_date=self.start_season, end_date=self.end_season, interval='daily') try: a.fetch_crop_data() print('{} appears valid'.format(a.station)) except Exception as e: print('{} appears invalid: {}'.format(a.station, e)) fails.append(a.station) print(fails)
def get_agrimet_crop(self, yr): agrimet = Agrimet(station=self.station, start_date=START.format(yr), end_date=END.format(yr), interval='daily') data = agrimet.fetch_crop_data() alfalfa = data['ALFM'] m_alfalfa = alfalfa.groupby(lambda x: x.month).sum().values m_alfalfa = m_alfalfa.reshape((m_alfalfa.shape[0], 1)) return m_alfalfa
def test_pacific_nw_crop(self): a = Agrimet(station=self.pn_site, start_date=self.start, end_date=self.end, interval='daily') df = a.fetch_crop_data() self.assertIsInstance(a, Agrimet)
def test_great_plains_crop(self): a = Agrimet(station=self.gp_site, start_date=self.start, end_date=self.end, interval='daily') df = a.fetch_crop_data() self.assertIsInstance(a, Agrimet)