Skip to content

Commit 7b8fa2a

Browse files
committed
utils.jl
1 parent 46d6387 commit 7b8fa2a

25 files changed

+263
-263
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 `interpolateDataFields2D`
367367

368368
```julia
369-
topo_v, fields_v = InterpolateDataFields2D(Topo, Lon, Lat)
369+
topo_v, fields_v = interpolateDataFields2D(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 `extractSubvolume`:
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 = extractSubvolume(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 `crossSection` function:
9999

100100
```julia
101-
data_200km = CrossSection(Tomo_Alps, Depth_level=-200)
101+
data_200km = crossSection(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 = crossSection(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?> crossSection
133+
search: crossSection crossSectionVolume crossSectionPoints crossSectionSurface flattenCrossSection
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+
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)
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 = crossSection(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 = crossSection(Tomo_Alps, Start=(5,47), End=(15,44))
176176
```
177177

178178
````

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 `rotateTranslateScale`:
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 = 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)
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 = interpolateDataFields2D(TopoGeology_cart_rot, ComputationalSurf, Rotate=RotationAngle)
230+
Basement_comp_surf = interpolateDataFields2D(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_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+
crossSection
1313
ProfileData
1414
extractProfileData
1515
createProfileData

docs/src/man/tools.md

Lines changed: 9 additions & 9 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+
crossSection
7+
extractSubvolume
8+
interpolateDataFields
9+
voteMap
10+
subtractHorizontalMean
1111
aboveSurface
1212
belowSurface
1313
interpolateDataOnSurface
14-
InterpolateTopographyOnPlane
15-
ParseColumns_CSV_File
16-
RotateTranslateScale!
14+
interpolateTopographyOnPlane
15+
parseColumns_CSV_File
16+
rotateTranslateScale!
1717
pointData2NearestGrid
1818
convert2UTMzone
1919
convert2CartData
2020
projectCartData
2121
drape_on_topo
22-
LithostaticPressure!
22+
lithostaticPressure!
2323
countMap
2424
```

docs/src/man/tutorial_GPS.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ We can load that in julia as:
4949
data_file = CSV.File("ALPS2017_DEF_VT.GRD",datarow=18,header=false,delim=' ')
5050

5151
num_columns = 4;
52-
data = ParseColumns_CSV_File(data_file, num_columns); #Read numerical data from the file
52+
data = parseColumns_CSV_File(data_file, num_columns); #Read numerical data from the file
5353
lon_Vz, lat_Vz, Vz_vec = data[:,1], data[:,2], data[:,3]
5454
```
5555

@@ -123,7 +123,7 @@ Next, we load the horizontal velocities which is available in the file `ALPS2017
123123
```julia
124124
download_data("https://store.pangaea.de/Publications/Sanchez-etal_2018/ALPS2017_DEF_HZ.GRD","ALPS2017_DEF_HZ.GRD")
125125
data_file = CSV.File("ALPS2017_DEF_HZ.GRD",datarow=18,header=false,delim=' ')
126-
data = ParseColumns_CSV_File(data_file, 10)
126+
data = parseColumns_CSV_File(data_file, 10)
127127
lon_Hz, lat_Hz, Ve_Hz, Vn_Hz = data[:,1], data[:,2], data[:,3], data[:,4]
128128
```
129129

docs/src/man/tutorial_ISC_data.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,9 @@ The main data-file, `ISC1.dat`, has 23 lines of comments (indicated with `#`), a
1515
julia> using CSV, GeophysicalModelGenerator
1616
julia> data_file = CSV.File("ISC1.dat",datarow=24,header=false,delim=',')
1717
```
18-
As this data contains a lot of information that we are not interested in at the moment and which is given in non-numeric formats (e.g. date, time etc.), we will use our helper function *ParseColumns_CSV_File* to only extract columns with numeric data.
18+
As this data contains a lot of information that we are not interested in at the moment and which is given in non-numeric formats (e.g. date, time etc.), we will use our helper function *parseColumns_CSV_File* to only extract columns with numeric data.
1919
```julia-repl
20-
julia> data = ParseColumns_CSV_File(data_file, 14)
20+
julia> data = parseColumns_CSV_File(data_file, 14)
2121
julia> lon = data[:,2];
2222
julia> lat = data[:,1];
2323
julia> depth = -1* data[:,3];

docs/src/man/tutorial_load3DSeismicData.md

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -173,10 +173,10 @@ Note that using geographic coordinates is slightly cumbersome in Paraview. If yo
173173
#### 5. Extract and plot cross-sections of the data
174174
In many cases you would like to create cross-sections through the 3D data sets as well, and visualize that in Paraview. That is in principle possible in Paraview as well (using the `Slice` tool, as described above). Yet, in many cases we want to have it at a specific depth, or through pre-defined `lon/lat` coordinates.
175175

176-
There is a simple way to achieve this using the `CrossSection` function.
176+
There is a simple way to achieve this using the `crossSection` function.
177177
To make a cross-section at a given depth:
178178
```julia
179-
julia> Data_cross = CrossSection(Data_set, Depth_level=-100km)
179+
julia> Data_cross = crossSection(Data_set, Depth_level=-100km)
180180
GeoData
181181
size : (121, 94, 1)
182182
lon ϵ [ 0.0 : 18.0]
@@ -190,7 +190,7 @@ julia> write_Paraview(Data_cross, "Zhao_CrossSection_100km")
190190

191191
Or at a specific longitude:
192192
```julia
193-
julia> Data_cross = CrossSection(Data_set, Lon_level=10)
193+
julia> Data_cross = crossSection(Data_set, Lon_level=10)
194194
GeoData
195195
size : (1, 94, 101)
196196
lon ϵ [ 10.05 : 10.05]
@@ -205,7 +205,7 @@ As you see, this cross-section is not taken at exactly 10 degrees longitude. Tha
205205

206206
If you wish to interpolate the data, specify `Interpolate=true`:
207207
```julia
208-
julia> Data_cross = CrossSection(Data_set, Lon_level=10, Interpolate=true)
208+
julia> Data_cross = crossSection(Data_set, Lon_level=10, Interpolate=true)
209209
GeoData
210210
size : (1, 100, 100)
211211
lon ϵ [ 10.0 : 10.0]
@@ -218,7 +218,7 @@ as you see, this causes the data to be interpolated on a `(100,100)` grid (which
218218

219219
We can also create a diagonal cut through the model:
220220
```julia
221-
julia> Data_cross = CrossSection(Data_set, Start=(1.0,39), End=(18,50))
221+
julia> Data_cross = crossSection(Data_set, Start=(1.0,39), End=(18,50))
222222
GeoData
223223
size : (100, 100, 1)
224224
lon ϵ [ 1.0 : 18.0]
@@ -232,10 +232,10 @@ Here an image that shows the resulting cross-sections:
232232
![Paraview_7](../assets/img/Tutorial_Zhao_Paraview_7.png)
233233

234234
#### 6. Extract a (3D) subset of the data
235-
Sometimes, the data set covers a large region (e.g., the whole Earth), and you are only interested in a subset of this data for your project. You can obviously cut your data to the correct size in Paraview. Yet, an even easier way is the routine `ExtractSubvolume`:
235+
Sometimes, the data set covers a large region (e.g., the whole Earth), and you are only interested in a subset of this data for your project. You can obviously cut your data to the correct size in Paraview. Yet, an even easier way is the routine `extractSubvolume`:
236236

237237
```julia
238-
julia> Data_subset = ExtractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45))
238+
julia> Data_subset = extractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45))
239239
GeoData
240240
size : (48, 35, 101)
241241
lon ϵ [ 4.95 : 12.0]
@@ -250,7 +250,7 @@ This gives the resulting image. You can obviously use that new, smaller, data se
250250
By default, we extract the original data and do not interpolate it on a new grid.
251251
In some cases, you will want to interpolate the data on a different grid. Use the `Interpolate=true` option for that:
252252
```julia
253-
julia> Data_subset_interp = ExtractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45), Interpolate=true)
253+
julia> Data_subset_interp = extractSubvolume(Data_set,Lon_level=(5,12), Lat_level=(40,45), Interpolate=true)
254254
GeoData
255255
size : (50, 50, 50)
256256
lon ϵ [ 5.0 : 12.0]

0 commit comments

Comments
 (0)