Esempio n. 1
0
    def __convertJavaObjToPyWrapper(self, javaObj):
        objtype = javaObj.java_name
        if objtype == "com.raytheon.uf.common.dataplugin.gfe.db.objects.DatabaseID":
            retVal = DatabaseID.DatabaseID(javaObj)
        elif objtype == "com.raytheon.uf.common.dataplugin.gfe.db.objects.ParmID":
            retVal = ParmID.ParmID(javaObj)
        elif objtype == "com.raytheon.uf.common.time.TimeRange":
            retVal = TimeRange.TimeRange(javaObj)
        else:
            retVal = None

        return retVal
Esempio n. 2
0
    def _makeRecordWithoutVTEC(self, ugcstring, segment, segmentText, cities,
                               purgeTime, ugcs):
        records = []

        #construct the active table entries, without the geography
        template = {}
        template['segText'] = segmentText
        template['overviewText'] = self._overviewText
        template['seg'] = segment
        startTime = self._issueTime * 1000
        ddhhmmz = ugcstring[-7:-1]
        endTime = self._dtgFromDDHHMM(ddhhmmz) * 1000
        template['startTime'] = long(startTime)
        template['endTime'] = long(endTime)
        template['ufn'] = True  # is this correct?
        if self._officeFromWMO:
            template['officeid'] = self._officeFromWMO

        template['purgeTime'] = long(
            self._dtgFromDDHHMM(purgeTime, self._issueTime) * 1000)
        template['issueTime'] = long(self._issueTime * 1000)
        template['state'] = "Decoded"
        template['xxxid'] = self._completeProductPil[3:]
        template['countyheader'] = ugcstring[:-8]
        if self._productPil[:3] in ACCURATE_CITIES_PILS:
            template['cities'] = cities
        template['pil'] = self._productPil
        template['ugcZoneList'] = ", ".join(ugcs)
        state = ugcstring[0:2]
        if REGIONS.has_key(state):
            template['region'] = REGIONS[state]
        else:
            template['region'] = 'DEFAULT'
        template['wmoid'] = self._wmoid
        template['geometry'] = self._polygon
        try:
            from com.raytheon.uf.common.time import DataTime, TimeRange
            valid = TimeRange(long(startTime), long(endTime))
            template['dataTime'] = DataTime(long(startTime), valid)
        except:
            template['dataTime'] = long(endTime)

        template['rawmessage'] = self._rawMessage
        if self._storm is not None:
            template['motdir'] = self._storm[0]
            template['motspd'] = self._storm[1]
            template['loc'] = self._storm[2]

        records.append(template)

        return records
Esempio n. 3
0
    def _expandVTEC(self, ugcstring, vtecStrings, segment, segmentText, cities,
                    purgeTime):
        #Routine takes a list of vtec strings and expands them out into
        #the format of the active table.
        #Returns the records.
        ugcs = self._expandUGC(ugcstring)
        records = []
        for vtecS, hvtec in vtecStrings:
            search = re.search(self._vtecRE, vtecS)

            #construct the active table entries, without the geography
            template = {}
            template['vtecstr'] = search.group(0)
            template['etn'] = search.group(5)
            template['sig'] = search.group(4)
            template['phen'] = search.group(3)
            template['segText'] = segmentText
            template['overviewText'] = self._overviewText
            template['phensig'] = template['phen'] + '.' + template['sig']
            template['act'] = search.group(1)
            template['seg'] = segment
            startTime, zeros = self._calcTime(search.group(6), search.group(7),
                                              self._issueTime * 1000)
            endTime, ufn = self._calcTime(search.group(8), search.group(9),
                                          self._maxFutureTime * 1000)
            template['startTime'] = long(startTime)
            template['endTime'] = long(endTime)
            template['ufn'] = ufn
            template['officeid'] = search.group(2)
            template['purgeTime'] = long(
                self._dtgFromDDHHMM(purgeTime, self._issueTime) * 1000)
            template['issueTime'] = long(self._issueTime * 1000)
            template['state'] = "Decoded"
            template['xxxid'] = self._completeProductPil[3:]
            if (self._hasDTG):
                template['countyheader'] = ugcstring[:-8]
            else:
                template['countyheader'] = ugcstring
            if self._productPil[:3] in ACCURATE_CITIES_PILS:
                template['cities'] = cities

            #remap pil if in mappedPils table to relate events that are
            #issued in one product, and updated in another product
            template['pil'] = self._remapPil(template['phen'], template['sig'],
                                             self._productPil)

            template['ugcZoneList'] = ", ".join(ugcs)
            state = ugcstring[0:2]
            if REGIONS.has_key(state):
                template['region'] = REGIONS[state]
            else:
                template['region'] = 'DEFAULT'
            template['wmoid'] = self._wmoid
            template['productClass'] = template['vtecstr'][1]
            template['geometry'] = self._polygon
            try:
                from com.raytheon.uf.common.time import DataTime, TimeRange
                valid = TimeRange(long(startTime), long(endTime))
                template['dataTime'] = DataTime(long(startTime), valid)
            except:
                template['dataTime'] = long(endTime)

            template['rawmessage'] = self._rawMessage
            if self._storm is not None:
                template['motdir'] = self._storm[0]
                template['motspd'] = self._storm[1]
                template['loc'] = self._storm[2]

            if hvtec is not None:
                hsearch = re.search(self._hVtecRE, hvtec)
                template['locationID'] = hsearch.group(1)
                template['floodSeverity'] = hsearch.group(2)
                template['immediateCause'] = hsearch.group(3)
                template['floodRecordStatus'] = hsearch.group(10)

                if template['phensig'] in PHENSIGS_IGNORE_HVTEC:
                    fakeBeginTime = None
                    fakeEndTime = None
                    fakeCrestTime = None
                else:
                    fakeBeginTime = template['issueTime']
                    fakeEndTime = long(self._maxFutureTime * 1000)
                    fakeCrestTime = fakeEndTime
                template['floodBegin'] = self._calcTime(
                    hsearch.group(4), hsearch.group(5), fakeBeginTime)[0]
                template['floodCrest'] = self._calcTime(
                    hsearch.group(6), hsearch.group(7), fakeCrestTime)[0]
                template['floodEnd'] = self._calcTime(hsearch.group(8),
                                                      hsearch.group(9),
                                                      fakeEndTime)[0]

            records.append(template)

        return records
Esempio n. 4
0
    def _makeRecordWithoutVTEC(self, ugcstring, vtecStrings, segment,
                               segmentText, cities, purgeTime, ugcs):
        records = []
        #for vtecS, hvtec in vtecStrings:
        #search = re.search(self._vtecRE, vtecS)

        #construct the active table entries, without the geography
        template = {}
        #template['vtecstr'] = search.group(0)
        #template['etn'] = search.group(5)
        #template['sig'] = search.group(4)
        #template['phen'] = search.group(3)
        template['segText'] = segmentText
        template['overviewText'] = self._overviewText
        #template['phensig'] = template['phen'] + '.' + template['sig']
        #template['act'] = search.group(1)
        template['seg'] = segment
        #startTime, zeros = self._calcTime(search.group(6),
        #  search.group(7), self._issueTime * 1000)
        startTime = self._issueTime * 1000
        #endTime, ufn = self._calcTime(search.group(8),
        #  search.group(9), self._maxFutureTime * 1000)
        ddhhmmz = ugcstring[-7:-1]
        endTime = self._dtgFromDDHHMM(ddhhmmz) * 1000
        template['startTime'] = long(startTime)
        template['endTime'] = long(endTime)
        #if ufn:
        template['ufn'] = True
        #else:
        #    template['ufn'] = False
        #template['officeid'] = search.group(2)
        if self._officeFromWMO:
            template['officeid'] = self._officeFromWMO

        template['purgeTime'] = long(
            self._dtgFromDDHHMM(purgeTime, self._issueTime) * 1000)
        template['issueTime'] = long(self._issueTime * 1000)
        template['state'] = "Decoded"
        template['xxxid'] = self._completeProductPil[3:]
        template['countyheader'] = ugcstring[:-8]
        if self._productPil[:3] in ACCURATE_CITIES_PILS:
            template['cities'] = cities

        #remap pil if in mappedPils table to relate events that are
        #issued in one product, and updated in another product
        #template['pil'] = self._remapPil(template['phen'],
        #  template['sig'], self._productPil)
        template['pil'] = self._productPil
        template['ugcs'] = ugcs
        state = ugcstring[0:2]
        if REGIONS.has_key(state):
            template['region'] = REGIONS[state]
        else:
            template['region'] = 'DEFAULT'
        template['wmoid'] = self._wmoid
        #template['productClass'] = template['vtecstr'][1]
        template['geometry'] = self._polygon
        try:
            from com.raytheon.uf.common.time import DataTime, TimeRange
            valid = TimeRange(long(startTime), long(endTime))
            template['dataTime'] = DataTime(long(startTime), valid)
        except:
            template['dataTime'] = long(endTime)

        template['rawmessage'] = self._rawMessage
        if self._storm is not None:
            template['motdir'] = self._storm[0]
            template['motspd'] = self._storm[1]
            template['loc'] = self._storm[2]

        #if hvtec is not None:
        #    hsearch = re.search(self._hVtecRE, hvtec)
        #    template['locationID'] = hsearch.group(1)
        #    template['floodSeverity'] = hsearch.group(2)
        #    template['immediateCause'] = hsearch.group(3)
        #    template['floodRecordStatus'] = hsearch.group(10)
        #    template['floodBegin'] = long(self._calcTime(hsearch.group(4), hsearch.group(5), self._issueTime)[0])
        #    template['floodCrest'] = long(self._calcTime(hsearch.group(6), hsearch.group(7), self._issueTime)[0])
        #    template['floodEnd'] = long(self._calcTime(hsearch.group(8), hsearch.group(9), self._issueTime)[0])

        records.append(template)
        #expand the template out by the ugcs
        #for geo in ugcs:
        #    dict = copy.deepcopy(template)
        #    dict['id'] = geo
        #    records.append(dict)

        return records
Esempio n. 5
0
def toJavaTimeRange(tr):
    return TimeRange(long(tr[0]) * long(1000), long(tr[1]) * long(1000))