source: trunk/src/scripts_Laura/ARCTIC/Travail_CEN/map_monthly_emis_spec-lamb.py @ 55

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

scripts ajoutes apres CEN

File size: 2.2 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
9from netCDF4 import Dataset
10import arctic_map # function to regrid coast limits
11import cartesian_grid_test # function to convert grid from polar to cartesian
12import scipy.special
13import ffgrid2
14import map_ffgrid
15
16
17
18month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY', 'AUGUST', 'SEPTEMBER', 'OCTOBER', 'NOVEMBER', 'DECEMBER'])
19month_day = np.array([31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31])
20M = len(month)
21
22
23
24dx=1.
25dy=0.5
26x0, x1 = -180., 180.
27y0, y1 = 65., 90.
28xx = np.arange(x0, x1 + dx, dx)
29yy = np.arange(y0, y1 + dy, dy)
30nx = len(xx)
31ny = len(yy)
32
33
34eee = np.zeros([ny, nx, M], float)
35for 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
63plt.ion()
64for 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
Note: See TracBrowser for help on using the repository browser.