Skip to content

Commit

Permalink
Fix small comments
Browse files Browse the repository at this point in the history
  • Loading branch information
facusapienza21 committed Feb 24, 2025
1 parent 147eee9 commit 17cdee0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 6 deletions.
2 changes: 1 addition & 1 deletion src/glaciers/data/SurfaceVelocityData.jl
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ function SurfaceVelocityData(;
date::Union{Vector{DateTime}, Nothing} = nothing,
date1::Union{Vector{DateTime}, Nothing} = nothing,
date2::Union{Vector{DateTime}, Nothing} = nothing,
date_error::Union{Vector{Day}, Nothing} = nothing,
date_error::Union{Vector{Day}, Vector{Millisecond}, Nothing} = nothing,
) where {F <: AbstractFloat}
Constructor for ice surface velocity data based on Rabatel et. al (2023).
Expand Down
14 changes: 9 additions & 5 deletions src/glaciers/data/surfacevelocitydata_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ Arguments
- `file`: name of netcdf file with data
- `interp`: boolean variable indicating if we use the inporpolated data or not
"""
function initialize_surfacevelocitydata(file::String; interp=false)
function initialize_surfacevelocitydata(file::String; interp=false, compute_vabs_error::Bool=true)

# Date of first adquisition
date1 = ncread(file, "date1")
Expand Down Expand Up @@ -65,10 +65,14 @@ function initialize_surfacevelocitydata(file::String; interp=false)
vx_error = ncread(file, "error_vx")
vy_error = ncread(file, "error_vy")
# Absolute error uncertanty using propagation of uncertanties
vx_ratio_max = map(i -> max_or_empty(abs.(vx[:,:,i][vabs[:,:,i] .> 0.0]) ./ vabs[:,:,i][vabs[:,:,i] .> 0.0]), 1:size(vx)[3])
vy_ratio_max = map(i -> max_or_empty(abs.(vy[:,:,i][vabs[:,:,i] .> 0.0]) ./ vabs[:,:,i][vabs[:,:,i] .> 0.0]), 1:size(vy)[3])
vabs_error = ((vx_ratio_max .* vx_error).^2 .+ (vy_ratio_max .* vy_error).^2).^0.5
vabs_error = convert(typeof(vx_error), vabs_error)
if compute_vabs_error
vx_ratio_max = map(i -> max_or_empty(abs.(vx[:,:,i][vabs[:,:,i] .> 0.0]) ./ vabs[:,:,i][vabs[:,:,i] .> 0.0]), 1:size(vx)[3])
vy_ratio_max = map(i -> max_or_empty(abs.(vy[:,:,i][vabs[:,:,i] .> 0.0]) ./ vabs[:,:,i][vabs[:,:,i] .> 0.0]), 1:size(vy)[3])
vabs_error = ((vx_ratio_max .* vx_error).^2 .+ (vy_ratio_max .* vy_error).^2).^0.5
vabs_error = convert(typeof(vx_error), vabs_error)
else
vabs_error = nothing
end
else
vx_error = nothing
vy_error = nothing
Expand Down

0 comments on commit 17cdee0

Please sign in to comment.