Skip to content

Commit 0a13c41

Browse files
committed
added json saving to reports.
1 parent d434c2e commit 0a13c41

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

bgcval2/bgcval2_make_report.py

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1593,6 +1593,31 @@ def newImageLocation(fn):
15931593
relativeFiles = [
15941594
addImageToHtml(catfn, imagesfold, reportdir) for catfn in catfiles
15951595
]
1596+
######
1597+
# Add json file too.
1598+
analysis_name = os.path.basename(reportdir[:-1]) # assume last character is slash
1599+
csvFolder = paths.imagedir + '/TimeseriesCompare_CSV/' + analysis_name
1600+
1601+
for catfn in catfiles:
1602+
# print('png:', catfn)
1603+
json_fn = csvFolder+'/'+analysis_name+'_'+os.path.basename(catfn)
1604+
together = json_fn.find('Together')
1605+
json_fn = json_fn[:together] + 'Together.json'
1606+
print('json:', json_fn)
1607+
if not os.path.exists(json_fn):
1608+
print('Can not find json:', json_fn)
1609+
continue
1610+
# copying file to report dir.
1611+
newfn = imagesfold + os.path.basename(json_fn)
1612+
1613+
if shouldIMakeFile(
1614+
json_fn,
1615+
newfn,
1616+
):
1617+
if os.path.exists(newfn):
1618+
os.remove(newfn)
1619+
shutil.copy2(json_fn, newfn)
1620+
15961621

15971622
####
15981623
# sort alphabeticaly.

0 commit comments

Comments
 (0)