anowacki / sac.jl Goto Github PK
View Code? Open in Web Editor NEWProcess seismic data in SAC format with Julia
License: Other
Process seismic data in SAC format with Julia
License: Other
In rotate_to_gcp!, we could get the rotated result directly from the parameters that are input into the function. And it seems this function also returns the result. However, the order of radial and trans component is different in this two way.
As for function
function rotate_to_gcp!(s1::SACtr, s2::SACtr, reverse::Bool=false)
s2_is_clockwise_of_s1 = angle_difference(s1[:cmpaz], s2[:cmpaz]) > 0
s2_is_clockwise_of_s1 || ((s1, s2) = (s2, s1))
!isundefined(s1[:baz]) && !isundefined(s2[:baz]) ||
throw(ArgumentError("Backazimuth is not defined for both traces"))
s1[:baz] โ s2[:baz] || throw(ArgumentError("Backazimuth not the same for both traces"))
phi = mod(s1[:baz] + 180 - s1[:cmpaz], 360)
rotate_through!(s2, s1, phi) # Checks for orthogonality
reverse && flip_component!(s2)
s1[:kcmpnm] = sacstring("Radial")
s2[:kcmpnm] = sacstring((reverse ? "-" : "")*"Trans")
s1, s2
end
This ambiguity may be related to
s2_is_clockwise_of_s1 || ((s1, s2) = (s2, s1))
The function interpolate!
seems to have some bug in expression
s.b + (0:(npts-1))*delta
raising an error
MethodError: no method matching +(::Float32, ::StepRangeLen{Float32,Float64,Float64})
And also it seems the test hasn't covered this function.
In the function tshift!:
function tshift!(s::SACtr, tshift::Number, wrap=true)
@info wrap,tshift
n = round(Int, tshift/s.delta)
@info wrap,n,tshift
if n == 0
sac_verbose && @info("SAC.tshift!: t ($tshift) is less than delta ($(s.delta)) so no shift applied")
return
end
@info wrap,n,tshift,s.t[1:n]
s.t = circshift(s.t, n)
@info wrap,n,tshift,s.t[1:n]
if !wrap
n > 0 ? s.t[1:n] = 0. : s.t[end+n+1:end] = 0.
end
update_headers!(s)
end
There is a bug when wrap=false, as it seems in Julia 1.0, we could only set:
s.t[1:n] .= 0.
But not:
s.t[1:n]=0.
A declarative, efficient, and flexible JavaScript library for building user interfaces.
๐ Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. ๐๐๐
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google โค๏ธ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.