From 99e82ee0190d4f5e0d73e51ee336e3e64cfff110 Mon Sep 17 00:00:00 2001 From: Pierre Cazenave Date: Tue, 13 Jan 2015 17:09:49 +0000 Subject: [PATCH] Add a map of the time series locations. --- Estuary/python/compare_var.py | 18 ++++++++++++++++++ 1 file changed, 18 insertions(+) diff --git a/Estuary/python/compare_var.py b/Estuary/python/compare_var.py index 67163a7..2e9431d 100644 --- a/Estuary/python/compare_var.py +++ b/Estuary/python/compare_var.py @@ -8,6 +8,7 @@ The model grids must match exactly in the different model runs. import os import glob +import string import numpy as np import matplotlib.pyplot as plt @@ -201,6 +202,23 @@ if __name__ == '__main__': # we've got observations. F, valid_indices = timeseries(conf, sites) + labels = ['{})'.format(s) for s in list(string.ascii_lowercase)] + + # Plot a map. + FG = ncread(fvcom[0], vars=('lon', 'lat', 'h', 'nv')) + fig0 = plt.figure(figsize=(10, 7)) + ax0 = fig0.add_subplot(1, 1, 1) + tp0 = ax0.tripcolor(FG['lon'], FG['lat'], FG['nv'].transpose() - 1, -FG['h']) + pt0 = ax0.plot(F[names[0]]['lon'], F[names[0]]['lat'], 'wo') + for ii, p in enumerate(valid_indices): + ax0.text(F[names[0]]['lon'][p], F[names[0]]['lat'][p], + labels[ii % len(labels)], color='w') + cb0 = fig0.colorbar(tp0) + cb0.set_label('Depth (m)') + ax0.axis('equal') + fig0.tight_layout() + fig0.show() + # Fix number formatting. date_fmt = DateFormatter('%m') formatter = ScalarFormatter(useOffset=False) -- GitLab