PyGMT library in Python made plotting high-resolution topographic maps a breeze. It comes packaged with shorelines, country borders and topographic data. Often, we need to highlight arbitrarily selected polygon shapes or regions on a map using available shapefile (SHP) data.

Photo by Andrew Stutesman on Unsplash

In this post, we will see how we can overlay shapefile data on top of the PyGMT map using geopandas library. Here, for example, I obtained the counties data available in .shp format from, and overlay it on the high-resolution map of Taiwan.

Import libraries

We will use the geopandas library to read the .shp files.

import pygmt
import os
import geopandas as…

Earthquake data on a map (Image by author)

In this post, we will first read a CSV file with earthquake locations (latitudes, and longitudes), magnitudes, and depths, and then overlay it on a topographic map. The topographic data are downloaded automatically using PyGMT API.

Read the CSV file for events data

I have a CSV file containing the earthquake events data. The data is obtained from the PyGMT example dataset. It can be obtained and saved locally:

data = pygmt.datasets.load_japan_quakes()
data.to_csv('my_events_data.csv', index=False)

The data is tabular, so we can read it using the pandas’ read_csv method.

import pandas as pd# this file is retrieved from the pygmt dataset
data = pd.read_csv('my_events_data.csv')

Plot the data on a topographic map

First, we define…

Photo by Stephen Kraakmo on Unsplash

Wavelets analysis can be thought of as a general form of Fourier Analysis. Fourier Transform is often used in denoising the signals. Still, the biggest downside of this approach is that the signal needs to be stationary. Most of our real-world measurements are not stationary. Also, in Fourier-based denoising, we apply a lowpass filter to remove the noise. However, when the data has high-frequency features such as spikes in a signal or edges in an image, the lowpass filter smooths these out.

Here, the wavelet-based approach might have some advantages. Wavelets look at the signals in the multi-resolution window. It…

iPad is not a computer but it has the potential to be. A computer is a computer, don’t make it an iPad.

You must have come across the ad about the iPad Pro: “What’s a computer?”. From those ads, I derived that Apple is trying to converge the iPad Pro towards a real computer. However, recent moves from Apple are showing that it is rather trying to converge a computer towards an iPad!

Photo by Henry Ascroft on Unsplash

Apple made the iPad fast, probably much faster than many Intel-based computers. It has a touch screen that Macs have never got (and probably will never get) and it often comes in handy in some quick and easy tasks. Recently, Apple introduced the M1 chip into the iPad…

I obtained the image data from Unsplash. I downloaded 42 cat images, 46 dog images, and 35 horse images for the input into the pre-trained Alexnet model in MATLAB. For details about the Alexnet network in MATLAB, see its documentation.

Photo by JJ Ying on Unsplash


AlexNet is a convolutional neural network that is 8 layers deep. The MATLAB has a pre-trained version of the network trained on more than a million images from the ImageNet database. The pre-trained network can classify images into 1000 predefined object categories.

The training for the 1000 object categories on a million images has made the network learn rich feature…

A wavelet series represents a real or complex-valued function by a certain orthonormal series generated by a wavelet. We cannot easily explain wavelet transform with a basic understanding of the Fourier Transform.

Photo by Kaleidico on Unsplash

Fourier Transform

The Fourier Transform is a useful tool to transform a signal from its time domain to its frequency domain. The peaks in the frequency spectrum correspond to the most occurring frequencies in the signal. The Fourier Transform is reliable when the frequency spectrum is stationary (the frequencies present in the signal are not time-dependent). …

One of the favorite parts of working in geophysics is without a doubt creating amazing visualizations. Visualizations are the best tool to effectively convey our findings to the scientific community.

GMT or generic mapping tools have become synonymous with plotting maps in Earth, Ocean, and Planetary sciences. It can be used for processing data, generating publication-quality illustrations, automating workflows, and even making awesome animations. Another great thing about GMT is that it supports many map projections and transformations and includes supporting data such as coastlines, rivers, and political boundaries, and optionally country polygons.

Photo by Ruthie on Unsplash

I have talked about GMT 5 and…

Photo by Marvin Meyer on Unsplash

Science is dependent on technology as much as technology is dependent on science. I love science, and I love technology. Both of them are complementing and impacting my research career. Before I talk about my favorites for the tech products, I want to tell you that I am a geophysical researcher with a strong inclination towards data science. What I have learned and achieved so far and where I am heading is largely because of my decisions about switching to some gadgets. …

Photo by Thai Nguyen on Unsplash

I love my iPhone 12 mini and would be sad if Apple decided to remove this model in the future. But at the same time, I am relieved that I already bought it and am secure for at least 2 to 3 years. The handling and performance of the iPhone 12 mini would give a satisfying feeling after coming from the ginormous iPhone 8 Plus for over three years.

Love of the iPhone Mini Form Factor

Every time I would see an iPod in the Apple store, I used to think that I wish Apple made a phone of the same form factor. I usually carry an…

Photo by David Clode on Unsplash

Since Python by itself is slow, it becomes important to know the nitty-gritty of different components of our code for efficiency. In this post, we will look into the most common ways we loop in Python using a simple summing example. We will also compute the memory profile to inspect which way is the most memory-efficient for analyzing huge datasets.

Utpal Kumar

Geophysics | Python | MATLAB | Productivity

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store