def cn_lunarcal(year):
    ''' to generate lunar calendar for year, the search should started from
    previous Winter Solstice to next year's Winter Solstic.

    Because there might be a leap month after this Winter Solstic, which can
    only be found by compute Calendar of next year, for example, 2033 has a
    leap 11 that belongs to the next year. Calendar for this and next year are
    computed and combined, then trim to fit into scale of this year.

    '''

    cal0 = search_lunarcal(year)
    cal1 = search_lunarcal(year + 1)
    for k, v in cal1.items():
        cal0[k] = v

    start = jdptime('%s-%s-%s' % (year, 1, 1), '%y-%m-%d')
    end = jdptime('%s-%s-%s' % (year, 12, 31), '%y-%m-%d')
    lc = []
    for jd, day in cal0.items():
        day['date'] = jdftime(jd, '%y-%m-%d', ut=False)
        if jd >= start and jd <= end:
            lc.append((jd, day))

    lc.sort()
    res = [x[1] for x in lc]

    return res
 to generate lunar calendar for year, the search should started from
    previous Winter Solstice to next year's Winter Solstic.

    Because there might be a leap month after this Winter Solstic, which can
    only be found by compute Calendar of next year, for example, 2033 has a
    leap 11 that belongs to the next year. Calendar for this and next year are
    computed and combined, then trim to fit into scale of this year.

    
lunarcalbase.py