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

Rename `shp_tr_dir` to `shp_coll_dir`

There may be a fourth shapefile for centers of eddies.
parent a024b7cc
No related branches found
No related tags found
No related merge requests found
......@@ -141,10 +141,10 @@ def snapshot(ax, ishape_list, readers, *, dashed = False, light = False,
if not light: lines[0].set_marker("o")
if dashed: lines[0].set_linestyle("dashed")
def plot_grid_bb(shp_tr_dir, ax):
def plot_grid_bb(shp_coll_dir, ax):
"""Grid bounding box."""
file = path.join(shp_tr_dir, "grid_nml.txt")
file = path.join(shp_coll_dir, "grid_nml.txt")
grid_nml = f90nml.read(file)["grid_nml"]
rect = patches.Rectangle(grid_nml["corner_deg"],
(grid_nml["nlon"] - 1) * 0.25,
......@@ -199,20 +199,20 @@ def make_animation(fig, ax, k1, ishape_last, readers, window, k_min, k_max,
interval = 500)
return ani
def open_shpt(shp_tr_dir):
readers = {"extr": shapefile.Reader(path.join(shp_tr_dir, "extremum")),
def open_shpt(shp_coll_dir):
readers = {"extr": shapefile.Reader(path.join(shp_coll_dir, "extremum")),
"outer":
shapefile.Reader(path.join(shp_tr_dir, "outermost_contour"))}
shapefile.Reader(path.join(shp_coll_dir, "outermost_contour"))}
try:
readers["m_s"] = shapefile.Reader(path.join(shp_tr_dir,
readers["m_s"] = shapefile.Reader(path.join(shp_coll_dir,
"max_speed_contour"))
except shapefile.ShapefileException:
print("Shapefile max_speed_contour not found. "
"Max-speed contours will not be plotted.")
k1 = readers["extr"].record(0).date_index
fname = path.join(shp_tr_dir, "ishape_last.txt")
fname = path.join(shp_coll_dir, "ishape_last.txt")
try:
ishape_last = np.loadtxt(fname, dtype = int, ndmin = 1)
......@@ -248,7 +248,7 @@ if __name__ == "__main__":
help = "dashed linestyle, useful for a second snapshot")
parser.add_argument("-a", "--anim", type = int, nargs = 2,
metavar = ("k_min", "k_max"), help = "make animation")
parser.add_argument("shp_tr_dir", help = "containing the three shapefiles")
parser.add_argument("shp_coll_dir", help = "containing the three shapefiles")
parser.add_argument("--save", metavar = "format",
help = "Save file to specified format")
args = parser.parse_args()
......@@ -275,7 +275,7 @@ if __name__ == "__main__":
lon_mask = np.ones(len(longitude), dtype = bool)
lat_mask = np.ones(len(latitude), dtype = bool)
readers, k1, ishape_last = open_shpt(args.shp_tr_dir)
readers, k1, ishape_last = open_shpt(args.shp_coll_dir)
fig = plt.figure()
src_crs = ccrs.PlateCarree()
projection = ccrs.PlateCarree()
......@@ -300,7 +300,7 @@ if __name__ == "__main__":
ax.plot(lon_2d.reshape(-1), lat_2d.reshape(-1), transform = src_crs,
marker = "+", color = "gray", linestyle = "None")
if args.window is None: plot_grid_bb(args.shp_tr_dir, ax)
if args.window is None: plot_grid_bb(args.shp_coll_dir, ax)
ishape_list = select_ishapes(k, k1, ishape_last, readers["extr"],
args.window)
ax.set_title(f"k = {k}", y = 1.05)
......
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