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

Draw the domain in `plot_snaphot.py`

In `plot_snapshot.py`, read `grid_nml.txt` and draw a rectangle
showing the domain.
parent 2d27b167
No related branches found
No related tags found
No related merge requests found
......@@ -153,6 +153,8 @@ def snapshot(directory, k = None, *, dashed = False, light = False,
if __name__ == "__main__":
import argparse
import sys
import f90nml
from matplotlib import patches
parser = argparse.ArgumentParser()
parser.add_argument("-v", "--velocity", help = "plot velocity field",
......@@ -207,6 +209,13 @@ if __name__ == "__main__":
ax.plot(lon_2d.reshape(-1), lat_2d.reshape(-1), transform = src_crs,
marker = "+", color = "gray", linestyle = "None")
file = path.join(args.directory, "grid_nml.txt")
grid_nml = f90nml.read(file)["grid_nml"]
rect = patches.Rectangle(grid_nml["corner_deg"],
(grid_nml["nlon"] - 1) * 0.25,
(grid_nml["nlat"] - 1) * 0.25, edgecolor="black",
fill=False)
ax.add_patch(rect)
snapshot(args.directory, args.k, dashed = args.dashed,
light = args.light, window = args.window)
......
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