epoch1 = gmtread("/home/rob/Documents/julia/Vgrdimg/51915_Vgrdimg.txt");
This is good to know! Thank you.
I did mess with various increments, but none of them actually made a, as far as I could tell, a difference in visualization. I tried 0.01, 0.1, 0.2, 0.5, 1.0, and 2.0
for the inc =
option, and ultimately just left it out since it wasn’t making a difference.
Yeah, I didn’t think it would work, but I wanted to try something out at least. the GMT.jl documentations provides substantial detail for the input arguments, but, in the way of follow-able examples, it is certainly lacking.
I tried to understand and follow the example here because I think it’s a fairly close to what I’m trying to achieve.
When I run:
function main_sc()
for (i,file) in enumerate(glob("*.txt", file))
file_hold = readdlm(file)
G = gridit(file_hold[:, [1, 2, 3]],
mask = 0.3, V = :q);
fig = grdimage(G, shade = true, coast = (ocean = :gray, shore = 0.5), fmt= :png);
#movie(main_sc, name=:count, frames = 100, format = :mp3, frame_rate = 16, clean = true );
end
end
movie(main_sc, name=:count, frames = 100, format = :mp4, frame_rate = 16, clean = true );
I get the following error message and stack trace:
ERROR: type String has no field data
Use `codeunits(str)` instead.
Stacktrace:
[1] getproperty(x::String, f::Symbol)
@ Base ./Base.jl:37
[2] snif_GI_set_CTRLlimits(G_I::String)
@ GMT ~/.julia/packages/GMT/PVGhC/src/imshow.jl:241
[3] common_insert_R!(d::Dict{Symbol, Any}, O::Bool, cmd0::String, I_G::Nothing)
@ GMT ~/.julia/packages/GMT/PVGhC/src/grdimage.jl:137
[4] grdimage(cmd0::String, arg1::Nothing, arg2::Nothing, arg3::Nothing; first::Bool, kwargs::@Kwargs{…})
@ GMT ~/.julia/packages/GMT/PVGhC/src/grdimage.jl:55
[5] grdimage (repeats 2 times)
@ ~/.julia/packages/GMT/PVGhC/src/grdimage.jl:51 [inlined]
[6] main_sc()
@ Main ~/Documents/julia/gridimage.jl:15
[7] jl_sc_2_shell_sc(name::typeof(main_sc), name2::String)
@ GMT ~/.julia/packages/GMT/PVGhC/src/movie.jl:164
[8] movie(main::Function; pre::Nothing, post::Nothing, kwargs::@Kwargs{…})
@ GMT ~/.julia/packages/GMT/PVGhC/src/movie.jl:110
[9] top-level scope
@ ~/Documents/julia/gridimage.jl:20
I also tried to see if I could decipher, modify, and translate this bash script to Julia syntax, but that is proving to be a job itself. lol
#!/bin/env -S bash -e
DIR0= $HOME/Documents/julia/Vgrdimg/
region=-R-130/-50/24.5/52
movie_files=movie_files
####### function to get the vaues of sigma max and min number of triangles from movie frame index
dir_names=($DIR0/*)
##~ get the name of the epoch from mnth_names that corresponds to the frame number
get_values() {
local index=$1
echo "${mnth_names[index]}"
}
out=strain_map_year ##not sure this is even needed
gmt begin "$out"
###########################~ plot coastlines, strain grid ######################
gmt coast $region -B --FORMAT_GEO_MAP=dddF -JM15c -EUS.CA,US.OR+p0.5p,#6e04c4 -W0.1p,#b4b5cc -G#ddded9 -S#b4b5cc -Df
gmt grdimage "$movie_files"/ave_strain_${MOVIE_FRAME}.grd -Cdil_strain.cpt
###########################~ plot principal strains #############################
pstr_ampl=0.08
##############& e1 is compressional
awk -v f="$pstr_ampl" '{if($3<0) print $1, $2, $5, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+ea+je+n1/0.2 -W3p,black -Gblack #-SVh0.04c/0.085c/0.075c -W0.1,black -Gblack
awk -v f="$pstr_ampl" '{if($3<0) print $1, $2, $5-180, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+ea+je+n1/0.2 -W3p,black -Gblack
###############& e2 is compressional
awk -v f="$pstr_ampl" '{if($4<0) print $1, $2, $5+90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+ea50+je+n1/0.2 -W3p,black -Gblack
awk -v f="$pstr_ampl" '{if($4<0) print $1, $2, $5-90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+ea+je+n1/0.2 -W3p,black -Gblack
################& e1 is dilatational
######* the first 2 lines are there to have a black outline:
awk -v f="$pstr_ampl" '{if($3>0) print $1, $2, $5, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+n1/0.2 -W2p,black -Gblack
awk -v f="$pstr_ampl" '{if($3>0) print $1, $2, $5-180, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+n1/0.2 -W2p,black -Gblack
###### *the second 2 lines actually show the sizes of the strain axes in white
awk -v f="$pstr_ampl" '{if($3>0) print $1, $2, $5, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.7c+ea+jb+n1/0.2+p0.4p -W0.5p,white -Gwhite
awk -v f="$pstr_ampl" '{if($3>0) print $1, $2, $5-180, $3*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.7c+ea+jb+n1/0.2+p0.4p -W0.5p,white -Gwhite
###################& e2 is dilatational
######* the first 2 lines are there to have a black outline:
awk -v f="$pstr_ampl" '{if($4>0) print $1, $2, $5+90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+n1/0.2 -W2p,black -Gblack
awk -v f="$pstr_ampl" '{if($4>0) print $1, $2, $5-90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.75c+n1/0.2 -W2p,black -Gblack
###### *the second 2 lines actually show the sizes of the strain axes in white
awk -v f="$pstr_ampl" '{if($4>0) print $1, $2, $5+90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.7c+ea+jb+n1/0.2+p0.4p -W0.5p,white -Gwhite
awk -v f="$pstr_ampl" '{if($4>0) print $1, $2, $5-90, $4*f}' $DIR0/MELD/seaspred/"$movie_files"/principal_strains${MOVIE_FRAME}.gmt | gmt plot -SV0.7c+ea+jb+n1/0.2+p0.4p -W0.5p,white -Gwhite #-SVt0.04c/0.085c/0.075c -W0.1,black -Gwhite
########################~ plot the name of epoch, sigma_max, and Nmin ##############
month_vals=$(get_values ${MOVIE_FRAME})
gmt text -F+f17p,Helvetica-Bold+jCB << EOF
-119 45.8 sigma: 25, Nmin: 40
-122 45.8 $month_vals
EOF
########################~ add stateline, lake outlines on top of frid ##############
gmt coast -W1 -Df -Na -Lf-130.8/46/10/200+lkm -EUS.CA+p0.5p
###########################~ plot mountain(s) ###################################
gmt plot mthood.lonlat -St0.5c -Wyellow -Gblack
###########################~ plot med locs of seism ##########################
gmt plot extra_locations.txt -Sc0.5c -Wblack -G#e00757
###########################~ plot seismic swarms ##################################
# sed 's/,/\t/g' maupin_swarm.csv | awk '{print $1, $2, $3, $4}' > maupin_swarm_scol.txt #date, lat, lon, depth, mag
## by depth
# awk '{print $3, $2, $4, $5}' $DIR0/seismo_data/maupin_swarm_scol.txt | gmt plot -Cseismo_depth.cpt -Sci -i0,1,2,3+s0.06 -Wfaint -hi1
# gmt psscale -Cseismo_depth.cpt -DjBR+o-1.5c/-1.2c+w6c/0.25c+h+o0c/0c -Baf+l"Seismic depth (km)" -I --FONT_LABEL=14p
## by date
###& Maupin swarm
awk '{print $5, $4}' $DIR0/seismo_data/maupin_swarm_locations_decyr_IEB.txt | gmt plot -Sc0.25c -hi1 -G#f7bc0a -Wblack
###& NLT swarm
awk '{print $3, $2, $1}' $DIR0/seismo_data/north_lake_tahoe_2003_swarm_decyr.txt | gmt plot -Sc0.25c -hi1 -G#f7bc0a -Wblack
###& Sierra Valley swarm
awk '{print $5, $4}' $DIR0/seismo_data/sierra_valley_locations_decyr_trugman.txt | gmt plot -Sc0.25c -hi1 -G#f7bc0a -Wblack
# gmt psscale -DjBR+o-1.5c/-1.2c+w6c/0.25c+h+o0c/0c -Baf+l"EQ year" -I --FONT_LABEL=14p -Cseismo_date.cpt
###& focal mech(s)
gmt psmeca $DIR0/seismo_data/single_maupin_moment_tensor.gmt -Sa1c -A
###########################~ add scale for strain ###################################
gmt psscale -Cdil_strain.cpt -DjBL+o4c/-1.2c+w6c/0.25c+h+o0c/0c -Baf+l"Dilatational Strain (10^-9)" -I --FONT_LABEL=14p
gmt end show
#### use these the make movie from command line:
####! use these the make movie from command line:
##& make a single frame to look at (here i have 24 frames, so -T24; -M is the master frame to view to make sure it looks right (as a png), so -M6 makes the 6th frame; -Fnone tells it we're not making a full movie yet); -Z deletes the intermediate directory with the files needed to make the movie; -N is the name of the output frame or output movie; -C sets the dimensions of the canvas; -D is how long you want each frame to display (frame rate))
##~ make 6th frame
# gmt movie make_strain_movie_fullyear.sh -C20x25x200 -T24 -M6,png -Fnone -Nseason_strain -Z
##~ make actual movie:
##&-P sets the options for a progress indicator (I have a bar on top right with a red triangle that shows where in the movie you are)
# gmt movie make_strain_movie_fullyear.sh -C20x25x200 -T24 -Fmp4 -Nseason_strain -Z -D0.5 -Pf+jTR+o0.5