Vous êtes sur la page 1sur 58

3D Earthquake Data Visualization

A PROJECT REPORT

Submitted by

Nidhi kumari

In partial fulfillment for the award of the degree


Of
BACHELOR OF TECHNOLOGY
IN
COMPUTER SCIENCE AND ENGINEERING
WITH SPECILIZATION IN OIL AND GAS INFORMATICS

MIT UNIVERSITY OF MEGHALAYA


Sunny View, Nongshilliang, Nongthmmai,
Shillong, Meghalaya – 793014
May, 2019
3D Earthquake Data Visualization

A PROJECT REPORT

Submitted by

Nidhi kumari

In partial fulfilment for the award of the degree


In

BACHELOR OF TECHNOLOGY
IN

Computer Science and Engineering


With Specialization in Oil and Gas Informatics

MIT UNIVERSITY OF MEGHALAYA


Sunny View, Nongshilliang, Nongthmmai,
Shillong, Meghalaya – 793014
May, 2019
MIT UNIVERSITY OF MEGHALAYA

BONAFIED CERTIFICATE

Certified that this project “3D Earthquake Data Visualization" is a bonafide


work of Nidhi kumari, Enrollment no: R010515015 who carried out this project
work under my supervision.

________________________ _________________
Dr. Debmalya Bhattacharya Ms. Bharathi Paleti
Pro Vice Chancellor, Assistant Professor (SS)
School of Technology, Dept. of Computer Science & Engineering
MIT University of Meghalaya, MIT University of Meghalaya,
Sunny View, Nongshilliang, Sunny View, Nongshilliang,
Nongthymmai, Shillong, Nongthymmai, Shillong,
Meghalaya – 793014 Meghalaya - 793014
CANDIDATE’S DECLARATION

I hereby certify that the project work entitled “3D Earthquake Data Visualization” in partial
fulfilment of the requirements for the award of the Degree of BACHLOR OF TECHNOLOGY
in COMPUTER SCIENCE AND ENGINEERING with specialization in OIL AND GAS
INFORMATICS and submitted to the Department of Computer Science and Engineering at
School of Technology, MIT University of Meghalaya, is an authentic record of our work carried
out during the period of January, 2019 to May,2019 under the supervision of Bharathi Paleti,
Assistant Professor(SS), MIT University of Meghalaya.

The matter presented in this project has not been submitted by us for the award of my other
degree of this or any other University.

Nidhi kumari
R010515015

This is to certify that the above statement made by the candidate is correct to the best of my
knowledge.
Date: - ________________.

Bharathi Paleti
Assistant Professor (SS)
Department of Computer Science & Engineering,
MIT University of Meghalaya, Shillong
ACKNOWLEDGEMENT

I wish to express our deep gratitude to our guide Bharathi Paleti for all advice, encouragement
and constant support she has given us throughout our project work. This work would not have
been possible without her support and valuable suggestions.

I sincerely thank to our respected Project Coordinator of the Department, Bharathi Paleti and
Monica Jha for her great support in doing our project.

I are also grateful to Dr. Debmalya Bhattacharya, Pro – Vice Chancellor, MIT University of
Meghalaya for giving us the necessary facilities to carry out our project work successfully.

I would like to thank all our friends for their help and constructive criticism during our project
work. Finally, we have no words to express our sincere gratitude to our parents who have shown
us this world and for every support they have given us.
ABSTRACT

Earthquake is one of the natural calamities that occur due to release of energy from the earth
crust. This calamity results into the loss of human life, property .The data of previous
earthquakes may serve as a tool for predicting various parameters such as, highly prone regions,
intensity of earthquake or for further research work. This data is usually available in the form of
'raw data'. Visualization of data using conventional excel sheet consume lot of time. This paper
discuss about the project that serves as a time efficient and user friendly solution for study,
analysis and representation of available earthquake data using data visualization technique. In
this paper I presented a list of Earthquakes in the India from 2000 to 2018. The analysis of data
interpretation has been done with the help of processing Data visualization tool.

KEYWORDS: data visualization, earthquake data.


TABLE OF CONTENT

S.no TOPIC Pg. no

1. Introduction …………………………….………….…9
1.1 Objectives …………………..……………………..10
1.2 Literature Survey ………………………………….11
1.3 Requirement Analysis………………….……….….12

2. System Analysis ………………....……………….……13


2.1 Existing System………………………………….…13
2.2 Proposed system……………………………………13
2.3 Motivation…………………………….……………14

3. Software Requirement Specification………………..14


3.1 Analysis Phase………………………………….…14
3.1.1 Functional Requirements………………………..14
3.1.2 Non-Functional requirements……………………28

4. Design
4.1 System Design ……………………..………..……..29
4.1.1 Input Data …………………..…………...…..…...29
4.1.2 ER-Diagram…………………………………...….31
4.1.3 System Diagram………………………………..…32
4.1.4 Methodology…………………………………..….33
5. Implementation………………………………………….….34
5.1 Lines of code ………………………….……………….…34
5.2 Output Screen …….……………………………………..37

6. Limitations……………………………………………….….57

7. Conclusion………………………………………………….57

8. References…………………………………………………...58
1. INTRODUCTION

Earthquake is a natural process that take place under the beneath of the Earth due to the
movement of seismic tectonic plates. It is not only an observational Science but strongly effect
the life of each and every living organism on the Earth .The origin of Earthquake is as old as the
origin of the Earth, But due to lack of knowledge and scientific instruments it is tremendous
challenge for ancient scientists and geophysicists to collect and analysis the Earthquake data.
Now a day’s science and technology grew up their maturities, collecting and analysis of
Earthquake movement is an easy job but storing of data is also tedious job.

Seismic waves travelling through earth carry lot of information regarding valuables buried under
the earth crust. These information are useful in many fields of seismology, geological
engineering, mining engineering and oil and gases industries etc. Speed of waves depends upon
the elastic properties of the medium. They provide us many characteristics i.e. homogeneity or
heterogeneity, isotropy or anisotropy and discontinuity present in the medium. On the analysis of
the velocities and travel times of P, SV, SH and surface waves, we can explore the possibility of
buried beneath the earth crust. Seismic data processing has application in earthquakes and after
shock detection .It is also used by exploration and production companies in order to identify oil
and natural gas deposit beneath the earth. Going back to 1960’s, scholars have used waveform
co-relation in study earthquakes as sensitive detections. These have been used over small regions
to track after shock sequences .It is considered a key tool to detecting earthquakes. Earthquakes
can’t be prevented instead we must be prepared for. Researchers have been using computer
simulations to better understanding the mechanism of seismic waves to build safer structures to
minimize the damage occurred during earthquake.

Prediction of geological disasters is the need of the day. Also, prediction of these disasters is a
very complex process that depends on many physical and environmental parameters. Many
approaches exits based on analysis for analyzing earthquake data. Data visualization techniques
can also be used for prediction of these natural hazards. The processing of post-earthquake raw
data is generally done using Excel sheet which is very much time consuming. This project
overcomes this drawback in which data will be uploaded just by clicking on a button .It involves
application of data visualization, which may serve as time effective solution for visualizing
Earthquake data.
1.1 OBJECTIVES

1. Demonstrating of the utility of utilizing earth shake maps for earthquake modeling using
USGS (US GEOLOGICAL SURVEY). USGS Earthquake Hazards Program, responsible
for monitoring, reporting, and researching earthquakes and earthquake hazards.

2. Emphasizing the importance of the spatial component of earthquake disaster through 3D


visualization.

3. Providing 3D visualization perspective for the purpose of disaster management and


emergency response.
1.2 LITERATURE SURVEY

The authors G. V. Otari, Dr. R. V. Kulkarni has discussed in their paper “A Review of
Application of Data Mining in Earthquake Prediction”, it is a prediction of geological disaster.
The main data mining techniques used for earthquake prediction are logistic models, neural
networks, and decision trees, all of which provide primary solutions to the problems inherent in
the prediction of earthquakes, tsunamis, and other micro seismic activities. In their paper they
also aim to encourage additional research on topics, and conclude with several suggestions for
further research.

The authors Gunther H. Weber, Marco Schneider, Daniel W. Wilson, Hans Hagen, Bernd
Hamann and Bruce L. Kutter has discussed in their paper “Visualization of Experimental
Earthquake Data”, a visualization tool that starts by reading the data which describes experiment
set-up and displays this data along with icons for the sensors used during data acquisition.

The authors C. Willmes, J. Weskamm, U. Baaser, K.-G. Hinzen, G.Bareth has discussed in their
paper “seismogis: a tool for the visualization of earthquake data”. SeismoGIS a GIS toolset
developed for the Earthquake. This system uses seismometer station network that are used to
measure the current and previous earthquake data which supports to visualize and analyze the
earthquake data.
1.3 REQUIREMENT ANALYSIS

TOOLS/ TECHNOLOGY USED

1. PROCESSING SOFTWARE TOOL


Processing is a simple programming environment that was created to make it easier to develop
visually oriented applications with an emphasis on animation and providing users with instant
feedback through interaction.
Processing is based on Java, but because program elements in Processing are fairly simple, you
can learn to use it even if you don't know any Java.

Processing consists of:

• The Processing Development Environment (PDE). This is the software that runs when
you double-click the Processing icon. The PDE is an Integrated Development
Environment (IDE) with a minimalist set of features designed as a simple introduction to
programming or for testing one-off ideas.

• A collection of functions (also referred to as commands or methods) that make up the


“core” programming interface, or API, as well as several libraries that support more
advanced features such as sending data over a network, reading live images from a
webcam, and saving complex imagery in PDF format.

• A language syntax, identical to Java but with a few modifications

2. EARTHQUAKE DATA

3. OPERATING SYSTEM

Windows, Mac OS X, or Linux

4. UP TO DATE GRAPHICS CARD DRIVERS.


2. SYSTEM ANALYSIS

2.1 EXISTING SYSTEM

Excel is a spreadsheet tool earlier used to display data in a tabular format (a table of columns and
rows). Each data point is stored in “cells” and can be manipulated by manually set formulas.

Limitations of existing system:

Existing system is not user friendly.


System is not well organized and precise.
It is time consuming.
Information is redundant and inconsistent.
It didn’t integrate all the modules.
Decision making is difficult.
It is not very cost effective.
Cannot connect to third-party tools to pull data.

2.2 PROPOSED SYSTEM

The proposed system uses processing 3.5.3 tool to visualize earthquake data in 3D as well as in
2D. Processing is a programming language and environment built on top of java. All the syntax
used is java syntax and it uses inbuilt libraries. The system contains two module. The one is for
coding and other uses image or any other requirements for the projects is stored.

The proposed system overcomes all the drawbacks of the existing examination system. Being an
online application it can be accessed from anywhere. It is fast, efficient and economical.
2.3 MOTIVATION

The need for interoperable Disaster Management Information system that allow for multi-tier
decision making process and engage different departments concerned with DM/EM issues.

The need for effective governmental organizational response to disasters that can address various
aspects of systematic and jurisdictional considerations.

The need for Multi-dimensional visualization tool that can provide the ease of use for non GIS
professional.

3. SOFTWARE REQUIREMENT SPECIFICATION

3.1 ANALYSIS PHASE

Systems analysis is the study of sets of interacting entities, including computer systems analysis.
This field is closely related to operations research. It is also an explicit formal inquiry carried out
to help someone (referred to as the decision maker) identify a better course of action and make a
better decision than he might otherwise have made.”

3.1.1 FUNCTIONAL REQUIREMENTS


The purpose of a functional specification is to define the requirements to be implemented by the
software solution. Processing tool is used for this visualization. It is a programming language and
environment built on top of java. All the syntax used is java syntax.

About processing tool


Processing tool is used for this visualization. It is a programming language and environment built
on top of java. Processing was started by Ben Fry and Casey Reas in the spring of 2001, while
both were graduate students at the MIT Media Lab within John Maeda's Aesthetics and
Computation research group. The Processing Environment includes a text editor, a compiler, and
a display window. It enables the creation of software within a carefully designed set of
constraints. Processing software includes the original Processing (Java), p5.js (JavaScript), and
Processing.py (Python).

Download and install processing from "https://processing.org/download"


I have used processing 3.5.3.
Open it. You will find different folder and file are as follows:
core
data
java
lib
modes
tools
processing
processing-java
revisions

Open processing-java, you will notice "welcome screen" java.


Open sketch-book and start coding in the editor/workspace.
Error messages along with line numbers will show in the console below and it will show at the
moment you type mistake syntax or word. This is best about processing.
Click "run" to run your sketch.

Overview
The Processing Development Environment (PDE) makes it easy to write Processing programs.
Programs are written in the Text Editor and started by pressing the Run button. In Processing, a
computer program is called a sketch. Sketches are stored in the Sketchbook, which is a folder on
your computer.

Sketches can draw two- and three-dimensional graphics. The default renderer is for drawing two-
dimensional graphics. The P3D renderer makes it possible to draw three-dimensional graphics,
which includes controlling the camera, lighting, and materials. The P2D renderer is a fast, but
less accurate renderer for drawing two-dimensional graphics. Both the P2D and P3D renderers
are accelerated if your computer has an OpenGL compatible graphics card.

The capabilities of Processing are extended with Libraries and Tools. Libraries make it possible
for sketches to do things beyond the core processing code. There are hundreds of libraries
contributed by the Processing community that can be added to your sketches to enable new
things like playing sounds, doing computer vision, and working with advanced 3D geometry.
Tools extend the PDE to help make creating sketches easier by providing interfaces for tasks like
selecting colors.

Processing has different programming modes to make it possible to deploy sketches on different
platforms and program in different ways. The Java mode is the default. Other programming
modes may be downloaded by selecting "Add Mode..." from the menu in the upper-right corner
of the PDE.

Top Processing Development Environment (PDE)

The Processing Development Environment (PDE) consists of a simple text editor for writing
code, a message area, a text console, tabs for managing files, and a toolbar with buttons for
common actions, and a series of menus. The menus options change from mode to mode. The
default Java mode is documented here.

Programs written using Processing are called sketches. These sketches are written in the text
editor. It has features for cutting/pasting and for searching/replacing text. The message area gives
feedback while saving and exporting and also displays errors. The console displays text output
by Processing sketches including complete error messages and text output from sketches with the
print() and println() functions. (Note that the console works well for occasional messages, but is
not intended for high-speed, real-time output.)

The buttons on the toolbar can run and stop programs:

Run
Runs the sketch. In Java mode, it compiles the code and opens a new display window.

Stop
Terminates a running sketch.
Additional commands are found within the six menus: File, Edit, Sketch, Debug, Tools, and
Help. The menus are context sensitive which means only those items relevant to the work
currently being carried out are available.

File:

New
Creates a new sketch in a new window, named as the current date is the format
"sketch_YYMMDDa".
Open...
Open a sketch in a new window.

Open Recent
Select a sketch to open from the list of recently closed sketches.

Sketchbook...
Open a new window to show the list of sketches in the sketchbook.

Examples...
Open a new window to show the list of the examples.

Close
Close the sketch in the front most window. If this is the last sketch that's open, you will be
prompted whether you would like to quit. To avoid the prompt, use Quit instead of Close when
you want to exit the application.

Save
Saves the open sketch in its current state.

Save as...
Saves the currently open sketch, with the option of giving it a different name. Does not replace
the previous version of the sketch.

Export
Exports a Java application as an executable file and opens the folder containing the exported
files.

Page Setup
Define page settings for printing.

Print (Ctrl+P)
Prints the code inside the text editor.

Preferences
Change some of the ways Processing works. (This item is located in the

Processing menu on Mac OS X.)


Quit
Exits the Processing Environment and closes all Processing windows. (This item is located in the
Processing menu on Mac OS X.)

Edit:

Undo
Reverses the last command or the last entry typed. Cancel the Undo command by choosing Edit
» Redo.

Redo
Reverses the action of the last Undo command. This option is only available if there has already
been an Undo action.

Cut
Removes and copies selected text to the clipboard (an off-screen text buffer).

Copy
Copies selected text to the clipboard.

Copy as HTML
Formats code as HTML in the same way it appears in the Processing environment and copies it
to the clipboard so it can be pasted somewhere else.

Paste
Inserts the contents of the clipboard at the location of the cursor, and replaces any selected text.

Select All
Selects all of the text in the file which is currently open in the text editor.

Auto Format
Attempts to format the code into a more human-readable layout. Auto Format was previously
called Beautify.

Comment/Uncomment
Comments the selected text. If the selected text is already commented, it uncomments it.

Increase Indent
Indents the selected text two spaces.
Decrease Indent (Ctrl+I)
If the text is indented, removes two spaces from the indent.

Find...
Finds an occurrence of a text string within the file open in the text editor and gives the option to
replace it with a different text.

Find Next
Finds the next occurrence of a text string within the file open in the text editor.

Find Previous
Finds the previous occurrence of a text string within the file open in the text editor.

Use Selection for Find


Sets the currently selected text as the item to find with Find Next and Find
Previous.

Sketch:

Run
Runs the code (compiles the code, opens the display window, and runs the sketch inside)

Present
Runs the code in the center of the screen with a solid-color background. Click the "stop" button
in the lower left to exit the presentation or press the Escape key. Change the background color in
the Preferences.

Tweak
Runs the code in a way where some color and variable values can be changed while the code is
running. The sketch needs to be saved before it can be run as a sketch to tweak.

Stop
If the code is running, stops the execution. Programs written without using the draw () function
are stopped automatically after they draw.

Import Library
Adds the necessary import statements to the top of the current sketch. For example, selecting
Sketch » Import Library » pdf adds the statement "import processing.pdf.*;" to the top of the file.
These import statements are necessary for using Libraries. Select Add Libraries... to open the
Library Manager to browse and install new libraries.

Show Sketch Folder


Opens the folder for the current sketch.

Add File...
Opens a file navigator window. Select an image, font, or other media files to add it to the sketch's
"data" folder.

Debug:

Enable Debugger
Activates the debugger. Note that the Run button will change to Debug. New
Continue and Step buttons will appear, along with a separate window for viewing variable
values.

Continue
Advances the code until the next breakpoint.

Step
Advances the code one line at a time. (Note that once the code reaches the end of the current
function call, the debugger will revert to "continue.")

ff

Step Into
Advances the debugger into the interior of a function call. This only works for user-defined
functions in the sketch.

Step Out
Advances the debugger outside of a function to the calling area. This only works for user-defined
functions in the sketch.

Toggle Breakpoint
Add or remove a breakpoint. When a breakpoint is added, the line number is replaced with the
symbol: <>.
Tools:

Create Font...
Converts fonts into the Processing font format (VLW) and adds to the current sketch. Opens a
dialog box that gives options for setting the font, its size, if it is anti-aliased (smooth), and which
characters to be generated. The amount of memory required for the font is determined by the size
selected and the number of characters selected through the "Characters..." menu; Processing
fonts are textures, so larger fonts require more image data. Fonts can also be created in the code
with the createFont () function.

Color Selector...
Interface for selecting colors. For each color, the HSB, RBG, and Hex values are shown. The
Hex value can be copied into the clipboard with the Copy button.

Archive Sketch
Archives a copy of the current sketch in .zip format. The archive is placed in the same folder as
the sketch.

Install "processing-java"
Installs the processing-java program to make it possible to build and run Java mode sketches
from the command line.

Movie Maker
Creates a QuickTime movie from a sequence of images. Options include setting the size, frame
rate, and compression, as well as an audio file.

Add Tool...
Opens the Tool Manager to browse and install new Tools.

Help:

Environment
Opens the reference for the Processing Development Environment (this page) in the default web
browser.

Reference
Opens the reference in the default web browser. Includes references for the language,
programming environment, and core libraries.
Find in Reference
Select an element of the Processing language in the text editor and select find in Reference to
open that page in the default web browser.

Libraries Reference
Select from the list to open the reference for compatible Libraries.

Tools Reference
Select from the list to open the reference for compatible Tools.

Getting Started
Opens the online Getting Started tutorial in the default browser.

Troubleshooting
Opens the online Troubleshooting wiki page in the default browser.

Frequently Asked Questions


Opens the online FAQ wiki page in the default browser.

The Processing Foundation


Opens the Foundation website in the default browser.

Visit Processing.org
Opens Processing website in the default browser.

Top Preferences:

The Processing Development Environment (PDE) is highly configurable. The most common
preferences can be modified in the Preferences window, located in the File menu on Windows
and Linux and in the Processing menu on Mac Os X. The full list of preferences are stored in the
"preferences.txt" file. This file can be opened and edited directly only when Processing is not
running. You can find the location of this file on your computer by reading the bottom-left
corner of the Preferences window.

Sketchbook location
Any folder can be used as the Sketchbook. Input a new location or select "Browse" to set the
folder you want to use.
Language
Select the language to use for the menus. Processing needs to be restarted after making a new
selection.
Editor and Console font
Select a different font to use for text in the Editor and Console. Note: the selected font should
match the language used in the Text Editor. See the "Enable complex text input" preference
below.
Editor font size
Sets the font size of the code in the text editor.
Console font size
Sets the font size of the text in the console.
Background color when presenting
Defined the background color used when a sketch is run with Present.
Use smooth text in editor window
By default, the text in the editor is aliased. When checked, the editor switches to an anti-aliased
(smoothed) font. Restart Processing after making this change.
Enable complex text input
Enables the Text Editor to display non-Latin fonts such as Japanese. Processing needs to be
restarted after making this selection.
Continuously check for errors and Show warnings
Turn on and off the features that continuously check for and report potential code errors.
Code completion with Ctrl-space
Turn on and off code completion. Press Ctrl-space to activate code completion while typing.
Suggest import statements
When checked, Processing will try to suggest libraries to import when code from that library is
detected.
Increase maximum available memory
Allocates more RAM to Processing sketches when they run. Sketches that use media files
(images, audio, etc.) sometimes require more RAM. Increase the amount of RAM if a sketch is
throwing Out of Memory Errors.
Delete previous folder on export
When checked (default behavior), Processing deletes the complete export folder before re-
creating it and adding the new media.
Check for updates on startup
When checked (default behavior), you'll be informed of new Processing software releases as they
become available through a small dialog box that opens as Processing starts.
Run sketches on display
If more than one monitor is attached, select the monitor on which to display the sketch.
Top Sketches and Sketchbook
All Processing projects are called sketches. Each sketch has its own folder. The main file for
each sketch has the same name as the folder and is found inside. For example, if the sketch is
named "Sketch_123", the folder for the sketch will be called "Sketch_123" and the main file will
be called "Sketch_123.pde". The PDE file extension is an acronym for the Processing
Development Environment.

Processing sketches can be stored anywhere on your computer, but by default they are stored in
the sketchbook, which will be in different places on your computer or network depending if you
use PC, Mac, or Linux and how the preferences are set. To locate this folder, select the
"Preferences" option from the File menu (or from the "Processing" menu on the Mac) and look
for the "Sketchbook location."

A sketch folder sometimes contains other folders for media files and other code. When a font or
image is added to a sketch by selecting "Add File..." from the Sketch menu, a "data" folder is
created. Files may also be added to your Processing sketch by dragging them into the text editor.
Image and sound files dragged into the application window will automatically be added to the
current sketch's "data" folder. All images, fonts, sounds, and other data files loaded in the sketch
must be in this folder.

Top Renderers:

Processing has four built-in screen renderers. The default renderer is for drawing two-
dimensional shapes. P2D is a faster, but less accurate renderer for drawing two-dimensional
shapes. P3D is for three-dimensional geometry; it can also control the camera, lighting, and
materials. The P2D and P3D renderers are accelerated if your computer has an OpenGL
compatible graphics card. The smooth () function affects the amount of antialiasing for each
renderer. Check the reference for smooth () for more information.

With the release of Processing 3.0, the FX2D renderer is included. Use it for fast 2D graphics on
large and high resolution displays for more speed than the default renderer. This renderer is still
experimental, but it useful for certain conditions.

The renderer used for each sketch is specified through the size () function. If a renderer is not
explicitly defined in size (), it uses the default renderer as shown in the following program:

void setup() {
size(200, 200);
}

void draw() {
background(204);
line(width/2, height/2, mouseX, mouseY);
}
To change the renderer, add a third parameter to size(). For example:
void setup() {
size(200, 200, P2D);
}

void draw() {
background(204);
line(width/2, height/2, mouseX, mouseY);
}
A large effort has been made to make Processing code behave similarly across the different
renderers, but there are currently some inconsistencies that are explained in the reference.

For more information, see the size() reference entry.

Tabs, Multiple Files, and Classes


It can be inconvenient to write a long program within a single file. When Processing sketches
grow to hundreds or thousands of lines, breaking them into modular units helps manage the
different parts. Processing manages files with the Sketchbook and each sketch can have multiple
files that are managed with tabs.

The arrow button to the right of the tabs in the Processing Development Environment is used to
manage these files. Click this button to reveal options to create a new tab, rename the current tab,
and delete the current tab. Tabs are intended for more advanced users, and for this reason, the
menu that controls the tabs is intentionally made less prominent.

Advanced

When a program with multiple tabs is run, the code is grouped together and the classes in other
tabs become inner classes. Because they're inner classes, they cannot have static variables.
Simply place the "static" variable outside the class itself to do the same thing (it need not be
explicitly named "static" once you list it in this manner). If you don't want code to be an inner
class, you can also create a tab with a ".java" suffix, which means it will be interpreted as straight
java code. It is also not possible to use static classes in separate tabs. If you do this, however,
you'll need to pass the PApplet object to that object in that tab in order to get PApplet functions
like line (), loadStrings () or saveFrame () to work.
Top Debug
The Processing Debugger is a tool for diagnosing problems with a sketch. Enable it to pause a
sketch while running and advance through the code one line at a time. The debugger is enabled
through the File menu (Debug > Enable Debugger) or by clicking the Debugger icon, the
butterfly in the upper-right corner of the PDE.
When the Debugger is enabled, the program runs as normal, but stops at "breakpoints." To create
a breakpoint, set the cursor at the line you want to pause the sketch and select Debug > Toggle
Breakpoint. The keyboard shortcut is Command-B. To remove the breakpoint, select Toggle
Breakpoint again. When a breakpoint is added, the line number is replaced with the symbol: <>.

Running the sketch in Debug mode causes the sketch to pause at any breakpoints. When paused,
current variable values are visible in a separate pane. You can advance to the next breakpoint by
selecting "Continue" or advance line by line through the code with "Step". Stepping only works
within the scope of the current function being run.

Top Programming Modes


Processing has different programming modes to make it possible to deploy sketches on different
platforms and program in different ways. The current default programming mode is Java mode.
Other programming modes such as Android Mode and Python are added by selecting "Add
Mode..." from the menu in the upper-right corner of the PDE.

Java Mode
This mode makes it possible to write short programs to draw to the screen, but also enables
complex Java programs as well. It can be used simply by beginners, but it scales to professional
Java software development. Sketches written in this mode can be exported as Java Applications
to run on Linux, Mac OS X, and Windows operating systems.

Advanced

Java files with the extension .java can be included with a Java mode sketch. They may be created
directly in the PDE or copied into the sketch folder through the "Add File..." item in the Sketch
menu or dragged into the text editor. It's possible to write any Java code in files with the .java
extension. In fact, complete Java code can be written from inside the Processing Environment by
sub classing PApplet like this:

public class My Demo extends PApplet {

This is for advanced developers only and is not really recommended. Using this technique means
that any additional tabs will no longer be inner classes, meaning you'll have to do extra work to
make them communicate properly with the host PApplet. It is not necessary to use this technique
just to get features of the Java language. Advanced developers can also program with Processing
in another Java Editor if higher-level code editing and tools are needed. Processing's core.jar can
be used as a part of any Java project.
Top Adding Libraries, Tools, and Modes
Processing 3.0 includes a set of features to make it easier to install, update, and remove Libraries,
Tools, Modes, and Examples.

Add a contributed library by selecting "Add Library..." from the "Import Library..." submenu
within the Sketch menu. This opens the Library Manager. Next, select a library and then click on
Install to download it.

Add a contributed tool by selecting "Add Tool..." from the Tools menu, then select a Tool to
download from the Tool Manager.

Add contributed modes by selecting "Add Mode..." from the Mode menu in the upper-right
corner of the PDE, then select a Mode to install.

Add contributed Examples by first opening the "Examples..." submenu from the File menu.
Click on the Add Examples button to open the Examples Manager. Next, select an examples
package and select Install to download.

Top Export
The Export information and Tips page on the Processing Wiki covers the details of exporting
Applications from Java mode.
3.1.2 NON-FUNCTIONAL REQUIREMENTS

This section includes performance of the product that is set by user interaction and studying the
existing system of the organization. These are stated in complete measurable terms, so that they
can be verified during system evaluation phase.

Advantage of processing:

• It is very easy to download and install

• It allows immediate programming with an easy entrance

• It allows full screen (!) or window exes on Win, Linux and Mac, it allows browser based
Apps and even Android

• It is very well documented with lots of examples and fantastic tutorials

• It is inexhaustible for bigger projects with lots of library’s

• Very helpful forum and a great community

• We can even turn to eclipse or JAVA easily

• Additional modes for Android and JavaScript

• Powerful graphics support e.g. OpenGL and Retina displays


4. DESIGN

4.1 SYSTEM DESIGN

The most creative and challenging phase of the life cycle is system design. The term design
describes a final system and the process by which it is developed. It refers to the technical
specifications. The designers goal is how the output is to be produced and in what format.
Samples of the output and input are also presented. Second input data have to be designed to
meet the requirements of the proposed output. The processing phases are handled through the
program Construction and Testing. Finally, details related to justification of the system.

4.1.1 INPUT DATA

The following are the earthquake data used in this system for data visualization. Data is taken
from USGS (US GEOLOGICAL SURVEY) for visualization.

Here are few sample input:


4.1.2 ER-DIAGRAM

Start

Processing tool

Write code

Upload CSV file for visualization

Run

Pre Process

Output

Visualize

Interpretation of results

End
4.1.3 SYSTEM DIAGRAM
4.1.4 METHODOLOGY

There are actually many earthquake dataset available on the internet, especially from the
earthquake or geology organization websites. It took me quite some time to seek the suitable one.
I finally picked the significant earthquake dataset from USGS.

I have used processing tool for visualization.

Basic Principle of Ray Casting Volume Rendering Algorithm in processing

Basic Principle of Ray Casting Volume Rendering Algorithm Ray Casting is the most commonly
used in the direct volume rendering algorithm, and it is a classical algorithm of volume rendering
based on image empty scanning. In the ray casting volume rendering algorithm, firstly, it needs
some pretreatment, such as, format the data in the data field, delete redundant data and store the
data with the required format. In order to reasonably and clearly show all sorts of different
material or different properties of a substance at the same time, the data need to be classified,
according to the size of the data values. All data is divided into several classes, and set the
corresponding mapping relationship between all classes of data and the color and opacity values.
Then re-sampling is conducted, takes each pixel on the screen as a starting point, launches a light
through the entire three-dimensional data field along the view direction, selects K equal interval
sampling points along the emission light, does thrice linear interpolation with the color value and
opacity value of the eight grid point closest to the sample point to calculate this sampling point's
opacity value and color value, and converts it into the corresponding image space coordinates.
And then, in turn from the front to rear, synthesizing the color value and opaque value of each
sample point to get color values of the pixel. Each pixel is calculated as the above to get the
whole image finally

3D Seismic Data Field Visualization Display System

3D seismic data field Visualization display system in this paper uses data visualization
technology, which displays 3d earthquake data in the form of three-dimensional and two-
dimensional surface to the user, to achieve the effect of the three-dimensional interpretation for
3d data
5. IMPLEMENTATION

5.1 LINES OF CODE

1. M6.0+ Earthquake from January 2000 to May 2018

sketch_190501a(file name)

// 3D Earthquake Data Visualization V2, Processing.JS version


// By: Niels J-L
// Date: May 12, 2018
//
// Originally: Coding Challenge #058: 3D Earthquake Data Visualization
// By: Daniel Shiffman, http://codingtra.in
// Date: February 20, 2017
// Video: https://www.youtube.com/watch?v=dbs4IYGfAXc
//
// Earthquake data (CSV format) gathered from USGS web site:
// https://earthquake.usgs.gov/earthquakes/search/
//
// Version 2 - Using less data M6.0+, instead of M5.0+

/* @pjs preload="land_shallow_topo_1024_inverted.jpg"; */

float angleY = 0.0;


float angleZ = 0.0;
float angleZdir = 0.003;

//Table quakeTable;
float r = 275; // Radius of globe

PImage earth;
PShape globe;

Earthquake[] listOfQuakes;
void setup() {
String table[];

size(800, 800, P3D);

earth = loadImage("land.jpg");

// Processing.JS does not support loadTable() yet!


//table =
loadTable("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_day.csv",
"header");
//table =
loadTable("http://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv",
"header");
//table = loadTable("all_2010s_M5plus.csv", "header");
//int rowNum = quakeTable.getRowCount();
//listOfQuakes = new Earthquake[rowNum];

// Note: When using loadStrings() the first line is the header so ignore it!
table =
loadStrings("https://www.openprocessing.org/sketch/549624/files/all_2000s_M6plus.csv");
int rowNum = table.length;
listOfQuakes = new Earthquake[rowNum - 1];

//println("# earthquakes = " + rowNum);

// Create the earthquake objects [using loadTable()]


//int i = 0;
//for (TableRow row : table.rows()) {
// float lat = row.getFloat("latitude");
// float lon = row.getFloat("longitude");
// float mag = row.getFloat("mag");
// listOfQuakes[i] = new Earthquake(mag, lat, lon);
// i++;
//}

// Create the earthquake objects [using loadStrings()]


for (int i = 1; i < rowNum; i++) {
String[] tokens = split(table[i], ",");
// 4 - mag, 1 - latitude, 2 - longtitude
listOfQuakes[i - 1] = new Earthquake(Float.parseFloat(tokens[4]), Float.parseFloat(tokens[1]),
Float.parseFloat(tokens[2]));
}

noStroke();

//globe = createShape(SPHERE, r);


//globe.setTexture(earth);

frameRate(12);
}

void draw() {
background(15);

lights();

fill(255, 255, 0, 127);


textSize(20);
textAlign(CENTER);
text("M6.0+ Earthquakes from Jan. 2000 to May 2018", width / 2, 30);

textSize(12);
textAlign(LEFT);
text("fps :" + int(frameRate), 10, 30);

translate(width / 2, height / 2);

rotateY(angleY);
angleY += 0.005;
rotateZ(angleZ);
if ( (angleZ < 0.0) || (angleZ > PI / 4.0) ) angleZdir *= -1.0;
angleZ += angleZdir;

fill(200);
noStroke();

//sphere(r);
//shape(globe);
makeSphere(r, earth);

for (Earthquake q : listOfQuakes) {


q.drawQuake();
}
}

class Earthquake {
float lat; // Latitude
float lon; // Longitude
float mag; // Magnitude

float theta; // Based on latitude


float phi; // Based on longitude

PVector pos; // 3D cartesian coords for position

float h; // Height on globe

// Constructor
Earthquake(float magnitude, float latitude, float longitude) {
mag = magnitude;
lat = latitude;
lon = longitude;

float theta = radians(lat); // Latitude is between -180 and 180 deg


float phi = radians(lon) + PI;

// In OpenGL: y & z axes are flipped from math notation of spherical coordinates
float x = r * cos(theta) * cos(phi);
float y = -r * sin(theta);
float z = -r * cos(theta) * sin(phi);

pos = new PVector(x, y, z);


h = pow(10, mag);
}

void drawQuake() {
float maxh = pow(10, 7);
float boxh = map(h, 0, maxh, 10, 100);
PVector xaxis = new PVector(1, 0, 0);
float angleb = PVector.angleBetween(xaxis, pos);
PVector raxis = xaxis.cross(pos);

pushMatrix();
translate(pos.x, pos.y, pos.z);
rotate(angleb, raxis.x, raxis.y, raxis.z);
fill(255, 255, 255, 127);
box(boxh, 1, 1);
popMatrix();
}
}

// makeSphere() code from Darby Rathbone's "textured sphere"


// see: https://www.openprocessing.org/sketch/97273
void makeSphere(float mag, PImage pg) {
float x1, x2, x3, x4, y1, y2, y3, y4, z1, z2, z3, z4;
float hd = 14;
float vd = 14;

noStroke();

//pg.noStroke();
beginShape(QUADS);
//texture(pg.get());
texture(pg);

for (int i = 0; i < (2.0 * vd); i++) {


for (int j = 0; j < hd; j++) {
x1 = cos(i/vd*PI*1.0);
x1 *= mag*sin(j/hd*PI);
x2 = cos((i+1)/vd*PI*1.0);
x2 *= mag*sin(j/hd*PI);
x3 = cos(i/vd*PI*1.0);
x3 *= mag*sin((j+1)/hd*PI);
x4 = cos((i+1)/vd*PI*1.0);
x4 *= mag*sin((j+1)/hd*PI);
y1 = cos(j/hd*PI);
y1 *= mag;
y2 =cos(j/hd*PI);
y2 *= mag;
y3 =cos((j+1)/hd*PI);
y3 *= mag;
y4 =cos((j+1)/hd*PI);
y4 *= mag;
z1 = sin(i/vd*PI*1.0);
z1 *= mag*sin(j/hd*PI);
z2 = sin((i+1)/vd*PI*1.0);
z2 *= mag*sin(j/hd*PI);
z3 = sin(i/vd*PI*1.0);
z3 *= mag*sin((j+1)/hd*PI);
z4 = sin((i+1)/vd*PI*1.0);
z4 *= mag*sin((j+1)/hd*PI);

vertex(x1, y1, z1, i/vd*pg.height, j/(hd*2.0)*pg.width);


vertex(x3, y3, z3, i/vd*pg.height, (j+1)/(hd*2.0)*pg.width);
vertex(x4, y4, z4, (i+1)/vd*pg.height, (j+1)/(hd*2.0)*pg.width);
vertex(x2, y2, z2, (i+1)/vd*pg.height, j/(hd*2.0)*pg.width);
}
}
endShape();
}
5.2 OUTPUT

3D EATHQUAKE VISUALIZATION

M6.0+ Earthquake from January 2000 to May 2018


2. Past 30 Days - 3D Earthquake visualization

// Daniel Shiffman
// http://codingtra.in
// Earthquake Data Viz
// Video: [coming soon]

float angle;

Table table;
float r = 200;

PImage earth;
PShape globe;

void setup() {
size(600, 600, P3D);
earth = loadImage("earth.jpg");
// table =
loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/significant_day.csv",
"header");

// 2019 year month : may


table = loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv",
"header");
//table =
loadTable("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv",
"header");

noStroke();
globe = createShape(SPHERE, r);
globe.setTexture(earth);
}

void draw() {
background(51);
translate(width*0.5, height*0.5);
rotateY(angle);
angle += 0.05;

lights();
fill(200);
noStroke();
//sphere(r);
shape(globe);

for (TableRow row : table.rows()) {


float lat = row.getFloat("latitude");
float lon = row.getFloat("longitude");
float mag = row.getFloat("mag");

// original version
// float theta = radians(lat) + PI/2;

// fix: no + PI/2 needed, since latitude is between -180 and 180 deg
float theta = radians(lat);

float phi = radians(lon) + PI;

// original version
// float x = r * sin(theta) * cos(phi);
// float y = -r * sin(theta) * sin(phi);
// float z = r * cos(theta);

// fix: in OpenGL, y & z axes are flipped from math notation of spherical coordinates
float x = r * cos(theta) * cos(phi);
float y = -r * sin(theta);
float z = -r * cos(theta) * sin(phi);

PVector pos = new PVector(x, y, z);

float h = pow(10, mag);


float maxh = pow(10, 7);
h = map(h, 0, maxh, 10, 100);
PVector xaxis = new PVector(1, 0, 0);
float angleb = PVector.angleBetween(xaxis, pos);
PVector raxis = xaxis.cross(pos);
pushMatrix();
translate(x, y, z);
rotate(angleb, raxis.x, raxis.y, raxis.z);
fill(255);
box(h, 5, 5);
popMatrix();
}
}
OUTPUT:
3. 2D Visualization of Earthquake data of past few days 2019

// Daniel Shiffman
// http://codingtra.in
// Earthquake Data Viz
// Video: https://youtu.be/ZiYdOwOrGyc

PImage mapimg;

int clat = 0;
int clon = 0;

int ww = 1024;
int hh = 512;

int zoom = 1;
String[] earthquakes;

float mercX(float lon) {


lon = radians(lon);
float a = (256 / PI) * pow(2, zoom);
float b = lon + PI;
return a * b;
}

float mercY(float lat) {


lat = radians(lat);
float a = (256 / PI) * pow(2, zoom);
float b = tan(PI / 4 + lat / 2);
float c = PI - log(b);
return a * c;
}

void setup() {
size(1024, 512);
// The clon and clat in this url are edited to be in the correct order.
String url = "https://api.mapbox.com/styles/v1/mapbox/dark-v9/static/" +
clon + "," + clat + "," + zoom + "/" +
ww + "x" + hh +

"?access_token=pk.eyJ1IjoiY29kaW5ndHJhaW4iLCJhIjoiY2l6MGl4bXhsMDRpNzJxcDh0a2N
hNDExbCJ9.awIfnl6ngyHoB3Xztkzarw";
mapimg = loadImage(url, "jpg");
println(url);
// earthquakes =
loadStrings("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_day.csv");
earthquakes =
loadStrings("https://earthquake.usgs.gov/earthquakes/feed/v1.0/summary/all_month.csv");

translate(width / 2, height / 2);


imageMode(CENTER);
image(mapimg, 0, 0);

float cx = mercX(clon);
float cy = mercY(clat);

for (int i = 1; i < earthquakes.length; i++) {


String[] data = earthquakes[i].split(",");
//console.log(data);
float lat = float(data[1]);
float lon = float(data[2]);
float mag = float(data[4]);
float x = mercX(lon) - cx;
float y = mercY(lat) - cy;
// This addition fixes the case where the longitude is non-zero and
// points can go off the screen.
if(x < - width/2) {
x += width;
} else if(x > width / 2) {
x -= width;
}
mag = pow(10, mag);
mag = sqrt(mag);
float magmax = sqrt(pow(10, 10));
float d = map(mag, 0, magmax, 0, 180);
stroke(255, 0, 255);
fill(255, 0, 255, 200);
ellipse(x, y, d, d);
}
}

OUTPUT:
LAST 7 YAER DATA OF EARTHQUAKES WITH MAGNITUDE 6.2
LAST 7 YAER DATA OF EARTHQUAKES WITH MAGNITUDE 5.4+
LAST 7 YAER DATA OF EARTHQUAKES WITH MAGNITUDE 4+
Recent earthquakes

China region

Russian region
Worldwide seismicity map (1900-2013)

Seismicity in the Himalaya region


6. LIMITATIONS

Processing is a programming language, meaning that it is low level. You don't have a Game
Engine, you can't just check in a car or an enemy, you don't have sprites directly at hand. You
can't have a message box or an input box or draw a GUI.

7. CONCLUSION

Very large, complex scientific data acquired in many research areas creates critical challenges
for scientists to understand, analyze, and organize their data. The objective of this project is to
visualize the earthquake which occurs in the lazy few years with the help of processing software
visualization tools that can assist domain scientists with their requirements in multiple phases of
scientific discovery and help to predict the future occurrence earthquake and take precautions.

The software supports the user of the earthquake observatory to analyses the earthquake data
.Another aspect of the Software is the visualization of the data, which is accomplished and
archived by the earthquake observatory.
8. REFERENCES

1. Spherical Coordinates System on Wikipedia: https://en.wikipedia.org/wiki/Spheric...

2. USGS Earthquake Data: http://earthquake.usgs.gov/data/

3. Cross Product Diagram: https://de.wikipedia.org/wiki/Kreuzpr...

4. Natural Earth Texture Maps: http://www.shadedrelief.com/natural3/...

5. Nasa Earth Maps:http: //visibleearth.nasa.gov/view_cat...

6. Euler Angle on Wikipedia: https://en.wikipedia.org/wiki/Euler_a...

7. Quaternion and spatial rotation on Wikipedia: https://en.wikipedia.org/wiki/Quatern...

8. https://earthquake.usgs.gov/earthquakes/feed/v1.0/csv.php

9. https://www.ktbyte.com/projects

Vous aimerez peut-être aussi