The ISC Bulletin Download Utility

The isc_downloader package provides a set of APIs to download a customized ISC catalogue from the ISC website (http://www.isc.ac.uk/iscbulletin/) using the Python command line.


In [1]:
%matplotlib inline
import eqcat.isc_downloader as isc

Basic Usage

At first, an url-based catalogue request object should be created with:


In [2]:
Cat1 = isc.ISCBulletinUrl()

The object contains a set of default parameters that can be listed with the merthod 'ListField'. A full description of each parameter and the list of available options can be found at http://www.isc.ac.uk/iscbulletin/search/webservices/.


In [3]:
Cat1.ListFields()


CURRENT SETTINGS:

	CatalogueType = REVIEWED
	OutputFormat = CATCSV
	SearchAreaShape = RECT
	RectangleBottomLatitude = 36
	RectangleTopLatitude = 48
	RectangleLeftLongitude = 6
	RectangleRightLongitude = 19
	CircularLatitude = [Empty]
	CircularLongitude = [Empty]
	CircularRadius = [Empty]
	MaxDistanceUnits = deg
	SeismicRegionNumber = [Empty]
	GeogrephicRegionNumber = [Empty]
	PolygonCoordinates = [Empty]
	StartYear = 2012
	StartMonth = 01
	StartDay = 01
	StartTime = 00:00:00
	EndYear = 2013
	EndMonth = 12
	EndDay = 31
	EndTime = 23:59:59
	MinimumDepth = [Empty]
	MaximumDepth = [Empty]
	NoDepthEvents = on
	MinimumMagnitude = [Empty]
	MaximumMagnitude = [Empty]
	NoMagnitudeEvents = on
	MagnitudeType = [Empty]
	MagnitudeAgency = [Empty]
	FocalMechanismAgency = Any
	IncludePhases = off
	MinimumPhaseNumber = [Empty]
	MaximumPhaseNumber = [Empty]
	NoKnownPhases = [Empty]
	PrimeOnly = [Empty]
	IncludeMagnitudes = on
	IncludeHeaders = on
	IncludeComments = on
	IncludeLinks = off

Each parameter can then be modified with the method 'SetField'(particular care should be paid to the standard format of the different options). For example, the desired output format for the catalogue can be set to ISF with the following command:


In [4]:
Cat1.SetField("OutputFormat","ISF")

As well, starting and ending time for the catalogue can be set with:


In [5]:
Cat1.SetField("StartYear","2000")
Cat1.SetField("EndYear","2001")

or search area (Nepal in this example):


In [6]:
Cat1.SetField('SearchAreaShape','RECT')
Cat1.SetField('RectangleBottomLatitude','23')
Cat1.SetField('RectangleTopLatitude','34')
Cat1.SetField('RectangleLeftLongitude','77')
Cat1.SetField('RectangleRightLongitude','91')

NOTE: When modified, optional parameters can be set back empty by using empty strings:


In [7]:
Cat1.SetField("MinimumDepth","")

Finally, the catalogue can simply be downloaded with the command:


In [8]:
Cat1.GetCatalogue()

And the result saved to disk:


In [9]:
Cat1.WriteOutput("outputs/Example_ISF_Catalogue.isf")


Warning: File exists. Use OverWrite option.

The catalogue has been saved in an ascii file that can later be manipulated with the GEM catalogue tools.


In [10]:
f = open("outputs/Example_ISF_Catalogue.isf", "r"); print f.read(); f.close()


DATA_TYPE EVENT IMS1.0
Reviewed ISC Bulletin
Event  3254347 Northern India
   Date       Time        Err   RMS Latitude Longitude  Smaj  Smin  Az Depth   Err Ndef Nsta Gap  mdist  Mdist Qual   Author      OrigID
2000/12/05 21:47:50.20   3.01 0.900  28.9540   77.4030   9.3   7.7  -1  14.2   8.7        10 188                      NDI        4214847
2000/12/05 21:47:53.92   1.44 1.703  28.7640   77.2960 14.65 11.19   0  14.2f         6    6 177   0.11   5.50 m i    ISC        4412029
 (#PRIME)

Magnitude  Err Nsta Author      OrigID
MD     2.3          NDI        4214847
ML     2.5          NDI        4214847
MW     2.5          NDI        4214847

Event  3264199 Qinghai
   Date       Time        Err   RMS Latitude Longitude  Smaj  Smin  Az Depth   Err Ndef Nsta Gap  mdist  Mdist Qual   Author      OrigID
2000/12/07 23:53:36.94   3.66 0.130  34.6313   92.7415 237.0  28.0  72   0.0f         4      187  17.03  80.74     uk IDC        4221686
2000/12/07 23:53:35.14   1.60 0.723  33.8960   90.0600 74.08 21.42  90  33.0f         5    5 182   8.45  81.91 m i    ISC        4412219
 (#PRIME)

Magnitude  Err Nsta Author      OrigID
mb     3.6 0.3    3 IDC        4221686
ML     3.5 0.0    1 IDC        4221686
mb     3.7        2 ISC        4412219

Event  3254520 Nepal-India border region
   Date       Time        Err   RMS Latitude Longitude  Smaj  Smin  Az Depth   Err Ndef Nsta Gap  mdist  Mdist Qual   Author      OrigID
2000/12/18 16:45:35.90   3.92 1.700  29.8210   80.1970  12.7  32.5  -1   5.0f              6 234                      NDI        4214956

Magnitude  Err Nsta Author      OrigID
MD     3.1          NDI        4214956

Event  3265672 Xizang
   Date       Time        Err   RMS Latitude Longitude  Smaj  Smin  Az Depth   Err Ndef Nsta Gap  mdist  Mdist Qual   Author      OrigID
2000/12/28 19:44:09.24   4.78 0.620  30.9443   84.4666 188.0  31.4  69   0.0f         3      228  18.07  72.06     uk IDC        4222892
2000/12/28 19:44:25.89   2.74 0.753  31.7240   86.7930 26.06 21.53  90 100.4  38.0   10   10 156   3.88  71.16 m i    ISC        4414178
 (#PRIME)

Magnitude  Err Nsta Author      OrigID
mb     3.4 0.2    2 IDC        4222892
ML     3.2 0.0    1 IDC        4222892
mb     3.2        2 ISC        4414178

Event  3254630 Northern India
   Date       Time        Err   RMS Latitude Longitude  Smaj  Smin  Az Depth   Err Ndef Nsta Gap  mdist  Mdist Qual   Author      OrigID
2000/12/29 08:40:32.30   5.75 1.900  24.2800   83.1610  11.5  10.4  -1  10.0f             11 125                      NDI        4215043

Magnitude  Err Nsta Author      OrigID
ML     3.3          NDI        4215043


Saving/Loading Parameters

One might want to save the current settings on a separate file, to be used as reference or subsequently to download another catalogue. This can be done with the command:


In [11]:
Cat1.SaveSettings("outputs/Example_Settings.par")

In [12]:
f = open("outputs/Example_Settings.par", "r"); print f.read(); f.close()


CatalogueType=REVIEWED
OutputFormat=ISF
SearchAreaShape=RECT
RectangleBottomLatitude=23
RectangleTopLatitude=34
RectangleLeftLongitude=77
RectangleRightLongitude=91
CircularLatitude=Null
CircularLongitude=Null
CircularRadius=Null
MaxDistanceUnits=deg
SeismicRegionNumber=Null
GeogrephicRegionNumber=Null
PolygonCoordinates=Null
StartYear=2000
StartMonth=01
StartDay=01
StartTime=00:00:00
EndYear=2001
EndMonth=12
EndDay=31
EndTime=23:59:59
MinimumDepth=Null
MaximumDepth=Null
NoDepthEvents=on
MinimumMagnitude=Null
MaximumMagnitude=Null
NoMagnitudeEvents=on
MagnitudeType=Null
MagnitudeAgency=Null
FocalMechanismAgency=Any
IncludePhases=off
MinimumPhaseNumber=Null
MaximumPhaseNumber=Null
NoKnownPhases=Null
PrimeOnly=Null
IncludeMagnitudes=on
IncludeHeaders=on
IncludeComments=on
IncludeLinks=off

As well, the parameters in the parameter file can be loaded back into memory with:


In [13]:
Cat2 = isc.ISCBulletinUrl()
Cat2.LoadSettings("outputs/Example_Settings.par")

Additional Formats

The ISC event catalogue can be saved in CSV format:


In [16]:
Cat1.SetField("OutputFormat","CATCSV")
Cat1.GetCatalogue()
Cat1.WriteOutput("outputs/Example_CSV_Catalogue.csv")


Warning: File exists. Use OverWrite option.

In [18]:
f = open("outputs/Example_CSV_Catalogue.csv", "r"); print f.read(); f.close()


DATA_TYPE EVENT_CATALOGUE
Reviewed ISC Bulletin
--EVENT--|--------------------ORIGIN (PRIME HYPOCENTRE)-------------------|------MAGNITUDES-----...
  EVENTID,AUTHOR   ,DATE      ,TIME       ,LAT     ,LON      ,DEPTH,DEPFIX,AUTHOR   ,TYPE  ,MAG 
Event  3254347
  3254347,ISC      ,2000-12-05,21:47:53.92, 28.7640,  77.2960, 14.2,TRUE  ,NDI      ,MD    , 2.3,NDI      ,ML    , 2.5,NDI      ,MW    , 2.5
Event  3264199
  3264199,ISC      ,2000-12-07,23:53:35.14, 33.8960,  90.0600, 33.0,TRUE  ,ISC      ,mb    , 3.7,IDC      ,mb    , 3.6,IDC      ,ML    , 3.5
Event  3254520
  3254520,NDI      ,2000-12-18,16:45:35.90, 29.8210,  80.1970,  5.0,TRUE  ,NDI      ,MD    , 3.1,
Event  3265672
  3265672,ISC      ,2000-12-28,19:44:25.89, 31.7240,  86.7930,100.4,      ,ISC      ,mb    , 3.2,IDC      ,mb    , 3.4,IDC      ,ML    , 3.2
Event  3254630
  3254630,NDI      ,2000-12-29,08:40:32.30, 24.2800,  83.1610, 10.0,TRUE  ,NDI      ,ML    , 3.3,

Catalogue of focal mechanisms is also available in CSV format:


In [20]:
Cat1.SetField("OutputFormat","FMCSV")
Cat1.SetField("StartYear","2000")
Cat1.SetField("EndYear","2005")
Cat1.GetCatalogue()
Cat1.WriteOutput("outputs/Example_FM_Catalogue.csv")


Warning: File exists. Use OverWrite option.

In [22]:
f = open("outputs/Example_FM_Catalogue.csv", "r"); print f.read(); f.close()


DATA_TYPE FOCAL_MECHANISM_SOLUTIONS
Reviewed ISC Bulletin
--EVENT--|------------------------------ORIGIN------------------------------|FM AUTHOR|----MOMENT---|-----------MOMENT TENSOR COMPONENTS---------|---------------NODAL PLANES--------------|-----------------------PRINCIPAL AXES-------------------------|
 EVENT_ID,AUTHOR   ,DATE      ,TIME       ,LAT     ,LON      ,DEPTH,CENTROID,AUTHOR   ,EX,MO   ,MW  ,EX,MRR   ,MTT   ,MPP   ,MRT   ,MTP   ,MPR   ,STRIKE,DIP  ,RAKE   ,STRIKE,DIP  ,RAKE   ,EX,T_VAL ,T_PL ,T_AZM ,P_VAL ,P_PL ,P_AZM ,N_VAL ,N_PL ,N_AZM 
Event    3323034
3323034  ,NDI      ,2001-06-23,02:33:31.60, 30.2700,  77.5320, 11.2,        ,NDI      ,  ,     ,    ,  ,      ,      ,      ,      ,      ,      , 62.80,53.90, -30.70,      ,     ,       ,  ,      ,     ,      ,      ,     ,      ,      ,     ,      
Event    2379218
2379218  ,HRVD     ,2001-11-27,07:31:57.10, 29.6100,  81.7500, 15.0,TRUE    ,HRVD     ,17,2.220, 5.5,17, 0.180,-0.340, 0.160, 2.140, 0.060,-0.530,104.00,87.00,  92.00,257.00, 4.00,  63.00,17, 2.140,48.00, 16.00,-2.300,42.00,192.00, 0.170, 2.00,284.00
Event    2408305
2408305  ,HRVD     ,2001-11-27,08:53:59.40, 28.9100,  81.4900, 15.0,TRUE    ,HRVD     ,17,1.590, 5.4,17, 1.140,-1.200, 0.060, 0.810, 0.540,-0.500,119.00,64.00,  99.00,280.00,28.00,  73.00,17, 1.480,70.00, 46.00,-1.710,18.00,202.00, 0.230, 8.00,295.00
Event    3166176
3166176  ,NEIC     ,2002-06-04,14:36:05.80, 30.5950,  81.4400, 33.0,        ,NEIC     ,17,1.900, 5.5,17,-1.270,-0.520, 1.790,-0.860, 0.220,-0.440, 33.00,62.00, -55.00,157.00,44.00,-137.00,17, 1.900,10.00, 99.00,-1.850,57.00,353.00,-0.050,31.00,195.00
3166176  ,HRVD     ,2002-06-04,14:36:08.50, 30.1300,  81.2500, 15.0,TRUE    ,HRVD     ,17,2.990, 5.6,17,-2.310,-0.480, 2.790,-1.500, 0.240,-0.140, 31.00,55.00, -53.00,159.00,49.00,-130.00,17, 2.820, 3.00, 96.00,-3.150,61.00,  0.00, 0.330,29.00,187.00
Event    6621514
6621514  ,HRVD     ,2003-03-25,18:51:30.70, 26.9200,  89.8200, 55.8,TRUE    ,HRVD     ,17,1.730, 5.4,17,-0.680,-1.260, 1.940,-0.460,-0.100, 0.010, 40.00,70.00, -21.00,137.00,71.00,-159.00,17, 1.940, 1.00,268.00,-1.510,29.00,358.00,-0.430,61.00,177.00
Event    7249665
7249665  ,HRVD     ,2004-02-10,05:39:42.60, 32.6000,  83.4200, 28.8,TRUE    ,HRVD     ,16,2.630, 4.9,16,-2.270,-0.120, 2.390, 0.840, 0.310, 0.810,203.00,58.00, -72.00,351.00,37.00,-116.00,16, 2.600,11.00,280.00,-2.650,71.00,156.00, 0.040,15.00, 13.00
Event    7319858
7319858  ,HRVD     ,2004-03-27,18:47:29.20, 34.0000,  89.3500, 12.0,TRUE    ,HRVD     ,18,1.110, 6.0,18,-0.880,-0.280, 1.160,-0.100, 0.520,-0.060, 28.00,48.00, -76.00,187.00,44.00,-105.00,18, 1.330, 2.00,108.00,-0.890,79.00,  6.00,-0.430,10.00,198.00
7319858  ,NEIC     ,2004-03-27,18:47:29.20, 33.9540,  89.1790,  8.0,        ,NEIC     ,  ,     ,    ,  ,      ,      ,      ,      ,      ,      , 10.00,60.00, -90.00,190.00,30.00, -90.00,  ,      ,15.00,100.00,      ,75.00,280.00,      , 0.00,  0.00
7319858  ,NEIC     ,2004-03-27,18:47:29.20, 33.9540,  89.1790,  8.0,        ,NEIC     ,18,1.100, 6.0,18,-1.030, 0.250, 0.780,-0.070, 0.400,-0.270, 25.00,53.00, -94.00,212.00,38.00, -85.00,18, 1.030, 8.00,118.00,-1.070,82.00,275.00, 0.040, 3.00, 28.00
Event    7319945
7319945  ,HRVD     ,2004-03-27,20:05:53.60, 33.8700,  89.1900, 18.4,TRUE    ,HRVD     ,16,3.910, 5.0,16,-3.000, 0.390, 2.610,-1.280, 1.180, 2.170, 44.00,36.00, -49.00,176.00,64.00,-115.00,16, 3.530,15.00,285.00,-4.290,62.00, 46.00, 0.760,23.00,188.00
Event    7320854
7320854  ,HRVD     ,2004-03-28,22:27:27.50, 33.9100,  89.2800, 16.9,TRUE    ,HRVD     ,16,5.340, 5.1,16,-3.350,-1.590, 4.930,-1.940, 1.890, 1.510, 46.00,50.00, -39.00,164.00,61.00,-132.00,16, 5.550, 7.00,283.00,-5.130,53.00, 22.00,-0.430,36.00,188.00
Event    7326697
7326697  ,HRVD     ,2004-04-06,10:30:32.30, 33.8300,  89.2500, 12.0,TRUE    ,HRVD     ,16,4.810, 5.1,16,-3.960,-0.450, 4.410,-1.730, 1.530, 0.340, 39.00,51.00, -58.00,174.00,49.00,-123.00,16, 4.850, 1.00,106.00,-4.760,66.00, 14.00,-0.090,24.00,197.00
Event    7333262
7333262  ,HRVD     ,2004-04-22,10:02:16.40, 33.8800,  89.3300, 17.7,TRUE    ,HRVD     ,17,0.750, 5.2,17,-0.550,-0.230, 0.780,-0.220, 0.190, 0.110, 36.00,49.00, -50.00,165.00,54.00,-126.00,17, 0.820, 3.00,279.00,-0.680,61.00, 15.00,-0.140,29.00,188.00
Event    7370445
7370445  ,NEIC     ,2004-07-11,23:08:44.18, 30.6940,  83.6720, 13.0,        ,NEIC     ,  ,     ,    ,  ,      ,      ,      ,      ,      ,      ,175.00,45.00, -90.00,355.00,45.00, -90.00,  ,      , 0.00, 85.00,      ,90.00,  0.00,      , 0.00,  0.00
7370445  ,NEIC     ,2004-07-11,23:08:44.18, 30.6940,  83.6720, 13.0,        ,NEIC     ,18,2.200, 6.2,18,-2.070,-0.080, 2.150,-0.320,-0.340,-0.090,  1.00,46.00, -77.00,162.00,45.00,-103.00,18, 2.200, 1.00, 82.00,-2.120,81.00,348.00,-0.070, 9.00,172.00
7370445  ,HRVD     ,2004-07-11,23:08:44.20, 30.5600,  83.7800, 13.0,TRUE    ,HRVD     ,18,2.360, 6.2,18,-2.140,-0.220, 2.360,-0.390,-0.610,-0.030,156.00,47.00,-106.00,359.00,45.00, -74.00,18, 2.500, 1.00,257.00,-2.220,78.00,351.00,-0.280,12.00,167.00
Event    7376904
7376904  ,HRVD     ,2004-07-28,22:22:13.10, 30.3500,  83.6300, 13.7,TRUE    ,HRVD     ,16,3.680, 5.0,16,-3.240,-0.420, 3.670,-1.050,-0.620, 0.020,  9.00,47.00, -64.00,154.00,49.00,-115.00,16, 3.770, 1.00,261.00,-3.590,71.00,356.00,-0.170,19.00,171.00
Event    7422127
7422127  ,HRVD     ,2004-10-26,02:11:33.40, 30.8800,  80.9700, 12.0,TRUE    ,HRVD     ,17,3.310, 5.6,17,-1.460,-1.310, 2.770,-0.370,-2.470,-0.360, 17.00,76.00, -17.00,112.00,73.00,-165.00,17, 3.940, 2.00, 65.00,-2.670,22.00,334.00,-1.270,68.00,159.00
7422127  ,NEIC     ,2004-10-26,02:11:33.44, 31.0240,  81.1540, 10.1,        ,NEIC     ,17,1.800, 5.4,17,-1.770, 0.420, 1.350,-0.260,-0.740,-0.330,140.00,44.00,-107.00,343.00,49.00, -74.00,17, 1.770, 3.00, 62.00,-1.860,78.00,319.00, 0.090,12.00,152.00

Solving download issues

Note that sometimes the ISC server is heavily loaded and the http request might fail. In such a case it could be conveninent to use an alternate (mirror) server:


In [23]:
Cat1.UseMirror()

Moreover, long time windows might produce a too large number of events, which cannot be downloaded in one block. The code gives the possibility to download the catalogue in separated blocks of a prescr ibed duration (using option SplitYears). The blocks are then automatically merged into a unique output:


In [24]:
Cat1.SetField("OutputFormat","ISF")
Cat1.GetCatalogue(SplitYears=1)


Downloading block: 2000 - 2000
Downloading block: 2001 - 2001
Downloading block: 2002 - 2002
Downloading block: 2003 - 2003
Downloading block: 2004 - 2004

Optionally, one can overwrite a previous download:


In [25]:
Cat1.WriteOutput('outputs/Example_ISF_Catalogue_SPLIT.isf', OverWrite=True)

In [ ]: