- Timestamp:
- Apr 16, 2018, 12:56:07 AM (7 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/tools/nc_var_tools.py
r1906 r1907 22905 22905 22906 22906 # Quantity of time_bnds 22907 availtunits = ['c', 'y', 'm', 'd', 'h', 'i', 's'] 22908 if tunit == 'c': 22907 availtunits = ['c', 'ce', 'y', 'yr', 'm', 'mo', 'w', 'we', 'd', 'da', 'h', 'hr', \ 22908 'i', 'mi', 's', 'se'] 22909 if tunit == 'c' or tunit == 'ce': 22909 22910 dtbnds = quantity * 100 * 365 * 24 * 3600. 22910 22911 begTBmat = [int(begTmat[0]/100)*100, 1, 1, 0, 0, 0] … … 22912 22913 [100,0,0,0,0,0]) 22913 22914 dTBmat = [quantity*100, 0, 0, 0, 0, 0] 22914 elif tunit == 'y' :22915 elif tunit == 'y' or tunit == 'yr': 22915 22916 dtbnds = quantity * 365 * 24 * 3600. 22916 22917 begTBmat = [begTmat[0], 1, 1, 0, 0, 0] 22917 22918 endTBmat = [endTmat[0]+1, 1, 1, 0, 0, 0] 22918 22919 dTBmat = [quantity, 0, 0, 0, 0, 0] 22919 elif tunit == 'm' :22920 elif tunit == 'm' or tunit == 'mo': 22920 22921 iyr = begTmat[0] 22921 22922 imo = begTmat[1] … … 22926 22927 endTBmat = [endTmat[0], endTmat[1]+1, 1, 0, 0, 0] 22927 22928 dTBmat = [0, quantity, 0, 0, 0, 0] 22928 elif tunit == 'w' :22929 elif tunit == 'w' or tunit == 'we': 22929 22930 dtbnds = quantity * 7 * 24 * 3600. 22930 22931 begTBmat = [begTmat[0], begTmat[1], begTmat[2], 0, 0, 0] … … 22932 22933 [0,0,7,0,0,0]) 22933 22934 dTBmat = [0, 0, quantity*7, 0, 0, 0] 22934 elif tunit == 'd' :22935 elif tunit == 'd' or tunit == 'da': 22935 22936 dtbnds = quantity * 24 * 3600. 22936 22937 begTBmat = [begTmat[0], begTmat[1], begTmat[2], 0, 0, 0] … … 22938 22939 [0,0,1,0,0,0]) 22939 22940 dTBmat = [0, 0, quantity, 0, 0, 0] 22940 elif tunit == 'h' :22941 elif tunit == 'h' or tunit == 'hr': 22941 22942 dtbnds = quantity * 3600. 22942 22943 begTBmat = [begTmat[0], begTmat[1], begTmat[2], begTmat[3], 0, 0] … … 22944 22945 0], [0,0,0,1,0,0]) 22945 22946 dTBmat = [0, 0, 0, quantity, 0, 0] 22946 elif tunit == 'i' :22947 elif tunit == 'i' or tunit == 'mi': 22947 22948 dtbnds = quantity * 60. 22948 22949 begTBmat = [begTmat[0], begTmat[1], begTmat[2], begTmat[3], begTmat[4], 0] … … 22950 22951 endTmat[4],0], [0,0,0,0,1,0]) 22951 22952 dTBmat = [0, 0, 0, 0, quantity, 0] 22952 elif tunit == 's' :22953 elif tunit == 's' or tunit == 'se': 22953 22954 dtbnds = quantity * 1. 22954 22955 begTBmat = [begTmat[0], begTmat[1], begTmat[2], begTmat[3], begTmat[4], \ … … 24373 24374 24374 24375 if np.mod(secfreq, 100 * 365 * 24 * 3600.) == 0.: 24375 Sfreq = str(int(secfreq/(100 * 365 * 24 * 3600.))) + ', C'24376 Sfreq = str(int(secfreq/(100 * 365 * 24 * 3600.))) + ',ce' 24376 24377 elif np.mod(secfreq, 365 * 24 * 3600.) == 0.: 24377 Sfreq = str(int(secfreq/(365 * 24 * 3600.))) + ', Y'24378 Sfreq = str(int(secfreq/(365 * 24 * 3600.))) + ',yr' 24378 24379 elif np.mod(secfreq, 7 * 24 * 3600.) == 0.: 24379 Sfreq = str(int(secfreq/(7 * 24 * 3600.))) + ', W'24380 Sfreq = str(int(secfreq/(7 * 24 * 3600.))) + ',we' 24380 24381 elif np.mod(secfreq, 24 * 3600.) == 0.: 24381 Sfreq = str(int(secfreq/(24.*3600.))) + ', D'24382 Sfreq = str(int(secfreq/(24.*3600.))) + ',da' 24382 24383 elif np.mod(secfreq,3600.) == 0.: 24383 Sfreq = str(int(secfreq/3600.)) + ', H'24384 Sfreq = str(int(secfreq/3600.)) + ',hr' 24384 24385 elif np.mod(secfreq,60.) == 0.: 24385 Sfreq = str(int(secfreq/60.)) + ', M'24386 Sfreq = str(int(secfreq/60.)) + ',mi' 24386 24387 else: 24387 24388 print ' ' + fname + ": data from file does not conform "+\ … … 24395 24396 print ' minute:', secfreq/(60.) 24396 24397 print ' second:', secfreq 24398 quit(-1) 24397 24399 print 'diff_conform:', Sfreq 24398 24400
Note: See TracChangeset
for help on using the changeset viewer.