Changeset 5138


Ignore:
Timestamp:
25/03/09 08:58:07 (10 years ago)
Author:
spascoe
Message:

Merging changes in the nappy package from trunk

Location:
nappy/branches/nappy-eggable/nappy
Files:
3 edited

Legend:

Unmodified
Added
Removed
  • nappy/branches/nappy-eggable/nappy/nappy_api.py

    r4693 r5138  
    197197        del arg_dict[arg_out] 
    198198 
    199     convertor = apply(nappy.nc_convertor.na_to_nc.NAToNC, [], arg_dict) 
     199    import nappy.nc_interface.na_to_nc 
     200    convertor = apply(nappy.nc_interface.na_to_nc.NAToNC, [], arg_dict) 
    200201    convertor.convert() 
    201202    if nc_file == None: 
     
    269270        na_file =  nappy.utils.getFileNameWithNewExtension(nc_file, "na") 
    270271 
    271     convertor = apply(nappy.nc_convertor.nc_to_na.NCToNA, [], arg_dict) 
     272    import nappy.nc_interface.nc_to_na 
     273    convertor = apply(nappy.nc_interface.nc_to_na.NCToNA, [], arg_dict) 
    272274    convertor.convert() 
    273275 
  • nappy/branches/nappy-eggable/nappy/nc_interface/na_to_cdms.py

    r4693 r5138  
    224224                self.cdms_variables.append(self._convertNAToCdmsVariable(var_number)) 
    225225        else: 
    226             if type(self.variables[0]) == type(1): # They are integers = indices 
     226            if type(self.variables[0]) == type(1) or re.match("\d+", str(self.variables[0])): # They are integers = indices 
    227227                for var_number in self.variables: 
    228                     self.cdms_variables.append(self._convertNAToCdmsVariable(var_number))    
     228                    vn = int(var_number) 
     229                    self.cdms_variables.append(self._convertNAToCdmsVariable(vn))    
    229230            elif type(self.variables[0]) == type("string"):  # Vars are strings 
    230231                for var_name in self.variables: 
  • nappy/branches/nappy-eggable/nappy/utils/common_utils.py

    r3999 r5138  
    146146 
    147147    d = {} 
    148     items = value.split(",") 
     148    items = s.split(",") 
    149149    while len(items) > 0: 
    150150        d[items[0]] = items[1] 
    151151        items = items[2:]  
    152152    return d 
     153 
     154 
     155def makeListFromCommaSepString(s): 
     156    """ 
     157    Reads in comma-separated list and converts to list of successive 
     158    keyword,value pairs. 
     159    """ 
     160    if s.count(",") % 2 == 0: 
     161        raise Exception("Must provide even number of items in argument of commas-separated pairs of values: " + s) 
     162 
     163    l = [] 
     164    items = s.split(",") 
     165    while len(items) > 0: 
     166        l.append((items[0], items[1])) 
     167        items = items[2:] 
     168    return l 
    153169 
    154170 
Note: See TracChangeset for help on using the changeset viewer.