Changeset 1224 in lmdz_wrf for trunk/tools/generic_tools.py


Ignore:
Timestamp:
Oct 20, 2016, 5:33:29 PM (8 years ago)
Author:
lfita
Message:

Including the single combinations as option in `combos'

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/tools/generic_tools.py

    r1222 r1224  
    312312      Num= number of elements
    313313    >>> list_norepeatcombos(4)
    314     [[0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]
     314    [[0], [1], [2], [3], [0, 1], [0, 2], [0, 3], [1, 2], [1, 3], [2, 3], [0, 1, 2], [0, 1, 3], [0, 2, 3], [1, 2, 3], [0, 1, 2, 3]]
    315315    """
    316316    from math import factorial
     
    318318
    319319    listv = range(Num)
     320    # Single values are also combinations!
     321    combos = []
     322    for i in range(Num):
     323        combos.append([i])
    320324
    321325    samevals = []
     
    325329        if searchInlist(samevals,iv): samevals.append(iv)
    326330
    327     combos = []
    328331    Nlvs = len(listv)
    329332    # Number of possible combinations
     
    97509753    timestep.sort()
    97519754    return timestep
     9755print timestep_conform(86400,3600,5)
    97529756
    97539757#quit()
Note: See TracChangeset for help on using the changeset viewer.