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.mzph.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…

无法获取 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…

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 …

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 …

hadoop windows

1、安装JDK1.6或更高版本 官网下载JDK&#xff0c;安装时注意&#xff0c;最好不要安装到带有空格的路径名下&#xff0c;例如:Programe Files&#xff0c;否则在配置Hadoop的配置文件时会找不到JDK&#xff08;按相关说法&#xff0c;配置文件中的路径加引号即可解决&#xff…

科学价值 社交关系 大数据_服务的价值:数据科学和用户体验研究美好生活

科学价值 社交关系 大数据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…

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上运…

netstat 在windows下和Linux下查看网络连接和端口占用

假设忽然起个服务&#xff0c;告诉我8080端口被占用了&#xff0c;OK&#xff0c;我要去看一下是什么服务正在占用着&#xff0c;能不能杀 先假设我是在Windows下&#xff1a; 第一列&#xff1a; Proto 协议 第二列&#xff1a; 本地地址【ip端口】 第三列&#xff1a;远程地址…

selenium 解析网页_用Selenium进行网页搜刮

selenium 解析网页网页抓取系列 (WEB SCRAPING SERIES) 总览 (Overview) Selenium is a portable framework for testing web applications. It is open-source software released under the Apache License 2.0 that runs on Windows, Linux and macOS. Despite serving its m…

代理ARP协议(Proxy ARP)

代理ARP&#xff08;Proxy-arp&#xff09;的原理就是当出现跨网段的ARP请求时&#xff0c;路由器将自己的MAC返回给发送ARP广播请求发送者&#xff0c;实现MAC地址代理&#xff08;善意的欺骗&#xff09;&#xff0c;最终使得主机能够通信。 图中R1和R3处于不同的局域网&…

hive 导入hdfs数据_将数据加载或导入运行在基于HDFS的数据湖之上的Hive表中的另一种方法。

hive 导入hdfs数据Preceding pen down the article, might want to stretch out appreciation to all the wellbeing teams beginning from cleaning/sterile group to Nurses, Doctors and other who are consistently battling to spare the mankind from continuous Covid-1…

对Faster R-CNN的理解(1)

目标检测是一种基于目标几何和统计特征的图像分割&#xff0c;最新的进展一般是通过R-CNN&#xff08;基于区域的卷积神经网络&#xff09;来实现的&#xff0c;其中最重要的方法之一是Faster R-CNN。 1. 总体结构 Faster R-CNN的基本结构如下图所示&#xff0c;其基础是深度全…

大数据业务学习笔记_学习业务成为一名出色的数据科学家

大数据业务学习笔记意见 (Opinion) A lot of aspiring Data Scientists think what they need to become a Data Scientist is :许多有抱负的数据科学家认为&#xff0c;成为一名数据科学家需要具备以下条件&#xff1a; Coding 编码 Statistic 统计 Math 数学 Machine Learni…

postman 请求参数为数组及JsonObject

2019独角兽企业重金招聘Python工程师标准>>> 1. (1)数组的请求方式(post) https://blog.csdn.net/qq_21205435/article/details/81909184 (2)数组的请求方式&#xff08;get&#xff09; http://localhost:port/list?ages10,20,30 后端接收方式&#xff1a; PostMa…