Skip to content
Snippets Groups Projects
Commit 7d9cb521 authored by Lionel GUEZ's avatar Lionel GUEZ
Browse files

Do not create `SHPC_{orient}_all_dates`

Create `SHPC_{orient}` before the loop on dates.
parent 91e564e3
No related branches found
No related tags found
No related merge requests found
......@@ -58,8 +58,8 @@ else:
last_date = my_date
for orient in ["cyclo", "anti"]:
if os.access(f"SHPC_{orient}_all_dates", os.F_OK):
shutil.rmtree(f"SHPC_{orient}_all_dates")
if os.access(f"SHPC_{orient}", os.F_OK): shutil.rmtree(f"SHPC_{orient}")
os.mkdir(f"SHPC_{orient}")
perf_report = open("perf_report.csv", "w", newline='')
writer = csv.writer(perf_report, lineterminator = "\n")
......@@ -83,8 +83,6 @@ while True:
nc_file = "unpacked.nc"
os.symlink(nc_file, "h.nc")
os.symlink(nc_file, "uv.nc")
os.mkdir("SHPC_cyclo")
os.mkdir("SHPC_anti")
elapsed_NCO = time.perf_counter() - my_pc
with open("main_nml.txt") as nml_file:
......@@ -101,18 +99,10 @@ while True:
my_pc = time.perf_counter()
for orient in ["cyclo", "anti"]:
if os.access(f"SHPC_{orient}_all_dates", os.F_OK):
if os.access(f"SHPC_{orient}", os.F_OK):
shutil.rmtree(f"SHPC_{orient}")
with open(f"SHPC_{orient}_all_dates/ishape_last.txt", "a") as \
ishape_last, \
shapefile.Reader(f"SHPC_{orient}_all_dates/extremum") as shpr:
n_shapes = len(shpr)
ishape_last.write(str(n_shapes - 1) + "\n")
else:
if os.access(f"SHPC_{orient}", os.F_OK):
os.rename(f"SHPC_{orient}", f"SHPC_{orient}_all_dates")
with open(f"SHPC_{orient}/ishape_last.txt", "a") as ishape_last, \
shapefile.Reader(f"SHPC_{orient}/extremum") as shpr:
n_shapes = len(shpr)
ishape_last.write(str(n_shapes - 1) + "\n")
elapsed_cat = time.perf_counter() - my_pc
writer.writerow([my_date, elapsed_NCO, elapsed_Fortran, elapsed_cat])
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment