def test_get_forecast_using_known_service_and_db_content(self): utc = Calendar() # always use Calendar() stuff met_stations = [ # this is the list of MetStations, the gis_id tells the position, the remaining tells us what properties we observe/forecast/calculate at the metstation (smg-ts) MetStationConfig( gis_id=598, temperature=u'/LTM5-Nea...........-T0017A3P_EC00_ENS', precipitation=u'/LTM5-Nea...........-T0000A5P_EC00_ENS') ] #note: the MetStationConfig can be constructed from yaml-config gis_location_repository = GisLocationService( ) # this provides the gis locations for my stations smg_ts_repository = SmGTsRepository( PROD, FC_PROD) # this provide the read function for my time-series geo_ts_repository = GeoTsRepository( epsg_id=32633, geo_location_repository=gis_location_repository, ts_repository=smg_ts_repository, met_station_list=met_stations, ens_config=None) #pass service info and met_stations self.assertIsNotNone(geo_ts_repository) utc_period = UtcPeriod(utc.time(YMDhms(2015, 10, 1, 0, 0, 0)), utc.time(YMDhms(2015, 10, 10, 0, 0, 0))) ts_types = ['temperature', 'precipitation'] geo_ts_dict = geo_ts_repository.get_forecast( ts_types, utc_period=utc_period, t_c=None, geo_location_criteria=None) self.assertIsNotNone(geo_ts_dict) for ts_type in ts_types: self.assertTrue( ts_type in geo_ts_dict.keys(), "we ecpect to find an entry for each requested type (it could be empty list though" ) self.assertTrue( len(geo_ts_dict[ts_type]) > 0, "we expect to find the series that we pass in, given they have not changed the name in SmG PROD" )
def test_get_forecast_using_known_service_and_db_content(self): utc = Calendar() met_stations=[ # this is the list of MetStations, the gis_id tells the position, the remaining tells us what properties we observe/forecast/calculate at the metstation (smg-ts) MetStationConfig(gis_id=598, temperature=u'/LTM5-Nea...........-T0017A3P_EC00_ENS', precipitation=u'/LTM5-Nea...........-T0000A5P_EC00_ENS') ] gis_location_repository = GisLocationService() smg_ts_repository = SmGTsRepository(PREPROD, FC_PREPROD) geo_ts_repository = GeoTsRepository( epsg_id = 32633, geo_location_repository = gis_location_repository, ts_repository = smg_ts_repository, met_station_list = met_stations, ens_config = None) self.assertIsNotNone(geo_ts_repository) utc_period = UtcPeriod(utc.time(YMDhms(2015, 10, 1, 0, 0, 0)), utc.time(YMDhms(2015, 10, 10, 0, 0, 0))) ts_types= ['temperature', 'precipitation'] geo_ts_dict = geo_ts_repository.get_forecast(ts_types, utc_period=utc_period, t_c=None, geo_location_criteria=None) self.assertIsNotNone(geo_ts_dict) for ts_type in ts_types: self.assertTrue(ts_type in geo_ts_dict.keys(), "we expect to find an entry for each requested type (it could be empty list though)") self.assertTrue(len(geo_ts_dict[ts_type])>0, "we expect to find the series that we pass in by name in SmG PREPROD")
def test_get_forecast_using_known_service_and_db_content(self): utc = Calendar() met_stations=[ # this is the list of MetStations, the gis_id tells the position, the remaining tells us what properties we observe/forecast/calculate at the metstation (smg-ts) MetStationConfig(gis_id=402, temperature=u'/LTM5-Nea...........-T0017A3P_EC00_ENS', precipitation=u'/LTM5-Nea...........-T0000A5P_EC00_ENS') ] gis_location_repository = GisLocationService() smg_ts_repository = SmGTsRepository(PREPROD, FC_PREPROD) geo_ts_repository = GeoTsRepository( epsg_id = 32633, geo_location_repository = gis_location_repository, ts_repository = smg_ts_repository, met_station_list = met_stations, ens_config = None) self.assertIsNotNone(geo_ts_repository) utc_period = UtcPeriod(utc.time(YMDhms(2015, 10, 1, 0, 0, 0)), utc.time(YMDhms(2015, 10, 10, 0, 0, 0))) ts_types= ['temperature', 'precipitation'] geo_ts_dict = geo_ts_repository.get_forecast(ts_types, utc_period=utc_period, t_c=None, geo_location_criteria=None) self.assertIsNotNone(geo_ts_dict) for ts_type in ts_types: self.assertTrue(ts_type in geo_ts_dict.keys(), "we expect to find an entry for each requested type (it could be empty list though)") self.assertTrue(len(geo_ts_dict[ts_type])>0, "we expect to find the series that we pass in by name in SmG PREPROD")
def test_get_forecast_using_known_service_and_db_content(self): utc = Calendar() # always use Calendar() stuff met_stations=[ # this is the list of MetStations, the gis_id tells the position, the remaining tells us what properties we observe/forecast/calculate at the metstation (smg-ts) MetStationConfig(gis_id=598,temperature=u'/LTM5-Nea...........-T0017A3P_EC00_ENS',precipitation=u'/LTM5-Nea...........-T0000A5P_EC00_ENS') ] #note: the MetStationConfig can be constructed from yaml-config gis_location_repository=GisLocationService() # this provides the gis locations for my stations smg_ts_repository = SmGTsRepository(PROD,FC_PROD) # this provide the read function for my time-series geo_ts_repository = GeoTsRepository( epsg_id=32633, geo_location_repository=gis_location_repository, ts_repository=smg_ts_repository, met_station_list=met_stations, ens_config=None) #pass service info and met_stations self.assertIsNotNone(geo_ts_repository) utc_period = UtcPeriod(utc.time(YMDhms(2015, 10, 1, 0, 0, 0)),utc.time(YMDhms(2015, 10, 10, 0, 0, 0))) ts_types= ['temperature','precipitation'] geo_ts_dict = geo_ts_repository.get_forecast(ts_types,utc_period=utc_period,t_c=None,geo_location_criteria=None) self.assertIsNotNone(geo_ts_dict) for ts_type in ts_types: self.assertTrue(ts_type in geo_ts_dict.keys(),"we ecpect to find an entry for each requested type (it could be empty list though") self.assertTrue(geo_ts_dict[ts_type].size()>0,"we expect to find the series that we pass in, given they have not changed the name in SmG PROD")