Skip to content

Commit 4573860

Browse files
committed
updating plots, readme, and fixing typos in example script
Fixing plots of I2 to be in a log scale in several places. Bumping version to 1.1.1
1 parent 18d8a85 commit 4573860

File tree

6 files changed

+22
-14
lines changed

6 files changed

+22
-14
lines changed

Strain_Tools/strain/models/strain_visr.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -211,5 +211,7 @@ def check_fortran_executable(path_to_executable):
211211
if os.path.isfile(path_to_executable):
212212
print("VISR executable found at %s " % path_to_executable);
213213
else:
214-
raise FileNotFoundError("VISR executable not found on your system. Check config file for path.");
214+
raise FileNotFoundError("\n ERROR! VISR executable not found on your system. Check config file for path. "
215+
"\n If you don't have it on your local system, the source can be downloaded from: "
216+
"\n http://scec.ess.ucla.edu/~zshen/visr/visr.html");
215217
return;

Strain_Tools/strain/output_manager.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -86,6 +86,7 @@ def outputs_1d(xcentroid, ycentroid, polygon_vertices, rot, exx, exy, eyy, range
8686
[I2nd, max_shear, dilatation, azimuth] = strain_tensor_toolbox.compute_derived_quantities(exx, exy, eyy);
8787
[e1, e2, v00, v01, v10, v11] = strain_tensor_toolbox.compute_eigenvectors(exx, exy, eyy);
8888
[positive_eigs, negative_eigs] = get_list_eigenvectors(xcentroid, ycentroid, e1, e2, v00, v01, v10, v11);
89+
I2nd = np.log10(np.abs(I2nd)); # for convenient plotting
8990

9091
dilatation_polygon_outfile = outdir + "Dilatation_polygons.txt"
9192
second_inv_polygon_outfile = outdir + "I2nd_polygons.txt"

code.json

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
"name": "Strain_2D",
44
"organization": "U.S. Geological Survey",
55
"description": "Strain rate modeling from GNSS velocity fields using multiple published strain rate techniques.",
6-
"version": "1.1.0",
6+
"version": "1.1.1",
77
"status": "RELEASE_STATUS",
88

99
"permissions": {
@@ -16,10 +16,10 @@
1616
]
1717
},
1818

19-
"homepageURL": "https://usgs.github.io/Strain_2D/",
20-
"downloadURL": "https://github.com/usgs/Strain_2D/archive/master.zip",
21-
"disclaimerURL": "https://github.com/usgs/Strain_2D/blob/master/LICENSE.md",
22-
"repositoryURL": "https://github.com/usgs/Strain_2D.git",
19+
"homepageURL": "https://code.usgs.gov/kmaterna/Strain_2D",
20+
"downloadURL": "https://code.usgs.gov/kmaterna/Strain_2Darchive/master.zip",
21+
"disclaimerURL": "https://code.usgs.gov/kmaterna/Strain_2D/blob/master/LICENSE.md",
22+
"repositoryURL": "https://code.usgs.gov/kmaterna/Strain_2D.git",
2323
"vcs": "git",
2424

2525
"laborHours": 0,

example/Display_output/comparison_rows_example.sh

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33

44
range=$1
55
projection="M2.0i"
6-
out_strain="output_rows.ps"
6+
out_strain="output_rows_plots.ps"
77
gmt set MAP_FRAME_TYPE plain
88
gmt set FORMAT_GEO_MAP D
99

@@ -14,9 +14,10 @@ infile3=$output_dir"visr/visr_strain.nc"
1414
infile4=$output_dir"loc_avg_grad/loc_avg_grad_strain.nc"
1515

1616
# Delaunay Strain
17-
gmt makecpt -T-1/5/0.5 -Cbatlow.cpt > mycpt.cpt
17+
gmt makecpt -T-1/5/0.5 -Cbatlow > mycpt.cpt
1818
gmt grdedit $infile1=gd?HDF5:"$infile1"://I2 -R$range -T -G$"I2_delaunay.nc"
1919
gmt grdedit I2_delaunay.nc -Ev
20+
gmt grdmath I2_delaunay.nc ABS LOG10 = I2_delaunay.nc
2021
gmt grdimage I2_delaunay.nc -R$range -J$projection -BWeSn -Bp1.0 -Cmycpt.cpt -X2 -Y10 -K > $out_strain
2122
gmt pscoast -R -J -Wthick,black -Df -Sgray -K -O >> $out_strain
2223
echo "-122.8 42.3 Delaunay" | gmt pstext -R -J -F+f18p,Helvetica-Bold -N -K -O >> $out_strain
@@ -26,6 +27,7 @@ gmt psvelo $output_dir"delaunay/negative_eigs.txt" -Se0.003/0.68/0 -A+b+n10+pthi
2627
# Loc_Avg_Grad Strain
2728
gmt grdedit $infile4=gd?HDF5:"$infile4"://I2 -R$range -T -G$"I2_loc_avg_grad.nc"
2829
gmt grdedit I2_loc_avg_grad.nc -Ev
30+
gmt grdmath I2_loc_avg_grad.nc ABS LOG10 = I2_loc_avg_grad.nc
2931
gmt grdimage I2_loc_avg_grad.nc -R$range -J$projection -BweSn -Bp1.0 -Cmycpt.cpt -X6 -Y0 -K -O >> $out_strain
3032
gmt pscoast -R -J -Wthick,black -Df -Sgray -K -O >> $out_strain
3133
echo "-122.8 42.3 Loc avg grad" | gmt pstext -R -J -F+f18p,Helvetica-Bold -N -K -O >> $out_strain
@@ -35,6 +37,7 @@ gmt psvelo $output_dir"loc_avg_grad/negative_eigs.txt" -Se0.003/0.68/0 -A+b+n10+
3537
# Visr Strain
3638
gmt grdedit $infile3=gd?HDF5:"$infile3"://I2 -R$range -T -G$"I2_visr.nc"
3739
gmt grdedit I2_visr.nc -Ev
40+
gmt grdmath I2_visr.nc ABS LOG10 = I2_visr.nc
3841
gmt grdimage I2_visr.nc -R -J -BweSn -Bp1.0 -Cmycpt.cpt -X6 -Y0 -K -O >> $out_strain
3942
gmt pscoast -R -J -Wthick,black -Df -Sgray -K -O >> $out_strain
4043
echo "-122.8 42.3 VISR" | gmt pstext -R -J -F+f18p,Helvetica-Bold -N -K -O >> $out_strain
@@ -44,6 +47,7 @@ gmt psvelo $output_dir"visr/negative_eigs.txt" -Se0.003/0.68/0 -A+b+n10+pthick,b
4447
# GPSgridder Strain
4548
gmt grdedit $infile2=gd?HDF5:"$infile2"://I2 -R$range -T -G$"I2_gpsgridder.nc"
4649
gmt grdedit I2_gpsgridder.nc -Ev
50+
gmt grdmath I2_gpsgridder.nc ABS LOG10 = I2_gpsgridder.nc
4751
gmt grdimage I2_gpsgridder.nc -R -J -BweSn -Bp1.0 -Cmycpt.cpt -X6 -Y0 -K -O >> $out_strain
4852
gmt pscoast -R -J -Wthick,black -Df -Sgray -K -O >> $out_strain
4953
echo "-122.8 42.3 gpsgridder" | gmt pstext -R -J -F+f18p,Helvetica-Bold -N -K -O >> $out_strain
@@ -53,7 +57,7 @@ gmt psvelo $output_dir"gpsgridder/negative_eigs.txt" -Se0.003/0.68/0 -A+b+n10+pt
5357

5458

5559
# Rotation
56-
gmt makecpt -T0/300/10 -Cmagma.cpt -Do -G0.30/1.0 > mycpt.cpt
60+
gmt makecpt -T0/300/10 -Cmagma -Do -G0.30/1.0 > mycpt.cpt
5761
gmt grdedit $infile1=gd?HDF5:"$infile1"://rotation -R$range -T -G$"rot_delaunay.nc"
5862
gmt grdedit rot_delaunay.nc -Ev
5963
gmt grdimage rot_delaunay.nc -R -J -BWeSn -Bp1.0 -Cmycpt.cpt -X-18 -Y-8 -K -O >> $out_strain

readme.md

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -114,8 +114,8 @@ class your_strain_method(strain_2d.Strain_2d):
114114
return
115115
116116
def compute(self, myVelfield):
117-
[Ve, Vn, rot_grd, exx_grd, exy_grd, eyy_grd] = your_strain_method_compute(myVelfield... etc);
118-
return [Ve, Vn, rot_grd, exx_grd, exy_grd, eyy_grd];
117+
[Ve, Vn, rot_grd, exx_grd, exy_grd, eyy_grd, velfield, residual_velfield] = your_strain_method_compute(myVelfield... etc);
118+
return [Ve, Vn, rot_grd, exx_grd, exy_grd, eyy_grd, velfield, residual_velfield];
119119
```
120120

121121
where:
@@ -131,9 +131,10 @@ where:
131131
To reproduce the figure in the README:
132132
1. In the example/ directory, run: ```strain_rate_compute.py --print_config``` to print an example config file (similar to the one provided here in the repo).
133133
2. Run: ```strain_rate_compute.py example_strain_config.txt``` to compute delaunay strain rate using the parameters in the newly-created config file.
134-
3. Change the method in the config file to try other methods, and re-run each time for different strain calculations with different parameters.
134+
3. Change the method in the config file to try other methods, and re-run each time for different strain calculations with different parameters. Try with ```gpsgridder```, ```delaunay```, and ```loc_avg_grad```. If you have the visr executable on your system, try with ```visr``` as well.
135135
4. Run: ```strain_rate_comparison.py example_strain_config.txt ``` to compute average strain rate maps from several results.
136-
5. Run: ```Display_output/comparison_rows_example.sh -125/-121/38/42``` to view a GMT plot with several strain rate calculations in Northern California together.
136+
5. Navigate into ```Display_output/```
137+
6. Run: ```./comparison_rows_example.sh -125/-121/38/42``` to view a GMT plot with several strain rate calculations in Northern California together.
137138

138139
![strain](https://github.com/kmaterna/2D_Strain/blob/master/example/Display_output/output_rows.png)
139140

version.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
version="1.1.0"
1+
version="1.1.1"

0 commit comments

Comments
 (0)