@@ -7,8 +7,8 @@ using GeophysicalModelGenerator
77Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,- 50 km);
88Data1 = Depth* 2 ; # some data
99Vx1,Vy1,Vz1 = Data1* 3 ,Data1* 4 ,Data1* 5
10- Data_set2D = GeoData (Lon,Lat,Depth,(Depthdata= Data1,LonData1= Lon, Velocity= (Vx1,Vy1,Vz1)))
11- Data_set2D0 = GeoData (Lon,Lat,Depth,(Depthdata= Data1,LonData1= Lon))
10+ Data_set2D = GeoData (Lon,Lat,Depth,(Depthdata= Data1,LonData1= Lon, Velocity= (Vx1,Vy1,Vz1)))
11+ Data_set2D0 = GeoData (Lon,Lat,Depth,(Depthdata= Data1,LonData1= Lon))
1212@test_throws ErrorException cross_section (Data_set2D, Depth_level= - 10 )
1313
1414# Test interpolation of depth to a given cartesian XY-plane
@@ -22,7 +22,7 @@ plane2 = interpolate_datafields_2D(Data_set2D, proj, x, y)
2222Lon1,Lat1,Depth1 = lonlatdepth_grid (12 : 18 ,33 : 39 ,- 50 km);
2323Data2 = Depth1* 2 ; # some data
2424Vx1,Vy1,Vz1 = Data2* 3 ,Data2* 4 ,Data2* 5
25- Data_set2D_1 = GeoData (Lon1,Lat1,Depth1,(Depthdata1= Data2,LonData2= Lon1))
25+ Data_set2D_1 = GeoData (Lon1,Lat1,Depth1,(Depthdata1= Data2,LonData2= Lon1))
2626
2727plane3 = interpolate_datafields_2D (Data_set2D0, Data_set2D_1)
2828@test sum (plane3. fields. Depthdata) ≈ - 4900.0 km
@@ -35,23 +35,23 @@ plane3 = interpolate_datafields_2D(Data_set2D0, Data_set2D_1)
3535Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,(- 300 : 25 : 0 )km);
3636Data = Depth* 2 ; # some data
3737Vx,Vy,Vz = ustrip (Data* 3 )* km/ s,ustrip (Data* 4 )* km/ s,ustrip (Data* 5 )* km/ s;
38- Data_set3D = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
38+ Data_set3D = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
3939
4040# Test addfield
41- Data_set3D = addfield (Data_set3D," Lat" , Lat)
41+ Data_set3D = addfield (Data_set3D," Lat" , Lat)
4242@test keys (Data_set3D. fields) == (:Depthdata , :LonData , :Velocity , :Lat )
4343
44- Data_set3D = addfield (Data_set3D,(;Lat, Lon))
44+ Data_set3D = addfield (Data_set3D,(;Lat, Lon))
4545@test keys (Data_set3D. fields) == (:Depthdata , :LonData , :Velocity , :Lat , :Lon )
4646
4747# Create 3D cartesian dataset
48- Data_setCart3D = CartData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
48+ Data_setCart3D = CartData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
4949
5050# Create 3D volume with some fake data
5151Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,(0 : - 25 : - 300 )km);
5252Data = Depth* 2 ; # some data
5353Vx,Vy,Vz = ustrip (Data* 3 )* km/ s,ustrip (Data* 4 )* km/ s,ustrip (Data* 5 )* km/ s;
54- Data_set3D_reverse = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
54+ Data_set3D_reverse = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon, Velocity= (Vx,Vy,Vz)))
5555
5656# Create cross-sections in various directions (no interpolation which is default)
5757test_cross = cross_section (Data_set3D, Depth_level= - 100 km)
@@ -99,6 +99,20 @@ test_cross = cross_section(Data_set3D, Start=(10,30), End=(20,40), dims=(
9999# @test size(test_cross_rev.fields[3][2])==(50,100,1)
100100# @test write_paraview(test_cross_rev, "profile_test_rev")[1]=="profile_test_rev.vts"
101101
102+ # Cross section of a topography
103+ depth_values = [rand (0 : 0.1 : 3.5 )]
104+ Lon, Lat, Depth = lonlatdepth_grid (10 : 20 , 30 : 40 , depth_values[:]);
105+ Data_Topo = GeoData (Lon, Lat, Depth, (Depthdata= Depth,))
106+ Data_Topo_geo= cross_section (Data_Topo, Start= (10 ,30 ), End= (20 ,40 ), dims= (50 ,100 ), Interpolate= true )
107+ @test Data_Topo_geo isa GeoData
108+
109+ Lon,Lat,Depth = lonlatdepth_grid (5 : 25 ,20 : 50 ,0 );
110+ Depth = cos .(Lon/ 5 ).* sin .(Lat)* 10 ;
111+ Data_surf = GeoData (Lon,Lat,Depth,(Z= Depth,));
112+ Data_surf_cart = convert2CartData (Data_surf, proj);
113+ Data_surf_cross = cross_section (Data_surf_cart, Start= (- 1693 ,2500 ), End= (- 1000 ,3650 ), dims= (50 ,100 ), Interpolate= true )
114+ @test Data_surf_cross isa CartData
115+
102116# Cross-section with cartesian data
103117test_cross = cross_section (Data_setCart3D, Lon_level= 15 , dims= (50 ,100 ), Interpolate= true )
104118@test size (test_cross. fields[3 ][2 ])== (1 ,50 ,100 )
@@ -173,16 +187,16 @@ Data_pert = subtract_horizontalmean(Data, Percentage=true) # 3D w
173187@test Data_pert[1000 ] == 0.0
174188
175189Data2D = Data[:,1 ,:];
176- Data_pert = subtract_horizontalmean (Data2D, Percentage= true ) # 2D version with units [dp the same along a vertical profile]
190+ Data_pert = subtract_horizontalmean (Data2D, Percentage= true ) # 2D version with units [dp the same along a vertical profile]
177191
178- Data_set2D = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon,Pertdata= Data_pert ,Velocity= (Vx,Vy,Vz)))
192+ Data_set2D = GeoData (Lon,Lat,Depth,(Depthdata= Data,LonData= Lon,Pertdata= Data_pert ,Velocity= (Vx,Vy,Vz)))
179193@test Data_set2D. fields[3 ][10 ,8 ,1 ] == 0
180194
181195
182196# Create surface ("Moho")
183197Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,- 40 km);
184198Depth = Depth + Lon* km; # some fake topography on Moho
185- Data_Moho = GeoData (Lon,Lat,Depth,(MohoDepth= Depth,LonData= Lon,TestData= (Depth,Depth,Depth)))
199+ Data_Moho = GeoData (Lon,Lat,Depth,(MohoDepth= Depth,LonData= Lon,TestData= (Depth,Depth,Depth)))
186200
187201
188202# Test intersecting a surface with 2D or 3D data sets
@@ -218,7 +232,7 @@ Data_VoteMap = votemap(Data_set3D_reverse, "Depthdata<-560",dims=(10,10,10))
218232@test Data_VoteMap. fields[:votemap ][101 ]== 0
219233@test Data_VoteMap. fields[:votemap ][100 ]== 1
220234
221- # Combine 2 datasets
235+ # Combine 2 datasets
222236Data_VoteMap = votemap ([Data_set3D_reverse, Data_set3D], [" Depthdata<-560" ," LonData>19" ],dims= (10 ,10 ,10 ))
223237@test Data_VoteMap. fields[:votemap ][10 ,9 ,1 ]== 2
224238@test Data_VoteMap. fields[:votemap ][9 ,9 ,1 ]== 1
@@ -253,9 +267,9 @@ cross_tmp = cross_section(Data_EQ,Lat_level=36.2,section_width=10km)
253267@test cross_tmp. fields. lat_proj[10 ]== 36.2 # check if the projected latitude level is the chosen one
254268
255269cross_tmp = cross_section (Data_EQ,Lon_level= 16.4 ,section_width= 10 km)
256- @test cross_tmp. fields. lon_proj[10 ]== 16.4 # check if the projected longitude level is the chosen one
270+ @test cross_tmp. fields. lon_proj[10 ]== 16.4 # check if the projected longitude level is the chosen one
257271cross_tmp = cross_section (Data_EQ,Start= (15.0 ,35.0 ),End= (17.0 ,37.0 ),section_width= 10 km)
258- @test cross_tmp. fields. lon_proj[20 ] == 15.314329874961091
272+ @test cross_tmp. fields. lon_proj[20 ] == 15.314329874961091
259273@test cross_tmp. fields. lat_proj[20 ] == 35.323420618580585
260274
261275# test inPolygon
0 commit comments