Skip to content

Conversation

mthielma
Copy link
Contributor

@mthielma mthielma commented Jul 8, 2025

To allow screenshots to be saved in ProfileData, I added this field. I also added the respective function create_profile_screenshot! and adapted extract_ProfileData. Tests were also modified.

To allow screenshots to be saved in ProfileData, I added this field. I also added the respective function  create_profile_screenshot! and adapted extract_ProfileData. Tests were also modified.
Copy link

github-actions bot commented Jul 8, 2025

Your PR requires formatting changes to meet the project's style guidelines.
Please consider running Runic (git runic main) to apply these changes.

Click here to view the suggested changes.
diff --git a/src/ProfileProcessing.jl b/src/ProfileProcessing.jl
index 86d177e..0e330a8 100644
--- a/src/ProfileProcessing.jl
+++ b/src/ProfileProcessing.jl
@@ -299,13 +299,13 @@ function create_profile_screenshot!(Profile::ProfileData, DataSet::NamedTuple)
             x_profile = flatten_cross_section(data_tmp, Start = Profile.start_lonlat) # compute the distance along the profile
             data_tmp = addfield(data_tmp, "x_profile", x_profile)
 
-             # add the data set as a NamedTuple
+            # add the data set as a NamedTuple
             data_NT = NamedTuple{(DataSetName[idata],)}((data_tmp,))
             tmp = merge(tmp, data_NT)
         else
             # we do not have this implemented
             #error("horizontal profiles not yet implemented")
-        end        
+        end
     end
     Profile.SurfData = tmp # assign to profile data structure
     return
@@ -394,7 +394,7 @@ end
 
 Extracts data along a vertical or horizontal profile
 """
-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 = 50km)
+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 = 50km)
 
     if !isnothing(VolData)
         create_profile_volume!(Profile, VolData; DimsVolCross = DimsVolCross, Depth_extent = Depth_extent)
@@ -415,13 +415,12 @@ Extracts data along a vertical or horizontal profile.
 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 = 50km)
 
     # call the actual function to extract the profile data
-    extract_ProfileData!(Profile, VolData, SurfData, PointData,NamedTuple(); DimsVolCross = DimsVolCross, Depth_extent = Depth_extent, DimsSurfCross = DimsSurfCross, section_width = section_width)
+    extract_ProfileData!(Profile, VolData, SurfData, PointData, NamedTuple(); DimsVolCross = DimsVolCross, Depth_extent = Depth_extent, DimsSurfCross = DimsSurfCross, section_width = section_width)
     return nothing
 end
 
 
 
-
 """
 This reads the picked profiles from disk and returns a vector of ProfileData
 """
diff --git a/test/test_ProfileProcessing.jl b/test/test_ProfileProcessing.jl
index 0a27c17..b3d9739 100644
--- a/test/test_ProfileProcessing.jl
+++ b/test/test_ProfileProcessing.jl
@@ -80,9 +80,9 @@ GeophysicalModelGenerator.create_profile_point!(prof4, Data.Point, section_width
 @test  length(prof1.PointData[1].lon) == 13
 @test  length(prof4.PointData[1].lon) == 445
 
-# test screenshot data 
+# test screenshot data
 GeophysicalModelGenerator.create_profile_screenshot!(prof5, Data.Screenshot)
-@test prof5.SurfData[1].fields.x_profile[1,1,1] == 0
+@test prof5.SurfData[1].fields.x_profile[1, 1, 1] == 0
 
 
 # Test the main profile extraction routines:

@mthielma mthielma requested a review from boriskaus July 8, 2025 13:28
extract_ProfileData!(prof2, VolData_combined1, Data.Surface, Data.Point)
extract_ProfileData!(prof3, VolData_combined1, Data.Surface, Data.Point)
extract_ProfileData!(prof4, VolData_combined1, Data.Surface, Data.Point)
extract_ProfileData!(prof1, VolData_combined1, Data.Surface, Data.Point, NamedTuple())
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see remark above

…hout an empty Named Tuple for ScreenshotData
@mthielma mthielma requested a review from boriskaus July 18, 2025 12:11
@mthielma mthielma merged commit 3e83725 into main Oct 2, 2025
30 of 34 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants