import numpy as np
import sys
#import datetime
#import calendar
#import pandas
#import re
#import matplotlib
#matplotlib.use('TKAgg')
#import matplotlib.pyplot as plt


filename = "fig_list.txt"

file = open(filename,"r")

fnameprim = "fig_E3SM_elm_"

nrow = 5

#print('<html lang="en">')
#print('<body>')
#

print('<div class="row">')


i = 1
for line in file.readlines():
    figname = line.strip()
    temp1 = figname.split('.')
    temp2 = temp1[0].split(fnameprim)

    temp3 = temp2[1].split('_')
    
    if ( temp3[0] == "2d" ):
       temp4 = temp2[1].split("2d_")
       varname = temp4[1]
    else:
       temp5 = temp2[1].split("ts_")
       varname = temp5[1] 


    if ( i%nrow > 0 ):
       print('  <div class="column">')       
       print('    <figcaption><center>'+varname+'</center></figcaption>')
       print('    <img src="'+figname+'" alt="Snow" style="width:100%">')
       print('  </div>')
    else:
       print('  <div class="column">')       
       print('    <figcaption><center>'+varname+'</center></figcaption>')
       print('    <img src="'+figname+'" alt="Snow" style="width:100%">')
       print('  </div>')
       print('</div>')
       print('<div class="row">')

    i = i + 1

file.close


