Commit ce63aa9e authored by BO ZHANG's avatar BO ZHANG 🏀
Browse files

added dm.dfs_l0_check_all()

parent 6427f7d9
Loading
Loading
Loading
Loading
+13 −1
Original line number Diff line number Diff line
@@ -574,7 +574,7 @@ class CsstMsDataManager:
    def dfs_l0_query(self, obs_id: str = "100000100"):
        """ Query L0 data from DFS. """
        result = self.dfs_L0DataApi.find(obs_id=str(obs_id))
        print(f"{result['totalCount']} entries returned from DFS.")
        print(f"{result['totalCount']} records returned from DFS.")
        if not result["code"] == 0:
            raise ValueError(f"DFS returns non-zero code! ({result['code']})")
        tbl = Table([_.__dict__ for _ in result["data"]])
@@ -586,6 +586,18 @@ class CsstMsDataManager:
                    self.logger_ppl.warning(f"Record not found for detector {detector:02d} and obs_type {obs_type}")
        return tbl

    def dfs_l0_check_all(self):
        """ Check all C5.2 L0 data is available in DFS. """
        is_good = True
        for obs_id in range(100000020, 100000155):
            tbl = self.dfs_l0_query(obs_id=f"{obs_id}")
            if len(tbl) == 60:
                self.logger_ppl.info(f"DFS returns {len(tbl)} records for obs_id={obs_id}")
            else:
                is_good = False
                self.logger_ppl.warning(f"DFS returns {len(tbl)} records for obs_id={obs_id}")
        return is_good

    def dfs_l1_query(self, obs_id, detector):
        """ Query L1 data from DFS. """
        pass