Changeset 8417


Ignore:
Timestamp:
27/06/12 16:49:04 (7 years ago)
Author:
mnagni
Message:

Complete - # 22511: ceda_collection title and description
 http://team.ceda.ac.uk/trac/ceda/ticket/22511

Location:
mauRepo/HPFos/trunk/src/HPFos
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • mauRepo/HPFos/trunk/src/HPFos/ceda_guid.py

    r8348 r8417  
    11''' 
     2BSD Licence 
     3Copyright (c) 2012, Science & Technology Facilities Council (STFC) 
     4All rights reserved. 
     5 
     6Redistribution and use in source and binary forms, with or without modification,  
     7are permitted provided that the following conditions are met: 
     8 
     9    * Redistributions of source code must retain the above copyright notice,  
     10        this list of conditions and the following disclaimer. 
     11    * Redistributions in binary form must reproduce the above copyright notice, 
     12        this list of conditions and the following disclaimer in the documentation 
     13        and/or other materials provided with the distribution. 
     14    * Neither the name of the Science & Technology Facilities Council (STFC)  
     15        nor the names of its contributors may be used to endorse or promote  
     16        products derived from this software without specific prior written permission. 
     17 
     18THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"  
     19AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,  
     20THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR  
     21PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS 
     22BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY,  
     23OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF  
     24SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) 
     25HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, 
     26OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE  
     27OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 
    228Created on 13 Apr 2012 
    329 
  • mauRepo/HPFos/trunk/src/HPFos/moles3epb.py

    r8406 r8417  
    148148            @return: a list of CEDA_ObservationCollections or None if empty   
    149149        """ 
     150         
    150151        collections = self._session.query(CEDA_ObservationCollection).all() 
     152        '''         
     153        for item in self._session.query(CEDA_ObservationCollection): 
     154            collections.append(self.searchSelectiveLoadByInstance(item, \ 
     155                                                           ['identifier', 'geographicExtent'])) 
     156        '''     
    151157        if bbox == None: 
    152158            return collections 
     
    160166         
    161167    def searchEager(self, clazz, inst_id): 
    162         return EPB.searchEager(clazz, inst_id)      
     168        return EPB.searchEager(clazz, inst_id, self._session)      
    163169      
    164170    def persistInstance(self, instance): 
  • mauRepo/HPFos/trunk/src/HPFos/osImpl/myimpl.py

    r8406 r8417  
    5555BBOX = 'box' 
    5656 
     57CEDA_TITLE = 'ceda_title' 
     58 
    5759def calculateStep(**kwargs): 
    5860    step = 20 
     
    175177        for subresult in subresults:  
    176178            #Here could loop over results 
    177             ititle = Title(Info.TEXT_TYPE, subresult.title) 
    178             icontent = Content(Info.HTML_TYPE, '<b> Search Feed  </b>  \ 
    179                 <ul> <li> Title: ASAR Image Mode source packets Level 0 (ASA_IM__0P) </li> \ 
    180              The ASAR Image Mode source packets Level 0 data product offers Level 0 data for possible images processing on an other processing site. It includes some mandatory information for SAR processing. The Image Mode Level 0 product consists of time-ordered Annotated Instrument Source Packets (AISPs) collected while the instrument is in Image Mode. The echo samples contained in the AISPs are compressed to 4 bits/sample using Flexible Block Adaptive Quantisation (FBAQ). This is a high-rate, narrow swath mode so data is only acquired for partial orbit segments and may be from one of seven possible image swaths. The Level 0 product is produced systematically for all data acquired within this mode. This product provides a continuation of the ERS-SAR_RAW product.<li> Abstract: The ASAR Image Mode source packets Level 0 data product offers Level 0 data for possible images processing on an other processing site. It includes some mandatory information for SAR processing. The Image Mode Level 0 product consists of time-ordered Annotated Instrument Source Packets (AISPs) collected while the instrument is in Image Mode. The echo samples contained in the AISPs are compressed to 4 bits/sample using Flexible Block Adaptive Quantisation (FBAQ). This is a high-rate, narrow swath mode so data is only acquired for partial orbit segments and may be from one of seven possible image swaths. The Level 0 product is produced systematically for all data acquired within this mode. This product provides a continuation of the ERS-SAR_RAW product. </li><li> Subject: Radar Imagery, Solid Earth (Tectonics/Seismic Activity), Water (Water Management), Natural Disasters (Oil Slick), Land (Topography/Mapping,Soil,Vegetation) Ocean and Coast (Ocean Currents and Topography,Ocean Waves,Coastal Geomorphology) </li>  \ 
    181                <li> Date: 2002-10-18 to 2012-03-29  \ 
    182                 </li> <li> Number of Records: 15945 </ul>') 
     179            ititle = Title(Info.HTML_TYPE, subresult.title) 
     180            icontent = Content(Info.HTML_TYPE, subresult.description) 
    183181            entry = Entry(path + subresult.id + '/' + self.extension, \ 
    184182                          ititle.buildElement(), \ 
     
    267265 
    268266    def _packResult(self, results, **kwargs): 
    269  
    270267        filtered = self._filterResults(results, **kwargs) 
    271268 
     
    273270        for result in filtered: 
    274271            result_guid = kwargs['moles3EPB'].retrieveGUIDFromInstance(result) 
    275             item = Subresult(result_guid.id, "title", datetime.now().isoformat()) 
     272            ititle = self._extractTitle(result) 
     273            item = Subresult(result_guid.id, ititle, result.description,  datetime.now().isoformat()) 
    276274            subresults.append(item) 
    277275         
    278276        return Result(len(results), subresult = subresults) 
    279277 
     278    def _extractTitle(self, cedaObj): 
     279        if hasattr(cedaObj, 'identifier'): 
     280            for ident in cedaObj.identifier: 
     281                if ident.authority.title == CEDA_TITLE: 
     282                    return ident.code   
    280283         
    281284    def doSearch(self, **kwargs): 
     
    296299             
    297300        results = kwargs['moles3EPB'].getObservationCollections(bbox = ibbox) 
    298  
    299  
    300          
     301        
    301302        return self._packResult(results, **kwargs) 
    302303 
     
    312313        if observation: 
    313314            observation = kwargs['moles3EPB'].searchSelectiveLoadByInstance(observation, 'result') 
    314              
    315         print observation 
    316         '''                         
    317         subresults = [] 
    318         for result in obs_coll.member: 
    319             result_guid = kwargs['moles3EPB'].retrieveGUIDFromInstance(result) 
    320             item = Subresult(result_guid.id, "title", datetime.now().isoformat()) 
    321             subresults.append(item) 
    322              
    323         result = Result(id = kwargs['params_values'][COLLECTION], subresult = subresults) 
    324         return result 
    325         ''' 
    326315        return None 
    327316 
    328317class Result(object): 
    329     def __init__(self, totalResults, id = None, title = "Discovery feed for Search Services", updated = datetime.now().isoformat(), subresult = []): 
     318    def __init__(self, totalResults, iid = None, title = "Discovery feed for Search Services", updated = datetime.now().isoformat(), subresult = []): 
    330319        ''' 
    331320            Constructor 
     
    336325        ''' 
    337326        self.totalResult = totalResults 
    338         self.id = id 
     327        self.id = iid 
    339328        self.title = title 
    340329        self.updated = updated 
     
    343332 
    344333class Subresult(object): 
    345     def __init__(self, id, title, updated): 
     334    def __init__(self, iid, title, description, updated): 
    346335        ''' 
    347336            Constructor 
     
    350339            @param updated: the last time the record was updated                         
    351340        ''' 
    352         self.id = id 
     341        self.id = iid 
    353342        self.title = title 
     343        self.description = description         
    354344        self.updated = updated 
Note: See TracChangeset for help on using the changeset viewer.