from browser import window, document import time def timeTime(): Logger = window.Logger Registry = window.Registry nj = window.nj vlab = window.vlab filter_label = window.filter_label dates_label = window.dates_label start_label = window.start_label date1 = window.date1 end_label = window.end_label date2 = window.date2 setDatesBtn = window.setDatesBtn resetDatesBtn = window.resetDatesBtn break1 = window.break1 keyword_label = window.keyword_label filter_loader = window.filter_loader keywords = window.keywords setWordsBtn = window.setWordsBtn clearWordsBtn = window.clearWordsBtn break2 = window.break2 area_label = window.area_label addAreaBtn = window.addAreaBtn addAreaText = window.addAreaText dbLogs = window.dbLogs dbPlan = window.dbPlan globe1 = window.globe1 colorLegBut = window.colorLegBut noMatchText = window.noMatchText timelineHeader = window.timelineHeader curTimeText = window.curTimeText W2Label = window.W2Label W1Label = window.W1Label WFDLabel = window.WFDLabel E2Label = window.E2Label E1Label = window.E1Label EFDLabel = window.EFDLabel timeline = window.timeline reqInfoText = window.reqInfoText reqInfo = window.reqInfo activeTimeText = window.activeTimeText mesoText = window.mesoText colorLegHead = window.colorLegHead colorLegText = window.colorLegText exitColorLeg = window.exitColorLeg cornerList = window.cornerList addCornerBtn = window.addCornerBtn resetAreaBtn = window.resetAreaBtn removeAreaBtn = window.removeAreaBtn globeRegion = window.globeRegion timelineregion = window.timelineregion inforegion = window.inforegion mesoTextregion = window.mesoTextregion colorLegendRegion = window.colorLegendRegion searchAreaRegion = window.searchAreaRegion loaded = window.loaded logging = window.logging scanAngToLonLat = window.scanAngToLonLat lonLatToScanAng = window.lonLatToScanAng addsegs = window.addsegs highResPoly = window.highResPoly calcHiResMeso = window.calcHiResMeso calcMeso = window.calcMeso plotMeso = window.plotMeso timeTime = window.timeTime getCurrentTime = window.getCurrentTime string2ts = window.string2ts ts2string = window.ts2string str2timestamp = window.str2timestamp plotReqs = window.plotReqs timelinePlotRequest = window.timelinePlotRequest messort = window.messort plotDefaults = window.plotDefaults timelineClick = window.timelineClick reqsort = window.reqsort currentSort = window.currentSort globePlotRequest = window.globePlotRequest limbCheck = window.limbCheck maxScanAng = window.maxScanAng sunPosition = window.sunPosition loadWelcome = window.loadWelcome hexToRgb = window.hexToRgb showColorLegend = window.showColorLegend hideColLeg = window.hideColLeg dateChange = window.dateChange setDateRange = window.setDateRange resetDates = window.resetDates getReqsFromRange = window.getReqsFromRange convertDateFormat = window.convertDateFormat keywordChange = window.keywordChange applyKeywords = window.applyKeywords plotFiltered = window.plotFiltered clearKeywords = window.clearKeywords clearFilters = window.clearFilters addArea = window.addArea makeCorner = window.makeCorner makeArea = window.makeArea updateArea = window.updateArea resetAreaDrag = window.resetAreaDrag addCorner = window.addCorner resetArea = window.resetArea removeArea = window.removeArea searchArea = window.searchArea test = window.test mesoTimelineID = window.mesoTimelineID globeID = window.globeID highlightMesos = window.highlightMesos unhighlightMesos = window.unhighlightMesos return time.time() window.timeTime = timeTime from browser import window, document import datetime def string2ts(time_tuple): Logger = window.Logger Registry = window.Registry nj = window.nj vlab = window.vlab filter_label = window.filter_label dates_label = window.dates_label start_label = window.start_label date1 = window.date1 end_label = window.end_label date2 = window.date2 setDatesBtn = window.setDatesBtn resetDatesBtn = window.resetDatesBtn break1 = window.break1 keyword_label = window.keyword_label filter_loader = window.filter_loader keywords = window.keywords setWordsBtn = window.setWordsBtn clearWordsBtn = window.clearWordsBtn break2 = window.break2 area_label = window.area_label addAreaBtn = window.addAreaBtn addAreaText = window.addAreaText dbLogs = window.dbLogs dbPlan = window.dbPlan globe1 = window.globe1 colorLegBut = window.colorLegBut noMatchText = window.noMatchText timelineHeader = window.timelineHeader curTimeText = window.curTimeText W2Label = window.W2Label W1Label = window.W1Label WFDLabel = window.WFDLabel E2Label = window.E2Label E1Label = window.E1Label EFDLabel = window.EFDLabel timeline = window.timeline reqInfoText = window.reqInfoText reqInfo = window.reqInfo activeTimeText = window.activeTimeText mesoText = window.mesoText colorLegHead = window.colorLegHead colorLegText = window.colorLegText exitColorLeg = window.exitColorLeg cornerList = window.cornerList addCornerBtn = window.addCornerBtn resetAreaBtn = window.resetAreaBtn removeAreaBtn = window.removeAreaBtn globeRegion = window.globeRegion timelineregion = window.timelineregion inforegion = window.inforegion mesoTextregion = window.mesoTextregion colorLegendRegion = window.colorLegendRegion searchAreaRegion = window.searchAreaRegion loaded = window.loaded logging = window.logging scanAngToLonLat = window.scanAngToLonLat lonLatToScanAng = window.lonLatToScanAng addsegs = window.addsegs highResPoly = window.highResPoly calcHiResMeso = window.calcHiResMeso calcMeso = window.calcMeso plotMeso = window.plotMeso timeTime = window.timeTime getCurrentTime = window.getCurrentTime string2ts = window.string2ts ts2string = window.ts2string str2timestamp = window.str2timestamp plotReqs = window.plotReqs timelinePlotRequest = window.timelinePlotRequest messort = window.messort plotDefaults = window.plotDefaults timelineClick = window.timelineClick reqsort = window.reqsort currentSort = window.currentSort globePlotRequest = window.globePlotRequest limbCheck = window.limbCheck maxScanAng = window.maxScanAng sunPosition = window.sunPosition loadWelcome = window.loadWelcome hexToRgb = window.hexToRgb showColorLegend = window.showColorLegend hideColLeg = window.hideColLeg dateChange = window.dateChange setDateRange = window.setDateRange resetDates = window.resetDates getReqsFromRange = window.getReqsFromRange convertDateFormat = window.convertDateFormat keywordChange = window.keywordChange applyKeywords = window.applyKeywords plotFiltered = window.plotFiltered clearKeywords = window.clearKeywords clearFilters = window.clearFilters addArea = window.addArea makeCorner = window.makeCorner makeArea = window.makeArea updateArea = window.updateArea resetAreaDrag = window.resetAreaDrag addCorner = window.addCorner resetArea = window.resetArea removeArea = window.removeArea searchArea = window.searchArea test = window.test mesoTimelineID = window.mesoTimelineID globeID = window.globeID highlightMesos = window.highlightMesos unhighlightMesos = window.unhighlightMesos """ Converts a datetime string into a different specified format """ Y, m, d, H, M, S = time_tuple in_str = f'{str(Y).zfill(4)}-{str(m).zfill(2)}-{str(d).zfill(2)}T{str(H).zfill(2)}:{str(M).zfill(2)}:{str(S).zfill(2)}' dt = datetime.datetime.strptime(in_str,"%Y-%m-%dT%H:%M:%S") utc = dt.replace(tzinfo=datetime.timezone.utc) ts = utc.timestamp() return int(ts) window.string2ts = string2ts from browser import window, document import datetime def ts2string(ts,fmt='%Y-%m-%dT%H:%MZ'): Logger = window.Logger Registry = window.Registry nj = window.nj vlab = window.vlab filter_label = window.filter_label dates_label = window.dates_label start_label = window.start_label date1 = window.date1 end_label = window.end_label date2 = window.date2 setDatesBtn = window.setDatesBtn resetDatesBtn = window.resetDatesBtn break1 = window.break1 keyword_label = window.keyword_label filter_loader = window.filter_loader keywords = window.keywords setWordsBtn = window.setWordsBtn clearWordsBtn = window.clearWordsBtn break2 = window.break2 area_label = window.area_label addAreaBtn = window.addAreaBtn addAreaText = window.addAreaText dbLogs = window.dbLogs dbPlan = window.dbPlan globe1 = window.globe1 colorLegBut = window.colorLegBut noMatchText = window.noMatchText timelineHeader = window.timelineHeader curTimeText = window.curTimeText W2Label = window.W2Label W1Label = window.W1Label WFDLabel = window.WFDLabel E2Label = window.E2Label E1Label = window.E1Label EFDLabel = window.EFDLabel timeline = window.timeline reqInfoText = window.reqInfoText reqInfo = window.reqInfo activeTimeText = window.activeTimeText mesoText = window.mesoText colorLegHead = window.colorLegHead colorLegText = window.colorLegText exitColorLeg = window.exitColorLeg cornerList = window.cornerList addCornerBtn = window.addCornerBtn resetAreaBtn = window.resetAreaBtn removeAreaBtn = window.removeAreaBtn globeRegion = window.globeRegion timelineregion = window.timelineregion inforegion = window.inforegion mesoTextregion = window.mesoTextregion colorLegendRegion = window.colorLegendRegion searchAreaRegion = window.searchAreaRegion loaded = window.loaded logging = window.logging scanAngToLonLat = window.scanAngToLonLat lonLatToScanAng = window.lonLatToScanAng addsegs = window.addsegs highResPoly = window.highResPoly calcHiResMeso = window.calcHiResMeso calcMeso = window.calcMeso plotMeso = window.plotMeso timeTime = window.timeTime getCurrentTime = window.getCurrentTime string2ts = window.string2ts ts2string = window.ts2string str2timestamp = window.str2timestamp plotReqs = window.plotReqs timelinePlotRequest = window.timelinePlotRequest messort = window.messort plotDefaults = window.plotDefaults timelineClick = window.timelineClick reqsort = window.reqsort currentSort = window.currentSort globePlotRequest = window.globePlotRequest limbCheck = window.limbCheck maxScanAng = window.maxScanAng sunPosition = window.sunPosition loadWelcome = window.loadWelcome hexToRgb = window.hexToRgb showColorLegend = window.showColorLegend hideColLeg = window.hideColLeg dateChange = window.dateChange setDateRange = window.setDateRange resetDates = window.resetDates getReqsFromRange = window.getReqsFromRange convertDateFormat = window.convertDateFormat keywordChange = window.keywordChange applyKeywords = window.applyKeywords plotFiltered = window.plotFiltered clearKeywords = window.clearKeywords clearFilters = window.clearFilters addArea = window.addArea makeCorner = window.makeCorner makeArea = window.makeArea updateArea = window.updateArea resetAreaDrag = window.resetAreaDrag addCorner = window.addCorner resetArea = window.resetArea removeArea = window.removeArea searchArea = window.searchArea test = window.test mesoTimelineID = window.mesoTimelineID globeID = window.globeID highlightMesos = window.highlightMesos unhighlightMesos = window.unhighlightMesos """ Converts unix timestamp to string in specified format """ dt = datetime.datetime.fromtimestamp(ts,datetime.UTC) string = dt.strftime(fmt) return string window.ts2string = ts2string from browser import window, document import re def hexToRgb(hex_str): Logger = window.Logger Registry = window.Registry nj = window.nj vlab = window.vlab filter_label = window.filter_label dates_label = window.dates_label start_label = window.start_label date1 = window.date1 end_label = window.end_label date2 = window.date2 setDatesBtn = window.setDatesBtn resetDatesBtn = window.resetDatesBtn break1 = window.break1 keyword_label = window.keyword_label filter_loader = window.filter_loader keywords = window.keywords setWordsBtn = window.setWordsBtn clearWordsBtn = window.clearWordsBtn break2 = window.break2 area_label = window.area_label addAreaBtn = window.addAreaBtn addAreaText = window.addAreaText dbLogs = window.dbLogs dbPlan = window.dbPlan globe1 = window.globe1 colorLegBut = window.colorLegBut noMatchText = window.noMatchText timelineHeader = window.timelineHeader curTimeText = window.curTimeText W2Label = window.W2Label W1Label = window.W1Label WFDLabel = window.WFDLabel E2Label = window.E2Label E1Label = window.E1Label EFDLabel = window.EFDLabel timeline = window.timeline reqInfoText = window.reqInfoText reqInfo = window.reqInfo activeTimeText = window.activeTimeText mesoText = window.mesoText colorLegHead = window.colorLegHead colorLegText = window.colorLegText exitColorLeg = window.exitColorLeg cornerList = window.cornerList addCornerBtn = window.addCornerBtn resetAreaBtn = window.resetAreaBtn removeAreaBtn = window.removeAreaBtn globeRegion = window.globeRegion timelineregion = window.timelineregion inforegion = window.inforegion mesoTextregion = window.mesoTextregion colorLegendRegion = window.colorLegendRegion searchAreaRegion = window.searchAreaRegion loaded = window.loaded logging = window.logging scanAngToLonLat = window.scanAngToLonLat lonLatToScanAng = window.lonLatToScanAng addsegs = window.addsegs highResPoly = window.highResPoly calcHiResMeso = window.calcHiResMeso calcMeso = window.calcMeso plotMeso = window.plotMeso timeTime = window.timeTime getCurrentTime = window.getCurrentTime string2ts = window.string2ts ts2string = window.ts2string str2timestamp = window.str2timestamp plotReqs = window.plotReqs timelinePlotRequest = window.timelinePlotRequest messort = window.messort plotDefaults = window.plotDefaults timelineClick = window.timelineClick reqsort = window.reqsort currentSort = window.currentSort globePlotRequest = window.globePlotRequest limbCheck = window.limbCheck maxScanAng = window.maxScanAng sunPosition = window.sunPosition loadWelcome = window.loadWelcome hexToRgb = window.hexToRgb showColorLegend = window.showColorLegend hideColLeg = window.hideColLeg dateChange = window.dateChange setDateRange = window.setDateRange resetDates = window.resetDates getReqsFromRange = window.getReqsFromRange convertDateFormat = window.convertDateFormat keywordChange = window.keywordChange applyKeywords = window.applyKeywords plotFiltered = window.plotFiltered clearKeywords = window.clearKeywords clearFilters = window.clearFilters addArea = window.addArea makeCorner = window.makeCorner makeArea = window.makeArea updateArea = window.updateArea resetAreaDrag = window.resetAreaDrag addCorner = window.addCorner resetArea = window.resetArea removeArea = window.removeArea searchArea = window.searchArea test = window.test mesoTimelineID = window.mesoTimelineID globeID = window.globeID highlightMesos = window.highlightMesos unhighlightMesos = window.unhighlightMesos # provide the hex color without the "#" in front R, G, B = bytes.fromhex(hex_str) return R, G, B window.hexToRgb = hexToRgb from browser import window, document event = window.Event.new('brython_rdy') document.dispatchEvent(event)