Skip to content
GitLab
Menu
Projects
Groups
Snippets
Help
Help
Support
Community forum
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in
Toggle navigation
Menu
Open sidebar
Franco Mele
decluster
Commits
ab51e8a8
Commit
ab51e8a8
authored
May 08, 2021
by
Franco Mele
Browse files
Merge branch 'pippo' into 'master'
Pippo See merge request
!1
parents
be964098
8173ef4d
Changes
2
Expand all
Hide whitespace changes
Inline
Side-by-side
dati_test.txt
0 → 100644
View file @
ab51e8a8
This diff is collapsed.
Click to expand it.
ingv_e
vent
s.py
→
ingv_e
arthquake
s.py
View file @
ab51e8a8
# ingv_earthquakes.py
#
# programmed on May 7th 2021 by F. Mele.
# Estraggo tramite webservice dell'INGV il catalogo dei terremoti
# nel formato FREE FORMAT (opzione 5) utile come input del programma cluster2000x di Reasenberg,
# da me modificato nella versione "main_program.f90".
# Il programma di Reasenberg calcola la magnitudo equivalente di ogni cluster
# sommando i momenti sismici dei terremoti del cluster. Essi sono calcolati con una formula
# di Kanamori che lega magnitudo a momento sismico. Una volta calcolato il momento sismico
# totale del cluster, la magnitudo equivalente è calcolata con la formula inversa della precedente.
#
# Il formato FREE è costituito da 5 interi e 4 reali separati da blank:
# yyyy mm dd HH MM lat lon depth mag
#
# Gli altri campi estratti da questa procedura sono ignorati dai programmi cluster2000x.f e main_program.f90
import
pandas
as
pd
# http://webservices.ingv.it/fdsnws/event/1/query?starttime=2012-05-29T00:00:00&endtime=2012-05-29T23:59:59
# http://webservices.ingv.it/fdsnws/event/1/query?starttime=2010-05-29T00:00:00&endtime=2012-05-29T23:59:58&limit=10&offset=2
# http://webservices.ingv.it/fdsnws/event/1/query?starttime=2012-05-29T00:00:00&endtime=2012-05-29T23:59:59&format=text (text format)
# http://webservices.ingv.it/fdsnws/event/1/query?eventId=1895389&includeallmagnitudes=true&includeallorigins=true&includearrivals=true&includeallstationsmagnitudes=true
def
main
():
minlat
=
input
(
" latitudine minima (ES: 35.5) "
)
...
...
@@ -16,14 +26,25 @@ def main():
maxmag
=
input
(
" magnitudo massima (ES: 10.0) "
)
startt
=
input
(
" data di inizio nella forma yyyy-mm-dd "
)
endt
=
input
(
" data di fine nella forma yyyy-mm-dd "
)
mlyn
=
input
(
" trasformo tutte le magnitudo in ML ? (1=sì, 2=no) "
)
mltrue
=
False
# se mltrue=True, trasformo le tutte le magnitudo in ML
mldb
=
True
# se mltrue=True e mldb=True, uso per la trasformazione
# la relazione Di Bona, altrimenti uso la Scongn.Tin.Mich.
if
(
mlyn
==
1
):
mltrue
=
True
print
(
" "
)
print
(
" per la trasformazione uso la relazione"
)
stmyn
=
input
(
" Scognamiglio Tinti Michelini (2009) ? (1=sì, 2=no) "
)
if
(
stm
==
1
):
mldb
=
False
print
(
startt
,
" "
,
endt
)
# imporre limiti spaziali ? 35.5-48 5-20 ?
# url = "http://webservices.ingv.it/fdsnws/event/1/query?starttime=2012-05-29T00:00:00&endtime=2012-05-29T23:59:59&format=text"
url
=
"http://webservices.ingv.it/fdsnws/event/1/query?minlat="
+
minlat
+
"&maxlat="
+
maxlat
+
"&minlon="
+
minlon
+
"&maxlon="
+
maxlon
+
\
print
(
" estraggo i dati del periodo "
,
startt
,
" "
,
endt
)
url
=
"http://webservices.ingv.it/fdsnws/event/1/query?minlat="
+
minlat
+
"&maxlat="
+
maxlat
+
\
"&minlon="
+
minlon
+
"&maxlon="
+
maxlon
+
\
"&mindepth="
+
mindepth
+
"&maxdepth="
+
maxdepth
+
\
"&starttime="
+
startt
+
"T00:00:00&endtime="
+
endt
+
"T23:59:59"
+
\
"&minmag="
+
minmag
+
"&maxmag="
+
maxmag
+
"&format=text"
print
(
url
)
# data = pd.read_csv(url,sep='|',header=0,names=['evid','ot','lat','lon','dep','author','catalog','contrib','mtype','mag','magauthor','eventlocname'])
...
...
@@ -40,6 +61,8 @@ def main():
ii
=
0
for
ind
in
df
.
index
[::
-
1
]:
ii
=
ii
+
1
mymag
=
df
[
'Magnitude'
][
ind
]
print
(
df
[
'Time'
][
ind
][
0
:
4
],
" "
,
\
df
[
'Time'
][
ind
][
5
:
7
],
" "
,
\
df
[
'Time'
][
ind
][
8
:
10
],
" "
,
\
...
...
@@ -48,7 +71,14 @@ def main():
"%.5f"
%
round
(
df
[
'Latitude'
][
ind
],
5
),
" "
,
\
"%.5f"
%
round
(
df
[
'Longitude'
][
ind
],
5
),
" "
,
\
"%.1f"
%
round
(
df
[
'Depth/Km'
][
ind
],
1
),
" "
,
\
df
[
'Magnitude'
][
ind
]
,
" "
,
df
[
'EventLocationName'
][
ind
])
mymag
,
" "
,
df
[
'EventLocationName'
][
ind
])
ML
Md
Mw
Mwp
mb
print
(
df
[
'Time'
][
ind
][
0
:
4
],
" "
,
\
df
[
'Time'
][
ind
][
5
:
7
],
" "
,
\
df
[
'Time'
][
ind
][
8
:
10
],
" "
,
\
...
...
@@ -57,7 +87,9 @@ def main():
"%.5f"
%
round
(
df
[
'Latitude'
][
ind
],
5
),
" "
,
\
"%.5f"
%
round
(
df
[
'Longitude'
][
ind
],
5
),
" "
,
\
"%.1f"
%
round
(
df
[
'Depth/Km'
][
ind
],
5
),
" "
,
\
df
[
'Magnitude'
][
ind
],
" "
,
df
[
'EventLocationName'
][
ind
],
file
=
f
)
df
[
'Magnitude'
][
ind
],
" "
,
\
df
[
'MagType'
][
ind
],
" "
,
\
df
[
'EventLocationName'
][
ind
],
file
=
f
)
print
(
" numero eventi: "
,
ii
,
" scritti nel file "
,
filo
)
...
...
Write
Preview
Supports
Markdown
0%
Try again
or
attach a new file
.
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment