Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 5 additions & 7 deletions src/ProfileProcessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ mutable struct ProfileData
ScreenshotData::Union{Nothing, NamedTuple}

function ProfileData(; kwargs...) # this constructor allows to define only certain fields and leave the others blank
K = new(true, nothing, nothing, nothing, nothing, nothing, nothing)
K = new(true, nothing, nothing, nothing, nothing, nothing, nothing, nothing, nothing)
for (key, value) in kwargs
# make sure that start and end point are given as tuples of Float64
if key == Symbol("start_lonlat")
Expand Down Expand Up @@ -617,14 +617,12 @@ function extract_ProfileData(ProfileCoordFile::String, ProfileNumber::Int64, Dat
# load all Data
VolData, SurfData, PointData, ScreenshotData, TopoData = load_GMG(Datasets_all)

# merge VolData:
VolData_combined = combine_vol_data(VolData)

# project data onto profile:
# project data onto profile (volume datasets are processed individually, without merging them first):
extract_ProfileData!(
profile, VolData_combined, SurfData, PointData;
profile, VolData, SurfData, PointData;
DimsVolCross = DimsVolCross, DimsSurfCross = DimsSurfCross,
Depth_extent = DepthVol, section_width = WidthPointProfile
Depth_extent = DepthVol, section_width = WidthPointProfile,
ScreenshotData = ScreenshotData, TopoData = TopoData
)

return profile
Expand Down
3 changes: 3 additions & 0 deletions test/test_ProfileProcessing.jl
Original file line number Diff line number Diff line change
Expand Up @@ -53,6 +53,9 @@ VolData_combined2 = combine_vol_data(Data.Volume, dims = (50, 51, 52))
VolData_combined3 = combine_vol_data(Data.Volume, lon = (1, 22), lat = (40, 52), dims = (50, 51, 52))
@test isnan(VolData_combined3.fields.Hua2017_Vp[1000])

# ProfileData has a TopoData field, which is empty by default
@test isnothing(ProfileData(depth = -10).TopoData)

# Define horizontal & vertical profiles
prof1 = ProfileData(start_lonlat = (5, 45), end_lonlat = (15, 49))
prof2 = ProfileData(depth = -100)
Expand Down