Changeset 2229 in lmdz_wrf for trunk/tools/generic_tools.py
- Timestamp:
- Nov 14, 2018, 9:30:59 PM (6 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/generic_tools.py
r2228 r2229 14025 14025 >>> cyclevar_within(np.arange(12)+1, 12, 2, 2) 14026 14026 True 14027 >>> cyclevar_within(np.arange(12)+1, 12, 2, 12) 14028 True 14027 14029 """ 14028 14030 fname = 'cyclevar_within' … … 14038 14040 if eind < bind: 14039 14041 eind = eind + dcyc 14040 vind = vind + dcyc14042 if vind != bind: vind = vind + dcyc 14041 14043 14042 14044 if vind < bind: … … 14655 14657 """ Function to return temporal slices of a series of times for a given amount 14656 14658 of periods 14657 tv: time val lues (CF format)14659 tv: time values (CF format) 14658 14660 tu: CF time-units 14659 14661 cal: calendar … … 14703 14705 print ' available ones:', type(np.arange(1)), type(range(2)) 14704 14706 quit(-1) 14705 #print 'mat times _______' 14707 #print 'mat times _______' 14706 14708 #for it in range(dimt): 14707 14709 # print ' ',it, mattimes[it,:] … … 14769 14771 if cyclevar_within(months12, bseas, eseas, estats[1]): 14770 14772 estats[1] = bseas 14771 b ereak14773 break 14772 14774 # Checking if the end of season is on the following year... 14773 14775 if bseas < mone: estats[0] = estats[0] + 1 … … 14980 14982 for it in range(0,10): 14981 14983 for itt in range(3): 14982 tv.append(iTT+it*totT+dT*itt) 14984 days = iTT+it*totT+dT*itt 14985 tv.append(days) 14983 14986 #values.append((it*3+itt)*1.) 14984 values.append(it*1.) 14985 14986 print 'tv:', tv 14987 print 'values:', values 14987 Nyear = int((days-31)/365) 14988 dyear = (days-31) - Nyear*365 14989 if dyear < 59: 14990 values.append(0.) 14991 elif dyear >= 59 and dyear < 151: 14992 values.append(1.) 14993 elif dyear >= 151 and dyear < 243: 14994 values.append(2.) 14995 elif dyear >= 243 and dyear < 334: 14996 values.append(3.) 14997 14998 for it in range(len(values)): 14999 print it, tv[it], values[it] 14988 15000 14989 15001 vals = np.array(values) 14990 15002 itdim = 0 14991 15003 tu = 'days since 1949-12-01 00:00:00' 14992 per = ' aggseason'15004 per = 'season' 14993 15005 calend = 'standard' 14994 15006 amount = 1 … … 15016 15028 origshape[itdim] = aggslc[iislc] 15017 15029 iishape[itdim] = iislc 15018 print iislc, ':', iishape, '<>', origshape 15030 print iislc, ':', iishape, '<>', origshape, vals[tuple(origshape)] 15019 15031 tvals[tuple(iishape)] = vals[tuple(origshape)] 15020 15032
Note: See TracChangeset
for help on using the changeset viewer.