Skip to content

Commit 19d4b0d

Browse files
author
Mike Hearne
authored
Merge pull request #143 from mhearne-usgs/datafix2
hopefully fixed data path problems
2 parents 61b8cfa + e8ed846 commit 19d4b0d

3 files changed

Lines changed: 59 additions & 58 deletions

File tree

setup.py

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
from distutils.core import setup
2-
import glob
2+
import os.path
33

44
setup(name='libcomcat',
55
version='0.1dev',
@@ -10,7 +10,12 @@
1010
packages=['libcomcat'],
1111
package_data={
1212
'libcomcat':
13-
glob.glob('libcomcat/data/**', recursive=True)
13+
[os.path.join('data', 'ne_50m_admin_0_countries.prj'),
14+
os.path.join('data', 'ne_50m_admin_0_countries.dbf'),
15+
os.path.join('data', 'ne_50m_admin_0_countries.shp'),
16+
os.path.join('data', 'ne_50m_admin_0_countries.cpg'),
17+
os.path.join('data', 'ne_50m_admin_0_countries.shx'),
18+
]
1419
},
1520
scripts=['bin/findid',
1621
'bin/getcsv',

tests/data/vcr_dyfi_dataframe.yaml

Lines changed: 48 additions & 52 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@ interactions:
66
Host: [earthquake.usgs.gov]
77
User-Agent: [Python-urllib/3.5]
88
method: GET
9-
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1558448846732/dyfi_geo_1km.geojson
9+
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1561138978988/dyfi_geo_1km.geojson
1010
response:
1111
body: {string: '{"features":[{"geometry":{"coordinates":[[[-97.86622,28.46285],[-97.856,28.46276],[-97.85591,28.47179],[-97.86612,28.47187]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(14R
1212
0611 3149 1000)<br>UTM:(14R 0611 3149 1000)","cdi":2.7,"dist":1471}},{"geometry":{"coordinates":[[[-100.61645,38.47718],[-100.60499,38.47734],[-100.60519,38.48635],[-100.61665,38.48619]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":2,"name":"UTM:(14S
@@ -4836,7 +4836,8 @@ interactions:
48364836
0773 3783 1000)<br>UTM:(16S 0773 3783 1000)","cdi":2,"dist":173}},{"geometry":{"coordinates":[[[-84.03551,34.25132],[-84.02466,34.25106],[-84.02435,34.26006],[-84.03519,34.26033]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
48374837
0773 3794 1000)<br>UTM:(16S 0773 3794 1000)","cdi":2,"dist":163}},{"geometry":{"coordinates":[[[-84.02852,34.44946],[-84.01765,34.44919],[-84.01733,34.4582],[-84.0282,34.45846]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
48384838
0773 3816 1000)<br>UTM:(16S 0773 3816 1000)","cdi":2,"dist":144}},{"geometry":{"coordinates":[[[-84.025,34.54852],[-84.01412,34.54826],[-84.01379,34.55726],[-84.02468,34.55753]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
4839-
0773 3827 1000)<br>UTM:(16S 0773 3827 1000)","cdi":2,"dist":134}},{"geometry":{"coordinates":[[[-84.04622,33.62958],[-84.03546,33.62932],[-84.03515,33.63833],[-84.04592,33.63859]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
4839+
0773 3827 1000)<br>UTM:(16S 0773 3827 1000)","cdi":2,"dist":134}},{"geometry":{"coordinates":[[[-84.0496,33.5305],[-84.03884,33.53024],[-84.03854,33.53925],[-84.04929,33.53951]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
4840+
0774 3714 1000)<br>UTM:(16S 0774 3714 1000)","cdi":5.6,"dist":239}},{"geometry":{"coordinates":[[[-84.04622,33.62958],[-84.03546,33.62932],[-84.03515,33.63833],[-84.04592,33.63859]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
48404841
0774 3725 1000)<br>UTM:(16S 0774 3725 1000)","cdi":3.4,"dist":228}},{"geometry":{"coordinates":[[[-84.04159,33.76469],[-84.03081,33.76443],[-84.0305,33.77344],[-84.04128,33.7737]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
48414842
0774 3740 1000)<br>UTM:(16S 0774 3740 1000)","cdi":2,"dist":214}},{"geometry":{"coordinates":[[[-84.04066,33.79171],[-84.02987,33.79145],[-84.02956,33.80046],[-84.04035,33.80072]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
48424843
0774 3743 1000)<br>UTM:(16S 0774 3743 1000)","cdi":2,"dist":211}},{"geometry":{"coordinates":[[[-84.03973,33.81873],[-84.02894,33.81847],[-84.02863,33.82748],[-84.03942,33.82774]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
@@ -6285,23 +6286,22 @@ interactions:
62856286
Access-Control-Allow-Headers: ['accept,origin,authorization,content-type']
62866287
Access-Control-Allow-Methods: ['*']
62876288
Access-Control-Allow-Origin: ['*']
6288-
Age: ['283']
62896289
Cache-Control: [max-age=315360000]
62906290
Connection: [close]
6291-
Content-Length: ['1677870']
6291+
Content-Length: ['1678138']
62926292
Content-Type: [text/plain]
6293-
Date: ['Mon, 17 Jun 2019 15:42:04 GMT']
6294-
ETag: ['"199a2e-58966a5ddcf80"']
6295-
Expires: ['Thu, 14 Jun 2029 15:42:04 GMT']
6296-
Last-Modified: ['Tue, 21 May 2019 14:27:26 GMT']
6293+
Date: ['Fri, 28 Jun 2019 17:32:00 GMT']
6294+
ETag: ['"199b3a-58bd8fe3a8c80"']
6295+
Expires: ['Mon, 25 Jun 2029 17:01:41 GMT']
6296+
Last-Modified: ['Fri, 21 Jun 2019 17:42:58 GMT']
62976297
Server: [nginx]
62986298
Strict-Transport-Security: [max-age=31536000]
62996299
Vary: ['Accept-Encoding,Accept-Encoding']
6300-
Via: [1.1 685083d3a5f8eecb6c517728d821ec87.cloudfront.net (CloudFront)]
6301-
X-Amz-Cf-Id: [N9FBkP3dbfb1ifHma0FGtPSLAvtm4dPDlcFQNd9HnjjNNTf8oakrgA==]
6302-
X-Amz-Cf-Pop: [IAD79-C1]
6303-
X-Cache: [Hit from cloudfront]
6304-
X-Cache-Status: [MISS]
6300+
Via: [1.1 fa751ee53e2bf18781ae98b293ff9375.cloudfront.net (CloudFront)]
6301+
X-Amz-Cf-Id: [9K1MI882QM2tzHLlRunoW2T9jv6nx64QwAfAPNxmDnyHTWKr_IAMIA==]
6302+
X-Amz-Cf-Pop: [SEA19]
6303+
X-Cache: [Miss from cloudfront]
6304+
X-Cache-Status: [HIT]
63056305
X-Content-Type-Options: [nosniff]
63066306
X-Frame-Options: [SAMEORIGIN]
63076307
X-XSS-Protection: [1; mode=block]
@@ -6313,7 +6313,7 @@ interactions:
63136313
Host: [earthquake.usgs.gov]
63146314
User-Agent: [Python-urllib/3.5]
63156315
method: GET
6316-
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1558448846732/dyfi_geo_10km.geojson
6316+
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1561138978988/dyfi_geo_10km.geojson
63176317
response:
63186318
body: {string: '{"features":[{"geometry":{"coordinates":[[[-97.87729,28.38171],[-97.77524,28.38083],[-97.7742,28.47107],[-97.87633,28.47196]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(14R
63196319
061 314 10000)<br>UTM:(14R 061 314 10000)","cdi":2.7,"dist":1471}},{"geometry":{"coordinates":[[[-100.71958,38.47571],[-100.60499,38.47734],[-100.60699,38.56743],[-100.72173,38.5658]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":2,"name":"UTM:(14S
@@ -7118,8 +7118,8 @@ interactions:
71187118
076 407 10000)<br>Williamsburg","cdi":2,"dist":144}},{"geometry":{"coordinates":[[[-84.10577,33.13515],[-83.9987,33.13262],[-83.99563,33.22269],[-84.1028,33.22524]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
71197119
077 367 10000)<br>Milner","cdi":3.8,"dist":277}},{"geometry":{"coordinates":[[[-84.1028,33.22524],[-83.99563,33.22269],[-83.99254,33.31277],[-84.09983,33.31532]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
71207120
077 368 10000)<br>Jackson","cdi":3.1,"dist":267}},{"geometry":{"coordinates":[[[-84.09983,33.31532],[-83.99254,33.31277],[-83.98944,33.40284],[-84.09683,33.4054]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":2,"name":"UTM:(16S
7121-
077 369 10000)<br>Locust Grove","cdi":3.1,"dist":257}},{"geometry":{"coordinates":[[[-84.09383,33.49548],[-83.98632,33.49291],[-83.98319,33.58298],[-84.09081,33.58556]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":2,"name":"UTM:(16S
7122-
077 371 10000)<br>UTM:(16S 077 371 10000)","cdi":3.8,"dist":238}},{"geometry":{"coordinates":[[[-84.09081,33.58556],[-83.98319,33.58298],[-83.98005,33.67305],[-84.08778,33.67564]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":10,"name":"UTM:(16S
7121+
077 369 10000)<br>Locust Grove","cdi":3.1,"dist":257}},{"geometry":{"coordinates":[[[-84.09383,33.49548],[-83.98632,33.49291],[-83.98319,33.58298],[-84.09081,33.58556]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":3,"name":"UTM:(16S
7122+
077 371 10000)<br>Covington","cdi":4.8,"dist":238}},{"geometry":{"coordinates":[[[-84.09081,33.58556],[-83.98319,33.58298],[-83.98005,33.67305],[-84.08778,33.67564]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":10,"name":"UTM:(16S
71237123
077 372 10000)<br>Conyers","cdi":3.1,"dist":229}},{"geometry":{"coordinates":[[[-84.08778,33.67564],[-83.98005,33.67305],[-83.97689,33.76312],[-84.08473,33.76572]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":1,"name":"UTM:(16S
71247124
077 373 10000)<br>Lithonia","cdi":2.9,"dist":219}},{"geometry":{"coordinates":[[[-84.08473,33.76572],[-83.97689,33.76312],[-83.97372,33.85319],[-84.08167,33.85579]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":21,"name":"UTM:(16S
71257125
077 374 10000)<br>Snellville","cdi":3.4,"dist":210}},{"geometry":{"coordinates":[[[-84.08167,33.85579],[-83.97372,33.85319],[-83.97053,33.94325],[-84.0786,33.94587]]],"type":"Polygon"},"type":"Feature","properties":{"stddev":0,"nresp":26,"name":"UTM:(16S
@@ -7722,23 +7722,22 @@ interactions:
77227722
Access-Control-Allow-Headers: ['accept,origin,authorization,content-type']
77237723
Access-Control-Allow-Methods: ['*']
77247724
Access-Control-Allow-Origin: ['*']
7725-
Age: ['109']
77267725
Cache-Control: [max-age=315360000]
77277726
Connection: [close]
7728-
Content-Length: ['356409']
7727+
Content-Length: ['356395']
77297728
Content-Type: [text/plain]
7730-
Date: ['Mon, 17 Jun 2019 15:45:00 GMT']
7731-
ETag: ['"57039-58966a5ddcf80"']
7732-
Expires: ['Mon, 04 Jun 2029 04:26:56 GMT']
7733-
Last-Modified: ['Tue, 21 May 2019 14:27:26 GMT']
7729+
Date: ['Fri, 28 Jun 2019 17:32:02 GMT']
7730+
ETag: ['"5702b-58bd8fe3a8c80"']
7731+
Expires: ['Mon, 25 Jun 2029 17:32:02 GMT']
7732+
Last-Modified: ['Fri, 21 Jun 2019 17:42:58 GMT']
77347733
Server: [nginx]
77357734
Strict-Transport-Security: [max-age=31536000]
77367735
Vary: ['Accept-Encoding,Accept-Encoding']
7737-
Via: [1.1 68f4ce62965bee950d499088765039e4.cloudfront.net (CloudFront)]
7738-
X-Amz-Cf-Id: [ys57cCY_YQagZ_Ip5r30uoKtmrlowkGaNRw6M7dsbovlzGHk9TaioQ==]
7739-
X-Amz-Cf-Pop: [IAD79-C1]
7740-
X-Cache: [Hit from cloudfront]
7741-
X-Cache-Status: [HIT]
7736+
Via: [1.1 26c88c0e916228dda5c9471d3f86bfda.cloudfront.net (CloudFront)]
7737+
X-Amz-Cf-Id: [L2oWNgUtzfhr--crTrezWM7Q2_zj5oCduM2DcKTRPuPR3SDZLcTR4g==]
7738+
X-Amz-Cf-Pop: [SEA19]
7739+
X-Cache: [Miss from cloudfront]
7740+
X-Cache-Status: [MISS]
77427741
X-Content-Type-Options: [nosniff]
77437742
X-Frame-Options: [SAMEORIGIN]
77447743
X-XSS-Protection: [1; mode=block]
@@ -7750,7 +7749,7 @@ interactions:
77507749
Host: [earthquake.usgs.gov]
77517750
User-Agent: [Python-urllib/3.5]
77527751
method: GET
7753-
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1558448846732/cdi_geo.txt
7752+
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1561138978988/cdi_geo.txt
77547753
response:
77557754
body: {string: '# Columns: Geocoded box,CDI,No. of responses,Hypocentral distance,Latitude,Longitude,Suspect?,Standard
77567755
deviation,City,State
@@ -9499,8 +9498,7 @@ interactions:
94999498

95009499
"UTM:(16S 077 369 10000)",3.1,2,257,33.3590,-84.0446,0,0.000,"Locust Grove",""
95019500

9502-
"UTM:(16S 077 371 10000)",3.8,2,238,33.5392,-84.0385,0,0.000,"UTM:(16S 077
9503-
371 10000)",""
9501+
"UTM:(16S 077 371 10000)",4.8,3,238,33.5392,-84.0385,0,0.000,"Covington",""
95049502

95059503
"UTM:(16S 077 372 10000)",3.1,10,229,33.6294,-84.0354,0,0.000,"Conyers",""
95069504

@@ -10821,23 +10819,22 @@ interactions:
1082110819
Access-Control-Allow-Headers: ['accept,origin,authorization,content-type']
1082210820
Access-Control-Allow-Methods: ['*']
1082310821
Access-Control-Allow-Origin: ['*']
10824-
Age: ['62']
1082510822
Cache-Control: [max-age=315360000]
1082610823
Connection: [close]
10827-
Content-Length: ['110102']
10824+
Content-Length: ['110088']
1082810825
Content-Type: [text/plain]
10829-
Date: ['Mon, 17 Jun 2019 15:45:49 GMT']
10830-
ETag: ['"1ae16-58966a5ddcf80"']
10831-
Expires: ['Thu, 14 Jun 2029 15:45:49 GMT']
10832-
Last-Modified: ['Tue, 21 May 2019 14:27:26 GMT']
10826+
Date: ['Fri, 28 Jun 2019 17:32:03 GMT']
10827+
ETag: ['"1ae08-58bd8fe3a8c80"']
10828+
Expires: ['Mon, 25 Jun 2029 17:28:44 GMT']
10829+
Last-Modified: ['Fri, 21 Jun 2019 17:42:58 GMT']
1083310830
Server: [nginx]
1083410831
Strict-Transport-Security: [max-age=31536000]
1083510832
Vary: ['Accept-Encoding,Accept-Encoding']
10836-
Via: [1.1 0173aeb09060ae0dd8c77e399d9e5634.cloudfront.net (CloudFront)]
10837-
X-Amz-Cf-Id: [Z5tP14_J3UlZGk9oECrgf3tmhjJp6fS0AY_3Co2JuNb9yjqeupGoIQ==]
10838-
X-Amz-Cf-Pop: [IAD79-C1]
10839-
X-Cache: [Hit from cloudfront]
10840-
X-Cache-Status: [MISS]
10833+
Via: [1.1 39f9e0f028321e95b5ebd1cd55661fd6.cloudfront.net (CloudFront)]
10834+
X-Amz-Cf-Id: [piIROpgQVTIWw-967v2amVUWFKYEY7QQp0KhoJAtJndmeURIrTjTfw==]
10835+
X-Amz-Cf-Pop: [SEA19]
10836+
X-Cache: [Miss from cloudfront]
10837+
X-Cache-Status: [HIT]
1084110838
X-Content-Type-Options: [nosniff]
1084210839
X-Frame-Options: [SAMEORIGIN]
1084310840
X-XSS-Protection: [1; mode=block]
@@ -10849,7 +10846,7 @@ interactions:
1084910846
Host: [earthquake.usgs.gov]
1085010847
User-Agent: [Python-urllib/3.5]
1085110848
method: GET
10852-
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1558448846732/cdi_zip.txt
10849+
uri: https://earthquake.usgs.gov/archive/product/dyfi/se60247871/us/1561138978988/cdi_zip.txt
1085310850
response:
1085410851
body: {string: '# Columns: ZIP/Location,CDI,No. of responses,Hypocentral distance,Latitude,Longitude,Suspect?,Standard
1085510852
deviation,City,State[,cityid]
@@ -11312,7 +11309,7 @@ interactions:
1131211309

1131311310
"30014",2.0,3,240,33.5811,-83.8196,0,0.000,"Covington","GA"
1131411311

11315-
"30016",2.0,7,243,33.5167,-83.9295,0,0.000,"Covington","GA"
11312+
"30016",5.5,8,243,33.5167,-83.9295,0,0.000,"Covington","GA"
1131611313

1131711314
"30017",2.7,7,203,33.8891,-83.9640,0,0.000,"Grayson","GA"
1131811315

@@ -12801,22 +12798,21 @@ interactions:
1280112798
Access-Control-Allow-Headers: ['accept,origin,authorization,content-type']
1280212799
Access-Control-Allow-Methods: ['*']
1280312800
Access-Control-Allow-Origin: ['*']
12804-
Age: ['31']
1280512801
Cache-Control: [max-age=315360000]
1280612802
Connection: [close]
1280712803
Content-Length: ['58259']
1280812804
Content-Type: [text/plain]
12809-
Date: ['Mon, 17 Jun 2019 15:46:21 GMT']
12810-
ETag: ['"e393-58966a5ddcf80"']
12811-
Expires: ['Thu, 14 Jun 2029 15:46:21 GMT']
12812-
Last-Modified: ['Tue, 21 May 2019 14:27:26 GMT']
12805+
Date: ['Fri, 28 Jun 2019 17:32:04 GMT']
12806+
ETag: ['"e393-58bd8fe3a8c80"']
12807+
Expires: ['Mon, 25 Jun 2029 17:32:04 GMT']
12808+
Last-Modified: ['Fri, 21 Jun 2019 17:42:58 GMT']
1281312809
Server: [nginx]
1281412810
Strict-Transport-Security: [max-age=31536000]
1281512811
Vary: ['Accept-Encoding,Accept-Encoding']
12816-
Via: [1.1 8f98a0b4c1a6979299c34e2923b8a5e0.cloudfront.net (CloudFront)]
12817-
X-Amz-Cf-Id: [2GEEHy05gjI2v3d0h-Wjyo_sX3v2NBXkLbf0ifOP8IUamCWqsmd38g==]
12818-
X-Amz-Cf-Pop: [IAD79-C1]
12819-
X-Cache: [Hit from cloudfront]
12812+
Via: [1.1 9bb9e176e1eb7840931dbe73ecc961f7.cloudfront.net (CloudFront)]
12813+
X-Amz-Cf-Id: [jeQJji3yH6_2B9GaksJLSgMcTB-qD1xPU7pnaOkO_7mQaR9eg_zgSw==]
12814+
X-Amz-Cf-Pop: [SEA19]
12815+
X-Cache: [Miss from cloudfront]
1282012816
X-Cache-Status: [MISS]
1282112817
X-Content-Type-Options: [nosniff]
1282212818
X-Frame-Options: [SAMEORIGIN]

tests/libcomcat/dataframes_test.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -242,16 +242,16 @@ def test_dyfi():
242242
with vcr.use_cassette(tape_file):
243243
df1km = get_dyfi_data_frame(detail, dyfi_file='utm_1km')
244244
np.testing.assert_almost_equal(
245-
df1km['intensity'].sum(), 14888.699999999)
245+
df1km['intensity'].sum(), 14894.3)
246246
df10km = get_dyfi_data_frame(detail, dyfi_file='utm_10km')
247247
np.testing.assert_almost_equal(
248-
df10km['intensity'].sum(), 3480.2000000000003)
248+
df10km['intensity'].sum(), 3481.2000000000003)
249249
dfutm = get_dyfi_data_frame(detail, dyfi_file='utm_var')
250250
np.testing.assert_almost_equal(
251-
dfutm['intensity'].sum(), 3480.2000000000003)
251+
dfutm['intensity'].sum(), 3481.2000000000003)
252252
dfzip = get_dyfi_data_frame(detail, dyfi_file='zip')
253253
np.testing.assert_almost_equal(
254-
dfzip['intensity'].sum(), 2344.6000000000004)
254+
dfzip['intensity'].sum(), 2348.1000000000004)
255255

256256

257257
if __name__ == '__main__':

0 commit comments

Comments
 (0)