More updates to logging and handling exceptions.

这个提交包含在:
craig-warren
2020-04-09 14:23:50 +01:00
父节点 aba5e749c5
当前提交 1e64d493a2
共有 27 个文件被更改,包括 334 次插入177 次删除

查看文件

@@ -1,8 +1,12 @@
import argparse
import logging
import os
import h5py
logger = logging.getLogger(__name__)
# Parse command line arguments
parser = argparse.ArgumentParser(description='Writes a HDF5 file of AustinMan or AustinWoman head only.', usage='python head_only_hdf5 filename')
parser.add_argument('filename', help='name and path to (HDF5) file containing AustinMan or AustinWoman model')
@@ -16,7 +20,7 @@ data = f['/data'][:, :, :]
# Define head as last 1/8 of total body height
nzhead = 7 * int(data.shape[2] / 8)
print('Dimensions of head model: {:g} x {:g} x {:g} cells'.format(data.shape[0], data.shape[1], data.shape[2] - nzhead))
logger.info(f'Dimensions of head model: {data.shape[0]:g} x {data.shape[1]:g} x {data.shape[2] - nzhead:g} cells')
# Write HDF5 file
headfile = os.path.splitext(args.filename)[0] + '_head.h5'