Exemplo n.º 1
0
    def test_combine_f107_all(self):
        """Test combine_f107 when all input is provided with '' and '45day'"""

        f107_inst = mm_f107.combine_f107(self.combineInst[''],
                                         self.combineInst['45day'],
                                         **self.combineTimes)

        assert f107_inst.index[0] >= self.combineTimes['start']
        assert f107_inst.index[-1] < self.combineTimes['stop']
        assert len(f107_inst.data.columns) == 1
        assert f107_inst.data.columns[0] == 'f107'

        del f107_inst
Exemplo n.º 2
0
    def test_combine_f107_no_data(self):
        """Test combine_f107 when no data is present for specified times"""

        combo_in = {
            kk: self.combine_inst['forecast']
            for kk in ['standard_inst', 'forecast_inst']
        }
        combo_in['start'] = dt.datetime(2014, 2, 19)
        combo_in['stop'] = dt.datetime(2014, 2, 24)
        f107_inst = mm_f107.combine_f107(**combo_in)

        assert f107_inst.data.isnull().all()["f107"]

        del combo_in, f107_inst
Exemplo n.º 3
0
    def test_combine_f107_inst_time(self):
        """Test combine_f107 with times provided through datasets"""

        self.combineInst['all'].load(date=self.combineTimes['start'])
        self.combineInst['forecast'].load(date=self.test_day)

        f107_inst = mm_f107.combine_f107(self.combineInst['all'],
                                         self.combineInst['forecast'])

        assert f107_inst.index[0] == dt.datetime(1947, 2, 13)
        assert f107_inst.index[-1] <= self.combineTimes['stop']
        assert len(f107_inst.data.columns) == 1
        assert f107_inst.data.columns[0] == 'f107'

        del f107_inst
Exemplo n.º 4
0
    def test_combine_f107_inst_time(self):
        """Test combine_f107 with times provided through datasets"""

        self.combine_inst['historic'].load(
            date=self.combine_inst['historic'].lasp_stime,
            end_date=self.combine_times['start'])
        self.combine_inst['forecast'].load(date=self.test_day)

        f107_inst = mm_f107.combine_f107(self.combine_inst['historic'],
                                         self.combine_inst['forecast'])

        assert f107_inst.index[0] == self.combine_inst['historic'].lasp_stime
        assert f107_inst.index[-1] <= self.combine_times['stop']
        assert len(f107_inst.data.columns) == 1
        assert f107_inst.data.columns[0] == 'f107'

        del f107_inst
Exemplo n.º 5
0
    def test_combine_f107_no_time(self):
        """Test combine_f107 failure when no times are provided"""

        with pytest.raises(ValueError):
            mm_f107.combine_f107(self.combine_inst['historic'],
                                 self.combine_inst['forecast'])
Exemplo n.º 6
0
    def test_combine_f107_none(self):
        """ Test combine_f107 failure when no input is provided"""

        with pytest.raises(TypeError):
            mm_f107.combine_f107()