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

Use only velocity file in `plot_veloicty.py`

And it is then conveninent to choose it from the command line.
parent adf5a96c
No related branches found
No related tags found
No related merge requests found
...@@ -18,9 +18,10 @@ parser.add_argument("--save", metavar = "format", ...@@ -18,9 +18,10 @@ parser.add_argument("--save", metavar = "format",
help = "Save file to specified format") help = "Save file to specified format")
parser.add_argument("-u", "--undefined", action = "store_true", parser.add_argument("-u", "--undefined", action = "store_true",
help = "plot points where velocity is not defined") help = "plot points where velocity is not defined")
parser.add_argument("input_file", help = "NetCDF file containing velocity")
args = parser.parse_args() args = parser.parse_args()
with netCDF4.Dataset("h.nc") as f: with netCDF4.Dataset(args.input_file) as f:
if "lon" in f.variables: if "lon" in f.variables:
lon = "lon" lon = "lon"
lat = "lat" lat = "lat"
...@@ -53,7 +54,7 @@ projection = ccrs.PlateCarree() ...@@ -53,7 +54,7 @@ projection = ccrs.PlateCarree()
##projection = ccrs.NorthPolarStereo() ##projection = ccrs.NorthPolarStereo()
ax = plt.axes(projection = projection) ax = plt.axes(projection = projection)
with netCDF4.Dataset("uv.nc") as f: with netCDF4.Dataset(args.input_file) as f:
if args.undefined: if args.undefined:
undef_velocity = np.logical_or(f["ugos"][0].mask, f["vgos"][0].mask) undef_velocity = np.logical_or(f["ugos"][0].mask, f["vgos"][0].mask)
lon_2d, lat_2d = np.meshgrid(longitude[lon_mask], lon_2d, lat_2d = np.meshgrid(longitude[lon_mask],
......
...@@ -61,11 +61,10 @@ ...@@ -61,11 +61,10 @@
{ {
"title": "Plot_velocity", "title": "Plot_velocity",
"command": "command":
["$src_dir/Inst_eddies/Analysis/plot_velocity.py", "--save=png"],
"required":
[ [
["$src_dir/Inst_eddies/Tests/Input/h_region_4.nc", "h.nc"], "$src_dir/Inst_eddies/Analysis/plot_velocity.py",
["$src_dir/Inst_eddies/Tests/Input/uv_region_4.nc", "uv.nc"] "$src_dir/Inst_eddies/Tests/Input/uv_region_4.nc",
"--save=png"
] ]
}, },
{ {
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment