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對象。

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文件看起來像這樣。

使用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()方法將其添加到我的地圖中。 最后,我們得到了一張已經令人印象深刻的地圖,顯示了過去一個月中所有的重大地震。 數據在不斷變化,因此您的嘗試可能看起來有所不同。

可視化地震幅度 (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。 該值對我來說很合適,但是您可以更改它,尤其是在繪制區域數據時。

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)。 現在,我們可以看到多個地震相互疊加。 除了代表大小的相對大小外,深紅色現在還代表熱點(多次地震),并賦予其熱圖效果。

使用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對象直接添加到我們剛剛創建的地圖中。 重新保存地圖將得到以下結果。

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應用程序。 在下面的照片中,我們看到了過去七天舊金山的所有地震。

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 ”列中的字符串的彈出窗口的示例

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,一經查實,立即刪除!