Skip to content

Commit fa73001

Browse files
authored
Merge pull request #19 from ClimateImpactLab/bump_dscimv0.2.1
Update directory_setup.py to download most recent dscim inputs
2 parents 2c0d783 + b9eec4e commit fa73001

File tree

1 file changed

+7
-7
lines changed

1 file changed

+7
-7
lines changed

scripts/directory_setup.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -43,8 +43,8 @@ def makedir(path):
4343

4444
# Download inputs from internet
4545
print("Downloading input files...")
46-
url = 'https://storage.googleapis.com/climateimpactlab-scc-tool/dscim-epa_input_data/dscim_v0.1.0_inputs.zip'
47-
name = 'dscim_v0.1.0_inputs.zip'
46+
name = 'dscim_v20220929_inputs.zip'
47+
url = 'https://storage.googleapis.com/climateimpactlab-scc-tool/dscim-epa_input_data/' + name
4848
with requests.get(url, stream = True) as r:
4949
r.raise_for_status()
5050
with open(name, 'wb') as f:
@@ -53,17 +53,17 @@ def makedir(path):
5353
if chunk: # filter out keep-alive new chunks
5454
f.write(chunk)
5555
pbar.update(len(chunk))
56-
56+
print("")
5757
print("Unzipping input files...")
58-
with zipfile.ZipFile('./dscim_v0.1.0_inputs.zip', 'r') as zip_ref:
58+
with zipfile.ZipFile(Path(base) / name, 'r') as zip_ref:
5959
for member in tqdm(zip_ref.infolist()):
6060
try:
61-
zip_ref.extract(member, './')
61+
zip_ref.extract(member, Path(base))
6262
except zipfile.error as e:
6363
pass
6464

65-
if os.path.exists("./dscim_v0.1.0_inputs.zip"):
66-
os.remove("./dscim_v0.1.0_inputs.zip")
65+
if os.path.exists(Path(base) / name):
66+
os.remove(Path(base) / name)
6767
else:
6868
print("Download Failed")
6969

0 commit comments

Comments
 (0)