Визуализация данных. Ошибка типа: неподдерживаемые типы операндов для *: 'int' и 'NoneType' - PullRequest
0 голосов
/ 08 февраля 2020

Я работаю над набором данных о глобальных землетрясениях и пытаюсь создать диаграмму с помощью Plotly. Мой набор данных находится в формате JSON. Проблема возникает из-за того, что я пытаюсь увеличить размер точки события (она указывает на величину землетрясения и большую величину землетрясения в точке события). При запуске моей программы я всегда получаю сообщение трассировки TypeError со следующим текстом:

File "/Users/johnphillip/PycharmProjects/earth_quake_analysis/latest_eq_analysis.py", строка 34, в формате 'size': [5 * mag for mag in mags], TypeError: неподдерживаемые типы операндов для *: 'int' и 'NoneType'

Но проблема в том, что я использовал этот же код в других файлах без каких-либо ошибки. Я также попытался просмотреть данные, но не нашел пропущенных значений для клавиши 'mag' в файле JSON.

  • Файл, содержащий мой код
import json

from plotly import offline
from plotly.graph_objs import Layout

# Open file and explore structure of the file's data
filename = "/Users/johnphillip/PycharmProjects/earth_quake_analysis/data" \
           "/latest_eq_data_30_m1.json"
with open(filename) as data_record:
    eq_data = json.load(data_record)

eq_features = eq_data['features']

# Automate the title of the graph by automatically fetching the title from
# the file's metadata properties.
title = eq_data['metadata']['title']

# Extract the magnitudes, longitude, latitudes and earthquake title for each
# earthquake event.
mags, longs, lats, event_titles = [], [], [], []
for eq_feature in eq_features:
    try:
        mag = eq_feature['properties']['mag']
        lon = eq_feature['geometry']['coordinates'][0]
        lat = eq_feature['geometry']['coordinates'][1]
        event = eq_feature['properties']['title']
    except ValueError:
        print("Data not found in the record.")
    else:
        mags.append(mag)
        longs.append(lon)
        lats.append(lat)
        event_titles.append(event)

# Style and map the earthquakes
data = [{
    'type': 'scattergeo',
    'lon': longs,
    'lat': lats,
    'text': event_titles,
    'maker': {
        'size': [5 * mag for mag in mags],
        'color': mags,
        'colorscale': 'Inferno',
        'reverserscale': True,
        'colorbar': {'title': 'Magnitude'}
    }
}]

# Set the plot layout
my_layout = Layout(title=title)
fig = {'data': data, 'layout': my_layout}

# Plot the chart.
if __name__ == '__main__':
    offline.plot(fig, filename= '/earth_quake_analysis/eq_html_plots/latest_eq_1month.html')

  • Биты файла набора данных
{"type":"FeatureCollection","metadata":{"generated":1580938541000,"url":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.geojson","title":"USGS All Earthquakes, Past Month","status":200,"api":"1.8.1","count":12514},"features":[{"type":"Feature","properties":{"mag":2.18,"place":"7km ENE of Pahala, Hawaii","time":1580938265440,"updated":1580938464240,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71371212","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71371212.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":73,"net":"hv","code":"71371212","ids":",hv71371212,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":51,"dmin":0.02491,"rms":0.12,"gap":140,"magType":"md","type":"earthquake","title":"M 2.2 - 7km ENE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4146729,19.2185001,33.09]},"id":"hv71371212"},
{"type":"Feature","properties":{"mag":0.58,"place":"2km NW of The Geysers, CA","time":1580938248420,"updated":1580938343830,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335996","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335996.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":5,"net":"nc","code":"73335996","ids":",nc73335996,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,","nst":13,"dmin":0.01009,"rms":0.06,"gap":98,"magType":"md","type":"earthquake","title":"M 0.6 - 2km NW of The Geysers, CA"},"geometry":{"type":"Point","coordinates":[-122.7768326,38.7879982,-0.01]},"id":"nc73335996"},
{"type":"Feature","properties":{"mag":0.57,"place":"10km NW of The Geysers, CA","time":1580938226490,"updated":1580938322932,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335991","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335991.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":5,"net":"nc","code":"73335991","ids":",nc73335991,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,","nst":15,"dmin":0.001722,"rms":0.01,"gap":83,"magType":"md","type":"earthquake","title":"M 0.6 - 10km NW of The Geysers, CA"},"geometry":{"type":"Point","coordinates":[-122.8376694,38.8388329,1.39]},"id":"nc73335991"},
{"type":"Feature","properties":{"mag":1.7,"place":"76km W of Anchor Point, Alaska","time":1580937855844,"updated":1580938209982,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nvzrwq","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nvzrwq.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":44,"net":"ak","code":"0201nvzrwq","ids":",ak0201nvzrwq,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.64,"gap":null,"magType":"ml","type":"earthquake","title":"M 1.7 - 76km W of Anchor Point, Alaska"},"geometry":{"type":"Point","coordinates":[-153.1844,59.7021,100.4]},"id":"ak0201nvzrwq"},
{"type":"Feature","properties":{"mag":3.5,"place":"36km SSW of Shishmaref, Alaska","time":1580937853558,"updated":1580938441474,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nvzrn5","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nvzrn5.geojson","felt":null,"cdi":null,"mmi":3.53,"alert":null,"status":"automatic","tsunami":0,"sig":188,"net":"ak","code":"0201nvzrn5","ids":",ak0201nvzrn5,","sources":",ak,","types":",geoserve,origin,shakemap,","nst":null,"dmin":null,"rms":1,"gap":null,"magType":"ml","type":"earthquake","title":"M 3.5 - 36km SSW of Shishmaref, Alaska"},"geometry":{"type":"Point","coordinates":[-166.2758,65.9363,15.1]},"id":"ak0201nvzrn5"},
{"type":"Feature","properties":{"mag":1.1,"place":"43km S of Redoubt Volcano, Alaska","time":1580937399652,"updated":1580938018962,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nvy3zx","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nvy3zx.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":19,"net":"ak","code":"0201nvy3zx","ids":",ak0201nvy3zx,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.46,"gap":null,"magType":"ml","type":"earthquake","title":"M 1.1 - 43km S of Redoubt Volcano, Alaska"},"geometry":{"type":"Point","coordinates":[-152.7669,60.0931,95.6]},"id":"ak0201nvy3zx"},
{"type":"Feature","properties":{"mag":2.8,"place":"61km SSW of Kobuk, Alaska","time":1580937119381,"updated":1580937888143,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nvx2p3","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nvx2p3.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":121,"net":"ak","code":"0201nvx2p3","ids":",ak0201nvx2p3,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.68,"gap":null,"magType":"ml","type":"earthquake","title":"M 2.8 - 61km SSW of Kobuk, Alaska"},"geometry":{"type":"Point","coordinates":[-157.3431,66.3906,35]},"id":"ak0201nvx2p3"},
{"type":"Feature","properties":{"mag":0.66,"place":"20km ESE of Little Lake, CA","time":1580936382210,"updated":1580936599711,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39293096","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39293096.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":7,"net":"ci","code":"39293096","ids":",ci39293096,","sources":",ci,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":11,"dmin":0.06302,"rms":0.1,"gap":83,"magType":"ml","type":"earthquake","title":"M 0.7 - 20km ESE of Little Lake, CA"},"geometry":{"type":"Point","coordinates":[-117.6908333,35.894,3.7]},"id":"ci39293096"},
{"type":"Feature","properties":{"mag":1.81,"place":"4km SSE of Pahala, Hawaii","time":1580936375960,"updated":1580936573150,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71371147","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71371147.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":50,"net":"hv","code":"71371147","ids":",hv71371147,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":44,"dmin":0.01462,"rms":0.12,"gap":110,"magType":"md","type":"earthquake","title":"M 1.8 - 4km SSE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4640045,19.1700001,34.96]},"id":"hv71371147"},
{"type":"Feature","properties":{"mag":2.05,"place":"5km SSE of Pahala, Hawaii","time":1580936223470,"updated":1580936420060,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71371137","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71371137.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":65,"net":"hv","code":"71371137","ids":",hv71371137,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":45,"dmin":0.007428,"rms":0.12,"gap":133,"magType":"md","type":"earthquake","title":"M 2.1 - 5km SSE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4673309,19.1609993,35.48]},"id":"hv71371137"},
{"type":"Feature","properties":{"mag":1.21,"place":"6km ENE of Vista, CA","time":1580935957760,"updated":1580936178983,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39293088","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39293088.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":23,"net":"ci","code":"39293088","ids":",ci39293088,","sources":",ci,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":37,"dmin":0.06898,"rms":0.22,"gap":95,"magType":"ml","type":"earthquake","title":"M 1.2 - 6km ENE of Vista, CA"},"geometry":{"type":"Point","coordinates":[-117.184,33.2213333,3.5]},"id":"ci39293088"},
{"type":"Feature","properties":{"mag":2.25,"place":"6km ENE of Pahala, Hawaii","time":1580935679550,"updated":1580936022000,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71371117","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71371117.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":78,"net":"hv","code":"71371117","ids":",hv71371117,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":53,"dmin":0.02927,"rms":0.13,"gap":136,"magType":"ml","type":"earthquake","title":"M 2.3 - 6km ENE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4210052,19.2183342,32.87]},"id":"hv71371117"},
{"type":"Feature","properties":{"mag":2.16,"place":"7km NNE of Pahala, Hawaii","time":1580935676580,"updated":1580936013990,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71371112","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71371112.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":72,"net":"hv","code":"71371112","ids":",hv71371112,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":35,"dmin":0.04713,"rms":0.37,"gap":67,"magType":"ml","type":"earthquake","title":"M 2.2 - 7km NNE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4380035,19.2651672,25.11]},"id":"hv71371112"},
{"type":"Feature","properties":{"mag":2.32,"place":"15km SSE of Guanica, Puerto Rico","time":1580935451370,"updated":1580937227783,"tz":-240,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/pr2020036045","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/pr2020036045.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":83,"net":"pr","code":"2020036045","ids":",pr2020036045,","sources":",pr,","types":",geoserve,origin,phase-data,","nst":10,"dmin":0.1333,"rms":0.11,"gap":255,"magType":"md","type":"earthquake","title":"M 2.3 - 15km SSE of Guanica, Puerto Rico"},"geometry":{"type":"Point","coordinates":[-66.8625,17.8428,10]},"id":"pr2020036045"},
{"type":"Feature","properties":{"mag":0.56,"place":"8km NW of The Geysers, CA","time":1580935148820,"updated":1580936043066,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335971","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335971.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":5,"net":"nc","code":"73335971","ids":",nc73335971,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":9,"dmin":0.01207,"rms":0.01,"gap":151,"magType":"md","type":"earthquake","title":"M 0.6 - 8km NW of The Geysers, CA"},"geometry":{"type":"Point","coordinates":[-122.8166656,38.8343315,1.48]},"id":"nc73335971"},
{"type":"Feature","properties":{"mag":1.94,"place":"10km SSW of Borrego Springs, CA","time":1580934779310,"updated":1580935428710,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39293040","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39293040.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":58,"net":"ci","code":"39293040","ids":",ci39293040,","sources":",ci,","types":",focal-mechanism,geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":57,"dmin":0.09103,"rms":0.24,"gap":21,"magType":"ml","type":"earthquake","title":"M 1.9 - 10km SSW of Borrego Springs, CA"},"geometry":{"type":"Point","coordinates":[-116.4293333,33.1775,13.06]},"id":"ci39293040"},
{"type":"Feature","properties":{"mag":1.03,"place":"6km ESE of Lake Los Angeles, CA","time":1580933751720,"updated":1580933977192,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39293008","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39293008.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":16,"net":"ci","code":"39293008","ids":",ci39293008,","sources":",ci,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":14,"dmin":0.04684,"rms":0.11,"gap":66,"magType":"ml","type":"earthquake","title":"M 1.0 - 6km ESE of Lake Los Angeles, CA"},"geometry":{"type":"Point","coordinates":[-117.7756667,34.5851667,8.52]},"id":"ci39293008"},
{"type":"Feature","properties":{"mag":1.3,"place":"17km N of Willow, Alaska","time":1580933552625,"updated":1580933744758,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nvbszi","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nvbszi.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":26,"net":"ak","code":"0201nvbszi","ids":",ak0201nvbszi,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.26,"gap":null,"magType":"ml","type":"earthquake","title":"M 1.3 - 17km N of Willow, Alaska"},"geometry":{"type":"Point","coordinates":[-150.0916,61.9,42.3]},"id":"ak0201nvbszi"},
{"type":"Feature","properties":{"mag":1.7,"place":"29km S of Alva, Oklahoma","time":1580933474617,"updated":1580933622210,"tz":-360,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ok2020cnmo","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ok2020cnmo.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":44,"net":"ok","code":"2020cnmo","ids":",ok2020cnmo,","sources":",ok,","types":",geoserve,origin,phase-data,","nst":11,"dmin":0.06233718991,"rms":0.1770460443,"gap":95.7381897,"magType":"ml","type":"earthquake","title":"M 1.7 - 29km S of Alva, Oklahoma"},"geometry":{"type":"Point","coordinates":[-98.62634277,36.54199219,4.390521049]},"id":"ok2020cnmo"},
{"type":"Feature","properties":{"mag":1.42,"place":"24km ENE of San Ardo, CA","time":1580933387750,"updated":1580935322987,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335966","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335966.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":31,"net":"nc","code":"73335966","ids":",nc73335966,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":7,"dmin":0.04687,"rms":0.02,"gap":149,"magType":"md","type":"earthquake","title":"M 1.4 - 24km ENE of San Ardo, CA"},"geometry":{"type":"Point","coordinates":[-120.652832,36.0783348,0.37]},"id":"nc73335966"},
{"type":"Feature","properties":{"mag":2,"place":"38km SW of Noatak, Alaska","time":1580932732415,"updated":1580933433437,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nv09xh","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nv09xh.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":62,"net":"ak","code":"0201nv09xh","ids":",ak0201nv09xh,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.36,"gap":null,"magType":"ml","type":"earthquake","title":"M 2.0 - 38km SW of Noatak, Alaska"},"geometry":{"type":"Point","coordinates":[-163.5099,67.2988,0.6]},"id":"ak0201nv09xh"},
{"type":"Feature","properties":{"mag":1.83,"place":"13km WSW of Searles Valley, CA","time":1580931892160,"updated":1580932532020,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39293000","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39293000.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":52,"net":"ci","code":"39293000","ids":",ci39293000,","sources":",ci,","types":",focal-mechanism,geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":26,"dmin":0.09991,"rms":0.16,"gap":74,"magType":"ml","type":"earthquake","title":"M 1.8 - 13km WSW of Searles Valley, CA"},"geometry":{"type":"Point","coordinates":[-117.5383333,35.728,4.42]},"id":"ci39293000"},
{"type":"Feature","properties":{"mag":1.9,"place":"63km SW of Cantwell, Alaska","time":1580931549503,"updated":1580931846587,"tz":-540,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ak0201nuw3vt","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ak0201nuw3vt.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":56,"net":"ak","code":"0201nuw3vt","ids":",ak0201nuw3vt,","sources":",ak,","types":",geoserve,origin,","nst":null,"dmin":null,"rms":0.46,"gap":null,"magType":"ml","type":"earthquake","title":"M 1.9 - 63km SW of Cantwell, Alaska"},"geometry":{"type":"Point","coordinates":[-149.6711,62.923,69.2]},"id":"ak0201nuw3vt"},
{"type":"Feature","properties":{"mag":0.16,"place":"10km E of Mammoth Lakes, CA","time":1580931369660,"updated":1580933643225,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335951","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335951.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":0,"net":"nc","code":"73335951","ids":",nc73335951,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":8,"dmin":0.0252,"rms":0.05,"gap":141,"magType":"md","type":"earthquake","title":"M 0.2 - 10km E of Mammoth Lakes, CA"},"geometry":{"type":"Point","coordinates":[-118.8618333,37.6525,2.66]},"id":"nc73335951"},
{"type":"Feature","properties":{"mag":1.03,"place":"2km SE of Loma Linda, CA","time":1580931038210,"updated":1580938425191,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39292984","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39292984.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":16,"net":"ci","code":"39292984","ids":",ci39292984,","sources":",ci,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":29,"dmin":0.1175,"rms":0.19,"gap":88,"magType":"ml","type":"earthquake","title":"M 1.0 - 2km SE of Loma Linda, CA"},"geometry":{"type":"Point","coordinates":[-117.2425,34.0336667,15.75]},"id":"ci39292984"},
{"type":"Feature","properties":{"mag":2.04,"place":"8km W of Calipatria, CA","time":1580930646860,"updated":1580938423810,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39292976","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39292976.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":64,"net":"ci","code":"39292976","ids":",ci39292976,","sources":",ci,","types":",focal-mechanism,geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":48,"dmin":0.02114,"rms":0.21,"gap":55,"magType":"ml","type":"earthquake","title":"M 2.0 - 8km W of Calipatria, CA"},"geometry":{"type":"Point","coordinates":[-115.6053333,33.122,9.38]},"id":"ci39292976"},
{"type":"Feature","properties":{"mag":2.89,"place":"7km ENE of Pahala, Hawaii","time":1580930375140,"updated":1580930889086,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71370952","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71370952.geojson","felt":1,"cdi":2,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":129,"net":"hv","code":"71370952","ids":",hv71370952,","sources":",hv,","types":",dyfi,geoserve,origin,phase-data,","nst":60,"dmin":0.01643,"rms":0.13,"gap":142,"magType":"ml","type":"earthquake","title":"M 2.9 - 7km ENE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4069977,19.2236671,32.08]},"id":"hv71370952"},
{"type":"Feature","properties":{"mag":1.31,"place":"10km SSW of Idyllwild, CA","time":1580930317340,"updated":1580938488420,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39292968","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39292968.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":26,"net":"ci","code":"39292968","ids":",ci39292968,","sources":",ci,","types":",focal-mechanism,geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":42,"dmin":0.06397,"rms":0.16,"gap":37,"magType":"ml","type":"earthquake","title":"M 1.3 - 10km SSW of Idyllwild, CA"},"geometry":{"type":"Point","coordinates":[-116.7601667,33.6598333,10.14]},"id":"ci39292968"},
{"type":"Feature","properties":{"mag":1.46,"place":"24km ESE of Julian, CA","time":1580930232970,"updated":1580938487725,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39292960","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39292960.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":33,"net":"ci","code":"39292960","ids":",ci39292960,","sources":",ci,","types":",focal-mechanism,geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":46,"dmin":0.06051,"rms":0.21,"gap":53,"magType":"ml","type":"earthquake","title":"M 1.5 - 24km ESE of Julian, CA"},"geometry":{"type":"Point","coordinates":[-116.3583333,33.0135,9.96]},"id":"ci39292960"},
{"type":"Feature","properties":{"mag":2.75,"place":"17km SSE of Guanica, Puerto Rico","time":1580930127280,"updated":1580934000558,"tz":-240,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/pr2020036044","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/pr2020036044.geojson","felt":1,"cdi":1,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":116,"net":"pr","code":"2020036044","ids":",pr2020036044,","sources":",pr,","types":",dyfi,geoserve,origin,phase-data,","nst":11,"dmin":0.1541,"rms":0.08,"gap":239,"magType":"md","type":"earthquake","title":"M 2.8 - 17km SSE of Guanica, Puerto Rico"},"geometry":{"type":"Point","coordinates":[-66.8356,17.8273,8]},"id":"pr2020036044"},
{"type":"Feature","properties":{"mag":0.67,"place":"7km WNW of The Geysers, CA","time":1580930094310,"updated":1580931544402,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/nc73335946","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/nc73335946.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":7,"net":"nc","code":"73335946","ids":",nc73335946,","sources":",nc,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":18,"dmin":0.00534,"rms":0.02,"gap":60,"magType":"md","type":"earthquake","title":"M 0.7 - 7km WNW of The Geysers, CA"},"geometry":{"type":"Point","coordinates":[-122.82267,38.8105011,2.09]},"id":"nc73335946"},
{"type":"Feature","properties":{"mag":2.42,"place":"3km S of Pahala, Hawaii","time":1580929886190,"updated":1580930221750,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71370942","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71370942.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":90,"net":"hv","code":"71370942","ids":",hv71370942,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":55,"dmin":0.02593,"rms":0.13,"gap":90,"magType":"ml","type":"earthquake","title":"M 2.4 - 3km S of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4754944,19.1781673,34.87]},"id":"hv71370942"},
{"type":"Feature","properties":{"mag":0.57,"place":"16km ESE of Little Lake, CA","time":1580929874610,"updated":1580930090824,"tz":-480,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ci39292944","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ci39292944.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":5,"net":"ci","code":"39292944","ids":",ci39292944,","sources":",ci,","types":",geoserve,nearby-cities,origin,phase-data,scitech-link,","nst":10,"dmin":0.07982,"rms":0.13,"gap":67,"magType":"ml","type":"earthquake","title":"M 0.6 - 16km ESE of Little Lake, CA"},"geometry":{"type":"Point","coordinates":[-117.7381667,35.9023333,7.74]},"id":"ci39292944"},
{"type":"Feature","properties":{"mag":1.91,"place":"16km S of Guanica, Puerto Rico","time":1580929810890,"updated":1580930606382,"tz":-240,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/pr2020036043","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/pr2020036043.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"reviewed","tsunami":0,"sig":56,"net":"pr","code":"2020036043","ids":",pr2020036043,","sources":",pr,","types":",geoserve,origin,phase-data,","nst":8,"dmin":0.1512,"rms":0.2,"gap":261,"magType":"md","type":"earthquake","title":"M 1.9 - 16km S of Guanica, Puerto Rico"},"geometry":{"type":"Point","coordinates":[-66.8935,17.8246,8]},"id":"pr2020036043"},
{"type":"Feature","properties":{"mag":2,"place":"4km ENE of Pahala, Hawaii","time":1580929440070,"updated":1580929636470,"tz":-600,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/hv71370932","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/hv71370932.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":62,"net":"hv","code":"71370932","ids":",hv71370932,","sources":",hv,","types":",geoserve,origin,phase-data,","nst":50,"dmin":0.0408,"rms":0.12,"gap":119,"magType":"md","type":"earthquake","title":"M 2.0 - 4km ENE of Pahala, Hawaii"},"geometry":{"type":"Point","coordinates":[-155.4396667,19.2286663,31.45]},"id":"hv71370932"},
{"type":"Feature","properties":{"mag":2,"place":"19km WSW of Wynnewood, Oklahoma","time":1580929339749,"updated":1580929480243,"tz":-360,"url":"https://earthquake.usgs.gov/earthquakes/eventpage/ok2020cnkh","detail":"https://earthquake.usgs.gov/earthquakes/feed/v1.0/detail/ok2020cnkh.geojson","felt":null,"cdi":null,"mmi":null,"alert":null,"status":"automatic","tsunami":0,"sig":62,"net":"ok","code":"2020cnkh","ids":",ok2020cnkh,","sources":",ok,","types":",geoserve,origin,phase-data,","nst":10,"dmin":0.0288195014,"rms":0.5521886308,"gap":137.4046211,"magType":"ml","type":"earthquake","title":"M 2.0 - 19km WSW of Wynnewood, Oklahoma"},"geometry":{"type":"Point","coordinates":[-97.35810852,34.57329941,3.277541876]},"id":"ok2020cnkh"},
{"type":"Feature","properties":{"mag":2.12,"place":"5km ENE of Pahala, Hawaii","time":1580929241670,"updated":1580929432540,"tz":-600,"

1 Ответ

0 голосов
/ 08 февраля 2020

Сообщение об ошибке довольно ясно: вы пытаетесь умножить int и None:

>>> mags = [None]
>>> [5 * mag for mag in mags]
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "<stdin>", line 1, in <listcomp>
TypeError: unsupported operand type(s) for *: 'int' and 'NoneType'

Возможно, в вашем файле есть строка с {"mag":null, ...}:

>>> d = json.loads('{"mag":null}')
>>> d["mag"] is None
True

То, что вы должны делать с None mag, мне неизвестно.

Добро пожаловать на сайт PullRequest, где вы можете задавать вопросы и получать ответы от других членов сообщества.
...