...
 
Commits (2)
......@@ -5,12 +5,28 @@ from os.path import isfile, join
import metadata
from main import start, parse_arguments
patterns = {}
patterns["shn"] = {"Argentina"}
patterns["anp"] = {"LPa", "MVD", "IdF"}
patterns["hycom"] = {"fn", "estaciones"}
patterns["noaa"] = {"noaa00", "noaa06", "noaa12", "noaa18"}
patterns["copernicus"] = {"estacionesCOP", "fnaCOP"}
def download_all(args):
config = getattr(metadata, args["source"])
path = config["output_path"]
dates = [datetime.strptime(f[:8], '%Y%m%d') for f in listdir(path) if isfile(join(path, f)) and f[-3:] == "mat"]
min_date = min(dates)
files_per_date = {}
dates = []
for f in listdir(path):
if isfile(join(path, f)) and f[-3:] == "mat":
date = datetime.strptime(f[:8], '%Y%m%d')
if date not in files_per_date:
files_per_date[date] = set()
files_per_date[date].add(f[8:-4])
if files_per_date[date] == patterns[args["source"]]:
dates.append(date)
min_date = min(files_per_date.keys())
max_date = datetime.today()
cur_date = min_date
while (cur_date <= max_date):
......