🌏 Earthquake metadata extraction from GeoTIFF 🗺️ provided by Quiet+ API (Japan)
This project extracts seismic intensity data from GeoTIFF files obtained through Quiet+ API (Japan). The process involves:
- API Data Retrieval: Connect to Quiet+ API using Bearer token authentication to fetch earthquake records for the current month in JST timezone
- GeoTIFF Download: Download GeoTIFF files from the API endpoints, storing them locally in a
downloadfolder - Coordinate-based Extraction: For specified latitude/longitude coordinates, extract seismic data using GDAL: Quiet+ Document
- Convert geographic coordinates (lat/lon) to pixel coordinates using geotransformation parameters
- Read values from three raster bands at the calculated pixel position
- Multi-band Data Processing: Extract three types of seismic measurements:
- Band 1: Seismic intensity (Shindo scale equivalent) using formula:
0.0256917 * raw_value + 0.4743083 - Band 2: Maximum ground acceleration (PGA) in cm/s² using:
10^(0.01255372 * raw_value + 0.288476275) - Band 3: Maximum ground velocity (PGV) in cm/s using:
10^(0.01255372 * raw_value - 0.711523725)
- Band 1: Seismic intensity (Shindo scale equivalent) using formula:
- Data Validation: Handle edge cases with bounds checking and return zero values for invalid pixels (raw value 0 or 255)
-
Sample output
INFO:root:Results for earthquake_3.gtiff: INFO:root: Seismic Intensity: 6.2292 INFO:root: Max Acceleration: 1260.4034 cm/s² INFO:root: Max Velocity: 126.0403 cm/s INFO:root:Processing earthquake 5/5
Due to the complexity of GDAL, it is recommended to use Conda instead of pip for installation.
-
Install Miniconda.
-
Open
Anaconda Prompt -
Create Environment from YAML
conda env create -f environment.yml
-
(Optional) If you want to create a new environment and install GDAL, use the following commands.
conda create -n <ENV_NAME> python=3.12 # Create a new environment (env name: e.g. pygdal) conda activate <ENV_NAME> # Activate a Specific Environment (env name: e.g. pygdal) conda install -c conda-forge gdal # Install GDAL from conda-forge:
-
Deactivate the environment:
conda deactivate conda env list # List All Conda environments conda list --name <ENV_NAME> # List Packages in a Specific Environment conda remove --name <ENV_NAME> package-name # Remove a package from <ENV_NAME> conda remove --name <ENV_NAME> --all # Remove a Conda Environment
-
Export Environment configuration to YAML
conda env export --name <ENV_NAME> > environment.yml
-
Verify installation:
from osgeo import gdal
- To select a Python interpreter, open the Command Palette by pressing Ctrl+Shift+P (Windows, Linux)/Cmd+Shift+P (Mac).
- Click
Python: Select Interpreterin the Command Palette and select the interpreter associated with your Anaconda environment. - Finding your Anaconda Python interpreter path
The Python interpreter path will be:
conda activate <ENV_NAME> where python
C:\Users\<YourUsername>\miniconda3\envs\myenv\python.exe