Changeset 3630 for nappy/trunk


Ignore:
Timestamp:
17/03/08 15:14:19 (12 years ago)
Author:
astephen
Message:

Fixed defaults for delimiter and float format so read from nappy.ini config file.

Location:
nappy/trunk
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/nappy.ini

    r3527 r3630  
    22version = 0.3.0 
    33DEBUG = False 
     4default_delimiter = __space____space____space____space__ 
     5default_float_format = %g 
    46annotations_file = annotations.ini 
    57 
  • nappy/trunk/nappy/nappy_api.py

    r3628 r3630  
    141141getNAFileClass = nappy.utils.common_utils.getNAFileClass 
    142142__version__ = nappy.utils.common_utils.getVersion() 
     143default_delimiter = nappy.utils.common_utils.getDefault("default_delimiter") 
     144default_float_format = nappy.utils.common_utils.getDefault("default_float_format") 
    143145 
    144146 
  • nappy/trunk/nappy/nc_interface/nc_to_na.py

    r3615 r3630  
    3535# Define global variables 
    3636DEBUG = nappy.utils.getDebug()  
     37default_delimiter = nappy.utils.getDefault("default_delimiter") 
     38default_float_format = nappy.utils.getDefault("default_float_format") 
     39 
    3740 
    3841class NCToNA(nappy.nc_interface.cdms_to_na.CDMSToNA): 
     
    118121        return file_names 
    119122 
    120     def writeNAFiles(self, na_file=None, delimiter="    ",  
    121                      float_format="%g", size_limit=None): 
     123    def writeNAFiles(self, na_file=None, delimiter=default_delimiter,  
     124                     float_format=default_float_format, size_limit=None): 
    122125        """ 
    123126        Writes the self.na_dict_list content to one or more NASA Ames files. 
  • nappy/trunk/nappy/utils/__init__.py

    r3406 r3630  
    11from parse_config import getConfigDict 
    2 from common_utils import getDebug, getVersion 
     2from common_utils import getDebug, getVersion, getDefault 
  • nappy/trunk/nappy/utils/common_utils.py

    r3628 r3630  
    152152    return d 
    153153 
    154 def getAnnotation(item, annotation, delimiter = ',   '): 
     154 
     155def getAnnotation(item, annotation, delimiter=None): 
    155156    """ 
    156157    Returns the annotation string for a given NASA Ames item. 
    157158    """ 
    158      
     159    if delimiter == None: 
     160        delimiter = getDefault("default_delimiter")  
    159161    dict = parse_config.getAnnotationsConfigDict() 
    160162    if annotation: return dict[item] + delimiter 
    161163    else: return '' 
     164 
    162165 
    163166def annotateLines(item_name, annotate, delimiter, lines): 
Note: See TracChangeset for help on using the changeset viewer.