Ignore:
Timestamp:
Jun 16, 2015, 7:01:30 PM (9 years ago)
Author:
slebonnois
Message:

SL: corrections in Titan and Venus tools

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/LMDZ.TITAN/Tools/fft.F90

    r888 r1454  
    6363integer,dimension(4) :: datashape4d ! shape of 4D datasets
    6464
    65 real :: miss_val=9.99e+33 ! special "missing value" to specify missing data
    66 real,parameter :: miss_val_def=9.99e+33 ! default value for "missing value"
     65real :: miss_val ! special "missing value" to specify missing data
     66real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value"
    6767real :: pi
    6868real,dimension(:),allocatable :: lon ! longitude
    6969integer lonlength ! # of grid points along longitude
    7070real,dimension(:),allocatable :: lat ! latitude
    71 real,dimension(:),allocatable :: latrad ! latitude in radian
    7271integer latlength ! # of grid points along latitude
    7372real,dimension(:),allocatable :: plev ! Pressure levels (Pa)
     
    125124logical :: lmdflag
    126125
     126! Tuning parameters
     127real :: fcoup1,fcoup2,width
     128real :: fcoup1tmp,fcoup2tmp,widthtmp
     129logical,dimension(4) :: ok_out
     130character (len=1) :: ok_outtmp
     131
    127132include "planet.h"
    128 include "filter.h"
    129133
    130134#include <fftw3.f>
     
    135139
    136140pi = 2.*asin(1.)
     141miss_val = miss_val_def
    137142
    138143write(*,*) ""
    139144write(*,*) "You are working on the atmosphere of ",planet
     145
     146! initialisation
     147!----------------
     148
     149! Par defaut
     150
     151! Define the filters
     152! Low  cutting frequency, in Hz    : fcoup1
     153fcoup1=2.5e-6
     154! High cutting frequency, in Hz    : fcoup2
     155fcoup2=6.5e-6
     156! Half-width of the filters, in Hz : width
     157width=4.e-7
     158! Outputs (U,     V,      W,     T)
     159ok_out=(/.true.,.true.,.false.,.true./)
     160
     161print*,"Low  cutting frequency, in Hz ?"
     162print*,"between 1e-5 and 1e-7, 0 for default => 2.5e-6"
     163read(*,*) fcoup1tmp
     164if ((fcoup1tmp.lt.1e-5).and.(fcoup1tmp.gt.1e-7)) fcoup1=fcoup1tmp
     165print*,"=",fcoup1
     166print*,"High cutting frequency, in Hz ?"
     167print*,"between 1e-5 and 1e-7, 0 for default => 6.5e-6"
     168read(*,*) fcoup2tmp
     169if ((fcoup2tmp.lt.1e-5).and.(fcoup2tmp.gt.1e-7)) fcoup2=fcoup2tmp
     170print*,"=",fcoup2
     171print*,"Half-width of the filters, in Hz ?"
     172print*,"between 1e-6 and 1e-8, 0 for default => 4e-7)"
     173read(*,*) widthtmp
     174if ((widthtmp.lt.1e-6).and.(widthtmp.gt.1e-8)) width=widthtmp
     175print*,"=",width
     176!width = 3./time(timelength)
     177
     178! Outputs
     179print*,"Output of zonal wind ? (y or n, default is y)"
     180read(*,'(a1)') ok_outtmp
     181if (ok_outtmp.eq."n") ok_out(1)=.false.
     182print*,"=",ok_out(1)
     183print*,"Output of meridional wind ? (y or n, default is y)"
     184read(*,'(a1)') ok_outtmp
     185if (ok_outtmp.eq."n") ok_out(2)=.false.
     186print*,"=",ok_out(2)
     187print*,"Output of vertical wind ? (y or n, default is n)"
     188read(*,'(a1)') ok_outtmp
     189if (ok_outtmp.eq."y") ok_out(3)=.true.
     190print*,"=",ok_out(3)
     191print*,"Output of temperature ? (y or n, default is y)"
     192read(*,'(a1)') ok_outtmp
     193if (ok_outtmp.eq."n") ok_out(4)=.false.
     194print*,"=",ok_out(4)
    140195
    141196!===============================================================================
     
    172227ierr=NF_GET_VAR_REAL(infid,lat_varid,lat)
    173228if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat"
    174 
    175 allocate(latrad(latlength))
    176 latrad = lat*pi/180.
    177229
    178230allocate(plev(altlength))
     
    212264
    213265text="temp"
    214 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2)
     266call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2)
    215267if (ierr1.ne.NF_NOERR) then
    216268  write(*,*) "  looking for t instead... "
    217269  text="t"
    218   call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,ierr1,ierr2)
     270  call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2)
    219271  if (ierr1.ne.NF_NOERR) then
    220272    print*,"Error: Failed to get temperature ID"
     
    236288
    237289text="vitu"
    238 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,ierr1,ierr2)
     290call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2)
    239291if (ierr1.ne.NF_NOERR) then
    240292  print*,"Error: Failed to get vitu ID"
     
    252304
    253305text="vitv"
    254 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,ierr1,ierr2)
     306call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2)
    255307if (ierr1.ne.NF_NOERR) then
    256308  print*,"Error: Failed to get vitv ID"
     
    268320
    269321text="vitw"
    270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,ierr1,ierr2)
     322call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2)
    271323if (ierr1.ne.NF_NOERR) then
    272324  print*,"Error: Failed to get vitw ID"
     
    288340! 2.2.1 FFT and filtering
    289341!===============================================================================
     342
    290343! allocations
    291344!-------------
     
    405458enddo
    406459
    407 ! Define the filters
    408 
    409 ! IN filter.h :
    410 ! Low  cutting frequency, in Hz    : fcoup1
    411 ! High cutting frequency, in Hz    : fcoup2
    412 ! Half-width of the filters, in Hz : width
    413 
    414 !print*,"Low  cutting frequency, in Hz ?"
    415 !read(*,*) fcoup1
    416 !print*,"High cutting frequency, in Hz ?"
    417 !read(*,*) fcoup2
    418 !print*,"Half-width of the filters, in Hz ?"
    419 !read(*,*) width
    420 !width = 3./time(timelength)
    421 
    422460do itim=1,M_fft+1
    423461  if (freq(itim).lt.(fcoup1-width)) then
Note: See TracChangeset for help on using the changeset viewer.