Skip to content

Commit

Permalink
Make directories only if they don't exist
Browse files Browse the repository at this point in the history
  • Loading branch information
xylar committed Oct 5, 2017
1 parent cb471e4 commit d8fe3ad
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
5 changes: 4 additions & 1 deletion feature_creation_scripts/iceshelves/write_basin_distances.py
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@ def readBasinImage(name):
outFile.createDimension('basinCount',basinCount)
var = outFile.createVariable('distances','f8',('basinCount','y','x'))

os.makedirs('dist')
try:
os.makedirs('dist')
except OSError:
pass

for basinIndex in range(len(names)):
name = names[basinIndex]
Expand Down
5 changes: 4 additions & 1 deletion feature_creation_scripts/iceshelves/write_basin_images.py
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,10 @@ def writeBasinImage(basinShape, name):

dx = 1e3

os.makedirs('basins')
try:
os.makedirs('basins')
except OSError:
pass

for index in range(len(basinShapes)):
name = basinData['features'][index]['properties']['name']
Expand Down

0 comments on commit d8fe3ad

Please sign in to comment.