The following help pages describe how to build a structural model with Gocad.

## Useful scripts¶

A collection of python scripts typically used to create the surfaces used in the CAD model is available here. They are documented (try -h option). The most important script are:

• createFaultFromCurve.py allows creating a ts surface from a fault trace. The fault trace is resampled, smoothed and extended using either a constant dip, a depth varying dip or an along-strike varying dip. This script has been used to generate all the faults of the Kaikoura model (Ulrich et al., 2019).
• createGOCADTSurf_NXNY.py, which allows creating a ts surface from a structured grid of points.
• createGOCADTSurf.py, which allows creating a ts surface from a partially structured grid of points. Contrary to createGOCADTSurf_NXNY.py, the number of nodes on a line (resp. on a column) should not constant. On the other hand, the lines (resp. the columns) of the point cloud should share constant ordinates (resp. abscissa). This script is used for creating the Sumatra fault of our Sumatra models (see Uphoff et al., 2017).
• convertTs2Stl.py, which allows converting the geometric model from Gocad into a stl file, inputted into the mesher (e.g. SimModeler).

## Processing high-resolution topographic data¶

High resolution topographic and bathymetric data are usually available. Generating geometric models including such large dataset can be challenging. In particular, intersecting such surfaces with other surfaces can be time-consuming and error-prone. Here we present various strategies and tools to overcome this challenge.

## Using Gdal¶

Gdal is a powerful library to process gridded data. It allows, for instance, to easily resample or crop a dataset, and to convert files in handy file formats. Here is a commented example of our use of gdal to create a ts surface from a high-resolution topography of Nepal (file data/merged_original.tif).

#resample data
gdalwarp -s_srs EPSG:4326 -r near -tr 0.0025 0.0025 data/merged_original.tif data/file250b.tif
#crop data
gdalwarp -te 83.7 26. 88.1 29.4 data/file250b.tif data/file250.tif
#change format
gdal_translate -of netCDF -co "FOMRAT=NC4" data/file250.tif data/file250.nc
#The specified hole allows to use algorithm described in 'remeshing the topography'
python createGOCADTSurfNXNY_netcdf.py data/file250.nc data/file250.stl --proj "+init=EPSG:32645" --hole 84.8 86.5 27.1 28.3


## Topographic data coarsening with SimModeler¶

To avoid dealing with too large files when building the CAD model, topography data can be coarsened where fine resolution is not necessary. For further details, see Remeshing the topography.

The same procedure can be also useful when the intersection between 2 surfaces fails in gocad. In fact, remeshing one of the surfaces can facilitate the intersection step in Gocad. In such a case, all surface already intersected with the surface that we want to remesh have to be exported to SimModeler. The mesh attributes “Use Discrete Geometry Mesh” and “No mesh” have to be assigned to these surfaces. This will ensure that the border nodes of the remesh surface keep unaffected by the remeshing.