Commit 7b81f327 authored by renzo's avatar renzo

procesar_noaa arreglado

parent 65143245
......@@ -43,7 +43,7 @@ def get_downloader_args(f, terminal_args):
return args
# Starts logging and lock the downloader file so only once process can access
# Starts logging and lock the downloader name so only once process can access
def start_logging(source):
global log_handle
log_path = metadata.logs_path + "/" + source + ".log"
......
......@@ -73,22 +73,22 @@ for source in sources:
paths[source] = getattr(metadata, source)["output_path"]
for path, dirnames, filenames in os.walk(root):
source_counter = 0
for i, source in enumerate(sources):
found = copy_mats(paths, path, filenames, templates[i])
if not found:
script_name = getattr(metadata, source)["process"][0]
script_path = metadata.matlab_scripts + "/" + script_name + ".m"
copy(script_path, path)
if source == "noaa":
optional_args = {"day": "today"}
else:
optional_args = {}
call = create_matlab_call(script_name, source, optional_args)
os.chdir(path)
subprocess.run(call, shell=True)
if path != root:
source_counter = 0
for i, source in enumerate(sources):
found = copy_mats(paths, path, filenames, templates[i])
if found:
source_counter += 1
if source_counter == 5:
shutil.rmtree(path)
\ No newline at end of file
if not found:
script_name = getattr(metadata, source)["process"][0]
script_path = metadata.matlab_scripts + "/" + script_name + ".m"
copy(script_path, path)
optional_args = {"output_path": path}
if source == "noaa":
optional_args["day"] = "today"
call = create_matlab_call(script_name, source, optional_args)
os.chdir(path)
# subprocess.run(call, shell=True)
found = copy_mats(paths, path, filenames, templates[i])
if found:
source_counter += 1
if source_counter == 5:
shutil.rmtree(path)
\ No newline at end of file
......@@ -2,7 +2,10 @@ function []=procesar_noaa(output_path, day, nctoolbox_path)
run(nctoolbox_path)
formatted_date = datestr(now, 'yyyymmdd');
if day == "today"
formatted_date = datestr(now, 'yyyymmdd');
else
formatted_date = datestr(now - days(1), 'yyyymmdd');
date = datenum(formatted_date,'yyyymmdd')
date=datevec(date)
......@@ -372,7 +375,7 @@ function []=procesar_noaa(output_path, day, nctoolbox_path)
% diflat=abs(max(latweb-lat));
% diflon=abs(max(lonweb-lon));
% difP=abs(max(max(Pweb-P_sup)));
% difhora=abs(horaweb-hora);
% difhora=abs(horaweb-hora);datestr(now, 'yyyymmdd');
for i=1:9
url=strcat('gfs.t12z.pgrb2.0p25.f00',num2str(i),'');
......@@ -648,4 +651,4 @@ function []=procesar_noaa(output_path, day, nctoolbox_path)
end
nc=[];
delete gfs*
end
\ No newline at end of file
end
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