- Timestamp:
- Sep 13, 2016, 10:52:42 AM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r1102 r1105 55 55 # index_mat: Function to provide the coordinates of a given value inside a matrix 56 56 # index_vec: Function to provide the coordinates of a given value inside a vector 57 # julday_360d: Function to provide the julian day of a date in a 360 days/yr (or 12 30-days months) calendar 57 58 # list_combos: Function to construct a new list with all possible N-combinations of the list-values 58 59 # list_coincidences: Function to provide the coincidences between two lists … … 280 281 Nlvs = len(listv) 281 282 for ic in range(Ncombos): 282 print fname + ' Lluis: ic:', ic, 'Nlvs:', Nlvs283 283 prevlist = list(newlist) 284 284 for lv in prevlist: … … 850 850 return newdate 851 851 852 def julday_360d(date): 853 """ Function to provide the julian day of a date in a 360 days/yr (or 12 30-days months) calendar 854 date= date [Y, m, d, h, mi, s] 855 >>> julday_360d([1976,2,17,8,30,2]) 856 47 857 """ 858 fname = 'julday_360d' 859 860 julday = (date[1]-1)*30 + date[2] 861 862 return julday 863 print julday_360d([1976,2,17,8,30,2]) 864 865 quit() 852 866 class dtsec360dyr(object): 853 867 """ Class to operate a number of seconds to a date in a 360 days/yr (or 12 30-days months) calendar … … 9198 9212 matype = mat.dtype 9199 9213 9200 print fname + '; Lluis: matype:', matype,'shape:',mat.shape,'opdims:',opdims9201 9202 9214 if oper.find(',') != -1: 9203 9215 opern = oper.split(',')[0] … … 9227 9239 idim = idim + 1 9228 9240 9241 if len(ldimop) == 0: 9242 print errormsg 9243 print ' ' + fname + ': no dimensions found for the operation !!' 9244 print ' dimensions in file:', dimns 9245 print ' dimensions for the operation:', opdims 9246 quit(-1) 9247 9229 9248 Ndop = len(opdims) 9230 9249 Ntotdims = np.prod(ldimop) 9231 print fname + '; Lluis ldimop:', ldimop, 'Ntotdims:', Ntotdims9232 9250 9233 9251 # Checking for coincidence in shapes … … 9251 9269 if slicevals[idn] == -1: 9252 9270 ijkop = ijkop + 1 9271 9253 9272 opslice.append(idcalc[ijkop]) 9254 9273 else:
Note: See TracChangeset
for help on using the changeset viewer.