Skip to content

Commit 011e2b0

Browse files
committed
address some of the review comments
1 parent a742627 commit 011e2b0

File tree

5 files changed

+117
-120
lines changed

5 files changed

+117
-120
lines changed

README.md

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@
1010

1111
Creating consistent 3D images of geophysical and geological datasets and turning that into an input model for geodynamic simulations is often challenging. The aim of this package is to help with this, by providing a number of routines to easily import data and create a consistent 3D visualisation from it in the VTK-toolkit format, which can for example be viewed with [Paraview](https://www.paraview.org). In addition, we provide a range of tools that helps to generate input models to perform geodynamic simulations and import the results of such simulations back into julia.
1212

13-
A short summary of the package and its features are given below. For a detailed description of the package and to learn how to use it, have a look at the [documentation](https://juliageodynamics.github.io/GeophysicalModelGenerator.jl/dev/).
13+
A short summary of the package and its features are given below. For a detailed description of the package and to learn how to use it, have a look at the [documentation](https://juliageodynamics.github.io/GeophysicalModelGenerator.jl/dev/).
1414

1515
![README_img](./docs/src/assets/img/Readme_pic.png)
1616
### Contents
@@ -43,17 +43,17 @@ The best way to learn how to use this is to install the package (see below) and
4343
## Installation
4444
First, you need to install julia on your machine. We recommend to use the binaries from [https://julialang.org](https://julialang.org).
4545
Next, start julia and switch to the julia package manager using `]`, after which you can add the package.
46-
```julia
46+
```julia-repl
4747
julia> ]
48-
(@v1.10) pkg> add GeophysicalModelGenerator
48+
(@1.11) pkg> add GeophysicalModelGenerator
4949
```
5050
You can test whether it works on your system with
51-
```julia
51+
```julia-repl
5252
julia> ]
53-
(@v1.10) pkg> test GeophysicalModelGenerator
53+
(@1.11) pkg> test GeophysicalModelGenerator
5454
```
5555
and use it with
56-
```julia
56+
```julia-repl
5757
julia> using GeophysicalModelGenerator
5858
```
5959

docs/src/man/installation.md

Lines changed: 22 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ You start julia on the command line with:
1515
kausb$ julia
1616
```
1717
This will start the command-line interface of julia:
18-
```julia
18+
```julia-repl
1919
_
2020
_ _ _(_)_ | Documentation: https://docs.julialang.org
2121
(_) | (_) (_) |
@@ -25,32 +25,32 @@ This will start the command-line interface of julia:
2525
_/ |\__'_|_|_|\__'_| | Official https://julialang.org/ release
2626
|__/ |
2727
28-
julia>
28+
julia>
2929
```
3030

3131
From the julia prompt, you start the package manager by typing `]`:
32-
```julia
33-
(@v1.6) pkg>
32+
```julia-repl
33+
(@1.11) pkg>
3434
```
3535
And you return to the command line with a backspace.
3636

3737
Also useful is that julia has a build-in terminal, which you can reach by typing `;` on the command line:
38-
```julia
38+
```julia-repl
3939
julia>;
40-
shell>
40+
shell>
4141
```
4242
In the shell, you can use the normal commands like listing the content of a directory, or the current path:
43-
```julia
43+
```julia-repl
4444
shell> ls
4545
LICENSE Manifest.toml Project.toml README.md docs src test tutorial
4646
shell> pwd
4747
/Users/kausb/.julia/dev/GeophysicalModelGenerator
4848
```
4949
As before, return to the main command line (called `REPL`) with a backspace.
5050

51-
If you want to see help information for any julia function, type `?` followed by the command.
51+
If you want to see help information for any julia function, type `?` followed by the command.
5252
An example for `tan` is:
53-
```julia
53+
```julia-repl
5454
help?> tan
5555
search: tan tanh tand atan atanh atand instances transpose transcode contains UnitRange ReentrantLock StepRange StepRangeLen trailing_ones trailing_zeros
5656
@@ -73,59 +73,55 @@ search: tan tanh tand atan atanh atand instances transpose transcode contains Un
7373
2×2 Matrix{Float64}:
7474
-1.09252 -1.09252
7575
-1.09252 -1.09252
76-
```
76+
```
7777

7878
If you are in a directory that has a julia file (which have the extension `*.jl`), you can open that file with Visual Studio Code:
79-
```julia
79+
```julia-repl
8080
shell> code runtests.jl
8181
```
8282
Execute the file with:
83-
```julia
83+
```julia-repl
8484
julia> include("runtests")
8585
```
8686
Note that you do not include the `*.jl` extension.
8787

8888

8989
### 4. Install GeophysicalModelGenerator.jl
9090
In order to install GeophysicalModelGenerator.jl, start julia and go to the package manager:
91-
```julia
91+
```julia-repl
9292
julia> ]
93-
(@v1.6) pkg> add GeophysicalModelGenerator
93+
(@v1.11) pkg> add GeophysicalModelGenerator
9494
```
9595
This will automatically install various other packages it relies on (using the correct version).
9696

9797
If you want, you can test if it works on your machine by running the test suite in the package manager:
98-
```julia
98+
```julia-repl
9999
julia> ]
100-
(@v1.6) pkg> test GeophysicalModelGenerator
100+
(@1.11) pkg> test GeophysicalModelGenerator
101101
```
102102
Note that we run these tests automatically on Windows, Linux and Mac every time we add a new feature to GeophysicalModelGenerator (using different julia versions). This Continuous Integration (CI) ensures that new features do not break others in the package. The results can be seen [here](https://github.com/JuliaGeodynamics/GeophysicalModelGenerator.jl/actions).
103103

104104
The installation of `GMG` only needs to be done once, and will precompile the package and all other dependencies.
105105

106106
If you, at a later stage, want to upgrade to the latest version of `GMG`, you can type:
107-
```julia
107+
```julia-repl
108108
julia> ]
109-
(@v1.6) pkg> update GeophysicalModelGenerator
109+
(@1.11) pkg> update GeophysicalModelGenerator
110110
```
111111

112112
You can load GeophysicalModelGenerator, for example to create cross-sections, with:
113-
```julia
113+
```julia-repl
114114
julia> using GeophysicalModelGenerator
115115
```
116116

117117
### 5. Other useful packages
118-
As you will work your way through the tutorials you will see that we often use external packages, for example to load ascii data files into julia. You will find detailed instructions in the respective tutorials.
118+
As you will work your way through the tutorials you will see that we often use external packages, for example to load ascii data files into julia. You will find detailed instructions in the respective tutorials.
119119

120120
If you already want to install some of those, here our favorites. Install them through the package manager:
121121

122-
- [CSV](https://github.com/JuliaData/CSV.jl): Read comma-separated data files into julia.
123-
- [Plots](https://github.com/JuliaPlots/Plots.jl): Create all kinds of plots in julia (quite an extensive package, but very useful to have).
122+
- [CSV](https://github.com/JuliaData/CSV.jl): Read comma-separated data files into julia.
123+
- [Plots](https://github.com/JuliaPlots/Plots.jl): Create all kinds of plots in julia (quite an extensive package, but very useful to have).
124124
- [JLD2](https://github.com/JuliaIO/JLD2.jl): This allows saving julia objects (such as a tomographic model) to a binary file and load it again at a later stage.
125125
- [Geodesy](https://github.com/JuliaGeo/Geodesy.jl): Convert UTM coordinates to latitude/longitude/altitude.
126126
- [NetCDF](https://github.com/JuliaGeo/NetCDF.jl): Read NetCDF files.
127127
- [GMT](https://github.com/GenericMappingTools/GMT.jl): A julia interface to the Generic Mapping Tools (GMT), which is a highly popular package to create (geophysical) maps. Note that installing `GMT.jl` is more complicated than installing the other packages listed above, as you first need to have a working version of `GMT` on your machine (it is not yet installed automatically). Installation instructions for Windows/Linux are on their webpage. On a mac, we made the best experiences by downloading the binaries from their webpage and not using a package manager to install GMT.
128-
129-
130-
131-

docs/src/man/projection.md

Lines changed: 19 additions & 19 deletions
Original file line numberDiff line numberDiff line change
@@ -2,18 +2,18 @@
22

33
Typically, you load a dataset by reading it into julia and either generating a `GeoData` structure (in case you have `longitude/latitude/depth` info), or as `UTMData` (in case the data is in `UTM coordinates`, which requires you to specify the zone & hemisphere).
44

5-
If you write the data to `Paraview`, it is internally converted to a Paraview structure (which involves `x,y,z` Cartesian Earth-Centered-Earth-Fixed (ECEF) coordinates using the `wgs84` ellipsoid).
5+
If you write the data to `Paraview`, it is internally converted to a Paraview structure (which involves `x,y,z` Cartesian Earth-Centered-Earth-Fixed (ECEF) coordinates using the `wgs84` ellipsoid).
66

77
Yet, if you do geodynamic calculations the chances are that the geodynamic code does not operate in spherical coordinates, but rather use cartesian ones. In that case you should transfer your data to the `CartData` structure, which requires you to specify a `ProjectionPoint` that is a point on the map that will later have the coordinates `(0,0)` in the `CartData` structure.
88

99

1010
#### 1. Converting
1111
Converting from one coordinate system to the other is straightforward. Let's use Europe as an example:
1212

13-
```julia
13+
```julia-repl
1414
julia> using GeophysicalModelGenerator, GMT
1515
julia> Topo = import_topo(lon = [-10, 45], lat=[25, 50], file="@earth_relief_20m")
16-
GeoData
16+
GeoData
1717
size : (165, 75, 1)
1818
lon ϵ [ -10.0 : 44.666666666666664]
1919
lat ϵ [ 25.0 : 49.666666666666664]
@@ -22,13 +22,13 @@ GeoData
2222
julia> write_paraview(Topo,"Topo")
2323
Saved file: Topo.vts
2424
```
25-
The result is shown on the globe as:
25+
The result is shown on the globe as:
2626
![Topo_Europe_GeoData](../assets/img/Topo_Europe_GeoData.png)
2727

2828
You can convert this to UTM zone as:
29-
```julia
29+
```julia-repl
3030
julia> convert(UTMData, Topo)
31-
UTMData
31+
UTMData
3232
UTM zone : 29-38 North
3333
size : (165, 75, 1)
3434
EW ϵ [ 197181.31221507967 : 769155.4572884373]
@@ -40,29 +40,29 @@ As the area is large, it covers a range of `UTM` zones (and every point has a UT
4040

4141
Yet, what we could do instead is show all data with respect to a single UTM zone. For this, we have to select a point around which we project (in this case more or less in the center):
4242

43-
```julia
43+
```julia-repl
4444
julia> p=ProjectionPoint(Lon=17.3, Lat=37.5)
4545
ProjectionPoint(37.5, 17.3, 703311.4380385976, 4.152826288024972e6, 33, true)
4646
```
4747

4848
Projecting the `GeoData` set using this projection point is done with:
49-
```julia
49+
```julia-repl
5050
julia> convert2UTMzone(Topo,p)
51-
UTMData
51+
UTMData
5252
UTM zone : 33-33 North
5353
size : (165, 75, 1)
5454
EW ϵ [ -2.0750691599137965e6 : 3.581351293385453e6]
5555
NS ϵ [ 2.7649477474783654e6 : 5.938114212160672e6]
5656
depth ϵ [ -4985.5 m : 3123.0 m]
5757
fields : (:Topography,)
5858
```
59-
Whereas this is now in UTM Data (in meters), it is distorted.
59+
Whereas this is now in UTM Data (in meters), it is distorted.
6060
![Topo_Europe_UTMData](../assets/img/Topo_Europe_UTMData.png)
6161

6262
Often it is more convenient to have this in `CartData`, which is done in a similar manner:
63-
```julia
63+
```julia-repl
6464
julia> Topo_Cart = convert2CartData(Topo,p)
65-
CartData
65+
CartData
6666
size : (165, 75, 1)
6767
x ϵ [ -2778.3805979523936 km : 2878.039855346856 km]
6868
y ϵ [ -1387.8785405466067 km : 1785.2879241356998 km]
@@ -72,34 +72,34 @@ CartData
7272
This shows that the model is ~5600 by 3000 km.
7373
![Topo_Europe_CartData](../assets/img/Topo_Europe_CartData.png)
7474

75-
Whereas this is ok to look at and compare with a LaMEM model setup, we cannot use it to perform internal calculations (or to generate a LaMEM model setup), because the `x` and `y` coordinates are distorted and not orthogonal.
75+
Whereas this is ok to look at and compare with a LaMEM model setup, we cannot use it to perform internal calculations (or to generate a LaMEM model setup), because the `x` and `y` coordinates are distorted and not orthogonal.
7676

7777
#### 2. Projecting data
7878
For use with LaMEM, you would need an orthogonal cartesian grid. From the last command above we get some idea on the area, so we can create this:
79-
```julia
79+
```julia-repl
8080
julia> Topo_Cart_orth = CartData(xyz_grid(-2000:20:2000,-1000:20:1000,0))
81-
CartData
81+
CartData
8282
size : (201, 101, 1)
8383
x ϵ [ -2000.0 km : 2000.0 km]
8484
y ϵ [ -1000.0 km : 1000.0 km]
8585
z ϵ [ 0.0 km : 0.0 km]
8686
fields : (:Z,)
8787
```
8888
Next, we can project the topographic data (in `GeoData` format) on this orthogonal grid
89-
```julia
89+
```julia-repl
9090
julia> Topo_Cart_orth = project_CartData(Topo_Cart_orth, Topo, p)
91-
CartData
91+
CartData
9292
size : (201, 101, 1)
9393
x ϵ [ -2000.0 km : 2000.0 km]
9494
y ϵ [ -1000.0 km : 1000.0 km]
9595
z ϵ [ -4.485650671162607 km : 2.5909655318121865 km]
9696
fields : (:Topography,)
97-
julia> write_paraview(Topo_Cart_orth,"Topo_Cart_orth");
97+
julia> write_paraview(Topo_Cart_orth,"Topo_Cart_orth");
9898
```
9999
![Topo_Europe_CartData_Proj](../assets/img/Topo_Europe_CartData_Proj.png)
100100
So this interpolates the topographic data from the `GeoData` to the orthogonal cartesian grid (which can be used with LaMEM, for example).
101101

102-
You can do similar projections with full 3D data sets or pointwise data.
102+
You can do similar projections with full 3D data sets or pointwise data.
103103

104104
#### 3. List of relevant functions
105105

0 commit comments

Comments
 (0)