Loading csst_common/dfs.py +24 −56 Original line number Diff line number Diff line Loading @@ -10,66 +10,34 @@ Modified-History: 2023-12-08, Bo Zhang, tweaks 2023-12-20, Bo Zhang, do nothing in DFS.__init__() 2023-12-28, Bo Zhang, add DFS.rec_to_table and DFS.rec_to_dlist 2025-01-02, Bo Zhang, use csst_dfs_client """ from astropy.table import Table from csst_dfs_api.common.catalog import CatalogApi from csst_dfs_api.facility import ( Level0DataApi, Level0PrcApi, Level1DataApi, Level1PrcApi, Level2DataApi, Level2TypeApi, OtherDataApi, from csst_dfs_client import ( level0, level1, level2, catalog, plan, ) # from csst_dfs_api.common.catalog import CatalogApi # from csst_dfs_api.facility import ( # Level0DataApi, # Level0PrcApi, # Level1DataApi, # Level1PrcApi, # Level2DataApi, # Level2TypeApi, # OtherDataApi, # ) class DFS: def __init__(self): pass # DFS APIs @property def L0DataApi(self): return Level0DataApi() @property def L0PrcApi(self): return Level0PrcApi() @property def L1DataApi(self): return Level1DataApi() @property def L1PrcApi(self): return Level1PrcApi() @property def L2DataApi(self): return Level2DataApi() @property def L2TypeApi(self): return Level2TypeApi() @property def OtherDataApi(self): return OtherDataApi() @property def CatApi(self): return CatalogApi() @staticmethod def rec_to_table(rec): assert rec["code"] == 0, rec data = list(zip(*rec["data"])) colnames = rec["columns"] return Table(data=data, names=colnames) @staticmethod def rec_to_dlist(rec): assert rec["code"] == 0, rec colnames = rec["columns"] return [dict(zip(colnames, _)) for _ in rec["data"]] self.level0 = level0 self.level1 = level1 self.level2 = level2 self.catalog = catalog self.plan = plan Loading
csst_common/dfs.py +24 −56 Original line number Diff line number Diff line Loading @@ -10,66 +10,34 @@ Modified-History: 2023-12-08, Bo Zhang, tweaks 2023-12-20, Bo Zhang, do nothing in DFS.__init__() 2023-12-28, Bo Zhang, add DFS.rec_to_table and DFS.rec_to_dlist 2025-01-02, Bo Zhang, use csst_dfs_client """ from astropy.table import Table from csst_dfs_api.common.catalog import CatalogApi from csst_dfs_api.facility import ( Level0DataApi, Level0PrcApi, Level1DataApi, Level1PrcApi, Level2DataApi, Level2TypeApi, OtherDataApi, from csst_dfs_client import ( level0, level1, level2, catalog, plan, ) # from csst_dfs_api.common.catalog import CatalogApi # from csst_dfs_api.facility import ( # Level0DataApi, # Level0PrcApi, # Level1DataApi, # Level1PrcApi, # Level2DataApi, # Level2TypeApi, # OtherDataApi, # ) class DFS: def __init__(self): pass # DFS APIs @property def L0DataApi(self): return Level0DataApi() @property def L0PrcApi(self): return Level0PrcApi() @property def L1DataApi(self): return Level1DataApi() @property def L1PrcApi(self): return Level1PrcApi() @property def L2DataApi(self): return Level2DataApi() @property def L2TypeApi(self): return Level2TypeApi() @property def OtherDataApi(self): return OtherDataApi() @property def CatApi(self): return CatalogApi() @staticmethod def rec_to_table(rec): assert rec["code"] == 0, rec data = list(zip(*rec["data"])) colnames = rec["columns"] return Table(data=data, names=colnames) @staticmethod def rec_to_dlist(rec): assert rec["code"] == 0, rec colnames = rec["columns"] return [dict(zip(colnames, _)) for _ in rec["data"]] self.level0 = level0 self.level1 = level1 self.level2 = level2 self.catalog = catalog self.plan = plan