ngamsPlotDataAccess.py 文件源码

python
阅读 20 收藏 0 点赞 0 评论 0

项目:ngas 作者: ICRAR 项目源码 文件源码
def sort_obsid_from_sqlite(sqlite_file):
    """
    """
    import sqlite3 as dbdrv
    obs_dict = defaultdict(int)
    query = "SELECT DISTINCT(obs_id) FROM ac WHERE offline > -1 ORDER BY obs_id"
    dbconn = dbdrv.connect(sqlite_file)
    cur = dbconn.cursor()
    cur.execute(query)
    all_obs = cur.fetchall() # not OK if we have millions of obs numbers
    cur.close()

    for c, obsid_row in enumerate(all_obs):
        obs_dict[obsid_row[0]] = c + 1

    return (obs_dict, all_obs[0][0], all_obs[-1][0])
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号