@@ -17,6 +17,7 @@ Structure that holds profile data (interpolated/projected on the profile)
1717 VolData :: GeophysicalModelGenerator.GeoData
1818 SurfData :: Union{Nothing, NamedTuple}
1919 PointData :: Union{Nothing, NamedTuple}
20+ ScreenshotData :: Union{Nothing, NamedTuple}
2021 end
2122
2223 Structure to store cross section data
@@ -29,6 +30,7 @@ mutable struct ProfileData
2930 VolData:: Union{Nothing, GeophysicalModelGenerator.GeoData}
3031 SurfData:: Union{Nothing, NamedTuple}
3132 PointData:: Union{Nothing, NamedTuple}
33+ ScreenshotData:: Union{Nothing, NamedTuple}
3234
3335 function ProfileData (; kwargs... ) # this constructor allows to define only certain fields and leave the others blank
3436 K = new (true , nothing , nothing , nothing , nothing , nothing , nothing )
@@ -51,7 +53,6 @@ mutable struct ProfileData
5153 end
5254end
5355
54-
5556function show (io:: IO , g:: ProfileData )
5657 if g. vertical
5758 println (io, " Vertical ProfileData" )
@@ -69,7 +70,9 @@ function show(io::IO, g::ProfileData)
6970 if ! isnothing (g. PointData)
7071 println (io, " PointData: $(keys (g. PointData)) " )
7172 end
72-
73+ if ! isnothing (g. ScreenshotData)
74+ println (io, " ScreenshotData: $(keys (g. ScreenshotData)) " )
75+ end
7376 return nothing
7477end
7578
@@ -282,6 +285,31 @@ function create_profile_volume!(Profile::ProfileData, VolData::AbstractGeneralGr
282285 return nothing
283286end
284287
288+ # ## internal function to process screenshot data - contrary to the volume data, we here have to save lon/lat/depth pairs for every screenshot data set, so we create a NamedTuple of GeoData data sets
289+ function create_profile_screenshot! (Profile:: ProfileData , DataSet:: NamedTuple )
290+ num_datasets = length (DataSet)
291+
292+ tmp = NamedTuple () # initialize empty one
293+ DataSetName = keys (DataSet) # Names of the datasets
294+
295+ for idata in 1 : num_datasets
296+ # load data set --> each data set is a single GeoData structure, so we'll only have to get the respective key to load the correct type
297+ data_tmp = DataSet[idata]
298+ if Profile. vertical
299+ x_profile = flatten_cross_section (data_tmp, Start = Profile. start_lonlat) # compute the distance along the profile
300+ data_tmp = addfield (data_tmp, " x_profile" , x_profile)
301+
302+ # add the data set as a NamedTuple
303+ data_NT = NamedTuple {(DataSetName[idata],)} ((data_tmp,))
304+ tmp = merge (tmp, data_NT)
305+ else
306+ # we do not have this implemented
307+ # error("horizontal profiles not yet implemented")
308+ end
309+ end
310+ Profile. SurfData = tmp # assign to profile data structure
311+ return
312+ end
285313
286314# ## internal function to process surface data - contrary to the volume data, we here have to save lon/lat/depth pairs for every surface data set, so we create a NamedTuple of GeoData data sets
287315function create_profile_surface! (Profile:: ProfileData , DataSet:: NamedTuple ; DimsSurfCross = (100 ,))
@@ -362,21 +390,38 @@ end
362390
363391
364392"""
365- extract_ProfileData!(Profile::ProfileData,VolData::GeoData, SurfData::NamedTuple, PointData::NamedTuple; DimsVolCross=(100,100),Depth_extent=nothing,DimsSurfCross=(100,),section_width=50)
393+ extract_ProfileData!(Profile::ProfileData,VolData::GeoData, SurfData::NamedTuple, PointData::NamedTuple, ScreenshotData::NamedTuple ; DimsVolCross=(100,100),Depth_extent=nothing,DimsSurfCross=(100,),section_width=50)
366394
367395Extracts data along a vertical or horizontal profile
368396"""
369- function extract_ProfileData! (Profile:: ProfileData , VolData:: Union{Nothing, GeoData} = nothing , SurfData:: NamedTuple = NamedTuple (), PointData:: NamedTuple = NamedTuple (); DimsVolCross = (100 , 100 ), Depth_extent = nothing , DimsSurfCross = (100 ,), section_width = 50 km)
397+ function extract_ProfileData! (Profile:: ProfileData , VolData:: Union{Nothing, GeoData} = nothing , SurfData:: NamedTuple = NamedTuple (), PointData:: NamedTuple = NamedTuple (),ScreenshotData :: NamedTuple = NamedTuple () ; DimsVolCross = (100 , 100 ), Depth_extent = nothing , DimsSurfCross = (100 ,), section_width = 50 km)
370398
371399 if ! isnothing (VolData)
372400 create_profile_volume! (Profile, VolData; DimsVolCross = DimsVolCross, Depth_extent = Depth_extent)
373401 end
374402 create_profile_surface! (Profile, SurfData, DimsSurfCross = DimsSurfCross)
375403 create_profile_point! (Profile, PointData, section_width = section_width)
404+ if ! isempty (ScreenshotData)
405+ create_profile_screenshot! (Profile, ScreenshotData)
406+ end
407+ return nothing
408+ end
376409
410+ """
411+ extract_ProfileData!(Profile::ProfileData,VolData::GeoData, SurfData::NamedTuple, PointData::NamedTuple; DimsVolCross=(100,100),Depth_extent=nothing,DimsSurfCross=(100,),section_width=50)
412+
413+ Extracts data along a vertical or horizontal profile.
414+ """
415+ function extract_ProfileData! (Profile:: ProfileData , VolData:: Union{Nothing, GeoData} = nothing , SurfData:: NamedTuple = NamedTuple (), PointData:: NamedTuple = NamedTuple (); DimsVolCross = (100 , 100 ), Depth_extent = nothing , DimsSurfCross = (100 ,), section_width = 50 km)
416+
417+ # call the actual function to extract the profile data
418+ extract_ProfileData! (Profile, VolData, SurfData, PointData,NamedTuple (); DimsVolCross = DimsVolCross, Depth_extent = Depth_extent, DimsSurfCross = DimsSurfCross, section_width = section_width)
377419 return nothing
378420end
379421
422+
423+
424+
380425"""
381426This reads the picked profiles from disk and returns a vector of ProfileData
382427"""
0 commit comments