Skip to content

Commit

Permalink
Realized I neede One More Check
Browse files Browse the repository at this point in the history
  • Loading branch information
chriswmackey committed May 4, 2017
1 parent 08feff2 commit aeabf0d
Show file tree
Hide file tree
Showing 2 changed files with 14 additions and 7 deletions.
21 changes: 14 additions & 7 deletions src/Ladybug_Open EPW And STAT Weather Files.py
Expand Up @@ -133,22 +133,29 @@ def unzip(source_filename, dest_dir):

def addresses(directory):
epw, stat = None, None
try:
keyText = directory.split('\\')[-2].replace('.','_')
except:
keyText = ''
for file in os.listdir(directory):
if file.endswith('.epw'):
if file.endswith('.epw') and keyText in file.replace('.','_'):
epw = directory + '/' + file
elif file.endswith('.stat'):
elif file.endswith('.stat')and keyText in file.replace('.','_'):
stat = directory + '/' + file

return epw, stat

def checkIfAlreadyDownloaded(workingDir, url):
if os.path.isdir(workingDir):
epw, stat = addresses(workingDir)
if os.path.isfile(epw) == True and os.path.isfile(stat) == True:
return True, epw, stat
try:
if os.path.isdir(workingDir):
epw, stat = addresses(workingDir)
if os.path.isfile(epw) == True and os.path.isfile(stat) == True:
return True, epw, stat
else:
return False, None, None
else:
return False, None, None
else:
except:
return False, None, None


Expand Down
Binary file modified userObjects/Ladybug_Open EPW And STAT Weather Files.ghuser
Binary file not shown.

0 comments on commit aeabf0d

Please sign in to comment.