def update_too_ddt_from_email(): """ find approved obsid from email and update too/ddt lists. no input, but read from email achive. update too_dr/too_list and ddt_list """ # #--- read existing TOO/DDT observations # line = too_dir + 'too_list' tooObsid = tdfnc.read_current_obsid(line) line = too_dir + 'ddt_list' ddtObsid = tdfnc.read_current_obsid(line) # #--- read email and find whether any notificaiton of new DDT/TOO observations available # tooList = [] ddtList = [] tooNew = [] ddtNew = [] chk = read_ddt_too_from_email( tooList, ddtList) #--- function to pick up obsid from email archive if chk == 0: return 0 else: # #--- extract only totally new Obsids # if len(tooList) > 0: tooNew = list(set(tooList).difference(set(tooObsid))) if len(ddtList) > 0: ddtNew = list(set(ddtList).difference(set(ddtObsid))) # #--- if there are actually new obsids, update lists # if len(ddtNew) > 0: tdfnc.update_list('ddt_list', ddtNew) if len(tooNew) > 0: tdfnc.update_list('too_list', tooNew)
def update_too_ddt_from_email(): """ find approved obsid from email and update too/ddt lists. no input, but read from email achive. update too_dr/too_list and ddt_list """ # # --- read existing TOO/DDT observations # line = too_dir + "too_list" tooObsid = tdfnc.read_current_obsid(line) line = too_dir + "ddt_list" ddtObsid = tdfnc.read_current_obsid(line) # # --- read email and find whether any notificaiton of new DDT/TOO observations available # tooNew = [] ddtNew = [] [tooList, ddtList] = read_ddt_too_from_email() # --- function to pick up obsid from email archive # # --- extract only totally new Obsids # if len(tooList) > 0: tooNew = list(set(tooList).difference(set(tooObsid))) if len(tooNew) > 0: tdfnc.update_list("too_list", tooNew) if len(ddtList) > 0: ddtNew = list(set(ddtList).difference(set(ddtObsid))) if len(ddtNew) > 0: tdfnc.update_list("ddt_list", ddtNew) # # --- remove archived and canceled observations and update obs date from the list # remove_old_obs("ddt_list") remove_old_obs("too_list")
def update_too_ddt_from_email(): """ find approved obsid from email and update too/ddt lists. no input, but read from email achive. update too_dr/too_list and ddt_list """ # #--- read existing TOO/DDT observations # line = too_dir + 'too_list' tooObsid = tdfnc.read_current_obsid(line) line = too_dir + 'ddt_list' ddtObsid = tdfnc.read_current_obsid(line) # #--- read email and find whether any notificaiton of new DDT/TOO observations available # tooNew = [] ddtNew = [] [tooList, ddtList] = read_ddt_too_from_email( ) #--- function to pick up obsid from email archive # #--- extract only totally new Obsids # if len(tooList) > 0: tooNew = list(set(tooList).difference(set(tooObsid))) if len(tooNew) > 0: tdfnc.update_list('too_list', tooNew) if len(ddtList) > 0: ddtNew = list(set(ddtList).difference(set(ddtObsid))) if len(ddtNew) > 0: tdfnc.update_list('ddt_list', ddtNew) # #--- remove archived and canceled observations and update obs date from the list # remove_old_obs('ddt_list') remove_old_obs('too_list')
def update_from_ddttoo_html(): """ update too/ddt list based on ddttoo.html entries no input, but use ddttoo.html and current ddt_list and too_list """ # #--- read obsids currently listed ddtoo.html as active # ddtList = [] tooList = [] tdfnc.read_too_ddt_html(ddtList, tooList) # #--- read obsid currently listed on ddt_list and too_list # line = too_dir + 'ddt_list' ddtCurrent = tdfnc.read_current_obsid(line) line = too_dir + 'too_list' tooCurrent = tdfnc.read_current_obsid(line) # #--- compare and select out obsids only listed in ddttoo.html # ddt_new_entry = list(set(ddtList).difference(set(ddtCurrent))) too_new_entry = list(set(tooList).difference(set(tooCurrent))) # #--- update ddt_list and too_list # if len(ddt_new_entry) > 0: tdfnc.update_list('ddt_list', ddt_new_entry) if len(too_new_entry) > 0: tdfnc.update_list('too_list', too_new_entry)