7171function GMT. parkermag (Gm:: GMTgrid{Float32, 2} , Gbat:: GMTgrid{Float32, 2} , dir:: String = " dir" ; year= 2020 , nnx= 0 , nny= 0 , nterms= 6 , zobs= 0.0 ,
7272 wshort= 0.0 , wlong= 0.0 , slin= 0.0 , sdip= 0.0 , sdec= 0.0 , thickness= 0.5 , pct= 30 , padtype:: String = " taper" ,
7373 geocentric= false , isRTP= false , verbose= false ):: GMTgrid{Float32, 2}
74- helper_parkermag (Gm, Gbat, dir, Float32 (year), nnx, nny, nterms, Float32 (zobs), Float32 (wshort), Float32 (wlong),
74+ helper_parkermag (Gm, Gbat, dir, Float32 (year), nnx:: Int , nny:: Int , nterms:: Int , Float32 (zobs), Float32 (wshort), Float32 (wlong),
7575 Float32 (slin), Float32 (sdip), Float32 (sdec), Float32 (thickness), Float64 (pct), padtype, Bool (geocentric),
7676 Bool (isRTP), Bool (verbose))
7777end
@@ -383,7 +383,7 @@ function grav_inv(grav, dx, dy, wl, ws, zmean, rho, max_iter, min_err, verbose):
383383 ny:: Int , nx:: Int = size (grav)
384384 nxy = nx * ny
385385 k = create_wavenumbers (nx, ny, dx, dy, eltype (grav))[1 ] # calculate wavenumber array
386- wts = bpass3d (nx, ny, convert ( eltype (grav), dx), convert ( eltype (grav), dy), wl, ws , false ) # set up bandpass filter
386+ wts = bpass3d (nx, ny, Float64 ( dx), Float64 ( dy), Float64 (wl), Float64 (ws), eltype (dx) , false ) # set up bandpass filter
387387
388388 F = - fft (grav) ./ (cte * exp .(- k .* _zmean) .+ eps (1.0f0 ))
389389 for m = 1 : nxy @inbounds F[m] *= wts[m] end
@@ -669,7 +669,7 @@ function inv3d(f3d, h, dx, dy, wl, ws, rlat, rlon, yr, zobs, thick, sdec, sdip,
669669 zup = zobs - hmax
670670 h .+ = Float32 (hwiggl - hmax)
671671
672- wts = bpass3d (nx, ny, convert ( eltype (f3d), dx), convert ( eltype (f3d), dy), wl, ws , verbose) # set up bandpass filter
672+ wts = bpass3d (nx, ny, Float64 ( dx), Float64 ( dy), Float64 (wl), Float64 (ws), eltype (dx) , verbose) # set up bandpass filter
673673
674674 dexpw = exp .(- k .* hwiggl)
675675 F = fft (f3d) # take fft of observed magnetic field and initial m3d
738738
739739# --------------------------------------------------------------------------------------------------
740740"""
741- wts = bpass3d(nnx::Int, nny::Int, dx::Float , dy::Float , wlong::Real , wshort::Real , verbose::Bool)
741+ wts = bpass3d(nnx::Int, nny::Int, dx::Float64 , dy::Float64 , wlong::Float64 , wshort::Float64, dt::eltype(dx) , verbose::Bool)
742742
743743Sets up bandpass filter weights in 2 dimensions.
744744
@@ -753,15 +753,15 @@ Returns:
753753 Matrix containing bandpass filter weights. The type of this matrix depends on the type of `dx`.
754754 It can be a `Float32` or `Float64` matrix.
755755"""
756- function bpass3d (nnx, nny, dx:: T , dy, wlong, wshort, verbose:: Bool ) where T
756+ function bpass3d (nnx:: Int , nny:: Int , dx:: Float64 , dy:: Float64 , wlong:: Float64 , wshort:: Float64 , dt :: DataType , verbose:: Bool )
757757 ! isa (dx, AbstractFloat) && (dx = Float32 (dx); dy = Float32 (dy))
758758 # Constants
759759 twopi = pi * 2
760760 dk1 = twopi/ ((nnx- 1 )* dx)
761761 dk2 = twopi/ ((nny- 1 )* dy)
762762
763763 # Calculate wavenumber array
764- k, _, _ = create_wavenumbers (nnx, nny, dx, dy, eltype (dx) )
764+ k, _, _ = create_wavenumbers (nnx, nny, dx, dy, dt )
765765
766766 # Default values for wshort and wlong
767767 wshort = wshort == 0.0 ? max (dx* 2 , dy* 2 ) : wshort
@@ -784,8 +784,8 @@ function bpass3d(nnx, nny, dx::T, dy, wlong, wshort, verbose::Bool) where T
784784 end
785785
786786 # Calculate wavelength information
787- wl1 = wlong > 0 ? twopi/ klo : 1000
788- wl2 = wlong > 0 ? twopi/ klof : 1000
787+ wl1 = wlong > 0 ? twopi/ klo : 1000.0
788+ wl2 = wlong > 0 ? twopi/ klof : 1000.0
789789 wl3 = twopi/ khif
790790 wl4 = twopi/ khi
791791 wnx = twopi/ (dk1* (nnx- 1 )/ 2 )
0 commit comments