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 | from netCDF4 import Dataset |
---|
10 | import arctic_map # function to regrid coast limits |
---|
11 | import cartesian_grid_test # function to convert grid from polar to cartesian |
---|
12 | import scipy.special |
---|
13 | import ffgrid2 |
---|
14 | import map_ffgrid |
---|
15 | |
---|
16 | |
---|
17 | |
---|
18 | month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER']) |
---|
19 | month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31]) |
---|
20 | M = len(month) |
---|
21 | |
---|
22 | |
---|
23 | |
---|
24 | dx=1. |
---|
25 | dy=0.5 |
---|
26 | x0, x1 = -180., 180. |
---|
27 | y0, y1 = 65., 90. |
---|
28 | xx = np.arange(x0, x1 + dx, dx) |
---|
29 | yy = np.arange(y0, y1 + dy, dy) |
---|
30 | nx = len(xx) |
---|
31 | ny = len(yy) |
---|
32 | |
---|
33 | |
---|
34 | eee = np.zeros([ny, nx, M], float) |
---|
35 | for imo in range (0, M): |
---|
36 | print 'month: ' + month[imo] |
---|
37 | fichier = open('/mma/hermozol/Documents/Data_tests/monthly_GLACE/lamb_spec_param_near_nadir_' + month[imo] + '2009.dat','r') |
---|
38 | numlines = 0 |
---|
39 | for line in fichier: numlines += 1 |
---|
40 | fichier.close |
---|
41 | fichier = open('/mma/hermozol/Documents/Data_tests/monthly_GLACE/lamb_spec_param_near_nadir_' + month[imo] + '2009.dat','r') |
---|
42 | nbtotal = numlines-1 |
---|
43 | iligne = 0 |
---|
44 | lat = np.zeros([nbtotal],float) |
---|
45 | lon = np.zeros([nbtotal],float) |
---|
46 | e_spec_lamb = np.zeros([nbtotal],float) |
---|
47 | while (iligne < nbtotal) : |
---|
48 | line=fichier.readline() |
---|
49 | liste = line.split() |
---|
50 | lat[iligne] = float(liste[2]) |
---|
51 | lon[iligne] = float(liste[1]) |
---|
52 | e_spec_lamb[iligne] = float(liste[18]) |
---|
53 | iligne=iligne+1 |
---|
54 | fichier.close() |
---|
55 | # grid [e_lamb - e_spec] |
---|
56 | print 'grid [e_lamb - e_spec]' |
---|
57 | z0 = e_spec_lamb.min() |
---|
58 | z1 = e_spec_lamb.max() |
---|
59 | zgrid, xvec, yvec = ffgrid2.ffgrid(lon, lat, e_spec_lamb, dx, dy, x0, x1, y0, y1, z0, z1) |
---|
60 | e_spec_lamb_month = zgrid |
---|
61 | eee[:, :, imo] = e_spec_lamb_month[:, :] |
---|
62 | |
---|
63 | plt.ion() |
---|
64 | for imo in range (0, M): |
---|
65 | map_ffgrid.draw_map_l (xvec, yvec, 0., 0.05, 0.001, eee[:, :, imo], 'emis lamb - emis spec') |
---|
66 | title(month[imo] + ' 2009 - AMSUB') |
---|
67 | plt.savefig('/mma/hermozol/Documents/figure_output/comp_lamb_spec/space_evolution/emis_spec-lamb_AMSUB_' + month[imo] + '2009.png') |
---|
68 | |
---|