Changeset 361 for nappy/trunk/general.py


Ignore:
Timestamp:
13/01/05 16:03:52 (15 years ago)
Author:
selatham
Message:

bug fixes, write classes and other new classes as required.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • nappy/trunk/general.py

    r349 r361  
    2222# Imports from local package 
    2323import naFile, naFile1001, naFile1010, naFile1020, naFile2010 
    24 import naFile2110, naFile2110, naFile2160, naFile2310 
     24import naFile2110, naFile2160, naFile2310 
    2525import naFile3010, naFile4010 
    2626 
     
    5252    elif d["NIV"]==3:     # 3 independent variables 
    5353        return 3010 
    54     elif d["NIV"]==2:     # 2 independent variables 
    55         # Three choices here:   2010 - Straightforward 2-D variables 
    56         #                       2110 - one independent variable changes length 
    57         #                       2160 - some auxiliary variables are character strings 
    58         for aux_var in d["A"]: 
    59             if type(aux_var[0])==str: 
    60                 return 2160 
    61         if type(d["X"][0][0])==list: 
    62             return 2110 
    63         else: 
    64             return 2010 
     54    # 2 independent variables 
     55        # Four choices here:   2010 - Straightforward 2-D variables 
     56        #                       2110 - one independent variable changes length and the values are specified 
     57        #                       2310 - one indepenent variable changes length but only the first value is specifically stated 
     58        #                       2160 - the  independent unbounded variable is a character string 
     59        #                                 (not "some auxiliary variables are character strings" as previously coded) 
     60 
     61    elif d["NIV"]==2 and type(d["X"][0][0])==str: 
     62        return 2160 
     63    elif d["NIV"]==2 and type(d["X"][0][1])==list and len(d["X"][0][1])>1: 
     64        return 2110 
     65    elif d["NIV"]==2 and type(d["X"][0][1])==list and len(d["X"][0][1])==1: 
     66        return 2310 
     67    elif d["NIV"]==2: 
     68        return 2010 
     69        #for aux_var in d["A"]: 
     70         #   if type(aux_var[0])==str: 
     71          #      return 2160 
     72        #print d["X"][0][0] 
     73        #if type(d["X"][0][0])==str: 
     74         #   return 2160 
     75        #elif type(d["X"][0][1])==list: 
     76          #  return 2110 
     77       # else: 
     78         #   return 2010 
    6579    elif d["NIV"]==1:     # 1 independent variable 
    6680        # Three choices here:   1001 - No auxiliary variables 
     
    7488            return 1010 
    7589    else: 
    76         raise """Could not resolve the dictionary object to create a suitable NASA 
    77         Ames File Format Index (FFI). Please modify the contents and try again.""" 
     90        raise "Could not resolve the dictionary object to create a suitable NASA Ames File Format Index (FFI). Please modify the contents and try again." 
    7891 
    7992 
Note: See TracChangeset for help on using the changeset viewer.