Changeset 2227 in lmdz_wrf for trunk/tools


Ignore:
Timestamp:
Nov 12, 2018, 4:57:00 PM (6 years ago)
Author:
lfita
Message:

Getting close to there for `time_slices'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r2226 r2227  
    1404514045    return within
    1404614046
    14047 def time_slices(tv, tu, cal, per, amount):
     14047def time_slices(tv, tu, cal, per, amount, temp_desc):
    1404814048    """ Function to return temporal slices of a series of times for a given amount
    1404914049        of periods
     
    1406414064          yy1/mm1/dd1 [00,...,23]:00:00 - yym/mmm/ddm [00,...,23]:59:59
    1406514065      amount: amount of periods
     14066      temp_desc: disctionary with the description of the time_steps (from
     14067        `temporal_desc' function))
    1406614068    """
    1406714069    import datetime as dt
     
    1420314205
    1420414206    elif per == 'aggmonth':
     14207        if temp_desc is None:
     14208            print errormsg
     14209            print '  ' + fname + ": For '" + per + "' temporal description is required"
     14210            quit(-1)
     14211
    1420514212        amount = 1
    1420614213        # Arranging accordingly beginning/ending statistics periods
     
    1433614343amount = 1
    1433714344
    14338 #tslc, Ntslc = time_slices(tv, tu, calend, per, amount)
     14345tdes = temporal_desc(tv, tu, calend)
     14346
     14347tslc, Ntslc = time_slices(tv, tu, calend, per, amount)
    1433914348
    1434014349#statn = 'mean'
     
    1495614965        temporal_desc[timesec]=tvsec
    1495714966
    14958     printing_dictionary(temporal_desc)   
     14967    #printing_dictionary(temporal_desc)   
    1495914968
    1496014969    return temporal_desc
    1496114970
    14962 
    14963 tv = []
    14964 values = []
    14965 totT = 24.*60.
    14966 dT = 20027.345
    14967 for it in range(0,30):
    14968     tv.append(29*24*60.+dT*it)
    14969     print 29*24*60.+dT*it
    14970     #values.append((it*3+itt)*1.)
    14971     values.append(it*1.)
    14972 
    14973 #print 'tv:', tv
    14974 #print 'values:', values
    14975 
    14976 vals = np.array(values)
    14977 itdim = 0
    14978 tu = 'minutes since 1949-12-01 00:00:00'
    14979 per = 'day'
    14980 calend = 'standard'
    14981 amount = 1
    14982 
    14983 temporal_desc(tv, tu, calend)
    14984 
    1498514971#quit()
    1498614972
Note: See TracChangeset for help on using the changeset viewer.