Index: /trunk/src/scripts_Laura/diff_frequ_AMSUA_test.py
===================================================================
--- /trunk/src/scripts_Laura/diff_frequ_AMSUA_test.py	(revision 24)
+++ /trunk/src/scripts_Laura/diff_frequ_AMSUA_test.py	(revision 24)
@@ -0,0 +1,284 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import string
+import numpy as np
+import matplotlib.pyplot as plt
+from pylab import *
+from mpl_toolkits.basemap import Basemap
+from mpl_toolkits.basemap import shiftgrid, cm
+from netCDF4 import Dataset
+import ffgrid2
+
+
+len_month = np.array([31, 28, 31, 30, 31, 30, 31])
+month = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY'])
+chan = np.array(['CH1', 'CH15'])
+################
+# CARTOGRAPHIE #
+################
+## Etude sur l'Antarctique ##
+dx = 5.
+dy = 5.
+x0, x1 = -180, 180
+y0, y1 = -90, -30
+
+
+## FABRUARY ##
+imo = 1
+## ch1 ##
+fovZen_ch1_FEB = np.where(fov1_FEB == 15.)
+bbemis_ch1_FEB = nonzero((emis1_FEB[fovZen_ch1_FEB] != -500.) & (emis1_FEB[fovZen_ch1_FEB] <= 1.))
+OUTZCH1_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch1_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch1_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch1_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+## ch15 ##
+fovZen_ch15_FEB = np.where(fov15_FEB == 15.)
+bbemis_ch15_FEB = nonzero((emis15_FEB[fovZen_ch15_FEB] != -500.) & (emis15_FEB[fovZen_ch15_FEB] <= 1.))
+OUTZCH15_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch15_FEB = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch15_FEB = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch15_FEB = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+for ijr in range (0, len_month[imo]):
+    print 'jour=', ijr+1
+    ## ch1 ##
+    ind_jr1_FEB = np.where(jjr1_FEB[fovZen_ch1_FEB][bbemis_ch1_FEB] == ijr+1)[0]
+    shape(ind_jr1_FEB)
+    xx = lon1_FEB[fovZen_ch1_FEB][bbemis_ch1_FEB][ind_jr1_FEB]
+    yy = lat1_FEB[fovZen_ch1_FEB][bbemis_ch1_FEB][ind_jr1_FEB]
+    zz = emis1_FEB[fovZen_ch1_FEB][bbemis_ch1_FEB][ind_jr1_FEB]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch1_FEB = outz
+    lonch1_FEB = outx
+    latch1_FEB = outy
+    OUTZCH1_FEB[:,:,ijr] = outzch1_FEB[:,:]
+    ## ch15 ##
+    ind_jr15_FEB = np.where(jjr15_FEB[fovZen_ch15_FEB][bbemis_ch15_FEB] == ijr+1)[0]
+    shape(ind_jr15_FEB)
+    xx = lon15_FEB[fovZen_ch15_FEB][bbemis_ch15_FEB][ind_jr15_FEB]
+    yy = lat15_FEB[fovZen_ch15_FEB][bbemis_ch15_FEB][ind_jr15_FEB]
+    zz = emis15_FEB[fovZen_ch15_FEB][bbemis_ch15_FEB][ind_jr15_FEB]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch15_FEB = outz
+    lonch15_FEB = outx
+    latch15_FEB = outy
+    OUTZCH15_FEB[:,:,ijr] = outzch15_FEB[:,:]
+
+OUTZ_FEB = np.array([OUTZCH1_FEB, OUTZCH15_FEB])
+
+## APRIL ##
+imo = 3
+## ch1 ##
+fovZen_ch1_APR = np.where(fov1_APR == 15.)
+bbemis_ch1_APR = nonzero((emis1_APR[fovZen_ch1_APR] != -500.) & (emis1_APR[fovZen_ch1_APR] <= 1.))
+OUTZCH1_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch1_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch1_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch1_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+## ch15 ##
+fovZen_ch15_APR = np.where(fov15_APR == 15.)
+bbemis_ch15_APR = nonzero((emis15_APR[fovZen_ch15_APR] != -500.) & (emis15_APR[fovZen_ch15_APR] <= 1.))
+OUTZCH15_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch15_APR = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch15_APR = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch15_APR = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+for ijr in range (0, len_month[imo]):
+    print 'jour=', ijr+1
+    ## ch1 ##
+    ind_jr1_APR = np.where(jjr1_APR[fovZen_ch1_APR][bbemis_ch1_APR] == ijr+1)[0]
+    shape(ind_jr1_APR)
+    xx = lon1_APR[fovZen_ch1_APR][bbemis_ch1_APR][ind_jr1_APR]
+    yy = lat1_APR[fovZen_ch1_APR][bbemis_ch1_APR][ind_jr1_APR]
+    zz = emis1_APR[fovZen_ch1_APR][bbemis_ch1_APR][ind_jr1_APR]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch1_APR = outz
+    lonch1_APR = outx
+    latch1_APR = outy
+    OUTZCH1_APR[:,:,ijr] = outzch1_APR[:,:]
+    ## ch15 ##
+    ind_jr15_APR = np.where(jjr15_APR[fovZen_ch15_APR][bbemis_ch15_APR] == ijr+1)[0]
+    xx = lon15_APR[fovZen_ch15_APR][bbemis_ch15_APR][ind_jr15_APR]
+    yy = lat15_APR[fovZen_ch15_APR][bbemis_ch15_APR][ind_jr15_APR]
+    zz = emis15_APR[fovZen_ch15_APR][bbemis_ch15_APR][ind_jr15_APR]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch15_APR = outz
+    lonch15_APR = outx
+    latch15_APR = outy
+    OUTZCH15_APR[:,:,ijr] = outzch15_APR[:,:]
+
+OUTZ_APR = np.array([OUTZCH1_APR, OUTZCH15_APR])
+
+
+## JULY ##
+imo = 6
+## ch1 ##
+fovZen_ch1_JUL = np.where(fov1_JUL == 15.)
+bbemis_ch1_JUL = nonzero((emis1_JUL[fovZen_ch1_JUL] != -500.) & (emis1_JUL[fovZen_ch1_JUL] <= 1.))
+OUTZCH1_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch1_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch1_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch1_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+## ch15 ##
+fovZen_ch15_JUL = np.where(fov15_JUL == 15.)
+bbemis_ch15_JUL = nonzero((emis15_JUL[fovZen_ch15_JUL] != -500.) & (emis15_JUL[fovZen_ch15_JUL] <= 1.))
+OUTZCH15_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx)),len_month[imo]], float)
+outzch15_JUL = np.zeros([len(np.arange(y0, y1+1, dy)),len(np.arange(x0, x1+1, dx))], float)
+lonch15_JUL = np.zeros([len(np.arange(x0, x1+1, dx))], float)
+latch15_JUL = np.zeros([len(np.arange(y0, y1+1, dy))], float)
+for ijr in range (0, len_month[imo]):
+    print 'jour=', ijr+1
+    ## ch1 ##
+    ind_jr1_JUL = np.where(jjr1_JUL[fovZen_ch1_JUL][bbemis_ch1_JUL] == ijr+1)[0]
+    xx = lon1_JUL[fovZen_ch1_JUL][bbemis_ch1_JUL][ind_jr1_JUL]
+    yy = lat1_JUL[fovZen_ch1_JUL][bbemis_ch1_JUL][ind_jr1_JUL]
+    zz = emis1_JUL[fovZen_ch1_JUL][bbemis_ch1_JUL][ind_jr1_JUL]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch1_JUL = outz
+    lonch1_JUL = outx
+    latch1_JUL = outy
+    OUTZCH1_JUL[:,:,ijr] = outzch1_JUL[:,:]
+    ## ch15 ##
+    ind_jr15_JUL = np.where(jjr15_JUL[fovZen_ch15_JUL][bbemis_ch15_JUL] == ijr+1)[0]
+    xx = lon15_JUL[fovZen_ch15_JUL][bbemis_ch15_JUL][ind_jr15_JUL]
+    yy = lat15_JUL[fovZen_ch15_JUL][bbemis_ch15_JUL][ind_jr15_JUL]
+    zz = emis15_JUL[fovZen_ch15_JUL][bbemis_ch15_JUL][ind_jr15_JUL]
+    zz0 = min(zz)
+    zz1 = max(zz)
+    outz, outx, outy = ffgrid2.ffgrid(xx, yy, zz, dx, dy, x0, x1, y0, y1, zz0, zz1)
+    outzch15_JUL = outz
+    lonch15_JUL = outx
+    latch15_JUL = outy
+    OUTZCH15_JUL[:,:,ijr] = outzch15_JUL[:,:]
+
+OUTZ_JUL = np.array([OUTZCH1_JUL, OUTZCH15_JUL])
+
+
+################################################
+## calcul de la climatologie moyenne par mois ##
+################################################
+lon = lonch1_FEB = lonch15_FEB = lonch1_APR = lonch15_APR
+lat = latch1_FEB = latch15_FEB = latch1_APR = latch15_APR
+## FEBRUARY ##
+mean_outz_FEB = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            mean_outz_FEB[ich, ilat, ilon] = mean(OUTZ_FEB[ich, ilat, ilon, :][nonzero(isnan(OUTZ_FEB[ich, ilat, ilon, :]) == False)])
+
+## APRIL ##
+mean_outz_APR = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            mean_outz_APR[ich, ilat, ilon] = mean(OUTZ_APR[ich, ilat, ilon, :][nonzero(isnan(OUTZ_APR[ich, ilat, ilon, :]) == False)])
+
+## JULY ##
+mean_outz_JUL = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            mean_outz_JUL[ich, ilat, ilon] = mean(OUTZ_JUL[ich, ilat, ilon, :][nonzero(isnan(OUTZ_JUL[ich, ilat, ilon, :]) == False)])
+
+
+mean_outz = np.array([mean_outz_FEB, mean_outz_APR, mean_outz_JUL])
+
+month_red = np.array(['FABRUARY', 'APRIL', 'JULY'])
+for imo in range (0, 3):
+    plt.figure()
+    plt.ion()
+    for ich in range (0, len(chan)):
+        plt.subplot(2, 1, ich+1)
+        m = Basemap(llcrnrlon=-180, urcrnrlon=180, llcrnrlat=-90, urcrnrlat=-30, projection='cyl', resolution='c', fix_aspect=True)
+        m.drawcoastlines(linewidth = 1)
+        m.drawparallels(np.arange(-90., -30., 20))
+        m.drawmeridians(np.arange(-180., 180., 20))
+        xii,yii = m(*np.meshgrid(lon, lat))
+        clevs = (arange(0.4, 1., 0.001))
+        cs = m.contourf(xii, yii, mean_outz[imo, ich, :, :], clevs, cmap=cm.s3pcpn_l_r)
+        cbar = colorbar(cs)
+        cbar.set_label(chan[ich]+' - 23.8GHz - ' + month_red[imo] + ' - AMSUA')
+        xticks(arange(-180, 200, 20), rotation = 45)
+        yticks(arange(-90, -10, 20))
+
+
+######################
+## calculs de stats ##
+######################
+## FEBRUARY ##
+imo = 1
+### VARIANCE ##
+var = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            var[ich, ilat, ilon] = np.sum((OUTZ_FEB[ich, ilat, ilon, :][nonzero(isnan(OUTZ_FEB[ich, ilat, ilon, :]) == False)] - mean_outz_FEB[ich, ilat, ilon])**2)
+
+var_FEB = var / len_month[imo]
+
+## APRIL ##
+imo = 3
+### VARIANCE ##
+var = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            var[ich, ilat, ilon] = np.sum((OUTZ_APR[ich, ilat, ilon, :][nonzero(isnan(OUTZ_APR[ich, ilat, ilon, :]) == False)] - mean_outz_APR[ich, ilat, ilon])**2)
+
+var_APR = var / len_month[imo]
+
+## JULY ##
+imo = 6
+### VARIANCE ##
+var = np.zeros([len(chan), len(lat), len(lon)], float)
+for ich in range (0, len(chan)):
+    for ilon in range (0, len(lon)):
+        for ilat in range (0, len(lat)):
+            var[ich, ilat, ilon] = np.sum((OUTZ_JUL[ich, ilat, ilon, :][nonzero(isnan(OUTZ_JUL[ich, ilat, ilon, :]) == False)] - mean_outz_JUL[ich, ilat, ilon])**2)
+
+var_JUL = var / len_month[imo]
+
+
+
+
+plt.figure()
+plt.ion()
+#plt.subplot(2, 1, 1)
+m = Basemap(llcrnrlon=-180, urcrnrlon=180, llcrnrlat=-90, urcrnrlat=-30, projection='cyl', resolution='c', fix_aspect=True)
+m.drawcoastlines(linewidth = 1)
+m.drawparallels(np.arange(-90., -30., 20))
+m.drawmeridians(np.arange(-180., 180., 20))
+xii,yii = m(*np.meshgrid(lon, lat))
+#clevs = (arange(0., 0.006, 0.00001))
+cs = m.contourf(xii, yii, var_JUL[0, :, :], cmap=cm.s3pcpn_l_r)
+cbar = colorbar(cs)
+cbar.set_label('CH1 - 23.8GHz')
+plt.title('var(emis) JUL - AMSUA')
+xticks(arange(-180, 200, 20), rotation = 45)
+yticks(arange(-90, -10, 20))
+plt.subplot(2, 1, 2)
+m = Basemap(llcrnrlon=-180, urcrnrlon=180, llcrnrlat=-90, urcrnrlat=-30, projection='cyl', resolution='c', fix_aspect=True)
+m.drawcoastlines(linewidth = 1)
+m.drawparallels(np.arange(-90., -30., 20))
+m.drawmeridians(np.arange(-180., 180., 20))
+xii,yii = m(*np.meshgrid(lon, lat))
+clevs = (arange(0., 0.0035, 0.00001))
+cs = m.contourf(xii, yii, var_JUL[1, :, :], clevs, cmap=cm.s3pcpn_l_r)
+cbar = colorbar(cs)
+cbar.set_label('CH15 - 89GHz')
+xticks(arange(-180, 200, 20), rotation = 45)
+yticks(arange(-90, -10, 20))
+
+
+
+
+
Index: /trunk/src/scripts_Laura/read_AMSUA_test.py
===================================================================
--- /trunk/src/scripts_Laura/read_AMSUA_test.py	(revision 23)
+++ /trunk/src/scripts_Laura/read_AMSUA_test.py	(revision 24)
@@ -9,24 +9,129 @@
 import netCDF4
 
-################ fichiers par mois - CH1 ###################################################
-
-f1='/net/dedale/usr/dedale/surf/lelod/ANTARC/AMSUA_CH1_ANTARC_'
-f2='2010.DAT'
-date=np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY'])
-
-numlines_month=np.zeros([7],float)
-
-for i in range (0,7):
-    f=f1+str(date[i])+f2
-    fichier=open(f,'r')
-    numlines_month[i]=0
-    for line in fichier: numlines_month[i]+=1
+################ fichiers par mois  ###################################################
+
+#########
+## CH1 ##
+#########
+
+f1 = '/net/dedale/usr/dedale/surf/lelod/ANTARC/AMSUA_CH1_ANTARC_'
+f2 = '2010.DAT'
+date = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY'])
+
+numlines_month = np.zeros([7],float)
+
+for i in range (0, 7):
+    print 'mois =', date[i]
+    f = f1 + str(date[i]) + f2
+    fichier = open(f,'r')
+    numlines_month[i] = 0
+    for line in fichier : numlines_month[i] += 1
 
     fichier.close()
 
 
-i=0 #JANUARY
-f=f1+str(date[i])+f2
-fichier=open(f,'r')
+i = 0 #JANUARY
+f = f1 + str(date[i]) + f2
+fichier = open(f,'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch1_JAN = amch
+lon1_JAN = amch1_JAN[0,:]
+lat1_JAN = amch1_JAN[1,:]
+jjr1_JAN = amch1_JAN[4,:]
+fov1_JAN = amch1_JAN[7,:]
+ts1_JAN = amch1_JAN[10,:]
+emis1_JAN = amch1_JAN[16,:]
+tb1_JAN = amch1_JAN[15,:]
+tup1_JAN = amch1_JAN[18,:]
+tdn1_JAN = amch1_JAN[17,:]
+trans1_JAN = amch1_JAN[19,:]
+orog1_JAN = amch1_JAN[13,:]
+
+
+i = 1 #FEBRUARY
+f = f1 + str(date[i]) + f2
+fichier = open(f,'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range(0,20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch1_FEB = amch
+lon1_FEB = amch1_FEB[0,:]
+lat1_FEB = amch1_FEB[1,:]
+jjr1_FEB = amch1_FEB[4,:]
+fov1_FEB = amch1_FEB[7,:]
+ts1_FEB = amch1_FEB[10,:]
+emis1_FEB = amch1_FEB[16,:]
+tb1_FEB = amch1_FEB[15,:]
+tup1_FEB = amch1_FEB[18,:]
+tdn1_FEB = amch1_FEB[17,:]
+trans1_FEB = amch1_FEB[19,:]
+orog1_FEB = amch1_FEB[13,:]
+
+
+i = 2 #MARCH
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch1_MAR = amch
+lon1_MAR = amch1_MAR[0,:]
+lat1_MAR = amch1_MAR[1,:]
+jjr1_MAR = amch1_MAR[4,:]
+fov1_MAR = amch1_MAR[7,:]
+ts1_MAR = amch1_MAR[10,:]
+emis1_MAR = amch1_MAR[16,:]
+tb1_MAR = amch1_MAR[15,:]
+tup1_MAR = amch1_MAR[18,:]
+tdn1_MAR = amch1_MAR[17,:]
+trans1_MAR = amch1_MAR[19,:]
+orog1_MAR = amch1_MAR[13,:]
+
+
+i = 3 #APRIL
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch1_APR = amch
+lon1_APR = amch1_APR[0,:]
+lat1_APR = amch1_APR[1,:]
+jjr1_APR = amch1_APR[4,:]
+fov1_APR = amch1_APR[7,:]
+ts1_APR = amch1_APR[10,:]
+emis1_APR = amch1_APR[16,:]
+tb1_APR = amch1_APR[15,:]
+tup1_APR = amch1_APR[18,:]
+tdn1_APR = amch1_APR[17,:]
+trans1_APR = amch1_APR[19,:]
+orog1_APR = amch1_APR[13,:]
+
+
+i = 4 #MAY
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
 amch=np.zeros([20,numlines_month[i]],float)
 for iligne in range (0,numlines_month[i]):
@@ -36,125 +141,10 @@
         amch[j,iligne] = float(liste[j])
 
-
-    fichier.close()
-
-
-amch1_JAN=amch
-#### def des variables 
-lon1_JAN=amch1_JAN[0,:]
-lat1_JAN=amch1_JAN[1,:]
-jjr1_JAN=amch1_JAN[4,:]
-ts1_JAN=amch1_JAN[10,:]
-emis1_JAN=amch1_JAN[16,:]
-tb1_JAN=amch1_JAN[15,:]
-tup1_JAN=amch1_JAN[18,:]
-tdn1_JAN=amch1_JAN[17,:]
-trans1_JAN=amch1_JAN[19,:]
-orog1_JAN=amch1_JAN[13,:]
-
-
-i=1 #FEBRUARY
-f=f1+str(date[i])+f2
-fichier=open(f,'r')
-amch=np.zeros([20,numlines_month[i]],float)
-for iligne in range (0,numlines_month[i]):
-    line=fichier.readline()
-    liste = line.split()
-    for j in range(0,20):
-        amch[j,iligne] = float(liste[j])
-
-
-    fichier.close()
-
-
-amch1_FEB=amch
-#### def des variables CH1 corrigees
-lon1_FEB=amch1_FEB[0,:]
-lat1_FEB=amch1_FEB[1,:]
-jjr1_FEB=amch1_FEB[4,:]
-ts1_FEB=amch1_FEB[10,:]
-emis1_FEB=amch1_FEB[16,:]
-tb1_FEB=amch1_FEB[15,:]
-tup1_FEB=amch1_FEB[18,:]
-tdn1_FEB=amch1_FEB[17,:]
-trans1_FEB=amch1_FEB[19,:]
-orog1_FEB=amch1_FEB[13,:]
-
-
-i=2 #MARCH
-f=f1+str(date[i])+f2
-fichier=open(f,'r')
-amch=np.zeros([20,numlines_month[i]],float)
-for iligne in range (0,numlines_month[i]):
-    line=fichier.readline()
-    liste = line.split()
-    for j in range(0,20):
-        amch[j,iligne] = float(liste[j])
-
-
-    fichier.close()
-
-
-amch1_MAR=amch
-#### def des variables
-lon1_MAR=amch1_MAR[0,:]
-lat1_MAR=amch1_MAR[1,:]
-jjr1_MAR=amch1_MAR[4,:]
-ts1_MAR=amch1_MAR[10,:]
-emis1_MAR=amch1_MAR[16,:]
-tb1_MAR=amch1_MAR[15,:]
-tup1_MAR=amch1_MAR[18,:]
-tdn1_MAR=amch1_MAR[17,:]
-trans1_MAR=amch1_MAR[19,:]
-orog1_MAR=amch1_MAR[13,:]
-
-
-i=3 #APRIL
-f=f1+str(date[i])+f2
-fichier=open(f,'r')
-amch=np.zeros([20,numlines_month[i]],float)
-for iligne in range (0,numlines_month[i]):
-    line=fichier.readline()
-    liste = line.split()
-    for j in range(0,20):
-        amch[j,iligne] = float(liste[j])
-
-
-    fichier.close()
-
-
-amch1_APR=amch
-#### def des variables 
-lon1_APR=amch1_APR[0,:]
-lat1_APR=amch1_APR[1,:]
-jjr1_APR=amch1_APR[4,:]
-ts1_APR=amch1_APR[10,:]
-emis1_APR=amch1_APR[16,:]
-tb1_APR=amch1_APR[15,:]
-tup1_APR=amch1_APR[18,:]
-tdn1_APR=amch1_APR[17,:]
-trans1_APR=amch1_APR[19,:]
-orog1_APR=amch1_APR[13,:]
-
-
-i=4 #MAY
-f=f1+str(date[i])+f2
-fichier=open(f,'r')
-amch=np.zeros([20,numlines_month[i]],float)
-for iligne in range (0,numlines_month[i]):
-    line=fichier.readline()
-    liste = line.split()
-    for j in range(0,20):
-        amch[j,iligne] = float(liste[j])
-
-
-    fichier.close()
-
-
+fichier.close()
 amch1_MAY=amch
-#### def des variables
 lon1_MAY=amch1_MAY[0,:]
 lat1_MAY=amch1_MAY[1,:]
 jjr1_MAY=amch1_MAY[4,:]
+fov1_MAY = amch1_MAY[7,:]
 ts1_MAY=amch1_MAY[10,:]
 emis1_MAY=amch1_MAY[16,:]
@@ -165,4 +155,5 @@
 orog1_MAY=amch1_MAY[13,:]
 
+
 i=5 #JUNE
 f=f1+str(date[i])+f2
@@ -175,13 +166,10 @@
         amch[j,iligne] = float(liste[j])
 
-
-    fichier.close()
-
-
+fichier.close()
 amch1_JUN=amch
-#### def des variables
 lon1_JUN=amch1_JUN[0,:]
 lat1_JUN=amch1_JUN[1,:]
 jjr1_JUN=amch1_JUN[4,:]
+fov1_JUN = amch1_JUN[7,:]
 ts1_JUN=amch1_JUN[10,:]
 emis1_JUN=amch1_JUN[16,:]
@@ -192,5 +180,6 @@
 orog1_JUN=amch1_JUN[13,:]
 
-i=6 #JULLY
+
+i=6 #JULY
 f=f1+str(date[i])+f2
 fichier=open(f,'r')
@@ -202,13 +191,10 @@
         amch[j,iligne] = float(liste[j])
 
-
-    fichier.close()
-
-
+fichier.close()
 amch1_JUL=amch
-#### def des variables 
 lon1_JUL=amch1_JUL[0,:]
 lat1_JUL=amch1_JUL[1,:]
 jjr1_JUL=amch1_JUL[4,:]
+fov1_JUL = amch1_JUL[7,:]
 ts1_JUL=amch1_JUL[10,:]
 emis1_JUL=amch1_JUL[16,:]
@@ -220,4 +206,197 @@
 
 
+##########
+## CH15 ##
+##########
+
+f1 = '/net/dedale/usr/dedale/surf/lelod/ANTARC/AMSUA_CH15_ANTARC_'
+f2 = '2010.DAT'
+date = np.array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY'])
+
+numlines_month = np.zeros([7],float)
+
+for i in range (0, 7):
+    print 'mois =', date[i]
+    f = f1 + str(date[i]) + f2
+    fichier = open(f,'r')
+    numlines_month[i] = 0
+    for line in fichier : numlines_month[i] += 1
+
+    fichier.close()
+
+
+i = 0 #JANUARY
+f = f1 + str(date[i]) + f2
+fichier = open(f,'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_JAN = amch
+lon15_JAN = amch15_JAN[0,:]
+lat15_JAN = amch15_JAN[1,:]
+jjr15_JAN = amch15_JAN[4,:]
+fov15_JAN = amch15_JAN[7,:]
+ts15_JAN = amch15_JAN[10,:]
+emis15_JAN = amch15_JAN[16,:]
+tb15_JAN = amch15_JAN[15,:]
+tup15_JAN = amch15_JAN[18,:]
+tdn15_JAN = amch15_JAN[17,:]
+trans15_JAN = amch15_JAN[19,:]
+orog15_JAN = amch15_JAN[13,:]
+
+
+i = 1 #FEBRUARY
+f = f1 + str(date[i]) + f2
+fichier = open(f,'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range(0,20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_FEB = amch
+lon15_FEB = amch15_FEB[0,:]
+lat15_FEB = amch15_FEB[1,:]
+jjr15_FEB = amch15_FEB[4,:]
+fov15_FEB = amch15_FEB[7,:]
+ts15_FEB = amch15_FEB[10,:]
+emis15_FEB = amch15_FEB[16,:]
+tb15_FEB = amch15_FEB[15,:]
+tup15_FEB = amch15_FEB[18,:]
+tdn15_FEB = amch15_FEB[17,:]
+trans15_FEB = amch15_FEB[19,:]
+orog15_FEB = amch15_FEB[13,:]
+
+
+i = 2 #MARCH
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_MAR = amch
+lon15_MAR = amch15_MAR[0,:]
+lat15_MAR = amch15_MAR[1,:]
+jjr15_MAR = amch15_MAR[4,:]
+fov15_MAR = amch15_MAR[7,:]
+ts15_MAR = amch15_MAR[10,:]
+emis15_MAR = amch15_MAR[16,:]
+tb15_MAR = amch15_MAR[15,:]
+tup15_MAR = amch15_MAR[18,:]
+tdn15_MAR = amch15_MAR[17,:]
+trans15_MAR = amch15_MAR[19,:]
+orog15_MAR = amch15_MAR[13,:]
+
+
+i = 3 #APRIL
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
+amch = np.zeros([20, numlines_month[i]], float)
+for iligne in range (0, numlines_month[i]):
+    line = fichier.readline()
+    liste = line.split()
+    for j in range (0, 20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_APR = amch
+lon15_APR = amch15_APR[0,:]
+lat15_APR = amch15_APR[1,:]
+jjr15_APR = amch15_APR[4,:]
+fov15_APR = amch15_APR[7,:]
+ts15_APR = amch15_APR[10,:]
+emis15_APR = amch15_APR[16,:]
+tb15_APR = amch15_APR[15,:]
+tup15_APR = amch15_APR[18,:]
+tdn15_APR = amch15_APR[17,:]
+trans15_APR = amch15_APR[19,:]
+orog15_APR = amch15_APR[13,:]
+
+
+i = 4 #MAY
+f = f1 + str(date[i]) + f2
+fichier = open(f, 'r')
+amch=np.zeros([20,numlines_month[i]],float)
+for iligne in range (0,numlines_month[i]):
+    line=fichier.readline()
+    liste = line.split()
+    for j in range(0,20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_MAY=amch
+lon15_MAY=amch15_MAY[0,:]
+lat15_MAY=amch15_MAY[1,:]
+jjr15_MAY=amch15_MAY[4,:]
+fov15_MAY = amch15_MAY[7,:]
+ts15_MAY=amch15_MAY[10,:]
+emis15_MAY=amch15_MAY[16,:]
+tb15_MAY=amch15_MAY[15,:]
+tup15_MAY=amch15_MAY[18,:]
+tdn15_MAY=amch15_MAY[17,:]
+trans15_MAY=amch15_MAY[19,:]
+orog15_MAY=amch15_MAY[13,:]
+
+
+i=5 #JUNE
+f=f1+str(date[i])+f2
+fichier=open(f,'r')
+amch=np.zeros([20,numlines_month[i]],float)
+for iligne in range (0,numlines_month[i]):
+    line=fichier.readline()
+    liste = line.split()
+    for j in range(0,20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_JUN=amch
+lon15_JUN=amch15_JUN[0,:]
+lat15_JUN=amch15_JUN[1,:]
+jjr15_JUN=amch15_JUN[4,:]
+fov15_JUN = amch15_JUN[7,:]
+ts15_JUN=amch15_JUN[10,:]
+emis15_JUN=amch15_JUN[16,:]
+tb15_JUN=amch15_JUN[15,:]
+tup15_JUN=amch15_JUN[18,:]
+tdn15_JUN=amch15_JUN[17,:]
+trans15_JUN=amch15_JUN[19,:]
+orog15_JUN=amch15_JUN[13,:]
+
+
+i=6 #JULY
+f=f1+str(date[i])+f2
+fichier=open(f,'r')
+amch=np.zeros([20,numlines_month[i]],float)
+for iligne in range (0,numlines_month[i]):
+    line=fichier.readline()
+    liste = line.split()
+    for j in range(0,20):
+        amch[j,iligne] = float(liste[j])
+
+fichier.close()
+amch15_JUL = amch
+lon15_JUL = amch15_JUL[0,:]
+lat15_JUL = amch15_JUL[1,:]
+jjr15_JUL = amch15_JUL[4,:]
+fov15_JUL = amch15_JUL[7,:]
+ts15_JUL = amch15_JUL[10,:]
+emis15_JUL = amch15_JUL[16,:]
+tb15_JUL = amch15_JUL[15,:]
+tup15_JUL = amch15_JUL[18,:]
+tdn15_JUL = amch15_JUL[17,:]
+trans15_JUL = amch15_JUL[19,:]
+orog15_JUL = amch15_JUL[13,:]
 
 
Index: /trunk/src/scripts_Laura/write_netcdf_AMSUA_test.py
===================================================================
--- /trunk/src/scripts_Laura/write_netcdf_AMSUA_test.py	(revision 24)
+++ /trunk/src/scripts_Laura/write_netcdf_AMSUA_test.py	(revision 24)
@@ -0,0 +1,105 @@
+#!/usr/bin/env python
+# -*- coding: utf-8 -*-
+import string
+import numpy as np
+import matplotlib.pyplot as plt
+from pylab import *
+from mpl_toolkits.basemap import Basemap
+from mpl_toolkits.basemap import shiftgrid, cm
+from netCDF4 import Dataset
+
+
+############################
+## monthly mean emisivity ##
+############################
+month = array(['JANUARY', 'FEBRUARY', 'MARCH', 'APRIL', 'MAY', 'JUNE', 'JULY'])
+rootgrp = Dataset ('/net/argos/data/parvati/lahlod/AMUSUA_CH1-CH15_FEB-APR-JUL_ANTARC.nc', 'w', format = 'NETCDF4')
+rootgrp.createDimension('longitude', len(lon))
+rootgrp.createDimension('latitude', len(lat))
+rootgrp.createDimension('channels', 2)
+rootgrp.createDimension('month', 3)
+nclon = rootgrp.createVariable('longitude', 'f8', ('longitude',))
+nclat = rootgrp.createVariable('latitude', 'f8', ('latitude',))
+ncchan = rootgrp.createVariable('channels', 'f8', ('channels',))
+ncmon = rootgrp.createVariable('month', 'f8', ('month',))
+ncemis = rootgrp.createVariable('emissivity', 'f8', ('month', 'channels', 'latitude', 'longitude'))
+nclon[:] =lon
+nclat[:] = lat
+ncchan[:] = [23.8, 89]
+ncmon[:] = [1., 2., 3.]
+ncemis[:] = mean_outz
+
+rootgrp.close()
+
+
+
+#####################
+## daily emisivity ##
+#####################
+month_red = array(['FEBRUARY', 'APRIL', 'JULY'])
+len_month_red = np.array([28, 30, 31])
+imo = 0
+rootgrp = Dataset ('/net/argos/data/parvati/lahlod/AMUSUA_CH1-CH15_' + month_red[imo] +'_ANTARC.nc', 'w', format = 'NETCDF4')
+rootgrp.createDimension('longitude', len(lon))
+rootgrp.createDimension('latitude', len(lat))
+rootgrp.createDimension('channels', len(chan))
+rootgrp.createDimension('day', len_month_red[imo])
+nclon = rootgrp.createVariable('longitude', 'f8', ('longitude',))
+nclat = rootgrp.createVariable('latitude', 'f8', ('latitude',))
+ncchan = rootgrp.createVariable('channels', 'f8', ('channels',))
+ncjours = rootgrp.createVariable('day', 'f8', ('day',))
+ncemis = rootgrp.createVariable('emissivity', 'f8', ('channels', 'latitude', 'longitude', 'day'))
+nclon[:] =lon
+nclat[:] = lat
+ncchan[:] = [23.8, 89]
+ncjours[:] = np.arange(0, len_month_red[imo], 1)
+ncemis[:] = OUTZ_FEB
+
+rootgrp.close()
+
+imo = 1
+rootgrp = Dataset ('/net/argos/data/parvati/lahlod/AMUSUA_CH1-CH15_' + month_red[imo] +'_ANTARC.nc', 'w', format = 'NETCDF4')
+rootgrp.createDimension('longitude', len(lon))
+rootgrp.createDimension('latitude', len(lat))
+rootgrp.createDimension('channels', len(chan))
+rootgrp.createDimension('day', len_month_red[imo])
+nclon = rootgrp.createVariable('longitude', 'f8', ('longitude',))
+nclat = rootgrp.createVariable('latitude', 'f8', ('latitude',))
+ncchan = rootgrp.createVariable('channels', 'f8', ('channels',))
+ncjours = rootgrp.createVariable('day', 'f8', ('day',))
+ncemis = rootgrp.createVariable('emissivity', 'f8', ('channels', 'latitude', 'longitude', 'day'))
+nclon[:] =lon
+nclat[:] = lat
+ncchan[:] = [23.8, 89]
+ncjours[:] = np.arange(0, len_month_red[imo], 1)
+ncemis[:] = OUTZ_APR
+
+rootgrp.close()
+
+imo = 2
+rootgrp = Dataset ('/net/argos/data/parvati/lahlod/AMUSUA_CH1-CH15_' + month_red[imo] +'_ANTARC.nc', 'w', format = 'NETCDF4')
+rootgrp.createDimension('longitude', len(lon))
+rootgrp.createDimension('latitude', len(lat))
+rootgrp.createDimension('channels', len(chan))
+rootgrp.createDimension('day', len_month_red[imo])
+nclon = rootgrp.createVariable('longitude', 'f8', ('longitude',))
+nclat = rootgrp.createVariable('latitude', 'f8', ('latitude',))
+ncchan = rootgrp.createVariable('channels', 'f8', ('channels',))
+ncjours = rootgrp.createVariable('day', 'f8', ('day',))
+ncemis = rootgrp.createVariable('emissivity', 'f8', ('channels', 'latitude', 'longitude', 'day'))
+nclon[:] =lon
+nclat[:] = lat
+ncchan[:] = [23.8, 89]
+ncjours[:] = np.arange(0, len_month_red[imo], 1)
+ncemis[:] = OUTZ_JUL
+
+rootgrp.close()
+
+
+
+
+
+
+### read nc file
+#ncfile = Dataset('/net/argos/data/parvati/lahlod/AMUSUA_CH1-CH15_FEB-APR-JUL_ANTARC.nc', 'w', format = 'NETCDF4', 'r')
+#data = ncfile.variables['data'][:]
