Changeset 7854
- Timestamp:
- Jun 17, 2010, 4:48:21 PM (15 years ago)
- Location:
- trunk/anuga_core/source/anuga
- Files:
-
- 3 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/anuga_core/source/anuga/file/csv_file.py
r7780 r7854 15 15 16 16 17 def load_csv_as_dict(file_name, title_check_list=None, delimiter=','): 17 def load_csv_as_dict(file_name, title_check_list=None, delimiter=',', 18 d_type = str): 18 19 """ 19 20 Load in the csv as a dictionary, title as key and column info as value. … … 26 27 27 28 delimiter is the delimiter used to separate the fields 29 30 format is one of float, str, int 28 31 29 32 return 2 dictionaries: ({key:column}, {title:index}). … … 35 38 36 39 # FIXME(Ole): Consider dealing with files without headers 37 # FIXME(Ole): Consider a wrapper automatically converting text fields38 # to the right type by trying for: int, float, string39 40 40 41 attribute_dic = {} … … 67 68 msg += 'although there were %d headers' % title_count 68 69 raise IOError, msg 69 for i, val uein enumerate(line[:title_count]): # skip trailing data70 attribute_dic.setdefault(titles_stripped[i], []).append( value)70 for i, val in enumerate(line[:title_count]): # skip trailing data 71 attribute_dic.setdefault(titles_stripped[i], []).append(d_type(val)) 71 72 72 73 return attribute_dic, title_index_dic -
trunk/anuga_core/source/anuga/fit_interpolate/interpolate.py
r7841 r7854 941 941 ['line', 'point'], 942 942 figname='points_boundary', 943 label=title, 944 verbose=verbose) 943 label=title) 945 944 946 945 m = len(self.interpolation_points) -
trunk/anuga_core/source/anuga/utilities/log.py
r7848 r7854 74 74 75 75 # set _new_python to True if python version 2.5 or later 76 _new_python = (sys.version_info >= 0x02050000) # 2.5.x.x76 _new_python = (sys.version_info[0]*10 + sys.version_info[1] >= 25) # 2.5.x.x 77 77 78 78
Note: See TracChangeset
for help on using the changeset viewer.