-
Notifications
You must be signed in to change notification settings - Fork 0
/
utili.f90
87 lines (68 loc) · 1.94 KB
/
utili.f90
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
!**********************************************************
!* Hanning taper subroutine
!* Parameters:
!* float *taper 1D array, the signal to be tapered
!* int ntaper the length of the taper
!*
! -------------------------------------------------
!* Code from Total E & P
! -------------------------------------------
!**********************************************************
subroutine staper(taper,ntaper,nx)
implicit none
integer, intent(in) ::nx
integer, intent(in) ::ntaper
real, dimension(nx),intent(out)::taper
integer :: ix,ntp
real :: pi
pi=4*atan(1.0)
ntp=ntaper-1
taper=1
if (nx.lt.ntaper) then
write(*,*)'Warn: ntaper too big! No taper in the wave field!'
return
endif
if (ntaper.lt.3) then
write(*,*)'Warn: ntaper<3! No taper in the wave field!'
return
endif
do ix=1,nx
if (ix.le.ntaper) then
taper(ix)=0.5-0.5*cos(pi*(ix-1)/ntp)
else if (ix.gt.nx-ntaper) then
taper(ix)=0.5-0.5*cos(pi*(nx-ix)/ntp)
endif
enddo
return
end
! ====================================================================
subroutine maxvalue(input,n,lgs,ik_max)
implicit none
integer :: ik_max,ik,n
complex :: lgs,input(n)
ik_max=1;
lgs=cmplx(0.0,0.0)
do ik=1,n
if (abs(input(ik)) .gt. abs(lgs)) then
lgs= input(ik)
ik_max=ik
endif
enddo
end subroutine
! ===============================================================
subroutine maxvalue_2d(local_p_fft,nxfft,nzfft,value_max,i_max,j_max)
implicit none
integer :: i_max,j_max
integer :: nxfft,nzfft,i,j
complex :: value_max,local_p_fft(1:nxfft,1:nzfft)
value_max=cmplx(0.0,0.0)
do j=1,nzfft
do i=1,nxfft
if (abs(local_p_fft(i,j)) .gt. abs(value_max)) then
value_max= local_p_fft(i,j)
i_max=i
j_max=j
endif
enddo
enddo
end subroutine