Verify checksums when downloading NNDC data. Move ACE files based on new NNDC

tgz file.
This commit is contained in:
Paul Romano 2014-12-19 23:41:46 -05:00
parent cdec89cafd
commit 23c61edb21

View file

@ -7,6 +7,7 @@ import subprocess
import sys
import tarfile
import glob
import hashlib
try:
from urllib.request import urlopen
@ -20,6 +21,8 @@ from convert_binary import ascii_to_binary
baseUrl = 'http://www.nndc.bnl.gov/endf/b7.1/aceFiles/'
files = ['ENDF-B-VII.1-neutron-293.6K.tar.gz',
'ENDF-B-VII.1-tsl.tar.gz']
checksums = ['9729a17eb62b75f285d8a7628ace1449',
'e17d827c92940a30f22f096d910ea186']
block_size = 16384
# ==============================================================================
@ -65,6 +68,16 @@ for f in files:
print('')
filesComplete.append(f)
# ==============================================================================
# VERIFY MD5 CHECKSUMS
print('Verifying MD5 checksums...')
for f, checksum in zip(files, checksums):
downloadsum = hashlib.md5(open(f, 'r').read()).hexdigest()
if downloadsum != checksum:
raise IOError("MD5 checksum for {} does not match. Contact OpenMC "
"developers by emailing openmc-users@googlegroups.com.")
# ==============================================================================
# EXTRACT FILES FROM TGZ
@ -78,6 +91,10 @@ for f in files:
print('Extracting {0}...'.format(f))
tgz.extractall(path='nndc/' + suffix)
# Move ACE files down one level
for filename in glob.glob('nndc/293.6K/ENDF-B-VII.1-neutron-293.6K/*'):
shutil.move(filename, 'nndc/293.6K/')
#===============================================================================
# EDIT GRAPHITE ZAID (6012 to 6000)