Changeset 572
- Timestamp:
- Mar 7, 2012, 7:56:37 PM (13 years ago)
- Location:
- trunk/UTIL/PYTHON
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/UTIL/PYTHON/myplot.py
r571 r572 93 93 94 94 ## Author: AC 95 def windamplitude (nc) 95 def windamplitude (nc): 96 96 varinfile = nc.variables.keys() 97 97 if "U" in varinfile: zu=getfield(nc,'U') … … 1041 1041 ## Read sparse data 1042 1042 from numpy import empty 1043 if datatype is'txt':1043 if datatype == 'txt': 1044 1044 if len(data[coord1].shape) == 1: 1045 1045 return data[coord1][:] … … 1048 1048 else: 1049 1049 errormess('error in readdata') 1050 elif datatype is'sav':1050 elif datatype == 'sav': 1051 1051 return data[coord1][coord2] 1052 1052 else: -
trunk/UTIL/PYTHON/sparse.py
r568 r572 111 111 112 112 ##### Find file type 113 if filename[k].find('.sav') is not -1: 114 all_type[k] ='sav' 115 print '.sav file detected for', filename[k],'!!' 116 elif filename[k].find('.txt') is not -1: 117 all_type[k] ='txt' 118 #print '.txt file detected for', filename[k],'!!' 113 if opt.ftype is None: 114 if filename[k].find('.sav') is not -1: 115 all_type[k] ='sav' 116 print '.sav file detected for', filename[k],'!!' 117 elif filename[k].find('.txt') is not -1: 118 all_type[k] ='txt' 119 #print '.txt file detected for', filename[k],'!!' 120 else: 121 all_type[k] ='txt' 122 print 'no file type detected for', filename[k],'!!, default type is', all_type[k] 123 124 if all_type[k] != all_type[0]: 125 print 'Two different types were used: ', all_type[k], all_type[0] 126 errormess('Not suported') 119 127 else: 120 all_type[k] ='txt' 121 print 'no file type detected for', filename[k],'!!, default type is', all_type[k] 122 123 if all_type[k] != all_type[0]: 124 print 'Two different types were used: ', all_type[k], all_type[0] 125 errormess('Not suported') 126 128 all_type[k] = opt.ftype 127 129 128 130 ##### Read file 129 if all_type[k] is'sav':131 if all_type[k] == 'sav': 130 132 print 'reading .sav file', filename[k], '...' 131 133 data = {} 132 134 data = readsav(filename[k], idict=data, python_dict=False) #, verbose=True) 133 135 all_data[k] = data 134 elif all_type[k] is'txt':136 elif all_type[k] == 'txt': 135 137 print 'reading .text file', filename[k], '...' 136 138 all_data[k] = np.loadtxt(filename[k])
Note: See TracChangeset
for help on using the changeset viewer.