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

Generalize to accept different dimension names

parent cd162b32
No related branches found
No related tags found
No related merge requests found
...@@ -17,8 +17,14 @@ colors = itertools.cycle(['blue', 'orange', 'green', 'red', 'purple', 'brown', ...@@ -17,8 +17,14 @@ colors = itertools.cycle(['blue', 'orange', 'green', 'red', 'purple', 'brown',
for filename in glob.glob("h_region_*.nc") + ["h_outermost.nc"]: for filename in glob.glob("h_region_*.nc") + ["h_outermost.nc"]:
with netCDF4.Dataset(filename) as f: with netCDF4.Dataset(filename) as f:
jumble.draw_bbox(f.variables["lon"][0], f.variables["lon"][-1], if "lon" in f.variables:
f.variables["lat"][0], f.variables["lat"][-1], lon = "lon"
lat = "lat"
else:
lon = "longitude"
lat = "latitude"
jumble.draw_bbox(f[lon][0], f[lon][-1], f[lat][0], f[lat][-1],
colors = [next(colors)], label = filename) colors = [next(colors)], label = filename)
plt.legend(loc = "lower left", bbox_to_anchor = (1, 0.5)) plt.legend(loc = "lower left", bbox_to_anchor = (1, 0.5))
......
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