Index: trunk/LMDZ.TITAN/Tools/fft.F90
===================================================================
--- trunk/LMDZ.TITAN/Tools/fft.F90	(revision 842)
+++ trunk/LMDZ.TITAN/Tools/fft.F90	(revision 888)
@@ -208,4 +208,5 @@
 ! 2.1.1 Atmospheric temperature
 !===============================================================================
+if (ok_out(4)) then
 allocate(temp(lonlength,latlength,altlength,timelength))
 
@@ -216,32 +217,65 @@
   text="t"
   call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2)
-  if (ierr1.ne.NF_NOERR) stop "Error: Failed to get temperature ID"
-endif
-if (ierr2.ne.NF_NOERR) stop "Error: Failed reading temperature"
+  if (ierr1.ne.NF_NOERR) then
+    print*,"Error: Failed to get temperature ID"
+    ok_out(4)=.false.
+  endif
+endif
+if (ierr2.ne.NF_NOERR) then
+  print*,"Error: Failed reading temperature"
+  ok_out(4)=.false.
+endif
+endif !ok_out(4)
 
 !===============================================================================
 ! 2.1.2 Winds
 !===============================================================================
+! zonal wind vitu (in m/s)
+if (ok_out(1)) then
 allocate(vitu(lonlength,latlength,altlength,timelength))
-allocate(vitv(lonlength,latlength,altlength,timelength))
-allocate(vitw(lonlength,latlength,altlength,timelength))
-
-! zonal wind vitu (in m/s)
+
 text="vitu"
 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,ierr1,ierr2)
-if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitu ID"
-if (ierr2.ne.NF_NOERR) stop "Error: Failed reading zonal wind"
+if (ierr1.ne.NF_NOERR) then
+  print*,"Error: Failed to get vitu ID"
+  ok_out(1)=.false.
+endif
+if (ierr2.ne.NF_NOERR) then
+  print*,"Error: Failed reading zonal wind"
+  ok_out(1)=.false.
+endif
+endif !ok_out(1)
 
 ! meridional wind vitv (in m/s)
+if (ok_out(2)) then
+allocate(vitv(lonlength,latlength,altlength,timelength))
+
 text="vitv"
 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,ierr1,ierr2)
-if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitv ID"
-if (ierr2.ne.NF_NOERR) stop "Error: Failed reading meridional wind"
+if (ierr1.ne.NF_NOERR) then
+  print*,"Error: Failed to get vitv ID"
+  ok_out(2)=.false.
+endif
+if (ierr2.ne.NF_NOERR) then
+  print*,"Error: Failed reading meridional wind"
+  ok_out(2)=.false.
+endif
+endif !ok_out(2)
 
 ! vertical wind vitw (in Pa/s)
+if (ok_out(3)) then
+allocate(vitw(lonlength,latlength,altlength,timelength))
+
 text="vitw"
 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,ierr1,ierr2)
-if (ierr1.ne.NF_NOERR) stop "Error: Failed to get vitw ID"
-if (ierr2.ne.NF_NOERR) stop "Error: Failed reading vertical wind"
+if (ierr1.ne.NF_NOERR) then
+  print*,"Error: Failed to get vitw ID"
+  ok_out(3)=.false.
+endif
+if (ierr2.ne.NF_NOERR) then
+  print*,"Error: Failed reading vertical wind"
+  ok_out(3)=.false.
+endif
+endif !ok_out(3)
 
 !===============================================================================
@@ -256,30 +290,38 @@
 ! allocations
 !-------------
+if (ok_out(1)) then
 allocate(fftau(lonlength,latlength,altlength,timelength))
+allocate(uprim(lonlength,latlength,altlength,timelength))
+allocate(ulf(lonlength,latlength,altlength,timelength))
+allocate(ubf(lonlength,latlength,altlength,timelength))
+allocate(uhf(lonlength,latlength,altlength,timelength))
+endif !ok_out(1)
+if (ok_out(2)) then
 allocate(fftav(lonlength,latlength,altlength,timelength))
+allocate(vprim(lonlength,latlength,altlength,timelength))
+allocate(vlf(lonlength,latlength,altlength,timelength))
+allocate(vbf(lonlength,latlength,altlength,timelength))
+allocate(vhf(lonlength,latlength,altlength,timelength))
+endif !ok_out(2)
+if (ok_out(3)) then
 allocate(fftaw(lonlength,latlength,altlength,timelength))
+allocate(wprim(lonlength,latlength,altlength,timelength))
+allocate(wlf(lonlength,latlength,altlength,timelength))
+allocate(wbf(lonlength,latlength,altlength,timelength))
+allocate(whf(lonlength,latlength,altlength,timelength))
+endif !ok_out(3)
+if (ok_out(4)) then
 allocate(fftaT(lonlength,latlength,altlength,timelength))
-allocate(uprim(lonlength,latlength,altlength,timelength))
-allocate(vprim(lonlength,latlength,altlength,timelength))
-allocate(wprim(lonlength,latlength,altlength,timelength))
 allocate(Tprim(lonlength,latlength,altlength,timelength))
-allocate(ulf(lonlength,latlength,altlength,timelength))
-allocate(vlf(lonlength,latlength,altlength,timelength))
-allocate(wlf(lonlength,latlength,altlength,timelength))
 allocate(Tlf(lonlength,latlength,altlength,timelength))
-allocate(ubf(lonlength,latlength,altlength,timelength))
-allocate(vbf(lonlength,latlength,altlength,timelength))
-allocate(wbf(lonlength,latlength,altlength,timelength))
 allocate(Tbf(lonlength,latlength,altlength,timelength))
-allocate(uhf(lonlength,latlength,altlength,timelength))
-allocate(vhf(lonlength,latlength,altlength,timelength))
-allocate(whf(lonlength,latlength,altlength,timelength))
 allocate(Thf(lonlength,latlength,altlength,timelength))
+endif !ok_out(4)
 
 ! lon,lat,alt
-allocate(umean(lonlength,latlength,altlength))
-allocate(vmean(lonlength,latlength,altlength))
-allocate(wmean(lonlength,latlength,altlength))
-allocate(Tmean(lonlength,latlength,altlength))
+if (ok_out(1)) allocate(umean(lonlength,latlength,altlength))
+if (ok_out(2)) allocate(vmean(lonlength,latlength,altlength))
+if (ok_out(3)) allocate(wmean(lonlength,latlength,altlength))
+if (ok_out(4)) allocate(Tmean(lonlength,latlength,altlength))
 
 ! time / frequencies
@@ -298,8 +340,8 @@
 !-----------------
 
-call moytim(lonlength,latlength,altlength,timelength,miss_val,vitu,umean)
-call moytim(lonlength,latlength,altlength,timelength,miss_val,vitv,vmean)
-call moytim(lonlength,latlength,altlength,timelength,miss_val,vitw,wmean)
-call moytim(lonlength,latlength,altlength,timelength,miss_val,temp,Tmean)
+if (ok_out(1)) call moytim(lonlength,latlength,altlength,timelength,miss_val,vitu,umean)
+if (ok_out(2)) call moytim(lonlength,latlength,altlength,timelength,miss_val,vitv,vmean)
+if (ok_out(3)) call moytim(lonlength,latlength,altlength,timelength,miss_val,vitw,wmean)
+if (ok_out(4)) call moytim(lonlength,latlength,altlength,timelength,miss_val,temp,Tmean)
 
 do ilon=1,lonlength
@@ -307,4 +349,5 @@
   do ilev=1,altlength
    do itim=1,timelength
+if (ok_out(1)) then
     if ((vitu(ilon,ilat,ilev,itim).ne.miss_val).and. &
         (umean(ilon,ilat,ilev)    .ne.miss_val)) then
@@ -313,4 +356,6 @@
   uprim(ilon,ilat,ilev,itim) = miss_val
     endif
+endif !ok_out(1)
+if (ok_out(2)) then
     if ((vitv(ilon,ilat,ilev,itim).ne.miss_val).and. &
         (vmean(ilon,ilat,ilev)    .ne.miss_val)) then
@@ -319,4 +364,6 @@
   vprim(ilon,ilat,ilev,itim) = miss_val
     endif
+endif !ok_out(2)
+if (ok_out(3)) then
     if ((vitw(ilon,ilat,ilev,itim).ne.miss_val).and. &
         (wmean(ilon,ilat,ilev)    .ne.miss_val)) then
@@ -325,4 +372,6 @@
   wprim(ilon,ilat,ilev,itim) = miss_val
     endif
+endif !ok_out(3)
+if (ok_out(4)) then
     if ((temp(ilon,ilat,ilev,itim).ne.miss_val).and. &
         (Tmean(ilon,ilat,ilev)    .ne.miss_val)) then
@@ -331,4 +380,5 @@
   Tprim(ilon,ilat,ilev,itim) = miss_val
     endif
+endif !ok_out(4)
    enddo
   enddo
@@ -743,4 +793,8 @@
 datashape1d   =time_dimid2
 
+call write_var1d(outfid2,datashape1d,timelength,&
+                "freq      ", "FFT frequencies     ","s-1       ",miss_val,&
+                 freq )
+
 call write_var4d(outfid2,datashape4d,lonlength,latlength,altlength,timelength,&
                  "fftav     ", "FFT ampl of vitv    ","m s-1     ",miss_val,&
@@ -768,4 +822,8 @@
 datashape1d   =time_dimid3
 
+call write_var1d(outfid3,datashape1d,timelength,&
+                "freq      ", "FFT frequencies     ","s-1       ",miss_val,&
+                 freq )
+
 call write_var4d(outfid3,datashape4d,lonlength,latlength,altlength,timelength,&
                  "fftaw     ", "FFT ampl of vitw    ","Pa s-1    ",miss_val,&
@@ -793,4 +851,8 @@
 datashape1d   =time_dimid4
 
+call write_var1d(outfid4,datashape1d,timelength,&
+                "freq      ", "FFT frequencies     ","s-1       ",miss_val,&
+                 freq )
+
 call write_var4d(outfid4,datashape4d,lonlength,latlength,altlength,timelength,&
                  "fftaT     ", "FFT ampl of temp    ","K         ",miss_val,&
Index: trunk/LMDZ.TITAN/Tools/filter.h
===================================================================
--- trunk/LMDZ.TITAN/Tools/filter.h	(revision 842)
+++ trunk/LMDZ.TITAN/Tools/filter.h	(revision 888)
@@ -11,5 +11,5 @@
 
 ! Choice of output files:
-!                                            (U,     V,      W,     T)
- logical,dimension(4),parameter :: ok_out=(/.true.,.true.,.false.,.true./)
+!                                  (U,     V,      W,     T)
+ logical,dimension(4) :: ok_out=(/.true.,.true.,.false.,.true./)
 
