source: trunk/src/scripts_Laura/ARCTIC/Travail_CEN/map_cartesian_grid.py @ 55

Last change on this file since 55 was 41, checked in by lahlod, 10 years ago

new scripts to regrid data in cartesian grid

File size: 1.3 KB
Line 
1#!/usr/bin/env python
2# -*- coding: utf-8 -*-
3import string
4import numpy as np
5import matplotlib.pyplot as plt
6from pylab import *
7from mpl_toolkits.basemap import Basemap
8from mpl_toolkits.basemap import shiftgrid, cm
9
10
11
12def 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 
Note: See TracBrowser for help on using the repository browser.