Ignore:
Timestamp:
06/07/12 15:57:19 (9 years ago)
Author:
mnagni
Message:

Complete - # 22489: CEDA Observation Collection - phenomenonTime
 http://team.ceda.ac.uk/trac/ceda/ticket/22489
Complete - # 22488: CEDA Observation Collection - Geographical Extent
 http://team.ceda.ac.uk/trac/ceda/ticket/22488

File:
1 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/MolesManager/trunk/src/libs/migration/processor/dataEntity.py

    r8433 r8445  
    4040    calculateHash, findDOIInMigrationDocument,\ 
    4141    hasMOBeenProcessed, getAtomDocumentHashByMO, extractTitle, extractSummary,\ 
    42     createEX_GeographicBoundingBox 
     42    createEX_GeographicBoundingBox, fromDateStringToPhenomenonTime,\ 
     43    comparePhenomenonTimes, compareGeographicBoundingBoxes 
    4344from libs.migration.processor.deployment import DeploymentProcessor 
    4445from logging import StreamHandler 
     
    4950    getCLValue 
    5051from ea_model.ceda_metadatamodel.ceda_observationcollection.ceda_observationcollection import CEDA_ObservationCollection  
     52from MolesManager.moles3epb import getUnifyObservationCollectionPhenomenonTime 
    5153CEDA_TITLE = 'ceda_title' 
    5254 
     
    8082            geographicExtent = createEX_GeographicBoundingBox(float(east), float(north), \ 
    8183                                                              float(west), float(south)) 
    82             if self._dataEntityHasBeenProcessed: 
    83                 DataEntityProcessor.log.warn('The _assignGeographicExtent update is skipped because not implemented') 
    84                 return 
    85              
    86             self.epbRepo.moles3EPB.updateCedaObject(ceda_observationCollection, {'geographicExtent': geographicExtent})                         
     84             
     85            if len(ceda_observationCollection.geographicExtent) == 0 or \ 
     86                (len(ceda_observationCollection.geographicExtent) > 0 and \ 
     87                    not compareGeographicBoundingBoxes(geographicExtent, \ 
     88                                                  ceda_observationCollection.geographicExtent[0])): 
     89                self.epbRepo.moles3EPB.updateCedaObject(ceda_observationCollection, \ 
     90                                                        {'geographicExtent': geographicExtent})                         
    8791        else: 
    8892            self._report.append(NoGeographicalExtensionException(self._dataEntityMigration))           
    8993         
     94    def _assignPhenomenonTime(self, ceda_observationCollection): 
     95        start, end = getUnifyObservationCollectionPhenomenonTime(ceda_observationCollection) 
     96        dateString = start 
     97        if end is not None: 
     98            dateString = '%s/%s' % (start, end) 
     99        pt = fromDateStringToPhenomenonTime(dateString) 
     100         
     101        if ceda_observationCollection.phenomenonTime is not None \ 
     102            and (len(ceda_observationCollection.phenomenonTime) == 0 \ 
     103                 or (len(ceda_observationCollection.phenomenonTime) == 1 and \ 
     104                     not comparePhenomenonTimes(ceda_observationCollection.phenomenonTime[0], pt))): 
     105            self.epbRepo.moles3EPB.updateCedaObject(ceda_observationCollection, {'phenomenonTime': pt})         
    90106 
    91107    def _assignDescription(self, ceda_observationCollection): 
     
    243259            except Exception as ex: 
    244260                self._report.append(ex)                 
     261                         
    245262        self._assignGeographicExtent(obsColl) 
     263        self._assignPhenomenonTime(obsColl)         
    246264           
    247265        return self._report 
Note: See TracChangeset for help on using the changeset viewer.