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

Change the arborescence of files

Adapt to the new definition of an SHPC.
parent 1e8f0da2
No related branches found
No related tags found
No related merge requests found
...@@ -172,29 +172,33 @@ else: ...@@ -172,29 +172,33 @@ else:
# There are two factories, one for cyclones and one for anticyclones: # There are two factories, one for cyclones and one for anticyclones:
factories = [dict(writers = {}, cell_name = "Anticyclonic_Cell", factories = [dict(writers = {}, cell_name = "Anticyclonic_Cell",
cyclone = False, SHPC = "SHPC_anti", id = "id_anti_cell"), cyclone = False, orientation = "Anticyclones",
id = "id_anti_cell"),
dict(writers = {}, cell_name = "Cyclonic_Cell", cyclone = True, dict(writers = {}, cell_name = "Cyclonic_Cell", cyclone = True,
SHPC = "SHPC_cyclo", id = "id_cyclo_cell")] orientation = "Cyclones", id = "id_cyclo_cell")]
for factory in factories: for factory in factories:
fname = path.join(factory["SHPC"], "extremum") fname = path.join("SHPC", "Slice_0", factory["orientation"], "extremum")
factory["writers"]["extr"] = shapefile.Writer(fname, factory["writers"]["extr"] = shapefile.Writer(fname,
shapeType = shapefile.POINT) shapeType = shapefile.POINT)
fname = path.join(factory["SHPC"], "centroid") fname = path.join("SHPC", "Slice_0", factory["orientation"], "centroid")
factory["writers"]["centroid"] \ factory["writers"]["centroid"] \
= shapefile.Writer(fname, shapeType = shapefile.POINT) = shapefile.Writer(fname, shapeType = shapefile.POINT)
fname = path.join(factory["SHPC"], "outermost_contour") fname = path.join("SHPC", "Slice_0", factory["orientation"],
"outermost_contour")
factory["writers"]["outer"] \ factory["writers"]["outer"] \
= shapefile.Writer(fname, shapeType = shapefile.POLYGON) = shapefile.Writer(fname, shapeType = shapefile.POLYGON)
fname = path.join(factory["SHPC"], "max_speed_contour") fname = path.join("SHPC", "Slice_0", factory["orientation"],
"max_speed_contour")
factory["writers"]["max_speed"] \ factory["writers"]["max_speed"] \
= shapefile.Writer(fname, shapeType = shapefile.POLYGON) = shapefile.Writer(fname, shapeType = shapefile.POLYGON)
define_fields(factory["writers"]) define_fields(factory["writers"])
fname = path.join(factory["SHPC"], "ishape_last.txt") fname = path.join("SHPC", "Slice_0", factory["orientation"],
"ishape_last.txt")
factory["writers"]["ishape_last"] = open(fname, "w") factory["writers"]["ishape_last"] = open(fname, "w")
...@@ -250,16 +254,8 @@ nml["grid_nml"] = dict(corner_deg = [matlab_data["X"][0], matlab_data["Y"][0]], ...@@ -250,16 +254,8 @@ nml["grid_nml"] = dict(corner_deg = [matlab_data["X"][0], matlab_data["Y"][0]],
nlat = matlab_data["Y"].size, nlat = matlab_data["Y"].size,
step_deg = [matlab_data["X"][1] - matlab_data["X"][0], step_deg = [matlab_data["X"][1] - matlab_data["X"][0],
matlab_data["Y"][1] - matlab_data["Y"][0]]) matlab_data["Y"][1] - matlab_data["Y"][0]])
fname = path.join("SHPC", "grid_nml.txt")
nml.write(fname, force = True)
for factory in factories: for factory in factories:
fname = path.join(factory["SHPC"], "grid_nml.txt")
nml.write(fname, force = True)
fname = path.join(factory["SHPC"], "orientation.txt")
with open(fname, "w") as f:
if factory["cyclone"]:
f.write("cyclones\n")
else:
f.write("anticyclones\n")
for key, v in factory["writers"].items(): v.close() for key, v in factory["writers"].items(): v.close()
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