Changeset 1454 for trunk/LMDZ.TITAN/Tools/fft.F90
- Timestamp:
- Jun 16, 2015, 7:01:30 PM (9 years ago)
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
trunk/LMDZ.TITAN/Tools/fft.F90
r888 r1454 63 63 integer,dimension(4) :: datashape4d ! shape of 4D datasets 64 64 65 real :: miss_val =9.99e+33! special "missing value" to specify missing data66 real,parameter :: miss_val_def= 9.99e+33 ! default value for "missing value"65 real :: miss_val ! special "missing value" to specify missing data 66 real,parameter :: miss_val_def=-9.99e+33 ! default value for "missing value" 67 67 real :: pi 68 68 real,dimension(:),allocatable :: lon ! longitude 69 69 integer lonlength ! # of grid points along longitude 70 70 real,dimension(:),allocatable :: lat ! latitude 71 real,dimension(:),allocatable :: latrad ! latitude in radian72 71 integer latlength ! # of grid points along latitude 73 72 real,dimension(:),allocatable :: plev ! Pressure levels (Pa) … … 125 124 logical :: lmdflag 126 125 126 ! Tuning parameters 127 real :: fcoup1,fcoup2,width 128 real :: fcoup1tmp,fcoup2tmp,widthtmp 129 logical,dimension(4) :: ok_out 130 character (len=1) :: ok_outtmp 131 127 132 include "planet.h" 128 include "filter.h"129 133 130 134 #include <fftw3.f> … … 135 139 136 140 pi = 2.*asin(1.) 141 miss_val = miss_val_def 137 142 138 143 write(*,*) "" 139 144 write(*,*) "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 153 fcoup1=2.5e-6 154 ! High cutting frequency, in Hz : fcoup2 155 fcoup2=6.5e-6 156 ! Half-width of the filters, in Hz : width 157 width=4.e-7 158 ! Outputs (U, V, W, T) 159 ok_out=(/.true.,.true.,.false.,.true./) 160 161 print*,"Low cutting frequency, in Hz ?" 162 print*,"between 1e-5 and 1e-7, 0 for default => 2.5e-6" 163 read(*,*) fcoup1tmp 164 if ((fcoup1tmp.lt.1e-5).and.(fcoup1tmp.gt.1e-7)) fcoup1=fcoup1tmp 165 print*,"=",fcoup1 166 print*,"High cutting frequency, in Hz ?" 167 print*,"between 1e-5 and 1e-7, 0 for default => 6.5e-6" 168 read(*,*) fcoup2tmp 169 if ((fcoup2tmp.lt.1e-5).and.(fcoup2tmp.gt.1e-7)) fcoup2=fcoup2tmp 170 print*,"=",fcoup2 171 print*,"Half-width of the filters, in Hz ?" 172 print*,"between 1e-6 and 1e-8, 0 for default => 4e-7)" 173 read(*,*) widthtmp 174 if ((widthtmp.lt.1e-6).and.(widthtmp.gt.1e-8)) width=widthtmp 175 print*,"=",width 176 !width = 3./time(timelength) 177 178 ! Outputs 179 print*,"Output of zonal wind ? (y or n, default is y)" 180 read(*,'(a1)') ok_outtmp 181 if (ok_outtmp.eq."n") ok_out(1)=.false. 182 print*,"=",ok_out(1) 183 print*,"Output of meridional wind ? (y or n, default is y)" 184 read(*,'(a1)') ok_outtmp 185 if (ok_outtmp.eq."n") ok_out(2)=.false. 186 print*,"=",ok_out(2) 187 print*,"Output of vertical wind ? (y or n, default is n)" 188 read(*,'(a1)') ok_outtmp 189 if (ok_outtmp.eq."y") ok_out(3)=.true. 190 print*,"=",ok_out(3) 191 print*,"Output of temperature ? (y or n, default is y)" 192 read(*,'(a1)') ok_outtmp 193 if (ok_outtmp.eq."n") ok_out(4)=.false. 194 print*,"=",ok_out(4) 140 195 141 196 !=============================================================================== … … 172 227 ierr=NF_GET_VAR_REAL(infid,lat_varid,lat) 173 228 if (ierr.ne.NF_NOERR) stop "Error: Failed reading lat" 174 175 allocate(latrad(latlength))176 latrad = lat*pi/180.177 229 178 230 allocate(plev(altlength)) … … 212 264 213 265 text="temp" 214 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp, ierr1,ierr2)266 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,temp,miss_val,ierr1,ierr2) 215 267 if (ierr1.ne.NF_NOERR) then 216 268 write(*,*) " looking for t instead... " 217 269 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) 219 271 if (ierr1.ne.NF_NOERR) then 220 272 print*,"Error: Failed to get temperature ID" … … 236 288 237 289 text="vitu" 238 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu, ierr1,ierr2)290 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitu,miss_val,ierr1,ierr2) 239 291 if (ierr1.ne.NF_NOERR) then 240 292 print*,"Error: Failed to get vitu ID" … … 252 304 253 305 text="vitv" 254 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv, ierr1,ierr2)306 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitv,miss_val,ierr1,ierr2) 255 307 if (ierr1.ne.NF_NOERR) then 256 308 print*,"Error: Failed to get vitv ID" … … 268 320 269 321 text="vitw" 270 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw, ierr1,ierr2)322 call get_var4d(infid,lonlength,latlength,altlength,timelength,text,vitw,miss_val,ierr1,ierr2) 271 323 if (ierr1.ne.NF_NOERR) then 272 324 print*,"Error: Failed to get vitw ID" … … 288 340 ! 2.2.1 FFT and filtering 289 341 !=============================================================================== 342 290 343 ! allocations 291 344 !------------- … … 405 458 enddo 406 459 407 ! Define the filters408 409 ! IN filter.h :410 ! Low cutting frequency, in Hz : fcoup1411 ! High cutting frequency, in Hz : fcoup2412 ! Half-width of the filters, in Hz : width413 414 !print*,"Low cutting frequency, in Hz ?"415 !read(*,*) fcoup1416 !print*,"High cutting frequency, in Hz ?"417 !read(*,*) fcoup2418 !print*,"Half-width of the filters, in Hz ?"419 !read(*,*) width420 !width = 3./time(timelength)421 422 460 do itim=1,M_fft+1 423 461 if (freq(itim).lt.(fcoup1-width)) then
Note: See TracChangeset
for help on using the changeset viewer.