#!/usr/bin/env python # -*- coding: utf-8 -*- import xarray as xr from matplotlib import pyplot as plt # Load dataset with xarray ax = plt.subplot(111) with xr.open_dataset('output_eddy.nc') as h: N = 20 # plot contour every N ax.plot((h.speed_contour_longitude[::N].T + 180) % 360 - 180, h.speed_contour_latitude[::N].T, 'r') # plot path ax.plot((h.longitude + 180) % 360 - 180, h.latitude, 'b', label='eddy path') ax.set_aspect('equal') ax.legend() ax.grid() plt.show()