当前位置: 首页>>代码示例>>Python>>正文


Python LDSUtilities.checkDateFormat方法代码示例

本文整理汇总了Python中lds.LDSUtilities.LDSUtilities.checkDateFormat方法的典型用法代码示例。如果您正苦于以下问题:Python LDSUtilities.checkDateFormat方法的具体用法?Python LDSUtilities.checkDateFormat怎么用?Python LDSUtilities.checkDateFormat使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在lds.LDSUtilities.LDSUtilities的用法示例。


在下文中一共展示了LDSUtilities.checkDateFormat方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: processLDS

# 需要导入模块: from lds.LDSUtilities import LDSUtilities [as 别名]
# 或者: from lds.LDSUtilities.LDSUtilities import checkDateFormat [as 别名]
    def processLDS(self):
        '''Process with LDS as a source and the destination supplied as an argument'''

        #fname = dst.DRIVER_NAME.lower()+self.LP_SUFFIX
        
        self.dst.applyConfigOptions()

        self.dst.setSRS(self.epsg)
        #might as well initds here, its going to be needed eventually
        if not self.dst.getDS():
            ldslog.info('Initialising absent DST.DS. This is not recommended in GUI/threaded mode')
            self.dst.setDS(self.dst.initDS(self.dst.destinationURI(None)))#DataStore.LDS_CONFIG_TABLE))

        self.dst.versionCheck()
        (self.sixtyfourlayers,self.partitionlayers,self.partitionsize,self.prefetchsize) = self.dst.confwrap.readDSParameters('Misc',{'idp':self.src.idp})

        if not self.dst.getLayerConf():
            self.dst.setLayerConf(TransferProcessor.getNewLayerConf(self.dst))        

        #still used on command line
        if self.getInitConfig():
            TransferProcessor.initialiseLayerConfig(self.src,self.dst)
        if self.dst.getLayerConf() is None:
            raise LayerConfigurationException("Cannot initialise Layer-Configuration file/table, "+str(self.dst.getConfInternal()))

        #------------------------------------------------------------------------------------------
        #Valid layers are those that exist in LDS and are also configured in the LC
        self.readCapsDoc(self.src)
        lds_valid = [i[0] for i in self.assembleLayerList(intersect=True)]
        #if layer provided, check that layer is in valid list
        #else if group then intersect valid and group members
        lgid = self.idLayerOrGroup(self.lgval)
        if lgid == LORG.GROUP:
            self.lnl = set()
            group = set(self.lgval.split(','))
            for lid in lds_valid:
                cats = self.dst.getLayerConf().readLayerProperty(lid,'category')
                #if cats and set([f.encode('utf8').strip() for f in cats.split(',')]).intersection(group):
                if cats and set([LU.recode(f) for f in cats.split(',')]).intersection(group):
                    self.lnl.update((lid,))
                
            if not len(self.lnl):
                ldslog.warn('Possible mis-identified Group, {}'.format(group))
                lgid = LORG.LAYER
                
        if lgid == LORG.LAYER:
            layer = LU.checkLayerName(self.dst.getLayerConf(),self.lgval) 
            if layer in lds_valid:
                self.lnl = (layer,)
            else:
                raise InputMisconfigurationException('Layer '+str(layer)+' invalid')
            
        #override config file dates with command line dates if provided
        ldslog.debug("SelectedLayers={}".format(len(self.lnl)))
        #ldslog.debug("Layer List:"+str(self.lnl))
        
        #------------------------------------------------------------------------------------------  
        
        #Before we go any further, if this is a cleaning job, no point doing anymore setup. Start deleting
        if self.getCleanConfig():
            for cleanlayer in self.lnl:
                self.cleanLayer(cleanlayer,truncate=False)
            return

        #build a list of layers with corresponding lastmodified/incremental flags
        fd = LU.checkDateFormat(self.fromdate)#if date format wrong treated as None
        td = LU.checkDateFormat(self.todate)
        self.layer_total = len(self.lnl)
        self.layer_count = 0
        for each_layer in self.lnl:
            ldslog.debug('BENCHMARK '+each_layer)
            lm = LU.checkDateFormat(self.dst.getLastModified(each_layer))
            srs = self.dst.getEPSGConversion(each_layer)
            pk = self.hasPrimaryKey(each_layer)
            filt = self.dst.getLayerConf().readLayerProperty(each_layer,'cql')
            #Set (cql) filters in URI call using layer picking the one with highest precedence            
            self.src.setFilter(LU.precedence(self.cql,self.dst.getFilter(),filt))
        
            #SRS are set in the DST since the conversion takes place during the write process. Needed here to trigger bypass to featureCopy 
            #print 'tp.epsg=',self.epsg,'srs=',srs,'!getsrs=',self.dst.getSRS()
            self.dst.setSRS(LU.precedence(self.epsg,srs,None))

            #Destination URI won't change because of incremental so set it here
            self.dst.setURI(self.dst.destinationURI(each_layer))
            #RB dst (not implemented)
            #self.dst.setURI(self.dst.requestbuilder.destinationURI(each_layer))
                
            #if PK is none do paging since page index uses pk (can't lookup matching FIDs for updates/deletes?)
            if pk:
                gdal.SetConfigOption('OGR_WFS_PAGING_ALLOWED','ON')
            else:
                gdal.SetConfigOption('OGR_WFS_PAGING_ALLOWED','OFF')
                
            #check dates -> check incr read -> incr or non

            nonincr = False          
            if any(i for i in [lm, fd, td]) and pk:
                ldslog.debug('lm={}, fd={}, td={}'.format(lm,fd,td))
                final_fd = (DataStore.EARLIEST_INIT_DATE if lm is None else lm) if fd is None else fd
                final_td = self.dst.getCurrent() if td is None else td
#.........这里部分代码省略.........
开发者ID:josephramsay,项目名称:LDS,代码行数:103,代码来源:TransferProcessor.py


注:本文中的lds.LDSUtilities.LDSUtilities.checkDateFormat方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。