Changeset 3617 for nappy


Ignore:
Timestamp:
17/03/08 01:28:05 (11 years ago)
Author:
astephen
Message:

Brand new API but not yet fixed to work.

Location:
nappy/trunk/nappy
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/nappy/nappy_api.py

    r3616 r3617  
    112112 
    113113 4. General NASA Ames utilities  
     114 
     115# Get the FFI from a NASA Ames file 
     116ffi = nappy.readFFI(na_file) 
     117 
     118# Given a NASA Ames dictionary (na_dict) get an appropriate FFI. 
     119ffi = nappy.chooseFFI(na_dict) 
     120 
    114121 
    115122""" 
     
    385392 
    386393 
    387 """ 
    388  
    389 MOVE TO UTILS AND FIX STRING TWOERS 
    390 def getFileNameWithNewExtension(input_file, format): 
    391     "" 
    392     Takes an input_file name and applies new extension to it by: 
    393     (i) replacing initial extension if there is one, OR 
    394     (ii) just appending new extension. 
    395     "" 
    396     base_name = input_file 
    397     last_four = base_name[-4:] 
    398     found = last_four.find(".") 
    399     if found > -1: 
    400         idx = len(base_name) + found 
    401         base_name = base_name[:idx] 
    402     return base_name + "." + format 
    403  
    404 TODO: 
    405 Need to test all arguments independently and in combinations. 
    406  * mode = "a"??? 
    407 compareNAFiles - do it 
    408   Check comparing 2001.na and 2001.csv and see why it falls over. 
    409 Error classes 
    410 Command-line utils, are they in-line with all changes? 
    411 Make sure annotation is callable at every level of the system. 
    412  
    413  * add no_header = True on write and for all write wrappers. 
    414 * Need uniform float_format and delimiter throughout main code so consistent. 
    415 """ 
  • nappy/trunk/nappy/utils/common_utils.py

    r3546 r3617  
    7575    else: 
    7676        raise Exception("Could not resolve the dictionary object to create a suitable NASA Ames File Format Index (FFI). Please modify the contents and try again.") 
     77 
     78 
     79def getFileNameWithNewExtension(input_file, format): 
     80    """ 
     81    Takes an input_file name and applies new extension to it by: 
     82    (i) replacing initial extension if there is one, OR 
     83    (ii) just appending new extension. 
     84    """ 
     85    base_name = input_file 
     86    last_four = base_name[-4:] 
     87    found = last_four.find(".") 
     88    if found > -1: 
     89        idx = len(base_name) + found 
     90        base_name = base_name[:idx] 
     91    return base_name + "." + format 
     92 
    7793     
    7894 
Note: See TracChangeset for help on using the changeset viewer.