Create results dir if it does not exists

pull/1/head
Tammo Jan Dijkema 2020-03-01 18:36:24 +01:00
parent 6ef4f99cde
commit 24f1c61aa6
2 changed files with 22 additions and 4 deletions

View File

@ -141,6 +141,27 @@
" station_type = \"intl\""
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [
{
"ename": "NameError",
"evalue": "name 'os' is not defined",
"output_type": "error",
"traceback": [
"\u001b[0;31m---------------------------------------------------------------------------\u001b[0m",
"\u001b[0;31mNameError\u001b[0m Traceback (most recent call last)",
"\u001b[0;32m<ipython-input-2-38adb07b9031>\u001b[0m in \u001b[0;36m<module>\u001b[0;34m\u001b[0m\n\u001b[0;32m----> 1\u001b[0;31m \u001b[0mos\u001b[0m\u001b[0;34m.\u001b[0m\u001b[0mmakedirs\u001b[0m\u001b[0;34m(\u001b[0m\u001b[0;34m'results'\u001b[0m\u001b[0;34m,\u001b[0m \u001b[0mexist_ok\u001b[0m\u001b[0;34m=\u001b[0m\u001b[0;32mTrue\u001b[0m\u001b[0;34m)\u001b[0m\u001b[0;34m\u001b[0m\u001b[0;34m\u001b[0m\u001b[0m\n\u001b[0m",
"\u001b[0;31mNameError\u001b[0m: name 'os' is not defined"
]
}
],
"source": [
"os.makedirs('results', exist_ok=True)"
]
},
{
"cell_type": "code",
"execution_count": 11,

View File

@ -267,10 +267,7 @@ def make_ground_image(xst_filename,
else:
station_type = "intl"
try:
os.mkdir('results')
except FileExistsError:
pass
os.makedirs('results', exist_ok=True)
# Distill metadata from filename
obsdatestr, obstimestr, _, rcu_mode, _, subbandname = cubename.rstrip(".dat").split("_")