Skip to content

Commit b785146

Browse files
committed
utils.jl
1 parent dc5385f commit b785146

33 files changed

+333
-333
lines changed

docs/src/man/Tutorial_AlpineData.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -363,10 +363,10 @@ nothing #hide
363363
At this stage we have the 3D velocity components on a grid. Yet, we don't have information yet about the elevation of the stations (as the provided data set did not give this).
364364
We could ignore that and set the elevation to zero, which would allow saving the data directly.
365365
Yet, a better way is to load the topographic map of the area and interpolate the elevation to the velocity grid.
366-
As we have already the loaded the topographic map in section 1 of this tutorial, we can simply reuse it. To interpolate, we will use the function `interpolateDataFields2D`
366+
As we have already the loaded the topographic map in section 1 of this tutorial, we can simply reuse it. To interpolate, we will use the function `interpolate_datafields_2D`
367367

368368
```julia
369-
topo_v, fields_v = interpolateDataFields2D(Topo, Lon, Lat)
369+
topo_v, fields_v = interpolate_datafields_2D(Topo, Lon, Lat)
370370
```
371371

372372
The variable we are interested in is the variable `topo_v`. `fields_v` contains the interpolation of all the fields in `Topo` to the new grid and we only keep it here for completeness.

docs/src/man/Tutorial_Basic.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -76,10 +76,10 @@ Note that I use the `Oleron` scientific colormap for the tomography which you ca
7676

7777
### 2. Extract subset of data
7878
As you can see the tomographic data covers a much larger area than the Alps itself, and in most of that area there is no data.
79-
It is thus advantageous to cut out a piece of the dataset that we are interested in which can be done with `extractSubvolume`:
79+
It is thus advantageous to cut out a piece of the dataset that we are interested in which can be done with `extract_subvolume`:
8080

8181
```julia
82-
Tomo_Alps = extractSubvolume(Tomo_Alps_full,Lon_level=(4,20),Lat_level=(36,50), Depth_level=(-600,-10))
82+
Tomo_Alps = extract_subvolume(Tomo_Alps_full,Lon_level=(4,20),Lat_level=(36,50), Depth_level=(-600,-10))
8383

8484
write_Paraview(Tomo_Alps,"Tomo_Alps");
8585
```
@@ -95,10 +95,10 @@ Which looks like:
9595
### 3. Create cross sections
9696
Paraview has the option to `Slice` through the data but it is not very intuitive to do this in 3D. Another limitation of Paraview is that it does not have native support for spherical coordinates, and therefore the data is translated to cartesian (`x`,`y`,`z`) coordinates (with the center of the Earth at `(0,0,0)`).
9797
That makes this a bit cumbersome to make a cross-section at a particular location.
98-
If you are interested in this you can use the `crossSection` function:
98+
If you are interested in this you can use the `cross_section` function:
9999

100100
```julia
101-
data_200km = crossSection(Tomo_Alps, Depth_level=-200)
101+
data_200km = cross_section(Tomo_Alps, Depth_level=-200)
102102
```
103103

104104
````
@@ -114,7 +114,7 @@ GeoData
114114
As you see, this is not exactly at 200 km depth, but at the closest `z`-level in the data sets. If you want to be exactly at 200 km, use the `Interpolate` option:
115115

116116
```julia
117-
data_200km_exact = crossSection(Tomo_Alps, Depth_level=-200, Interpolate=true)
117+
data_200km_exact = cross_section(Tomo_Alps, Depth_level=-200, Interpolate=true)
118118
```
119119

120120
````
@@ -129,10 +129,10 @@ GeoData
129129

130130
In general, you can get help info for all functions with `?`:
131131
```julia
132-
help?> crossSection
133-
search: crossSection crossSectionVolume crossSectionPoints crossSectionSurface flattenCrossSection
132+
help?> cross_section
133+
search: cross_section cross_section_volume cross_section_points cross_section_surface flatten_cross_section
134134

135-
crossSection(DataSet::AbstractGeneralGrid; dims=(100,100), Interpolate=false, Depth_level=nothing, Lat_level=nothing, Lon_level=nothing, Start=nothing, End=nothing, Depth_extent=nothing, section_width=50km)
135+
cross_section(DataSet::AbstractGeneralGrid; dims=(100,100), Interpolate=false, Depth_level=nothing, Lat_level=nothing, Lon_level=nothing, Start=nothing, End=nothing, Depth_extent=nothing, section_width=50km)
136136

137137
Creates a cross-section through a GeoData object.
138138

@@ -160,7 +160,7 @@ search: crossSection crossSectionVolume crossSectionPoints crossSectionSurface f
160160
julia> Data = Depth*2; # some data
161161
julia> Vx,Vy,Vz = ustrip(Data*3),ustrip(Data*4),ustrip(Data*5);
162162
julia> Data_set3D = GeoData(Lon,Lat,Depth,(Depthdata=Data,LonData=Lon, Velocity=(Vx,Vy,Vz)));
163-
julia> Data_cross = crossSection(Data_set3D, Depth_level=-100km)
163+
julia> Data_cross = cross_section(Data_set3D, Depth_level=-100km)
164164
GeoData
165165
size : (11, 11, 1)
166166
lon ϵ [ 10.0 : 20.0]
@@ -172,7 +172,7 @@ search: crossSection crossSectionVolume crossSectionPoints crossSectionSurface f
172172
Let's use this to make a vertical cross-section as well:
173173

174174
```julia
175-
Cross_vert = crossSection(Tomo_Alps, Start=(5,47), End=(15,44))
175+
Cross_vert = cross_section(Tomo_Alps, Start=(5,47), End=(15,44))
176176
```
177177

178178
````

docs/src/man/Tutorial_FaultDensity.md

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -82,12 +82,12 @@ Data_Faults = GeoData(Lon3D,Lat3D,Faults,(Faults=Faults,))
8282
```
8383

8484
## 2. Create Density Map
85-
Create a density map of the fault data. This is done with the `countMap` function. This function takes a specified field of a 2D `GeoData` struct and counts the entries in all control areas which are defined by steplon (number of control areas in lon direction) and steplat (number of control areas in lat direction). The field should only consist of 0.0 and 1.0 and the steplength. The final result is normalized by the highest count.
85+
Create a density map of the fault data. This is done with the `countmap` function. This function takes a specified field of a 2D `GeoData` struct and counts the entries in all control areas which are defined by steplon (number of control areas in lon direction) and steplat (number of control areas in lat direction). The field should only consist of 0.0 and 1.0 and the steplength. The final result is normalized by the highest count.
8686

8787
```julia
8888
steplon = 188
8989
steplat = 104
90-
cntmap = countMap(Data_Faults,"Faults",steplon,steplat)
90+
cntmap = countmap(Data_Faults,"Faults",steplon,steplat)
9191
```
9292

9393
Plot the density map with coastlines
@@ -103,7 +103,7 @@ Plot this using `Plots.jl`:
103103

104104
```julia
105105
heatmap(lon,lat,coastlinesEurope',colormap=cgrad(:gray1,rev=true),alpha=1.0);
106-
heatmap!(lon,lat,cntmap.fields.countMap[:,:,1]',colormap=cgrad(:batlowW,rev=true),alpha = 0.8,legend=true,title="Fault Density Map Europe",ylabel="Lat",xlabel="Lon")
106+
heatmap!(lon,lat,cntmap.fields.countmap[:,:,1]',colormap=cgrad(:batlowW,rev=true),alpha = 0.8,legend=true,title="Fault Density Map Europe",ylabel="Lat",xlabel="Lon")
107107
```
108108

109109
![tutorial_Fault_Map](../assets/img/FaultDensity.png)

docs/src/man/Tutorial_Jura.md

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -186,7 +186,7 @@ below = belowSurface(CrossSection_1_cart, TopoGeology_cart)
186186
We can add that to the cross-section with:
187187

188188
```julia
189-
CrossSection_1_cart = addField(CrossSection_1_cart,"rocks",Int64.(below))
189+
CrossSection_1_cart = addfield(CrossSection_1_cart,"rocks",Int64.(below))
190190
```
191191

192192
Note that we transfer the boolean to an integer
@@ -204,13 +204,13 @@ The result looks like:
204204

205205
## 3. Geological block model
206206
Yet, if you want to perform a numerical simulation of the Jura, it is more convenient to rotate the maps such that we can perform a simulation perpendicular to the strike of the mountain belt.
207-
This can be done with `rotateTranslateScale`:
207+
This can be done with `rotate_translate_scale`:
208208

209209
```julia
210210
RotationAngle = -43
211-
TopoGeology_cart_rot = rotateTranslateScale(TopoGeology_cart, Rotate=RotationAngle)
212-
Basement_cart_rot = rotateTranslateScale(Basement_cart, Rotate=RotationAngle)
213-
CrossSection_1_cart_rot = rotateTranslateScale(CrossSection_1_cart, Rotate=RotationAngle)
211+
TopoGeology_cart_rot = rotate_translate_scale(TopoGeology_cart, Rotate=RotationAngle)
212+
Basement_cart_rot = rotate_translate_scale(Basement_cart, Rotate=RotationAngle)
213+
CrossSection_1_cart_rot = rotate_translate_scale(CrossSection_1_cart, Rotate=RotationAngle)
214214
```
215215

216216
Next, we can create a new computational grid that is more conveniently oriented:
@@ -226,8 +226,8 @@ ComputationalGrid = CartData(xyzGrid(x,y,z))
226226
Re-interpolate the rotated to the new grid:
227227

228228
```julia
229-
GeologyTopo_comp_surf = interpolateDataFields2D(TopoGeology_cart_rot, ComputationalSurf, Rotate=RotationAngle)
230-
Basement_comp_surf = interpolateDataFields2D(Basement_cart_rot, ComputationalSurf, Rotate=RotationAngle)
229+
GeologyTopo_comp_surf = interpolate_datafields_2D(TopoGeology_cart_rot, ComputationalSurf, Rotate=RotationAngle)
230+
Basement_comp_surf = interpolate_datafields_2D(Basement_cart_rot, ComputationalSurf, Rotate=RotationAngle)
231231
```
232232

233233
Next we can use the surfaces to create a 3D block model.
@@ -254,8 +254,8 @@ Phases[id] .= 2
254254
Add to the computational grid:
255255

256256
```julia
257-
ComputationalGrid = addField(ComputationalGrid,"Phases", Phases)
258-
ComputationalGrid = removeField(ComputationalGrid,"Z")
257+
ComputationalGrid = addfield(ComputationalGrid,"Phases", Phases)
258+
ComputationalGrid = removefield(ComputationalGrid,"Z")
259259
```
260260

261261
Save the surfaces, cross-section and the grid:

docs/src/man/Tutorial_LaPalma.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ Phases[ind] .= 3 #Magma
140140
Add rocktypes to the grid:
141141

142142
```julia
143-
Grid_3D = addField(Grid_3D,"Phases",Phases)
143+
Grid_3D = addfield(Grid_3D,"Phases",Phases)
144144
```
145145

146146
We can save this to paraview format

docs/src/man/Tutorial_NumericalModel_2D.md

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ addBox!(Phases, Temp, Grid2D; xlim=(0,300), zlim=(-80.0, 0.0), phase = ConstantP
5959
Add them to the `CartData` dataset:
6060

6161
```julia
62-
Grid2D = addField(Grid2D,(;Phases, Temp))
62+
Grid2D = addfield(Grid2D,(;Phases, Temp))
6363
```
6464

6565
````
@@ -107,7 +107,7 @@ addBox!(Phases, Temp, Grid2D; xlim=(0,300), zlim=(-80.0, 0.0), phase = lith, Dip
107107
Which looks like:
108108

109109
```julia
110-
Grid2D = addField(Grid2D,(;Phases, Temp))
110+
Grid2D = addfield(Grid2D,(;Phases, Temp))
111111
write_Paraview(Grid2D,"Grid2D_SubductionMechanicalLayered");
112112
```
113113

@@ -131,7 +131,7 @@ addBox!(Phases, Temp, Grid2D; xlim=(0,300), zlim=(-80.0, 0.0), phase = lith, T =
131131
Which looks like:
132132

133133
```julia
134-
Grid2D = addField(Grid2D,(;Phases, Temp))
134+
Grid2D = addfield(Grid2D,(;Phases, Temp))
135135
write_Paraview(Grid2D,"Grid2D_SubductionHalfspaceCooling");
136136
```
137137

@@ -174,7 +174,7 @@ We can set the mantle lithosphere that is hotter > 1250 C to mantle:
174174
ind = findall(Temp .> 1250 .&& Phases .==2);
175175
Phases[ind] .= 0;
176176

177-
Grid2D = addField(Grid2D,(;Phases, Temp))
177+
Grid2D = addfield(Grid2D,(;Phases, Temp))
178178
write_Paraview(Grid2D,"Grid2D_SubductionRidge");
179179
```
180180

@@ -213,7 +213,7 @@ Lithosphere-asthenosphere boundary:
213213
ind = findall(Temp .> 1250 .&& Phases .==2);
214214
Phases[ind] .= 0;
215215

216-
Grid2D = addField(Grid2D,(;Phases, Temp))
216+
Grid2D = addfield(Grid2D,(;Phases, Temp))
217217
write_Paraview(Grid2D,"Grid2D_SubductionOverriding");
218218
```
219219

@@ -250,7 +250,7 @@ addSlab!(Phases, Temp, Grid2D, trench, phase = ConstantPhase(1));
250250
Add them to the `CartData` dataset:
251251

252252
```julia
253-
Grid2D = addField(Grid2D,(;Phases, Temp))
253+
Grid2D = addfield(Grid2D,(;Phases, Temp))
254254
write_Paraview(Grid2D,"Grid2D_SubductionCurvedMechanical");
255255
```
256256

@@ -330,7 +330,7 @@ Lithosphere-asthenosphere boundary:
330330
ind = findall(Temp .> 1250 .&& (Phases.==2 .|| Phases.==5));
331331
Phases[ind] .= 0;
332332

333-
Grid2D = addField(Grid2D,(;Phases, Temp))
333+
Grid2D = addfield(Grid2D,(;Phases, Temp))
334334
write_Paraview(Grid2D,"Grid2D_SubductionCurvedOverriding");
335335
```
336336

docs/src/man/Tutorial_NumericalModel_3D.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ addBox!(Phases, Temp, Grid; xlim=(0,300), ylim=(-400, 400.0), zlim=(-80.0, 0.0),
5959
Add them to the `CartData` dataset:
6060

6161
```julia
62-
Grid = addField(Grid,(;Phases, Temp))
62+
Grid = addfield(Grid,(;Phases, Temp))
6363
```
6464

6565
````
@@ -162,7 +162,7 @@ addStripes!(Phases, Grid; stripAxes = (1,1,0), phase = ConstantPhase(0), stripeP
162162
Finally, we can add all this to the `CartData` dataset:
163163

164164
```julia
165-
Grid = addField(Grid,(;Phases, Temp))
165+
Grid = addfield(Grid,(;Phases, Temp))
166166
write_Paraview(Grid,"Grid3D_Ridges");
167167
```
168168

docs/src/man/Tutorial_Votemaps.md

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ PSwave_Koulakov
4444
fields: (:dVp_percentage, :dVs_percentage)
4545
```
4646

47-
#### 2. Creating a voteMap
47+
#### 2. Creating a votemap
4848
The idea of `Votemaps` is rather simple:
4949
- assume that a certain perturbation describes a feature (say, P wave anomalies >3% are interpreted to be slabs in the model of Paffrath)
5050
- Everything that fulfills this criteria gets the number 1, everything else 0.
@@ -59,7 +59,7 @@ So how do we create Votemaps?
5959
Doing this is rather simple:
6060

6161
```julia
62-
Data_VoteMap = voteMap( [Pwave_Paffrath, PSwave_Koulakov, Pwave_Zhao],
62+
Data_VoteMap = votemap( [Pwave_Paffrath, PSwave_Koulakov, Pwave_Zhao],
6363
["dVp_Percentage>3.0","dVp_percentage>2.0","dVp_Percentage>2.0"], dims=(100,100,100))
6464
```
6565

@@ -72,7 +72,7 @@ GeoData
7272
lon ϵ [ 4.0 : 18.0]
7373
lat ϵ [ 38.0 : 49.01197604790419]
7474
depth ϵ [ -606.0385 km : -10.0 km]
75-
fields: (:voteMap,)
75+
fields: (:votemap,)
7676
```
7777

7878
And from this, we can generate profiles, visualize 3D features in Paraview etc. etc.
@@ -88,7 +88,7 @@ You can ofcourse argue that newer tomographic models include more data & should
8888
A simple way to take that into account is to list the model twice:
8989

9090
```julia
91-
Data_VoteMap = voteMap( [Pwave_Paffrath, Pwave_Paffrath, PSwave_Koulakov, Pwave_Zhao],
91+
Data_VoteMap = votemap( [Pwave_Paffrath, Pwave_Paffrath, PSwave_Koulakov, Pwave_Zhao],
9292
["dVp_Percentage>3.0","dVp_Percentage>3.0", "dVp_percentage>2.0","dVp_Percentage>2.0"],
9393
dims=(100,100,100))
9494
```

docs/src/man/profile_processing.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,7 @@ The routines provided here have the following functionality:
99
```@docs
1010
load_GMG
1111
save_GMG
12-
crossSection
12+
cross_section
1313
ProfileData
1414
extractProfileData
1515
createProfileData

docs/src/man/tools.md

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,22 +3,22 @@
33
We have a number of functions with which we can extract sub-data from a 2D or 3D `GeoData` structure.
44

55
```@docs
6-
crossSection
7-
extractSubvolume
8-
interpolateDataFields
9-
voteMap
10-
subtractHorizontalMean
6+
cross_section
7+
extract_subvolume
8+
interpolate_datafields
9+
votemap
10+
subtract_horizontalmean
1111
aboveSurface
1212
belowSurface
1313
interpolateDataOnSurface
14-
interpolateTopographyOnPlane
15-
parseColumns_CSV_File
16-
rotateTranslateScale!
14+
interpolate_topography_plane
15+
parse_columns_CSV
16+
rotate_translate_scale!
1717
pointData2NearestGrid
1818
convert2UTMzone
1919
convert2CartData
2020
projectCartData
2121
drape_on_topo
22-
lithostaticPressure!
23-
countMap
22+
lithostatic_pressure!
23+
countmap
2424
```

0 commit comments

Comments
 (0)