#!/home/bfiedler/anaconda3/bin/python3 from datetime import datetime, timedelta # date and time helpers import glob, os, sys import janim2 # https://code.activestate.com/recipes/580675-makes-html-with-javascript-to-animate-a-sequence-o def btime(ts, dhr=0): year=int( ts[:4] ) month=int(ts[4:6]) day=int(ts[6:8]) hr=int(ts[8:]) timex = datetime(year,month,day,hr) + timedelta(hours=dhr) timef=timex.strftime("%Y%m%d%H") return timef pngloc = '/home/bfiedler/play/grib/pngs/' phdir='/var/www/html/' pngdirs = glob.glob(pngloc+'*') pngdirs.sort() ldir=pngdirs[-1] ltime=ldir.split('/')[-1] pngl=[] for n in range(20): h=n*12 pf=f'f{h:03d}.png' pd=btime(ltime,dhr=-h) thepng='pngs/'+pd+'/'+pf lookpng=pngloc+pd+'/'+pf print(lookpng) if os.path.exists(lookpng): pngl.append(thepng) print(pngl) what="forecast
conver-
gence
animation
info
" what+="""




""" janim2.makeanim(pngl,outfile=phdir+"CONanimator.shtml",sortOrder=True, ctlOnSide=True,titlestring="convergence animation",what=what)