1 | #!/usr/bin/env python |
---|
2 | # -*- coding: utf-8 -*- |
---|
3 | import string |
---|
4 | import numpy as np |
---|
5 | import matplotlib.pyplot as plt |
---|
6 | from pylab import * |
---|
7 | from mpl_toolkits.basemap import Basemap |
---|
8 | from mpl_toolkits.basemap import shiftgrid, cm |
---|
9 | |
---|
10 | |
---|
11 | |
---|
12 | def draw_map_cartes_l (x_coast, y_coast, z_coast, volume, xvec, yvec, zvar, c0, c1, dc, colormap, text): |
---|
13 | |
---|
14 | |
---|
15 | ############################ |
---|
16 | # definition of input data # |
---|
17 | ############################ |
---|
18 | # x_coast = x coordinate of each point of coast line (1D-array) |
---|
19 | # y_coast = y coordinate of each point of coast line (1D-array) |
---|
20 | # z_coast = value of coast line (1 if coast line, 0 if land or sea) (1D-array) |
---|
21 | # volume = size of points plotted on the map (integer) |
---|
22 | # xvec = x coordinate of data we want to map |
---|
23 | # yvec = y coordinate of data we want to map |
---|
24 | # zvar = values of data we want to map (2-D array) |
---|
25 | # c0, c1, dc = resolution of colorbar of the map |
---|
26 | # colormap = type of colorbar for the map |
---|
27 | # text = legend of the colorbar |
---|
28 | |
---|
29 | figure() |
---|
30 | scatter(x_coast, y_coast, c = z_coast, s = volume) |
---|
31 | clevs = np.arange(c0, c1, dc) |
---|
32 | #cmap = cm.s3pcpn_l_r |
---|
33 | cs = contourf(xvec, yvec, zvar, clevs, cmap = colormap) |
---|
34 | cbar = colorbar(cs) |
---|
35 | cbar.set_label(text) |
---|
36 | xlim(-3500, 2700.) |
---|
37 | ylim(-4000, 2800.) |
---|
38 | |
---|
39 | |
---|
40 | return |
---|