Skip to content

Commit

Permalink
rebase and add download utility
Browse files Browse the repository at this point in the history
  • Loading branch information
thurber committed Feb 15, 2021
1 parent a72d5ed commit e47acfd
Show file tree
Hide file tree
Showing 3 changed files with 54 additions and 2 deletions.
53 changes: 53 additions & 0 deletions download.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,53 @@
import enum
import os

from benedict import benedict

from mosartwmpy.utilities.download_data import download_data

available_data = benedict.from_yaml('./mosartwmpy/data_manifest.yaml')

data_list = []
data = []

for i, name in enumerate(available_data.keys()):
data_list.append(name)
data.append(f"""
{i + 1}) {name} - {available_data.get(f'{name}.description')}""")

# clear the terminal
print(chr(27) + "[2J")

print(f"""
🎶 Welcome to the mosartwmpy download utility! 🎵
Please select the data you wish to download by typing the number:
""")

for d in data:
print(f"""
{d}""")

print(f"""
0) exit
""")
try:
user_input = int(input("""
Please select a number and press enter: """))
except:
pass

if not user_input or user_input == 0 or user_input > len(data):
print("""
Exiting...
""")

else:
print("")
print("")
download_data(data_list[user_input - 1])

2 changes: 1 addition & 1 deletion mosartwmpy/data_manifest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ sample_input:

validation:
description: Result datasets that can be used for validating the model; includes results with and without WM; covers 1981-1982.
url: TODO
url: https://zenodo.org/record/4539693/files/mosartwmpy_validation.zip?download=1
destination: ./validation

# TODO add other weather files, demand files, etc as they become ready
1 change: 0 additions & 1 deletion mosartwmpy/utilities/download_data.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,6 @@
import sys

from benedict import benedict
from pkg_resources import get_distribution


def download_data(dataset: str, destination: str = None, manifest: str = './mosartwmpy/data_manifest.yaml') -> None:
Expand Down

0 comments on commit e47acfd

Please sign in to comment.