Download Earthquake Catalogs from Global CMT website

In seismology, we always need to download and check the event information about the events. This python script can download the event catalog from the website to the local computer for the given range of time.

Running this program is very simple:
Screen Shot 2017-08-25 at 11.47.09 PM.png

The user just needs to input the time range for the earthquakes e.g., 2000/05-2009/08.

 

Requirements: Python 3

To download the program, please click here.

Plotting spiral pattern using MATLAB

MATLAB Codes:

 

clear; close all; clc

 t = linspace(0,10*pi,1000);

 x = t.*cos(t);

 y = t.*sin(t);

 z=linspace(0,2*pi,1000);

plot3(x,y,z,'LineWidth',8)

axis tight, grid on, view(35,30)

c = 1:numel(t);      

surface([x(:), x(:)], [y(:), y(:)], [z(:), z(:)], ...

    [c(:), c(:)], 'EdgeColor','flat', 'FaceColor','none','LineWidth',8);

colormap(jet(numel(t))) 

colorbar

saveas(gcf,'spiralPlot.png')

spiralPlot

Using Generic Mapping Tool (Basics)

Generic Mapping Tool (GMT) is an open-source collection of commands for processing and displaying 2D or 3D datasets. It also has features like rasterization, filtering and other image processing operations.

Here, we will see how can we use it to make high resolution publishable quality plots. It is very simple as it only involves few commands to get the control of the plot. In total, GMT only has about 80 commands so it is really simple to learn.

It can be downloaded from the GMT website 

#!/bin/bash
IN1=Photo1.tif
IN2=1995_2016_M_5_8.dat
cpl=GMT_globe.cpt
output=first_gmt_map.ps
echo "Output file is $output"
rm -f ${output}

# Define map characteristics
proj="-JM4.5i" # Mercator projection
minlon=119
maxlon=124
minlat=17
maxlat=26
bounds="-R$minlon/$maxlon/$minlat/$maxlat"
annot="-B1"

open="-K -V -P -Xc -Yc"
add="-O -K -V"
close="-O -V"

grdimage $IN1 $proj $annot $bounds -C$cpl $open > $output
psscale -D13/10/10/0.5v -C$cpl -B3000:"Altitude in meters":/:mts: $add >> $output

psmeca $IN2 $proj $bounds -Sa.7c/0/0 -G0 -C -N $close >> $output

gs $output #requires the pre-installed ghostview or ghostscipt

For running this script, simply save it in any file and make the file executable and run it.

Screen Shot 2016-11-11 at 1.54.34 PM.png

Screen Shot 2016-11-11 at 2.04.17 PM.png

Guessing a number (Fortran)

This program will randomly pick a value and the user is prompted to enter their guess. It will keep counting your number of attempts to reach the value stored by the system. The lower the number of guesses you have, the better guesser you are or your algorithm is better.

To run the program:

Screen Shot 2016-10-27 at 4.54.33 PM.png

You can play with the program and try to modify it to learn more. Let’s see how many attempts you need!

Program: guess.f (by Cedric Legendre IES, Academia Sinica)