def l2anc(x: float): return to_l2anc({ "LST": 0. + x, "Orbit": 1 + int(np.ceil(x)), "SZA1D": 2. + x, "SZA": [3. + x, 4. + x], "Theta": [5. + x, 6. + x], })
def test_get_l2anc_get_called_as_expected(self, patched_get_ancillary_data, level2db): l2getter = smrl2filewriter.L2Getter(1, "Prod1", FakeDatabaseConnector, level2db) fakel2dict = l2dict(0.) l2anc = l2getter.get_l2anc(fakel2dict) patched_get_ancillary_data.assert_has_calls([call(ANY, [fakel2dict])]) assert l2anc == to_l2anc(FAKE_ANC)
def test_to_l2anc_works(l2anc): assert datamodel.to_l2anc(l2anc) == datamodel.L2anc( LST=0., Orbit=1, SZA1D=2., SZA=[3., 4.], Theta=[5., 6.], )
def get_l2anc(self, l2: Dict[str, Any]) -> datamodel.L2anc: return datamodel.to_l2anc(get_ancillary_data(self.db1(), [l2])[0])
def test_l2full_get_data_works(l2, l2i, l2anc, para, expect): l2full = datamodel.L2Full(l2=datamodel.to_l2(l2, "O3"), l2i=datamodel.to_l2i(l2i), l2anc=datamodel.to_l2anc(l2anc)) assert l2full.get_data(para) == expect