-
Notifications
You must be signed in to change notification settings - Fork 35
Added a screenshot field to the ProfileData structure #176
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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.
Your PR requires formatting changes to meet the project's style guidelines. 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: |
boriskaus
requested changes
Jul 8, 2025
test/test_ProfileProcessing.jl
Outdated
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()) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
see remark above
albert-de-montserrat
approved these changes
Jul 8, 2025
…hout an empty Named Tuple for ScreenshotData
boriskaus
approved these changes
Oct 2, 2025
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
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.