Commit 0d63f875 authored by renzo's avatar renzo

detalles menores en el script para migrar datos

parent 16373fe0
# import requests
#
# shots_url = 'http://www.hidro.gob.ar/Api/v1/AlturasHorarias/ValoresGrafico/BSAS/2020-04-14T12:19'
# shots_url = ''
#
# # request the URL and parse the JSON
# response = requests.get(shots_url)
# response.raise_for_status() # raise exception if invalid response
# shots = response.json()
# 1
import os
import subprocess
......@@ -17,8 +16,6 @@ import re
from shutil import copy
import metadata
def get_signature(script_name):
script_path = metadata.matlab_scripts + "/" + script_name + ".m"
regex = r"function.*=.*" + script_name + ".*[(](.*)[)]"
......@@ -74,6 +71,7 @@ for source in sources:
paths[source] = getattr(metadata, source)["output_path"]
delete = []
copied = []
for path, dirnames, filenames in os.walk(root):
if path != root:
source_counter = 0
......@@ -88,11 +86,16 @@ for path, dirnames, filenames in os.walk(root):
optional_args["day"] = "today"
call = create_matlab_call(script_name, source, optional_args)
os.chdir(path)
subprocess.run(call, shell=True)
# subprocess.run(call, shell=True)
found = copy_mats(paths, path, filenames, templates[i])
if found:
if path not in copied:
copied.append(path)
source_counter += 1
if source_counter == 5:
delete.append(path)
print(path + ": " + str(source_counter))
print(delete)
\ No newline at end of file
print("Carpetas a borrar:")
print(delete)
print("Carpetas de las que se copiaron archivos:")
print(copied)
\ No newline at end of file
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