Files
CoolProp/dev/scripts/replace_ancillaries.py
Matthis Thorade 19a4875879 More autopep8 (#1621)
* autopep8 rule-groups E101,W1,W2,W3

* autopep8 with rule group E3 (blank lines)

autopep8 --in-place --recursive --max-line-length=200 --exclude="externals" --select="E101,E3,W1,W2,W3" .

* tabs and space W191

* autopep8 aggressive
2017-12-13 14:43:41 +01:00

25 lines
657 B
Python

#!/Users/ian/anaconda/bin/python
import json, glob, CoolProp
for fluid in glob.glob('../fluids/*.json'):
with open(fluid, 'r') as fp:
jj = json.load(fp)
pL = jj['ANCILLARIES'].pop('pL')
pV = jj['ANCILLARIES'].pop('pV')
# Keep the one with the lower error
if pL['max_abserror_percentage'] < pV['max_abserror_percentage']:
pS = pL
else:
pS = pV
pseudo_pure = jj['EOS'][0]['pseudo_pure']
if pseudo_pure:
print '-----------------PSEUDO (SKIPPING !!!)', fluid
else:
print fluid
jj['ANCILLARIES']['pS'] = pS
with open(fluid, 'w') as fp:
json.dump(jj, fp)