Changeset 279


Ignore:
Timestamp:
30/01/15 17:24:51 (5 years ago)
Author:
astephen
Message:

drs for esa-cci

Location:
CCCC/trunk/ceda_cc
Files:
1 deleted
3 edited

Legend:

Unmodified
Added
Removed
  • CCCC/trunk/ceda_cc/config_c4.py

    r278 r279  
    229229      self.drsMappings = {'variable':'#var','platform':'platform','sensor':'sensor','level':'#level', \ 
    230230                'standard_name':'*standard_name', \ 
     231                'algorithm':'$algorithm:unset', 'frequency':'$frequency', \ 
    231232                'spatial_resolution':'spatial_resolution', 'ecv':'@ecv','version':'#version','convention_version':'#gdsv'} 
    232233      self.globalAttributesInFn = [None,] 
     
    359360 
    360361    ##assert self.project != 'CCMI', 'Not completely set up for CCMI yet' 
     362 
     363  def getExtraAtts(self): 
     364 
     365    eafile = self.mipVocabDir + 'extraAtts.txt' 
     366    self.extraAtts = {} 
     367    if os.path.isfile( eafile ): 
     368      for l in open( eafile ).readlines(): 
     369        if l[0] != '#': 
     370          bits = map( string.strip, string.split(l,',') ) 
     371          id = '%s.%s' % (bits[0],bits[1]) 
     372          ee = {} 
     373          for b in bits[2:]: 
     374            bb = string.split(b,'=') 
     375            ee[bb[0]] = bb[1] 
     376          self.extraAtts[id] = ee 
    361377 
    362378  def getVocabs(self): 
  • CCCC/trunk/ceda_cc/unitTestsS1.py

    r278 r279  
    8686      if len(l) > 2 and l[2]  == 'CCIplus': 
    8787        cga.globalAts =  {'platform':'platform','sensor':'sensor', \ 
     88                 'naming_authority':'org.ghrsst', 'id':'AATSR-ESACCI-L3U-v1', \ 
    8889                'spatial_resolution':'1 km'} 
    8990        cga.varAts = { 'var':{ 'standard_name':'dummy'} } 
  • CCCC/trunk/ceda_cc/utils_c4.py

    r278 r279  
    365365    self.step = 'Initialised' 
    366366    self.checks = (self.do_check_ga,) 
     367    self.fileId = None 
    367368 
    368369  def check(self,globalAts, varAts,varName,varGroup, vocabs, fnParts): 
     
    376377    self.fnParts = fnParts 
    377378    self.runChecks() 
     379 
     380  def getId(self): 
     381    if self.fileId == None: 
     382      self.fileId = '%s.%s' % (self.globalAts['naming_authority'],self.globalAts['id']) 
    378383 
    379384  def getDrs( self ): 
     
    395400      elif self.drsMappings[k] == '@ecv': 
    396401        ee[k] = self.pcfg.ecvMappings[ self.parent.fnDict['project'] ] 
     402      elif self.drsMappings[k][0] == '$': 
     403        self.pcfg.getExtraAtts() 
     404        print self.pcfg.extraAtts 
     405        self.getId() 
     406        if string.find(self.drsMappings[k],':') != -1: 
     407          k2,dflt = string.split( self.drsMappings[k][1:],':') 
     408          ee[k] = self.pcfg.extraAtts[self.fileId].get( k2, dflt ) 
     409        else: 
     410          ee[k] = self.pcfg.extraAtts[self.fileId][self.drsMappings[k][1:]] 
    397411      elif self.drsMappings[k][0] == '*': 
    398412        thisk = self.drsMappings[k][1:] 
Note: See TracChangeset for help on using the changeset viewer.