Esempio n. 1
0
 def test_collect_data(self):
     start_time = '1/1/2015 00:00:00'
     final_time = '1/1/2015 06:00:00'
     # Instantiate control object
     otherinput = exodata.OtherInputFromDF(self.df, \
                                                self.variable_map)
     # Get control data
     otherinput.collect_data(start_time, final_time)
     # Check reference
     df_test = otherinput.display_data()
     self.check_df(df_test, 'collect_data.csv')
Esempio n. 2
0
 def setUp(self):
     self.df = pd.read_csv(
         os.path.join(self.get_unittest_path(), 'resources', 'weather',
                      'Tamb.csv'))
     time = pd.to_datetime(self.df['Time'])
     self.df.set_index(time, inplace=True)
     variable_map = {
         'T': ('Tamb', units.degC)
     }
     # Instantiate control object
     self.otherinput = exodata.OtherInputFromDF(self.df, \
                                                variable_map)
Esempio n. 3
0
 def test_collect_data_tz_handling(self):
     start_time = '1/1/2015 00:00:00'
     final_time = '1/1/2015 06:00:00'
     # Localize timezone
     self.df = self.df.tz_localize('UTC')
     # Instantiate weather object
     with self.assertRaises(TypeError):
         otherinput = exodata.OtherInputFromDF(self.df, \
                                               self.variable_map)
     # Remove timezone
     self.df = self.df.tz_convert(None)
     # Instantiate weather object
     otherinput = exodata.OtherInputFromDF(self.df, \
                                           self.variable_map)
     # Get control data
     otherinput.collect_data(start_time, final_time)
     # Collect twice
     otherinput.collect_data(start_time, final_time)
     # Check reference
     df_test = otherinput.display_data()
     self.check_df(df_test, 'collect_data.csv')