Simple time-series with thresholds

A simple time-series of El Niño 3.4 index

code excerpt :

ENSO

gmt psxy -R$day1/$day2/-3/3 -JX16ct/9c enso_pos.txt -Sb1u+B$ensothd1p -Wfaint,$myred -P $open > $psENSO
gmt psxy -R -J enso_neg.txt -Sb1u+B$ensothd1m -Wfaint,$myblue $add >> $psENSO
gmt psxy -R -J $TSenso -W1.25,black $add >> $psENSO

gmt psxy -R -J -W1.25p,black $add <<EOF>> $psENSO
0 0
15000 0
EOF
gmt psxy -R -J -W1p,$myred,- $add <<EOF>> $psENSO
0 $ensothd1p
15000 $ensothd1p
EOF
gmt psxy -R -J -W1p,$myblue,- $add <<EOF>> $psENSO
0 $ensothd1m
15000 $ensothd1m
EOF
gmt psxy -R -J -W1p,$myred,. $add <<EOF>> $psENSO
0 $ensothd2p
15000 $ensothd2p
EOF
gmt psxy -R -J -W1p,$myblue,. $add <<EOF>> $psENSO
0 $ensothd2m
15000 $ensothd2m
EOF

gmt set FONT_ANNOT_PRIMARY 8p
gmt pslegend -R -J -DjBR -F $add <<EOF>> $psENSO
S 6p - 16p - 1.25p,black 24p SST anomaly
S 6p - 16p - 1p,$myred,- 24p +1 STD
S 6p - 16p - 1p,$myblue,. 24p -2 STD
G 3p
S 6p - 16p - 8p,$myred 24p El Niño
G 3p
S 6p - 16p - 8p,$myblue 24p La Niña
EOF
gmt set FONT_ANNOT_PRIMARY 12p

gmt psbasemap -R -J -Bya0.5f0.1+l"Temperature anomaly" -Bxa5Yf1Y+a45 -BWSen+t"ENSO (niño3.4) index" $close >> $psENSO

gmt psconvert -Tg -A $psENSO

Thanks for these examples, but could you please update the entire script that generate them? The idea here is not to show only the result but to allow also that others can reuse/modify the examples.

Hi,
If you’re asking on how to generate the points themselves, I didn’t do it with GMT. Most of the time I use MATLAB and export to netcdf or txt …

Then, a perfect target for a gmtmex script :wink:

I actually tried 2 years ago… and failed.
I could call “gmt” , but couldn’t plot anything. I haven’t tried again since.

You can try again. Post the difficulties in Q&A

Probably after osX next release, I need to do a cleansing of the system, especially the libraries (shared, brew, perso …)