@@ -7,8 +7,8 @@ using GeophysicalModelGenerator
7
7
Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,- 50 km);
8
8
Data1 = Depth* 2 ; # some data
9
9
Vx1,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))
12
12
@test_throws ErrorException cross_section (Data_set2D, Depth_level= - 10 )
13
13
14
14
# Test interpolation of depth to a given cartesian XY-plane
@@ -22,7 +22,7 @@ plane2 = interpolate_datafields_2D(Data_set2D, proj, x, y)
22
22
Lon1,Lat1,Depth1 = lonlatdepth_grid (12 : 18 ,33 : 39 ,- 50 km);
23
23
Data2 = Depth1* 2 ; # some data
24
24
Vx1,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))
26
26
27
27
plane3 = interpolate_datafields_2D (Data_set2D0, Data_set2D_1)
28
28
@test sum (plane3. fields. Depthdata) ≈ - 4900.0 km
@@ -35,23 +35,23 @@ plane3 = interpolate_datafields_2D(Data_set2D0, Data_set2D_1)
35
35
Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,(- 300 : 25 : 0 )km);
36
36
Data = Depth* 2 ; # some data
37
37
Vx,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)))
39
39
40
40
# Test addfield
41
- Data_set3D = addfield (Data_set3D," Lat" , Lat)
41
+ Data_set3D = addfield (Data_set3D," Lat" , Lat)
42
42
@test keys (Data_set3D. fields) == (:Depthdata , :LonData , :Velocity , :Lat )
43
43
44
- Data_set3D = addfield (Data_set3D,(;Lat, Lon))
44
+ Data_set3D = addfield (Data_set3D,(;Lat, Lon))
45
45
@test keys (Data_set3D. fields) == (:Depthdata , :LonData , :Velocity , :Lat , :Lon )
46
46
47
47
# 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)))
49
49
50
50
# Create 3D volume with some fake data
51
51
Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,(0 : - 25 : - 300 )km);
52
52
Data = Depth* 2 ; # some data
53
53
Vx,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)))
55
55
56
56
# Create cross-sections in various directions (no interpolation which is default)
57
57
test_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=(
99
99
# @test size(test_cross_rev.fields[3][2])==(50,100,1)
100
100
# @test write_paraview(test_cross_rev, "profile_test_rev")[1]=="profile_test_rev.vts"
101
101
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
+
102
116
# Cross-section with cartesian data
103
117
test_cross = cross_section (Data_setCart3D, Lon_level= 15 , dims= (50 ,100 ), Interpolate= true )
104
118
@test size (test_cross. fields[3 ][2 ])== (1 ,50 ,100 )
@@ -173,16 +187,16 @@ Data_pert = subtract_horizontalmean(Data, Percentage=true) # 3D w
173
187
@test Data_pert[1000 ] == 0.0
174
188
175
189
Data2D = 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]
177
191
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)))
179
193
@test Data_set2D. fields[3 ][10 ,8 ,1 ] == 0
180
194
181
195
182
196
# Create surface ("Moho")
183
197
Lon,Lat,Depth = lonlatdepth_grid (10 : 20 ,30 : 40 ,- 40 km);
184
198
Depth = 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)))
186
200
187
201
188
202
# 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))
218
232
@test Data_VoteMap. fields[:votemap ][101 ]== 0
219
233
@test Data_VoteMap. fields[:votemap ][100 ]== 1
220
234
221
- # Combine 2 datasets
235
+ # Combine 2 datasets
222
236
Data_VoteMap = votemap ([Data_set3D_reverse, Data_set3D], [" Depthdata<-560" ," LonData>19" ],dims= (10 ,10 ,10 ))
223
237
@test Data_VoteMap. fields[:votemap ][10 ,9 ,1 ]== 2
224
238
@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)
253
267
@test cross_tmp. fields. lat_proj[10 ]== 36.2 # check if the projected latitude level is the chosen one
254
268
255
269
cross_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
257
271
cross_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
259
273
@test cross_tmp. fields. lat_proj[20 ] == 35.323420618580585
260
274
261
275
# test inPolygon
0 commit comments