-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathhistogram_of_event.py
More file actions
40 lines (37 loc) · 1.1 KB
/
histogram_of_event.py
File metadata and controls
40 lines (37 loc) · 1.1 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
# -*- coding: utf-8 -*-
"""
Created on Mon Jun 6 15:48:46 2022
@author: grace
"""
import numpy as np
import pandas as pd
from pandas.core.frame import DataFrame
dir = 'D:/GMT/GMT/seismicity/'
file = 'catalogo_3_9.csv'
df = pd.read_csv(dir+file)
# mask1 = (df.Longitud>-101)
# mask2 = (df.Longitud<-97)
# mask3 = (df.Latitud<19.5)
# mask4 = (df.Latitud>18.5)
mask1 = (df.Longitud>-103)
mask2 = (df.Longitud<-95)
mask3 = (df.Latitud>19.5)
mask4 = (df.Latitud<25.5)
df = df[(mask1)&(mask2)&(mask3)&(mask4)]
import matplotlib.pyplot as plt
mm = np.array(df.Profundidad)[np.array(df.Profundidad)!='menos de 1']
kk = np.ones(len(mm))
for rr,item in enumerate(mm):
kk[rr] = float(item)
kk[rr] = int(kk[rr])
fig, (ax) = plt.subplots(1,1,figsize=(10,6))
bins = np.linspace(0,100,21)
n, bins, patches=ax.hist(kk, rwidth=0.85, color= '#708090',bins=bins)
ax.grid()
ax.set_xlabel("Depth (km)",fontsize = 20)
ax.set_ylabel("Number of event",fontsize = 20)
# ax.set_title("Histogram")
ax.tick_params(axis='x', labelsize=16)
ax.tick_params(axis='y', labelsize=16)
ax.set_xlim(0,100)
# plt.show()