Skip to content

Commit

Permalink
dev #4, update readme, corntibutions
Browse files Browse the repository at this point in the history
  • Loading branch information
demanast@triangle committed Oct 31, 2017
1 parent 38d1ceb commit f555cab
Show file tree
Hide file tree
Showing 3 changed files with 112 additions and 61 deletions.
117 changes: 68 additions & 49 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ coulomb2gmt -- pre-released v1.0-beta6.2

* Plot Fault geometry (Projection, Surface, Depth).

* Plot GPS displacement observed and modeled.
* Plot GPS displacements observed and modeled.

* Plot Fault and CMT databases and earhtquake distribution.

Expand All @@ -41,12 +41,12 @@ coulomb2gmt -- pre-released v1.0-beta6.2

## Requirements

* __GMT__: [The Generic Mappting Tools - GMT](http://gmt.soest.hawaii.edu/) version > 5.1.1 . Recommented installation from source code.
* for _Ubuntu/Debian_ if you use default package installation you have to install also `libgmt-dev` package
* __GMT__: [The Generic Mappting Tools - GMT](http://gmt.soest.hawaii.edu/) version > 5.1.1 . It is recommented to install it from source code.
* for _Ubuntu/Debian_: if you use default package installation you have to install also `libgmt-dev` package

* __Coulomb 3__: [Coulomb 3, developed by USGS](https://earthquake.usgs.gov/research/software/coulomb/)

* __python__: required for some calculations included in the main script.
* __python__: required for some math calculations included in the main script.

## Usage details
The main script is: `coulomb2gmt.sh`
Expand All @@ -57,7 +57,7 @@ run:
```
* `<inputfile>`: name of input file used from Coulomb. Extention `.inp` not needed. Path to the directory of input files configured at `default-param`.

* `<inputdata>`: Name of input files include results of coulmb calculations. Input data files are:
* `<inputdata>`: Code name of input files include results of coulmb calculations. Input data files are:

_Fault geometry files:_

Expand Down Expand Up @@ -101,7 +101,8 @@ line* :lon lat font\_size,font\_type,font\_color angle potision text
```
* `<inputdata>-gps.dist`: GPS displacements.


> All paths can be configured in the `deafault-param` file.
> Default the paths are where coulomb create by default each file.
### Default parameters

Expand All @@ -115,31 +116,29 @@ Many parameters configured at `default-param` file.

* `-r | --region`: set custom region parameters. _Structure_ `-r minlon maxlon minlat maxlat prjscale`

* `-t | --topography`: plot topography using dem file
* `-t | --topography`: plot topography using DEM file

* `-o | --output <filename>`: set custom name of output file. Default is `<inputadata>`.
* `-o | --output <filename>`: set custom name of output file. Default is `<inputdata>`.

* `-cmt | --moment_tensor <file>` : Plot Centroid Moment Tensors of earthquakes.
* `-cmt | --moment_tensor <file>` : Plot Centroid Moment Tensors list of earthquakes.

* `-ed | --eq_distribution <file>` : Plot earthquakes distribution. No classification.

* `-fl | --faults_db`: Plot custom fault database catalogue.

* `-mt | --map_title "map title"`: Custom map title.

* `-ct | --custom_text <path to file>` : Plot Custom text. Config custom text file.
* `-ct | --custom_text <path to file>` : Plot Custom text file.

* `-lg | --logo_gmt`: Plot GMT logo and time stamp.

* `-lc | --logo_custom`: Plot custom logo of your organization.

* `-h | --help`: Help menu
* `-lc | --logo_custom`: Plot custom logo (image) of your organization.

* `-v | --version`: Plot version

* `-d | --debug`:Enable Debug option
* `-h | --help`: Help menu.

* `-v | --version`: Plot version.

* `-d | --debug`: Enable Debug option.

### Plot fault parameters

Expand All @@ -150,6 +149,7 @@ Many parameters configured at `default-param` file.
* `-fdep`: Plot intersection of target depth with fault plane.

### Plot stress

* `-cstress`: Plot Coulomb Stress change.

* `-sstress`: Plot Shear Stress change.
Expand All @@ -166,8 +166,9 @@ Many parameters configured at `default-param` file.

>**Overlay Stress/strain on the top of DEM**
>
>* `-****+ot`: use `+ot` after the main argument to overlay the raster output on the top of DEM.
> configure transparency in `default-param` file. __Be careful__ transparency can printed only in JPEG, PNG and PDF outputs.
>`-****+ot`: use `+ot` after the main argument to overlay the raster output on the top of DEM.
> configure transparency in `default-param` file.
> __Be careful__ transparency can printed only in JPEG, PNG and PDF outputs.
### Plot gps velocities, observed and modeled

Expand All @@ -183,58 +184,59 @@ Many parameters configured at `default-param` file.

### Output formats

Default format is `*.ps` file. You can use the options bellow to convert to other format and adjust paper size to map size.

* `-outjpg` : Adjust and convert to JPEG.

* `-outpng` : Adjust and convert to PNG (transparent where nothing is plotted)
* `-outpng` : Adjust and convert to PNG (transparent where nothing is plotted).

* `-outeps` : Adjust and convert to EPS"
* `-outeps` : Adjust and convert to EPS.

* `-outpdf` : Adjust and convert to PDF
* `-outpdf` : Adjust and convert to PDF.

## `mvclsbfiles.sh` script
## Move and rename coulomb output files

An assistant script `mvclbfiles.sh` developed to move` and rename all output files in specific directories on coulomb home directory.
An assistant script `mvclbfiles.sh` developed to move and rename all output files in specific directories on coulomb home directory.

You must first set `CLB34_HOME` variable the path to coulomb home directory,
etc. `$ export CLB34_HOME=${HOME}/coulomb34`

__Usage__: `$ ./mvclsbfiles.sh <inputdata>`
`<inputdata>` is the code as me ntioned in the main script above.

__Files, Rename and move:__

* `coulomb_out.dat` -> `/gmt_files/<inputdata>-coulomb_out.dat`
`<inputdata>` is the code as mentioned in the main script above.

__Files, rename and move:__
```
1. `coulomb_out.dat` -> `/gmt_files/<inputdata>-coulomb_out.dat`
```
_Fault geometry files_
```
2. `gmt_fault_calc_dep.dat` -> `/gmt_files/<inputdata>-gmt_fault_calc_dep.dat`
* `gmt_fault_calc_dep.dat` -> `/gmt_files/<inputdata>-gmt_fault_calc_dep.dat`

* `gmt_fault_map_proj.dat` -> `/gmt_files/<inputdata>-gmt_fault_map_proj.dat`

* `gmt_fault_surface.dat` -> `/gmt_files/<inputdata>-gmt_fault_surface.dat`
3. `gmt_fault_map_proj.dat` -> `/gmt_files/<inputdata>-gmt_fault_map_proj.dat`
4. `gmt_fault_surface.dat` -> `/gmt_files/<inputdata>-gmt_fault_surface.dat`
```
_GPS displacements_

* `/output_files/GPS_output.csv` -> ` /gps_data/<inputdata>-gps.disp`

```
5. `/output_files/GPS_output.csv` -> ` /gps_data/<inputdata>-gps.disp`
```
_Stress change files_
```
6. `/output_files/Cross_section.dat` -> `/output_files/<inputdata>-Cross_section.dat`
* `/output_files/Cross_section.dat` -> `/output_files/<inputdata>-Cross_section.dat`

* `/output_files/dcff.cou` -> `/output_files/<inputdata>-dcff.cou`

* `/output_files/dcff_section.cou` -> `/output_files/<inputdata>-dcff_section.cou`
7. `/output_files/dcff.cou` -> `/output_files/<inputdata>-dcff.cou`
* `/output_files/dilatation_section.cou` -> `/output_files/<inputdata>-dilatation_section.cou`
8. `/output_files/dcff_section.cou` -> `/output_files/<inputdata>-dcff_section.cou`
* `/output_files/Focal_mech_stress_output.csv` -> `/output_files/<inputdata>-Focal_mech_stress_output.csv`
9. `/output_files/dilatation_section.cou` -> `/output_files/<inputdata>-dilatation_section.cou`
10. `/output_files/Focal_mech_stress_output.csv` -> `/output_files/<inputdata>-Focal_mech_stress_output.csv`
```
_Strain output files_

* `/output_files/Strain.cou` -> `/output_files/<inputdata>-Strain.cou`

```
11. `/output_files/Strain.cou` -> `/output_files/<inputdata>-Strain.cou`
```
## Contributing

1. Create an issue and describe your idea
Expand All @@ -249,18 +251,35 @@ _Strain output files_

### git structure

* __brunch__ master/develop: stucture of main branch
* __branch__ master/develop: stucture of main branch
* bash scripts
* coulomb2gmt.sh: main script
* mvclbfiles.sh: assistant script, move and rename files
* default-param: configure parameters
* functions: bash functions called from main script
* messages.sh: help function and ptint messages.
* gen_func.sh: general functions.
* clbplots.sh: functions for gmt plots
* checknum.sh: check number function.
* docs: MarkDown files for licence, contribution etc.
* docs: MarkDown templates for issues, pull requests, contributions etc.


* __brunch__ documents :
* __branch__ documents :
* tutorial: reference and user guide, tex files.
* examples: presentation of examples, tex/beamer files.

* __branch__ testcase: Include configured files for testing the script.

### Simple guidances for coding

* __general__
* Use 80 characters long line.
* Surround variables with `{}` and use `"${}"` in `if` case.
* Use comments in coding.
* __gmt functions__
* Use `-K` `-O` `-V${VRBLEVM}` at the end of each function.
* Create a function if a part of the script will be used more than two times.
* Add printed comments and debug messages in the code.

## ChangeLog

Expand Down
24 changes: 12 additions & 12 deletions coulomb2gmt.sh
Original file line number Diff line number Diff line change
Expand Up @@ -181,32 +181,32 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift
shift
else
echo "[ERROR] \"-r\": projscale must be a number and greater than 0."
echo "[ERROR] \"${3}\": projscale must be a number and greater than 0."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
else
echo "[ERROR] \"-r\": maxlat must be a number and greater than minlat."
echo "[ERROR] \"${3}\": maxlat must be a number and greater than minlat."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
else
echo "[ERROR] \"-r\": minlat must be a number."
echo "[ERROR] \"${3}\": minlat must be a number."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
else
echo "[ERROR] \"-r\": maxlon must be number and greater than minlon."
echo "[ERROR] \"${3}\": maxlon must be number and greater than minlon."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
else
echo "[ERROR] \"-r\": minlon must be number."
echo "[ERROR] \"${3}\": minlon must be number."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
else
echo "[ERROR] Not enough input arguments at \"-r\" option."
echo "[ERROR] Not enough input arguments at \"${3}\" option."
echo "[STATUS] Script Finished Unsuccesful! Exit Status 1"
exit 1
fi
Expand All @@ -217,7 +217,7 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift
;;
-o | --output)
DEBUG echo "[DEBUG:${LINENO}] -o: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] ${3}: next argument:" ${4}
if [ $# -gt 3 ] && [ ${4:0:1} != \- ]; then
OUTFILES=1
outfile=${4}.ps
Expand All @@ -240,7 +240,7 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift
;;
-cmt | --moment_tensor)
DEBUG echo "[DEBUG:${LINENO}] cmt: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] ${3}: next argument:" ${4}
if [ $# -ge 4 ] && [ ${4:0:1} != \- ]; then
CMT=1
inpcmt=${pth2eqdir}/${4}
Expand All @@ -258,7 +258,7 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift
;;
-mt| --map_title)
DEBUG echo "[DEBUG:${LINENO}] maptitle: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] ${3}: next argument:" ${4}
if [ $# -ge 4 ] && [ ${4:0:1} != \- ]; then
MTITLE=1
mtitle=${4}
Expand All @@ -271,7 +271,7 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift #shift for the argument -mt
;;
-ct | --custom_text)
DEBUG echo "[DEBUG:${LINENO}] ctext: next argument:" ${4}
DEBUG echo "[DEBUG:${LINENO}] ${3}: next argument:" ${4}
if [ $# -ge 4 ] && [ -f ${4} ]; then
CTEXT=1
pth2ctextfile=${4}
Expand All @@ -288,7 +288,7 @@ elif [ -f ${pth2inpdir}/${1}.inp ]; then
shift # shift for the arg -ctext
;;
-ed | --eq_distribution)
DEBUG echo "[DEBUG:${LINENO}] eqdist next argument: "${4}
DEBUG echo "[DEBUG:${LINENO}] ${3}: next argument: "${4}
if [ $# -ge 4 ] && [ ${4:0:1} != \- ]; then
EQDIST=1
pth2eqdistfile=${pth2eqdir}/${4}
Expand Down Expand Up @@ -942,7 +942,7 @@ fi


# //////////////////////////////////////////////////////////////////////////////
# PLOT gmt_fault_map_proj.dat
# PLOT gmt fault geometry

if [ "${FPROJ}" -eq 1 ]; then
echo "...plot fault projection..."
Expand Down
32 changes: 32 additions & 0 deletions docs/CONTRIBUTING.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,35 @@
5. Publish the branch (`git push origin my-new-idea`)
6. Create a new Pull Request
7. Profit! :white_check_mark:

### git structure

* __branch__ master/develop: stucture of main branch
* bash scripts
* coulomb2gmt.sh: main script
* mvclbfiles.sh: assistant script, move and rename files
* default-param: configure parameters
* functions: bash functions called from main script
* messages.sh: help function and ptint messages.
* gen_func.sh: general functions.
* clbplots.sh: functions for gmt plots
* checknum.sh: check number function.
* docs: MarkDown templates for issues, pull requests, contributions etc.


* __branch__ documents :
* tutorial: reference and user guide, tex files.
* examples: presentation of examples, tex/beamer files.

* __branch__ testcase: Include configured files for testing the script.

### Simple guidelines for coding

* __general__
* Use 80 characters long line.
* Surround variables with `{}` and use `"${}"` in `if` case.
* Use comments in coding.
* __gmt functions__
* Use `-K` `-O` `-V${VRBLEVM}` at the end of each function.
* Create a function if a part of the script will be used more than two times.
* Add printed comments and debug messages in the code.

0 comments on commit f555cab

Please sign in to comment.