def test_get_timeseries_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'/NeNi-Sylsjøen......-T0017V3KI0114', precipitation=u'/NeNi-Sylsjøen-2....-T0000D9BI0124'), MetStationConfig( gis_id=574, temperature=u'/NeNi-Stuggusjøen...-T0017V3KI0114', precipitation=u'/NeNi-Stuggusjøen...-T0000D9BI0124', radiation= u'/ENKI/STS/Radiation/Sim.-Stuggusjøen...-T0006A0B-0119') ] #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(2010, 1, 1, 0, 0, 0)), utc.time(YMDhms(2010, 1, 2, 0, 0, 0))) ts_types = ['temperature', 'precipitation', 'radiation'] geo_ts_dict = geo_ts_repository.get_timeseries( ts_types, utc_period=utc_period, 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_timeseries_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'/NeNi-Sylsjøen......-T0017V3KI0114', precipitation=u'/NeNi-Sylsjøen-2....-T0000D9BI0124'), MetStationConfig(gis_id=574, temperature=u'/NeNi-Stuggusjøen...-T0017V3KI0114', precipitation=u'/NeNi-Stuggusjøen...-T0000D9BI0124') ] 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(2016, 1, 1, 0, 0, 0)), utc.time(YMDhms(2016, 1, 2, 0, 0, 0))) ts_types= ['temperature', 'precipitation'] geo_ts_dict = geo_ts_repository.get_timeseries(ts_types, utc_period=utc_period, 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, given by name in SmG PREPROD")
def test_get_timeseries_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'/NeNi-Sylsjøen......-T0017V3KI0114', precipitation=u'/NeNi-Sylsjøen-2....-T0000D9BI0124'), MetStationConfig(gis_id=460, temperature=u'/NeNi-Stuggusjøen...-T0017V3KI0114', precipitation=u'/NeNi-Stuggusjøen...-T0000D9BI0124') ] 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(2016, 1, 1, 0, 0, 0)), utc.time(YMDhms(2016, 1, 2, 0, 0, 0))) ts_types= ['temperature', 'precipitation'] geo_ts_dict = geo_ts_repository.get_timeseries(ts_types, utc_period=utc_period, 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, given by name in SmG PREPROD")
def test_get_timeseries_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'/NeNi-Sylsjøen......-T0017V3KI0114',precipitation=u'/NeNi-Sylsjøen-2....-T0000D9BI0124'), MetStationConfig(gis_id=574,temperature=u'/NeNi-Stuggusjøen...-T0017V3KI0114',precipitation=u'/NeNi-Stuggusjøen...-T0000D9BI0124',radiation=u'/ENKI/STS/Radiation/Sim.-Stuggusjøen...-T0006A0B-0119') ] #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(2010, 1, 1, 0, 0, 0)),utc.time(YMDhms(2010, 1, 2, 0, 0, 0))) ts_types= ['temperature','precipitation','radiation'] geo_ts_dict = geo_ts_repository.get_timeseries(ts_types,utc_period=utc_period,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")