@@ -17,6 +17,7 @@ Structure that holds profile data (interpolated/projected on the profile)
17
17
VolData :: GeophysicalModelGenerator.GeoData
18
18
SurfData :: Union{Nothing, NamedTuple}
19
19
PointData :: Union{Nothing, NamedTuple}
20
+ ScreenshotData :: Union{Nothing, NamedTuple}
20
21
end
21
22
22
23
Structure to store cross section data
@@ -29,6 +30,7 @@ mutable struct ProfileData
29
30
VolData:: Union{Nothing, GeophysicalModelGenerator.GeoData}
30
31
SurfData:: Union{Nothing, NamedTuple}
31
32
PointData:: Union{Nothing, NamedTuple}
33
+ ScreenshotData:: Union{Nothing, NamedTuple}
32
34
33
35
function ProfileData (; kwargs... ) # this constructor allows to define only certain fields and leave the others blank
34
36
K = new (true , nothing , nothing , nothing , nothing , nothing , nothing )
@@ -51,7 +53,6 @@ mutable struct ProfileData
51
53
end
52
54
end
53
55
54
-
55
56
function show (io:: IO , g:: ProfileData )
56
57
if g. vertical
57
58
println (io, " Vertical ProfileData" )
@@ -69,7 +70,9 @@ function show(io::IO, g::ProfileData)
69
70
if ! isnothing (g. PointData)
70
71
println (io, " PointData: $(keys (g. PointData)) " )
71
72
end
72
-
73
+ if ! isnothing (g. ScreenshotData)
74
+ println (io, " ScreenshotData: $(keys (g. ScreenshotData)) " )
75
+ end
73
76
return nothing
74
77
end
75
78
@@ -282,6 +285,31 @@ function create_profile_volume!(Profile::ProfileData, VolData::AbstractGeneralGr
282
285
return nothing
283
286
end
284
287
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
285
313
286
314
# ## 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
287
315
function create_profile_surface! (Profile:: ProfileData , DataSet:: NamedTuple ; DimsSurfCross = (100 ,))
@@ -362,21 +390,38 @@ end
362
390
363
391
364
392
"""
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)
366
394
367
395
Extracts data along a vertical or horizontal profile
368
396
"""
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)
370
398
371
399
if ! isnothing (VolData)
372
400
create_profile_volume! (Profile, VolData; DimsVolCross = DimsVolCross, Depth_extent = Depth_extent)
373
401
end
374
402
create_profile_surface! (Profile, SurfData, DimsSurfCross = DimsSurfCross)
375
403
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
376
409
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)
377
419
return nothing
378
420
end
379
421
422
+
423
+
424
+
380
425
"""
381
426
This reads the picked profiles from disk and returns a vector of ProfileData
382
427
"""
0 commit comments