Skip to content

About

🌏Earthquake metadata extraction from GeoTIFF🗺️ provided by Quiet+ API (Japan)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Latest commit

 

History

2 Commits

Folders and files

Repository files navigation

Earthquake Extraction from Geotiff

🌏 Earthquake metadata extraction from GeoTIFF 🗺️ provided by Quiet+ API (Japan)

Process Overview

This project extracts seismic intensity data from GeoTIFF files obtained through Quiet+ API (Japan). The process involves:

  1. API Data Retrieval: Connect to Quiet+ API using Bearer token authentication to fetch earthquake records for the current month in JST timezone
  2. GeoTIFF Download: Download GeoTIFF files from the API endpoints, storing them locally in a download folder
  3. 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
  4. 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)
  5. 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

Installation

Due to the complexity of GDAL, it is recommended to use Conda instead of pip for installation.

  1. Install Miniconda.

  2. Open Anaconda Prompt

  3. Create Environment from YAML

    conda env create -f environment.yml
  4. (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

Run a script with Visual Studio Code

  1. To select a Python interpreter, open the Command Palette by pressing Ctrl+Shift+P (Windows, Linux)/Cmd+Shift+P (Mac).
  2. Click Python: Select Interpreter in the Command Palette and select the interpreter associated with your Anaconda environment.
  3. Finding your Anaconda Python interpreter path
    conda activate <ENV_NAME>
    where python
    The Python interpreter path will be: C:\Users\<YourUsername>\miniconda3\envs\myenv\python.exe

About

🌏Earthquake metadata extraction from GeoTIFF🗺️ provided by Quiet+ API (Japan)

Topics

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages