usgs地震記錄如何下載_用大葉草繪制USGS地震數據

usgs地震記錄如何下載

One of the many services provided by the US Geological Survey (USGS) is the monitoring and tracking of seismological events worldwide. I recently stumbled upon their earthquake datasets provided at the website below.

美國地質調查局(USGS)提供的眾多服務之一是對全球地震事件的監視和跟蹤。 我最近偶然發現了下面網站提供的地震數據集。

The site has data feeds that contain ‘live’ csv data for every significant earthquake over the past hour, day, week, or month. The data is updated every minute and contains magnitudes, lat/long, depth, and other earthquake descriptors.

該站點的數據源包含過去一小時,一天,一周或一個月中每次重大地震的“實時” csv數據。 數據每分鐘更新一次,其中包含震級,緯度/經度,深度和其他地震描述符。

While there are lots of earthquake visualizations out there, I thought it would be a fun exercise to see what could be easily created in Folium from the raw data. For this project, we will be plotting every earthquake worldwide using just Pandas and Folium. We will also add some tectonic plate boundaries with geoJSON just for fun.

盡管那里有很多地震可視化內容,但我認為從原始數據中輕松地在Folium中創建什么內容將是一個有趣的練習。 對于此項目,我們將僅使用熊貓和大葉子繪制全球每次地震的圖。 我們還將通過geoJSON添加一些構造板塊邊界,只是為了好玩。

導入我們的數據 (Importing Our Data)

I will be using the data feed located at the following URL.

我將使用位于以下URL的數據提要。

https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month.csv

https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/2.5_month.csv

That is the direct link to a csv formatted file containing every earthquake greater than magnitude 2.5, worldwide, over the last month. I encourage you to try out the other data feeds, but I found that the size of the dataset really balloons when you include smaller quakes.

這是指向csv格式文件的直接鏈接,該文件包含最近一個月在世界范圍內發生的每一次大于2.5級的地震。 我鼓勵您嘗試其他數據饋送,但是我發現當包含較小的地震時,數據集的大小實際上會膨脹。

In the code below, we import our libraries, and use the pandas.read_csv() function to create a DataFrame object directly from the URL.

在下面的代碼中,我們導入我們的庫,并使用pandas.read_csv()函數直接從URL創建一個DataFrame對象。

Image for post
Available columns from earthquake DataFrame
地震DataFrame中的可用列

The data column descriptions are well documented on the USGS website. The relevant columns for our project will be: latitude, longitude, and mag (magnitude of the quake). All are stored as float objects and there is no preprocessing necessary. Thank you USGS for keeping these datasets clean and user friendly.

數據列的說明在USGS網站上有詳細記錄。 為我們的項目相關列將是:緯度,經度和MAG(地震的大小)。 所有這些都存儲為浮點對象,并且不需要任何預處理。 感謝USGS保持這些數據集干凈和用戶友好。

在Folium中制作底圖 (Making a Base Map in Folium)

We will start by making a simple map in Folium using the code below.

我們將使用下面的代碼在Folium中制作一個簡單的地圖開始。

We chose a lat/long of (0, 0) since we are plotting the whole world. A zoom value of 2 worked well for me to see the entire Earth in openstreetmap. My resulting earthquakes.html file looked like this.

由于繪制整個世界,因此我們選擇了緯度/經度(0,0) 。 縮放值為2可以很好地使我在openstreetmap中看到整個地球。 我生成的地震.html文件看起來像這樣。

Image for post
Basic world map
基本的世界地圖

使用Folium Circles添加地震數據 (Adding Earthquake Data using Folium Circles)

Now that we have a working base map, let’s plot our earthquakes. We will use Folium’s Circle object to represent each quake. To start, we will just make all the earthquakes the same size.

現在我們有了工作底圖,讓我們繪制地震圖。 我們將使用Folium的Circle對象來表示每個地震。 首先,我們將使所有地震大小相同。

In the code above, we iterated through each earthquake in the DataFrame, created a Circle object at that location, and added it to my map using the add_to() method. We end up with an already impressive map showing all of the significant earthquakes over the past month. The data is constantly changing, so your attempt might look different.

在上面的代碼中,我們遍歷了DataFrame中的每次地震,在該位置創建了一個Circle對象,然后使用add_to()方法將其添加到我的地圖中。 最后,我們得到了一張已經令人印象深刻的地圖,顯示了過去一個月中所有的重大地震。 數據在不斷變化,因此您的嘗試可能看起來有所不同。

Image for post

可視化地震幅度 (Visualizing Earthquake Magnitudes)

To give us a quick visual representation of the magnitudes, I chose to alter the size of each circle based on the size of the quake. (alternately, you could experiment with colormaps or heatmaps)

為了讓我們快速直觀地看到震級,我選擇根據地震的大小來改變每個圓的大小。 (或者,您可以嘗試使用顏色圖或熱圖)

For the last map, I used a radius of 10 for every Circle and we saw each earthquake represented by a blue dot. The Circle object’s radius is displayed in meters on your map, so each Circle marker shows up as a 10m ring when you zoom all the way in on your interactive map.

對于最后一張地圖,我為每個圓使用了10的半徑,并且我們看到每個地震都由一個藍點表示。 “圓”對象的半徑以米為單位顯示在地圖上,因此當您在交互式地圖上一直放大時,每個“圓”標記都顯示為10m的圓環。

We will make the radius a function of the earthquake’s magnitude. Large magnitude quakes will be represented by large radius Circle markers.

我們將半徑作為地震震級的函數。 大地震將由大半徑圓形標記表示。

I chose to set my radius equal to 50,000 times the magnitude. A 4.0 earthquake would show on my map as having a radius of 200,000m or 200km. That value felt right for me, but you could certainly change it, especially if you were plotting regional data.

我選擇將半徑設置為等于半徑50,000倍。 我的地圖上會顯示4.0級地震的半徑為200,000m或200km。 該值對我來說很合適,但是您可以更改它,尤其是在繪制區域數據時。

Image for post

Now we can clearly see the relative size of the plotted earthquakes, although we certainly have some work to do on the formatting.

現在我們可以清楚地看到繪制的地震的相對大小,盡管我們當然需要進行一些格式化工作。

使它漂亮 (Making it Pretty)

The map is now functional with minimal coding. We can now use the Circle object’s keyword arguments to make them more attractive.

該地圖現在可以以最少的編碼運行。 現在,我們可以使用Circle對象的關鍵字參數使它們更具吸引力。

This time, we specified five new keyword arguments (weight, color, opacity, fill_color, and fill_opacity) in our Circle objects. We now see multiple earthquakes on top of each other. In addition to the relative sizes to represent magnitude, the darker red now represents hot spots (multiple quakes), and gives it a heatmap effect.

這次,我們在Circle對象中指定了五個新的關鍵字參數(權重,顏色,不透明度,fill_color和fill_opacity)。 現在,我們可以看到多個地震相互疊加。 除了代表大小的相對大小外,深紅色現在還代表熱點(多次地震),并賦予其熱圖效果。

Image for post

使用GeoJSON添加構造板塊 (Adding Tectonic Plates Using GeoJSON)

When we look at the resulting map, we see a visualization of the Pacific rim’s ‘ring of fire’. I immediately had the thought of laying the actual tectonic plate boundaries as an overlay to my map.

當查看生成的地圖時,我們看到了太平洋邊緣的“火環”的可視化圖像。 我立刻想到放置實際的構造板塊邊界作為我的地圖的疊加層。

A quick google search led me to this file on github with the polygons for the tectonic boundaries stored in geoJSON format.

谷歌的快速搜索將我帶到github上的該文件,其中以geoJSON格式存儲了構造邊界的多邊形。

GeoJSON is my personal favorite filetype for shapes when using Python and Folium, but you could use other shape files as well. The geoJSON format has the advantage of working as a JSON file and can be treated like a dictionary in Python should you need to.

在使用Python和Folium時,GeoJSON是我個人最喜歡的形狀文件類型,但是您也可以使用其他形狀文件。 geoJSON格式的優點是可以作為JSON文件使用,如果需要,可以將其視為Python中的字典。

The code below shows how Folium can easily handle a GeoJson file to add a map overlay.

下面的代碼顯示Folium如何輕松處理GeoJson文件以添加地圖疊加層。

The GeoJson object is added directly to the map we just created. Resaving the map gives the following result.

GeoJson對象直接添加到我們剛剛創建的地圖中。 重新保存地圖將得到以下結果。

Image for post

The map results are exactly as you might expect. Earthquakes are neatly placed along the boundaries of our tectonic plates, just like they were in my middle school science textbook.

地圖結果完全符合您的預期。 地震沿我們構造板塊的邊界整齊地放置,就像在我的中學科學教科書中一樣。

走得更遠 (Going Further)

Now that we have an attractive earthquake map, you may want to do some additional work to create something even more amazing.

現在我們有了一張引人入勝的地震圖,您可能想要做一些額外的工作來創建更令人驚奇的東西。

Consider making a web application with controls for magnitude, time ranges, and locations. In the photo below, we see all of the earthquakes in San Francisco over the past seven days.

考慮制作一個具有幅度,時間范圍和位置控件的Web應用程序。 在下面的照片中,我們看到了過去七天舊金山的所有地震。

Image for post
Cisco 7 day map
思科7天地圖

Consider looking into the significant formatting options of the Folium Circle class. With the popup kwarg, you can insert html tags for every earthquake. You could then add the magnitude and description for every quake worldwide. The image below is an example of a popup that displays the string from the ‘place’ column

考慮研究Folium Circle類的重要格式化選項。 使用彈出式kwarg,您可以為每次地震插入html標簽。 然后,您可以添加全球每個地震的震級和描述。 下圖是顯示“ place ”列中的字符串的彈出窗口的示例

Image for post
example of popup
彈出示例

See what you can create with these fantastic datasets. If you make something beautiful, let me know. Good luck!

看看您可以使用這些出色的數據集創建什么。 如果您做的很漂亮,請告訴我。 祝好運!

翻譯自: https://levelup.gitconnected.com/plotting-usgs-earthquake-data-with-folium-8f11ddc21950

usgs地震記錄如何下載

本文來自互聯網用戶投稿,該文觀點僅代表作者本人,不代表本站立場。本站僅提供信息存儲空間服務,不擁有所有權,不承擔相關法律責任。
如若轉載,請注明出處:http://www.pswp.cn/news/388119.shtml
繁體地址,請注明出處:http://hk.pswp.cn/news/388119.shtml
英文地址,請注明出處:http://en.pswp.cn/news/388119.shtml

如若內容造成侵權/違法違規/事實不符,請聯系多彩編程網進行投訴反饋email:809451989@qq.com,一經查實,立即刪除!

相關文章

Springboot 項目中 xml文件讀取yml 配置文件

2019獨角獸企業重金招聘Python工程師標準>>> 在xml文件中讀取yml文件即可&#xff0c;代碼如下&#xff1a; 現在spring-boot提倡零配置&#xff0c;但是的如果要集成老的spring的項目&#xff0c;涉及到的bean的配置。 <bean id"yamlProperties" clas…

eclipse 插件打包發布

如果想把調試好的插件打包發布&#xff0c;并且在ECLIPSE中可以使用. 1.File-->Export 2.選擇 PLug-in Development下 的 Deployable plug-ins and fragments 3.進入 Deployable plug-ins and fragments 頁面 4.把底下的 Destubatuib 的選項中選擇 Archive file 在這里添入要…

無法獲取 vmci 驅動程序版本: 句柄無效

https://jingyan.baidu.com/article/a3a3f811ea5d2a8da2eb8aa1.html 將 vmci0.present "TURE" 改為 “FALSE”; 轉載于:https://www.cnblogs.com/limanjihe/p/9868462.html

數據可視化 信息可視化_更好的數據可視化的8個技巧

數據可視化 信息可視化Ggplot is R’s premier data visualization package. Its popularity can likely be attributed to its ease of use — with just a few lines of code you are able to produce great visualizations. This is especially great for beginners who are…

分布式定時任務框架Elastic-Job的使用

為什么80%的碼農都做不了架構師&#xff1f;>>> 一、前言 Elastic-Job是一個優秀的分布式作業調度框架。 Elastic-Job是一個分布式調度解決方案&#xff0c;由兩個相互獨立的子項目Elastic-Job-Lite和Elastic-Job-Cloud組成。 Elastic-Job-Lite定位為輕量級無中心化…

Memcached和Redis

Memcached和Redis作為兩種Inmemory的key-value數據庫&#xff0c;在設計和思想方面有著很多共通的地方&#xff0c;功能和應用方面在很多場合下(作為分布式緩存服務器使用等) 也很相似&#xff0c;在這里把兩者放在一起做一下對比的介紹 基本架構和思想 首先簡單介紹一下兩者的…

第4章 springboot熱部署 4-1 SpringBoot 使用devtools進行熱部署

/imooc-springboot-starter/src/main/resources/application.properties #關閉緩存, 即時刷新 #spring.freemarker.cachefalse spring.thymeleaf.cachetrue#熱部署生效 spring.devtools.restart.enabledtrue #設置重啟的目錄,添加那個目錄的文件需要restart spring.devtools.r…

border-radius 漲知識的寫法

<div idapp></div>復制代碼#app{width:100%;height:80px;background:pink;border-radius:75%/20% 20% 0 0;}復制代碼僅供自己總結記憶轉載于:https://juejin.im/post/5c80afd66fb9a049f81a1217

ibm python db_使用IBM HR Analytics數據集中的示例的Python獨立性卡方檢驗

ibm python dbSuppose you are exploring a dataset and you want to examine if two categorical variables are dependent on each other.假設您正在探索一個數據集&#xff0c;并且想要檢查兩個分類變量是否相互依賴。 The motivation could be a better understanding of …

Oracle優化檢查表

分類檢查項目相關文件或結果狀態備注日志及文件Oracle Alert 日志bdump/udump下是否存在明顯的報警listener相關日志SQL* Net日志參數/參數文件listener.ora/tnsnames.ora操作系統操作系統版本檢查操作系統補丁節點名操作系統vmstat狀態操作系統I/O狀態操作系統進程情況操作系統…

spring分布式事務學習筆記(2)

此文已由作者夏昀授權網易云社區發布。歡迎訪問網易云社區&#xff0c;了解更多網易技術產品運營經驗。Model類如下&#xff1a;package com.xy.model1 package com.xy.model;2 3 /**4 * Created by helloworld on 2015/1/30.5 */6 public class NameQa {7 private long …

sql 左聯接 全聯接_通過了解自我聯接將您SQL技能提升到一個新的水平

sql 左聯接 全聯接The last couple of blogs that I have written have been great for beginners ( Data Concepts Without Learning To Code or Developing A Data Scientist’s Mindset). But, I would really like to push myself to create content for other members of …

如何查看linux中文件打開情況

如何查看linux中文件打開情況 前言 我們都知道&#xff0c;在linux下&#xff0c;“一切皆文件”&#xff0c;因此有時候查看文件的打開情況&#xff0c;就顯得格外重要&#xff0c;而這里有一個命令能夠在這件事上很好的幫助我們-它就是lsof。 linux下有哪些文件 在介紹lsof命…

hadoop windows

1、安裝JDK1.6或更高版本 官網下載JDK&#xff0c;安裝時注意&#xff0c;最好不要安裝到帶有空格的路徑名下&#xff0c;例如:Programe Files&#xff0c;否則在配置Hadoop的配置文件時會找不到JDK&#xff08;按相關說法&#xff0c;配置文件中的路徑加引號即可解決&#xff…

Ocelot中文文檔入門

入門 Ocelot僅適用于.NET Core&#xff0c;目前是根據netstandard2.0構建的&#xff0c;如果Ocelot適合您&#xff0c;這個文檔可能會有用。 .NET Core 2.1 安裝NuGet包 使用nuget安裝Ocelot及其依賴項。 您需要創建一個netstandard2.0項目并將其打包到其中。 然后按照下面的“…

科學價值 社交關系 大數據_服務的價值:數據科學和用戶體驗研究美好生活

科學價值 社交關系 大數據A crucial part of building a product is understanding exactly how it provides your customers with value. Understanding this is understanding how you fit into the lives of your customers, and should be central to how you build on wha…

在Ubuntu下創建hadoop組和hadoop用戶

一、在Ubuntu下創建hadoop組和hadoop用戶 增加hadoop用戶組&#xff0c;同時在該組里增加hadoop用戶&#xff0c;后續在涉及到hadoop操作時&#xff0c;我們使用該用戶。 1、創建hadoop用戶組 2、創建hadoop用戶 sudo adduser -ingroup hadoop hadoop 回車后會提示輸入新的UNIX…

day06 hashlib模塊

1.hashlib模塊 import hashlib# password123456# print( password.encode()) #加密前先轉成二進制# mhashlib.md5(password.encode())# print(dir(m)) #查詢m的所有方法## print(m.hexdigest()) #使用hexdigest()方法加密&#xff0c;md5加密之后是不可逆&#xff0c;不可以解…

vs azure web_在Azure中遷移和自動化Chrome Web爬網程序的指南。

vs azure webWebscraping as a required skill for many data-science related jobs is becoming increasingly desirable as more companies slowly migrate their processes to the cloud.隨著越來越多的公司將其流程緩慢遷移到云中&#xff0c;將Web爬網作為許多與數據科學相…

hadoop eclipse windows

首先說一下本人的環境: Windows7 64位系統 Spring Tool Suite Version: 3.4.0.RELEASE Hadoop2.6.0 一&#xff0e;簡介 Hadoop2.x之后沒有Eclipse插件工具&#xff0c;我們就不能在Eclipse上調試代碼&#xff0c;我們要把寫好的java代碼的MapReduce打包成jar然后在Linux上運…