Esempio n. 1
0
 def buildProductName(self, met=None, ext=None):
     if self.debug!=0:
         print " NamingConvention.buildProductName, pattern used:%s" % self.usedPattern
     toks = self.PATTERN.split('_')
     res=''
     for tok in toks:
         if self.debug!=0:
             print "doing token:%s" % tok
         if tok=='<SSS>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_PLATFORM), len(tok)-3, None, 1).upper()
             tmp1=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_PLATFORM_ID), len(tok)-4, None, 1)
             res="%s%s" % (tmp, tmp1)
             if self.debug!=0:
                 print "res is now:%s"% res
         elif tok=='<CCCC>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_FILECLASS), len(tok)-2)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "res1 is now:%s"% res
         elif tok=='<TTTTTTTTTT>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_TYPECODE), 10)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "res2 is now:%s"% res
         elif tok=='<instance ID>.<extension>':
             tmp=self.buildInstance(met)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "res3 is now:%s"% res
     if ext!=None:
         res="%s.%s" % (res, ext)
     return res
Esempio n. 2
0
 def buildInstance(self, met=None):
     res=''
     for tok in self.usedPattern.split('_'):
         if self.debug!=0:
             print "doing instance token:%s" % tok
         if tok=='<yyyymmddThhmmss>':
             tmp=formatUtils.normaliseDate(met.getMetadataValue(metadata.METADATA_START_DATE), 8)
             tmp1=formatUtils.normaliseTime(met.getMetadataValue(metadata.METADATA_START_TIME), 6)
             res="%sT%s" % (tmp, tmp1)
             if self.debug!=0:
                 print "res4 is now:%s"% res
         if tok=='<YYYYMMDDTHHMMSS>':
             tmp=formatUtils.normaliseDate(met.getMetadataValue(metadata.METADATA_STOP_DATE), 8)
             tmp1=formatUtils.normaliseTime(met.getMetadataValue(metadata.METADATA_STOP_TIME), 6)
             res="%s_%sT%s" % (res, tmp, tmp1)
             if self.debug!=0:
                 print "res5 is now:%s"% res
         if tok=='<vvvv>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_VERSION), len(tok)-2)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "resV is now:%s"% res
         if tok=='<oooooo>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_ORBIT), len(tok)-2, '0')
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "resO is now:%s"% res
         if tok=='<tttt>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_TRACK), len(tok)-2)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "resT is now:%s"% res
         if tok=='<ffff>':
             tmp=formatUtils.normaliseNumber(met.getMetadataValue(metadata.METADATA_FRAME), len(tok)-2)
             res="%s_%s" % (res, tmp)
             if self.debug!=0:
                 print "resF is now:%s"% res
     return res