コード例 #1
0
ファイル: pyalmanac.py プロジェクト: FrankKooij/Pyalmanac
2	Just tables for the sun
""")
if s == "2":
	print "Creating the sun tables only. \n The year %s" %year
	print "Please wait this can take a while."
	filename = "sunalmanac%s.tex" %year
	outfile = open(filename, 'w')
	outfile.write(suntables.almanac(year))
	outfile.close()
	command = 'pdflatex %s' %filename
	os.system(command)
	print "finished"
	os.remove("sunalmanac%s.log" %year)
	os.remove("sunalmanac%s.aux" %year)
	os.remove(filename)
elif s == "1":
	print "Creating the nautical almanac for the year %s" %year
	print "Please wait this can take a while."
	filename = "almanac%s.tex" %year
	outfile = open(filename, 'w')
	outfile.write(tables.almanac(year))
	outfile.close()
	command = 'pdflatex %s' %filename
	os.system(command)
	print "finished"
	os.remove(filename)
	os.remove("almanac%s.log" %year)
	os.remove("almanac%s.aux" %year)
else:
	print "Error! Choose either 1 or 2"
	
コード例 #2
0
        DecFmt = '[old]'

    if s == '1':
        print "Be patient - this may take a while."
        ##        config.init()		# initialize log file
        for yearint in range(int(yearfr), int(yearto) + 1):
            start = time.time()
            year = "{:4d}".format(yearint)  # year = "%4d" %yearint
            msg = "\nCreating the nautical almanac for the year {}".format(
                year)
            print(msg)
            ##            config.writeLOG(msg)
            first_day = datetime.date(yearint, 1, 1)
            filename = "almanac{}{}.tex".format(ff, year + DecFmt)
            outfile = open(filename, 'w')
            outfile.write(tables.almanac(first_day, 122))
            outfile.close()
            stop = time.time()
            msg = "execution time = {:0.2f} seconds".format(
                stop -
                start)  # msg = "execution time = %0.2f seconds" %(stop-start)
            print(msg)
            ##            config.writeLOG("\n\n" + msg + "\n")
            print
            command = 'pdflatex {}'.format(filename)
            os.system(command)
            print("finished creating nautical almanac for {}".format(year))
            os.remove(filename)
            if os.path.isfile("almanac{}{}.log".format(ff, year + DecFmt)):
                os.remove("almanac{}{}.log".format(ff, year + DecFmt))
            if os.path.isfile("almanac{}{}.aux".format(ff, year + DecFmt)):
コード例 #3
0
	2	Just tables for the sun
	""")
    if s == "2":
        print "Creating the sun tables only. \n The year %s" % year
        print "Please wait this can take a while."
        filename = "sunalmanac%s.tex" % year
        outfile = open(filename, 'w')
        outfile.write(suntables.almanac(year))
        outfile.close()
        command = 'pdflatex %s' % filename
        os.system(command)
        print "finished"
        os.remove("sunalmanac%s.log" % year)
        os.remove("sunalmanac%s.aux" % year)
        os.remove(filename)
    elif s == "1":
        print "Creating the nautical almanac for the year %s" % year
        print "Please wait this can take a while."
        filename = "almanac%s.tex" % year
        outfile = open(filename, 'w')
        outfile.write(tables.almanac(year))
        outfile.close()
        command = 'pdflatex %s' % filename
        os.system(command)
        print "finished"
        os.remove(filename)
        os.remove("almanac%s.log" % year)
        os.remove("almanac%s.aux" % year)
    else:
        print "Error! Choose either 1 or 2"