Skip to content
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

Bugfixes for sealevel and test for GeoData surface interpolation #133

Merged
merged 2 commits into from
Jul 4, 2024
Merged
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
4 changes: 3 additions & 1 deletion src/sea_lvl.jl
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
export sea_level_files, SeaLevel, load_sea_level, curve_name

const sea_level_path = joinpath(pwd(), "src/sea_level_data")
pkg_dir = pkgdir(GeophysicalModelGenerator)

const sea_level_path = joinpath(pkg_dir, joinpath("src","sea_level_data"))

const sea_level_files = Dict(
:Spratt_800ka => "Spratt2016-800ka.txt",
Expand Down
11 changes: 11 additions & 0 deletions test/test_utils.jl
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ Lon,Lat,Depth = lonlatdepth_grid(10:20,30:40,-50km);
Data1 = Depth*2; # some data
Vx1,Vy1,Vz1 = Data1*3,Data1*4,Data1*5
Data_set2D = GeoData(Lon,Lat,Depth,(Depthdata=Data1,LonData1=Lon, Velocity=(Vx1,Vy1,Vz1)))
Data_set2D0 = GeoData(Lon,Lat,Depth,(Depthdata=Data1,LonData1=Lon))
@test_throws ErrorException cross_section(Data_set2D, Depth_level=-10)

# Test interpolation of depth to a given cartesian XY-plane
Expand All @@ -17,6 +18,16 @@ plane1 = interpolate_datafields_2D(Data_set2D, x, y)
proj = ProjectionPoint()
plane2 = interpolate_datafields_2D(Data_set2D, proj, x, y)


Lon1,Lat1,Depth1 = lonlatdepth_grid(12:18,33:39,-50km);
Data2 = Depth1*2; # some data
Vx1,Vy1,Vz1 = Data2*3,Data2*4,Data2*5
Data_set2D_1 = GeoData(Lon1,Lat1,Depth1,(Depthdata1=Data2,LonData2=Lon1))

plane3 = interpolate_datafields_2D(Data_set2D0, Data_set2D_1)
@test sum(plane3.fields.Depthdata) ≈ -4900.0km


@test plane1 == plane2
@test all(==(-50e0), plane1)

Expand Down
Loading