Skip to content

Commit

Permalink
Cleanup.
Browse files Browse the repository at this point in the history
  • Loading branch information
zshaheen committed Dec 5, 2017
1 parent 0dab4b0 commit c214b9b
Showing 1 changed file with 1 addition and 53 deletions.
54 changes: 1 addition & 53 deletions acme_diags/acme_viewer.py
Original file line number Diff line number Diff line change
Expand Up @@ -287,7 +287,7 @@ def _create_lat_lon_table_index(viewer, root_dir):
"""Create an index in the viewer that links the individual htmls for the lat-lon table."""
seasons = ['ANN', 'DJF', 'MAM', 'JJA', 'SON']
viewer.add_page('Table', seasons)
viewer.add_group('Something Table')
viewer.add_group('Summary Table')
viewer.add_row('All variables')

for s in seasons:
Expand All @@ -298,12 +298,10 @@ def _create_lat_lon_table_index(viewer, root_dir):

def _add_lat_lon_table_to_viewer_index(root_dir):
"""Move the link to Table next to the link to Latitude-Longitude contour maps"""

index_page = os.path.join(root_dir, 'index.html')
soup = BeautifulSoup(open(index_page), "lxml")

# append the new tag underneath the old one, so add it to the parent of the old one

td_to_move = None
for tr in soup.find_all("tr"):
for td in tr.find_all("td"):
Expand All @@ -316,63 +314,13 @@ def _add_lat_lon_table_to_viewer_index(root_dir):
for tr in soup.find_all("tr"):
for td in tr.find_all("td"):
for a in td.find_all("a"):
print 'a'
print a
print "_better_page_name('lat_lon')"
print _better_page_name('lat_lon')
if _better_page_name('lat_lon') in a.string:
print 'moving shit!'
print 'moving shit!'
print 'moving shit!'
td.append(td_to_move)

html = soup.prettify("utf-8")
with open(index_page, "wb") as f:
f.write(html)

'''
for a in soup.find_all('a'):
if _better_page_name('lat_lon') in a:
parent = a.parent
parent.append(table_a)
# Remove the tr with the Table in it
html = soup.prettify("utf-8")
with open(index_page, "wb") as f:
f.write(html)
'''



'''
# Add this to index.html:
# <a href="table/index.html" style="padding-left:1em">
# Latitiude-Longitude Table
# </a>
# underneath this, which is already in index.html:
# <a href="latitude-longitude/index.html">
# Latitude-Longitude contour maps
# </a>
index_page = os.path.join(root_dir, 'index.html')
soup = BeautifulSoup(open(index_page), "lxml")
table_index_path = 'table/index.html'
table_a = soup.new_tag("a", href=table_index_path, style="padding-left:1em")
table_a.append("Latitiude-Longitude Table")
# append the new tag underneath the old one, so add it to the parent of the old one
for a in soup.find_all('a'):
if _better_page_name('lat_lon') in a:
parent = a.parent
parent.append(table_a)
html = soup.prettify("utf-8")
with open(index_page, "wb") as f:
f.write(html)
'''

def generate_lat_lon_metrics_table(viewer, root_dir):
"""For each season in LAT_LON_TABLE_INFO, create a csv, convert it to an html and append that html to the viewer."""
table_dir = os.path.join(root_dir, 'table-data') # output_dir/viewer/table-data
Expand Down

0 comments on commit c214b9b

Please sign in to comment.