Commit edbbcad1 authored by renzo's avatar renzo

shn vuelve el dia actual y el anterior, pero no los otros

parent 7a08b13f
......@@ -36,13 +36,13 @@ def downloader(date, destination_path):
def download_shn(tmp_path, date):
# The matlab script that process the data needs the data from the previous 4 days,
# so that data is also downloaded in case it wasn't downloaded before
for day in range(0, 5):
cur_date = date - timedelta(days=day)
for day_diff in range(0, 5):
cur_date = date - timedelta(days=day_diff)
destination_dir = tmp_path + "/" + datetime.strftime(cur_date, '%Y%m%d')
if destination_dir and not os.path.exists(destination_dir):
os.makedirs(destination_dir)
destination_path = destination_dir + "/data.csv"
if os.path.exists(destination_path):
if os.path.exists(destination_path) and day_diff > 1:
continue
downloader(cur_date, destination_path)
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment