Changeset 345


Ignore:
Timestamp:
18/06/15 10:30:13 (5 years ago)
Author:
astephen
Message:

Removed superfluous code block. Added in a simple plural function to
log plural forms if more than one.

File:
1 edited

Legend:

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

    r344 r345  
    355355 
    356356    self.var = self.fnParts[self.pcfg.varIndex] 
    357     if self.pcfg.projectV.id in ['ESA-CCIxxx']: 
    358       if  self.fnDict['project'] == 'GlobSnow': 
    359         if self.fnDict['additional'] == 'weekly': 
    360           self.var += 'weekly' 
    361         elif self.fnDict['additional'] == 'monthly' and self.var == 'SWE': 
    362           self.var += 'weekly' 
    363357 
    364358    if self.pcfg.fnvdict != None: 
     
    12351229    assert nn==n2, 'some file lost!!!!!!' 
    12361230    if len(elist) == 0: 
    1237       self.info =  '%s files, %s' % (nn,str(ee.keys()) ) 
    1238     else: 
    1239       self.info =  '%s files, %s frequencies, severe errors in file names: %s' % (nn,len(ee.keys()),len(elist) ) 
     1231      self.info =  '%s %s, %s' % (nn, maybe_plural("file", nn), str(ee.keys())) 
     1232    else: 
     1233      self.info =  '%s %s, %s frequencies, severe errors in file names: %s' % (nn, maybe_plural("file", nn), len(ee.keys()), len(elist)) 
    12401234      for e in elist: 
    12411235        self.info += '\n%s' % e 
     
    13261320    self.fhCountMax = max( self.fhCountMax, len(self.ps) ) 
    13271321    return len( self.ps ) 
     1322 
     1323def maybe_plural(word, n): 
     1324    "Return ``word`` if n is 1, and plural of ``word`` if n is not." 
     1325    if n == 1: 
     1326        return word 
     1327    return "%ss" % word 
Note: See TracChangeset for help on using the changeset viewer.