Data structures

The main data structure used in GeophysicalModelGenerator.jl is GeoData, which contains info about the latitude, longitude and depth of a data set, as well as several data sets itself.

GeophysicalModelGenerator.GeoDataType
GeoData(lon::Any, lat:Any, depth::GeoUnit, fields::NamedTuple)

Data structure that holds one or several fields with longitude, latitude and depth information.

  • depth can have units of meter, kilometer or be unitless; it will be converted to km.
  • fields should ideally be a NamedTuple which allows you to specify the names of each of the fields.
  • In case you only pass one array we will convert it to a NamedTuple with default name.
  • A single field should be added as (DataFieldName=Data,) (don't forget the comma at the end).
  • Multiple fields can be added as well. lon,lat,depth should all have the same size as each of the fields.
  • In case you want to display a vector field in paraview, add it as a tuple: (Velocity=(Veast,Vnorth,Vup), Veast=Veast, Vnorth=Vnorth, Vup=Vup); we automatically apply a vector transformation when transforming this to a CartData structure from which we generate Paraview output. As this changes the magnitude of the arrows, you will no longer see the [Veast,Vnorth,Vup] components in Paraview which is why it is a good ideas to store them as separate Fields.
  • Yet, there is one exception: if the name of the 3-component field is colors, we do not apply this vector transformation as this field is regarded to contain RGB colors.

Example

julia> Lat         =   1.0:10.0;
julia> Lon         =   11.0:20.0;
julia> Depth       =   (-20:-11)*km;
julia> Data        =   zeros(size(Lon));
julia> Data_set    =   GeophysicalModelGenerator.GeoData(Lon,Lat,Depth,(DataFieldName=Data,))   
GeoData 
  size  : (10,)
  lon   ϵ [ 1.0 : 10.0]
  lat   ϵ [ 11.0 : 20.0]
  depth ϵ [ -20 km : -11 km]
  fields: (:DataFieldName,)
source
GeophysicalModelGenerator.CartDataType
CartData(x::GeoUnit, y::GeoUnit, z::GeoUnit, values::NamedTuple)

Cartesian data in x/y/z coordinates to be used with Paraview This is usually generated automatically from the GeoData structure, but you can also invoke do this manually:

julia> Data_set    =   GeophysicalModelGenerator.GeoData(1.0:10.0,11.0:20.0,(-20:-11)*km,(DataFieldName=(-20:-11),))   
julia> Data_cart = convert(CartData, Data_set)
source
GeophysicalModelGenerator.LonLatDepthGridFunction
Lon, Lat, Depth = LonLatDepthGrid(Lon::Any, Lat::Any, Depth:Any)

Creates 3D arrays of Lon, Lat, Depth from 1D vectors or numbers

Example 1: Create 3D grid

julia> Lon,Lat,Depth =  LonLatDepthGrid(10:20,30:40,(-10:-1)km);
julia> size(Lon)
(11, 11, 10)

Example 2: Create 2D lon/lat grid @ a given depth

julia> Lon,Lat,Depth =  LonLatDepthGrid(10:20,30:40,-50km);
julia> size(Lon)
(11, 11)

Example 3: Create 2D lon/depth grid @ a given lat

julia> Lon,Lat,Depth =  LonLatDepthGrid(10:20,30,(-10:-1)km);
julia> size(Lon)
(11, 11)

Example 4: Create 1D vertical line @ a given lon/lat point

julia> Lon,Lat,Depth =  LonLatDepthGrid(10,30,(-10:-1)km);
julia> size(Lon)
(10, )
source
GeophysicalModelGenerator.XYZGridFunction
X,Y,Z = XYZGrid(X_vec::Any, Y_vec::Any, Z_vec::Any)

Creates a X,Y,Z grid. It works just as LonLatDepthGrid apart from the better suited name.

Example 1: Create 3D grid

julia> X,Y,Z =  XYZGrid(10:20,30:40,(-10:-1)km);
julia> size(X)
(11, 11, 10)

See LonLatDepthGrid for more examples.

source