mirror of
https://github.com/openmc-dev/openmc.git
synced 2026-07-29 06:35:48 -04:00
Verify checksums when downloading NNDC data. Move ACE files based on new NNDC
tgz file.
This commit is contained in:
parent
cdec89cafd
commit
23c61edb21
1 changed files with 17 additions and 0 deletions
|
|
@ -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)
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue