Skip to content

Commit a67afb5

Browse files
committed
address joss changes
1 parent c240cfb commit a67afb5

10 files changed

+140
-117
lines changed

docs/src/man/Tutorial_Basic.md

Lines changed: 17 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -70,9 +70,17 @@ Saved file: Topo_Alps.vts
7070
7171
````
7272

73-
If we open both datasets in Paraview, we see this (after giving some color to the topography):
73+
If we open both datasets in Paraview, and changing both files from outline/solid colors to the corresponing data field, we see:
74+
![Basic_Tutorial_1](../assets/img/Basic_Tutorial_Paraview_1.png)
75+
Now we can change the colormap on the right side, marked by a red square. For topography we use the `Oleron` colormap, which you can download [here](https://www.fabiocrameri.ch/colourmaps/).
76+
For the tomography we use the `Roma` scientific colormap. You will now see a blue'ish box of the tomography, this is not the best color to visualise the data. Let's invert the colormap by clicking on the item marked by the blue arrow.
77+
Now we see the tomography in a more intuitive way, but the topography is not visible anymore. We can change the opacity of the tomography by setting a value in the `Opacity` field marked by the red square.
78+
Note that you will need to adapt the range of the topography colormap as the change in color is not at 0.0. By clicking on the item marked by the black arrow, you can set your desired range.
79+
80+
![Basic_Tutorial_1](../assets/img/Basic_Tutorial_Paraview_2.png)
81+
82+
Now you should see somthing like this:
7483
![Basic_Tutorial_1](../assets/img/Basic_Tutorial_1.png)
75-
Note that I use the `Oleron` scientific colormap for the tomography which you can download [here](https://www.fabiocrameri.ch/colourmaps/)
7684

7785
### 2. Extract subset of data
7886
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.
@@ -89,7 +97,7 @@ Saved file: Tomo_Alps.vts
8997
9098
````
9199

92-
Which looks like:
100+
After loading the new data again in paraview, switching to the proper data field and adjusting the colormap, you should see somthing like this:
93101
![Basic_Tutorial_2](../assets/img/Basic_Tutorial_2.png)
94102

95103
### 3. Create cross sections
@@ -128,7 +136,7 @@ GeoData
128136
````
129137

130138
In general, you can get help info for all functions with `?`:
131-
```julia
139+
```julia-repl
132140
help?> cross_section
133141
search: cross_section cross_section_volume cross_section_points cross_section_surface flatten_cross_section
134142
@@ -198,8 +206,12 @@ Saved file: data_200km.vts
198206
199207
````
200208

209+
After loading the data in Paraview, you can use the `Clip` tool on the topography to only show the topography above sealevel and make it 60% transparent. Also adjust the colormap of the tomography to 5.0 and -5.0
210+
211+
![Basic_Tutorial_3](../assets/img/Basic_Tutorial_Paraview_3.png)
212+
213+
After doing all these steps, you should see something like this:
201214
![Basic_Tutorial_3](../assets/img/Basic_Tutorial_3.png)
202-
In creating this image, I used the `Clip` tool of Paraview to only show topography above sealevel and made it 50% transparent.
203215

204216
### 4. Cartesian data
205217
As you can see, the curvature or the Earth is taken into account here. Yet, for many applications it is more convenient to work in Cartesian coordinates (kilometers) rather then in geographic coordinates.

docs/src/man/Tutorial_Chmy_MPI.md

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -156,9 +156,8 @@ You can than run it with:
156156
mpiexecjl -n 4 --project=. julia Tutorial_Chmy_MPI.jl
157157
```
158158

159-
The full file can be downloaded [here](../../../tutorials/Tutorial_Chmy_MPI.jl)
159+
The full file can be downloaded [here](https://github.com/JuliaGeodynamics/GeophysicalModelGenerator.jl/blob/main/tutorials/Tutorial_Chmy_MPI.jl)
160160

161161
---
162162

163163
*This page was generated using [Literate.jl](https://github.com/fredrikekre/Literate.jl).*
164-

docs/src/man/tutorial_ISC_data.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ You can get data from the ISC catalogue here:
1010
The catalogue will give you an on screen CSV output that will then have to be copied to a file of your choice (here we will call it `ISC1.dat`). Do that and start julia from the directory where it was downloaded.
1111

1212
#### 2. Read data into Julia
13-
The main data-file, `ISC1.dat`, has 23 lines of comments (indicated with `#`), after which the data starts. We can use the julia package [https://github.com/JuliaData/CSV.jl](CSV.jl) to read in the data, and tell it that the data is separated by `,`.
13+
The main data-file, `ISC1.dat`, has 23 lines of comments (indicated with `#`), after which the data starts. We can use the julia package [CSV.jl](https://github.com/JuliaData/CSV.jl) to read in the data, and tell it that the data is separated by `,`.
1414
```julia-repl
1515
julia> using CSV, GeophysicalModelGenerator
1616
julia> data_file = CSV.File("ISC1.dat",datarow=24,header=false,delim=',')

docs/src/man/tutorial_loadregular3DSeismicData_netCDF.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ El-Sharkawy et al. (2020), *The Slab Puzzle of the Alpine‐Mediterranean Region
1111
The data is can be downloaded from [https://ds.iris.edu/files/products/emc/emc-files/El-Sharkawy-etal-G3.2020-MeRE2020-Mediterranean-0.0.nc](https://ds.iris.edu/files/products/emc/emc-files/El-Sharkawy-etal-G3.2020-MeRE2020-Mediterranean-0.0.nc). Do that and start julia from the directory where it was downloaded.
1212

1313
#### 2. Read data into Julia
14-
The main data-file, `El-Sharkawy-etal-G3.2020-MeRE2020-Mediterranean-0.0.nc`, is given as netCDF file. To read in data of this type, it is necessary to load an appropriate package. Here, we will use the [https://github.com/JuliaGeo/NetCDF.jl](NetCDF.jl) package. Download and install the package with:
14+
The main data-file, `El-Sharkawy-etal-G3.2020-MeRE2020-Mediterranean-0.0.nc`, is given as netCDF file. To read in data of this type, it is necessary to load an appropriate package. Here, we will use the [NetCDF.jl](https://github.com/JuliaGeo/NetCDF.jl) package. Download and install the package with:
1515
```julia
1616
julia> using Pkg
1717
julia> Pkg.add("NetCDF")

src/LaMEM_io.jl

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -97,12 +97,12 @@ Extracts a certain `keyword` from a LaMEM input `file` and convert it to a certa
9797
Optionally, you can also pass command-line arguments which will override the value read from the input file.
9898
9999
# Example 1:
100-
```julia
100+
```julia-repl
101101
julia> nmark_z = ParseValue_LaMEM_InputFile("SaltModels.dat","nmark_z",Int64)
102102
```
103103
104104
# Example 2:
105-
```julia
105+
```julia-repl
106106
julia> nmark_z = ParseValue_LaMEM_InputFile("SaltModels.dat","nmark_z",Int64, args="-nel_x 128 -coord_x -4,4")
107107
```
108108
@@ -173,7 +173,7 @@ Parses a LaMEM input file and stores grid information in the `Grid` structure.
173173
Optionally, you can pass LaMEM command-line arguments as well.
174174
175175
# Example 1
176-
```julia
176+
```julia-repl
177177
julia> Grid = read_LaMEM_inputfile("SaltModels.dat")
178178
LaMEM Grid:
179179
nel : (32, 32, 32)
@@ -185,7 +185,7 @@ z ϵ [-2.0 : 0.0]
185185
```
186186
187187
# Example 2 (with command-line arguments)
188-
```julia
188+
```julia-repl
189189
julia> Grid = read_LaMEM_inputfile("SaltModels.dat", args="-nel_x 64 -coord_x -4,4")
190190
LaMEM Grid:
191191
nel : (64, 32, 32)
@@ -823,7 +823,7 @@ end
823823
Reads a parallel, rectilinear, `*.vts` file with the name `fname` and located in `dir` and create a 3D `Data` struct from it.
824824
825825
# Example
826-
```julia
826+
```julia-repl
827827
julia> Data = read_data_PVTR("Haaksbergen.pvtr", "./Timestep_00000005_3.35780500e-01/")
828828
ParaviewData
829829
size : (33, 33, 33)
@@ -1025,6 +1025,6 @@ function coordinate_grids(Data::LaMEM_grid; cell=false)
10251025
if cell
10261026
X,Y,Z = average_q1(X),average_q1(Y), average_q1(Z)
10271027
end
1028-
1028+
10291029
return X,Y,Z
10301030
end

src/WaterFlow.jl

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,7 +19,7 @@ function spacing(lon,lat)
1919
dlat[:,2:end-1] = (lat.val[:,3:end,1] - lat.val[:,1:end-2,1])/2
2020
dlat[:,1] = dlat[:,2]
2121
dlat[:,end] = dlat[:,end-1]
22-
22+
2323
return dlon, dlat
2424
end
2525

@@ -39,26 +39,26 @@ end
3939

4040

4141
"""
42-
Topo_water, sinks, pits, bnds = waterflows(Topo::GeoData;
42+
Topo_water, sinks, pits, bnds = waterflows(Topo::GeoData;
4343
flowdir_fn=WhereTheWaterFlows.d8dir_feature, feedback_fn=nothing, drain_pits=true, bnd_as_sink=true,
4444
rainfall = nothing,
4545
minsize=300)
4646
4747
Takes a GMG GeoData object of a topographic map and routes water through the grid. Optionally,
48-
you can specify `rainfall` in which case we accumulate the rain as specified in this 2D array instead of the cellarea.
48+
you can specify `rainfall` in which case we accumulate the rain as specified in this 2D array instead of the cellarea.
4949
This allows you to, for example, sum, up water if you have variable rainfall in the area.
5050
The other options are as in the `waterflows` function of the package `WhereTheWaterFlows`.
5151
5252
Example
5353
===
54-
```julia
54+
```julia-repl
5555
# Download some topographic data
5656
julia> Topo = import_topo([6.5,7.3,50.2,50.6], file="@earth_relief_03s");
5757
5858
# Flow the water through the area:
5959
julia> Topo_water, sinks, pits, bnds = waterflows(Topo)
6060
julia> Topo_water
61-
GeoData
61+
GeoData
6262
size : (961, 481, 1)
6363
lon ϵ [ 6.5 : 7.3]
6464
lat ϵ [ 50.2 : 50.59999999999999]
@@ -68,7 +68,7 @@ GeoData
6868
```
6969
7070
"""
71-
function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature; feedback_fn=nothing, drain_pits=true, bnd_as_sink=true, rainfall=nothing, minsize=300)
71+
function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature; feedback_fn=nothing, drain_pits=true, bnd_as_sink=true, rainfall=nothing, minsize=300)
7272

7373
cellarea = cell_area(Topo)
7474
cellarea_m2 = cellarea
@@ -96,10 +96,10 @@ function waterflows(Topo::GeoData, flowdir_fn= WhereTheWaterFlows.d8dir_feature;
9696
largest_catchment = catchment_large .== catchment_large[id_max]
9797
largest_area = copy(area)
9898
largest_area[.!largest_catchment] .= NaN
99-
99+
100100
log10_area = log10.(area)
101101
log10_largest_area = log10.(largest_area)
102102

103-
Topo_water = addfield(Topo,(;area, slen, dir, nout, nin, c, cellarea_m2, catchment_large, log10_area, largest_catchment, largest_area, log10_largest_area))
104-
return Topo_water, sinks, pits, bnds
105-
end
103+
Topo_water = addfield(Topo,(;area, slen, dir, nout, nin, c, cellarea_m2, catchment_large, log10_area, largest_catchment, largest_area, log10_largest_area))
104+
return Topo_water, sinks, pits, bnds
105+
end

src/surface_functions.jl

Lines changed: 13 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,12 +17,12 @@ function is_surface(surf::AbstractGeneralGrid)
1717
return issurf
1818
end
1919

20-
function +(a::_T, b::_T) where _T<:AbstractGeneralGrid
20+
function +(a::_T, b::_T) where _T<:AbstractGeneralGrid
2121
@assert size(a) == size(b)
2222
return _addSurfaces(a,b)
2323
end
2424

25-
function -(a::_T, b::_T) where _T<:AbstractGeneralGrid
25+
function -(a::_T, b::_T) where _T<:AbstractGeneralGrid
2626
@assert size(a) == size(b)
2727
return _subtractSurfaces(a,b)
2828
end
@@ -71,11 +71,11 @@ This drapes fields of a data set `Data` on the topography `Topo`
7171
function drape_on_topo(Topo::GeoData, Data::GeoData)
7272
@assert is_surface(Topo)
7373
@assert is_surface(Data)
74-
74+
7575
Lon,Lat,_ = lonlatdepth_grid( Topo.lon.val[:,1,1], Topo.lat.val[1,:,1],Topo.depth.val[1,1,:]);
7676

7777
# use nearest neighbour to interpolate data
78-
idx = nearest_point_indices(Lon,Lat, vec(Data.lon.val), vec(Data.lat.val) );
78+
idx = nearest_point_indices(Lon,Lat, vec(Data.lon.val), vec(Data.lat.val) );
7979

8080
idx_out = findall( (Lon .< minimum(Data.lon.val)) .| (Lon .> maximum(Data.lon.val)) .|
8181
(Lat .< minimum(Data.lat.val)) .| (Lat .> maximum(Data.lat.val)) )
@@ -137,7 +137,7 @@ Drapes Cartesian Data on topography
137137
function drape_on_topo(Topo::CartData, Data::CartData)
138138
@assert is_surface(Topo)
139139
@assert is_surface(Data)
140-
140+
141141
Topo_lonlat = GeoData(ustrip.(Topo.x.val),ustrip.(Topo.y.val), ustrip.(Topo.z.val), Topo.fields )
142142
Data_lonlat = GeoData(ustrip.(Data.x.val),ustrip.(Data.y.val), ustrip.(Data.z.val), Data.fields )
143143

@@ -152,12 +152,12 @@ end
152152
"""
153153
surf_new = fit_surface_to_points(surf::GeoData, lon_pt::Vector, lat_pt::Vector, depth_pt::Vector)
154154
155-
This fits the `depth` values of the surface `surf` to the `depth` value of the closest-by-points in (`lon_pt`,`lat_pt`, `depth_pt`)
155+
This fits the `depth` values of the surface `surf` to the `depth` value of the closest-by-points in (`lon_pt`,`lat_pt`, `depth_pt`)
156156
157157
"""
158158
function fit_surface_to_points(surf::GeoData, lon_pt::Vector, lat_pt::Vector, depth_pt::Vector)
159159
@assert is_surface(surf)
160-
160+
161161
idx = nearest_point_indices(NumValue(surf.lon),NumValue(surf.lat), lon_pt, lat_pt);
162162
depth = NumValue(surf.depth)
163163
depth[idx] .= depth_pt[idx];
@@ -171,12 +171,12 @@ end
171171
"""
172172
surf_new = fit_surface_to_points(surf::CartData, lon_pt::Vector, lat_pt::Vector, depth_pt::Vector)
173173
174-
This fits the `depth` values of the surface `surf` to the `depth` value of the closest-by-points in (`lon_pt`,`lat_pt`, `depth_pt`)
174+
This fits the `depth` values of the surface `surf` to the `depth` value of the closest-by-points in (`lon_pt`,`lat_pt`, `depth_pt`)
175175
176176
"""
177177
function fit_surface_to_points(surf::CartData, X_pt::Vector, Y_pt::Vector, Z_pt::Vector)
178178
@assert is_surface(surf)
179-
179+
180180
idx = nearest_point_indices(NumValue(surf.x),NumValue(surf.y), X_pt[:], Y_pt[:]);
181181
depth = NumValue(surf.z)
182182
depth = Z_pt[idx]
@@ -197,7 +197,7 @@ This can be used, for example, to mask points above/below the Moho in a volumetr
197197
198198
# Example
199199
First we create a 3D data set and a 2D surface:
200-
```julia
200+
```julia-repl
201201
julia> Lon,Lat,Depth = lonlatdepth_grid(10:20,30:40,(-300:25:0)km);
202202
julia> Data = Depth*2;
203203
julia> Data_set3D = GeoData(Lon,Lat,Depth,(Depthdata=Data,LonData=Lon))
@@ -217,7 +217,7 @@ julia> Data_Moho = GeoData(Lon,Lat,Depth+Lon*km, (MohoDepth=Depth,))
217217
fields: (:MohoDepth,)
218218
```
219219
Next, we intersect the surface with the data set:
220-
```julia
220+
```julia-repl
221221
julia> Above = above_surface(Data_set3D, Data_Moho);
222222
```
223223
Now, `Above` is a boolean array that is true for points above the surface and false for points below and at the surface.
@@ -337,7 +337,7 @@ end
337337
338338
Interpolates a 3D data set `V` on a surface defined by `Surf`.
339339
# Example
340-
```julia
340+
```julia-repl
341341
julia> Data
342342
ParaviewData
343343
size : (33, 33, 33)
@@ -403,4 +403,4 @@ function interpolate_data_surface(V::GeoData, Surf::GeoData)
403403
Surf_interp = interpolate_datafields(V, Surf.lon.val, Surf.lat.val, Surf.depth.val)
404404

405405
return Surf_interp
406-
end
406+
end

0 commit comments

Comments
 (0)