Skip to content

About

Config files for my GitHub profile.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

9 Commits

Folders and files

Repository files navigation

Combine-DEM-DEMNAS-Linux Scripts Guide

This repository contains CSH (C Shell) scripts for processing and visualizing DEMNAS (Digital Elevation Model of Indonesia) data. These scripts are designed to work with geospatial data, particularly DEM files in TIFF format, and utilize tools like GDAL and GMT (Generic Mapping Tools).

Prerequisites

Before running these scripts, ensure you have the following installed:

  • GDAL: For geospatial data processing (e.g., merging and converting TIFF files).
  • GMT (Generic Mapping Tools): For plotting and visualizing DEM data.
  • Bash shell: The scripts are written in Bash, despite the .csh extension.

You can install GDAL and GMT using your package manager:

  • On Ubuntu/Debian: sudo apt-get install gdal-bin gmt
  • On macOS: brew install gdal gmt
  • On Windows: Use WSL or install via conda/miniconda.

Scripts Overview

1. combain_dem_demnas.csh (Combine DEMNAS Data)

This script merges multiple DEMNAS TIFF files into a single combined TIFF file.

Usage:

./combain_dem_demnas.csh

What it does:

  • Looks for files matching DEMNAS_*.tif in the current directory.
  • Merges them into Surabaya_demnas.tif using gdal_merge.py.
  • Cleans up temporary files.

Note: The output filename is hardcoded as Surabaya_demnas. Modify the script if you need a different name.

2. tiff2grd.csh (Convert TIFF to GRD)

This script converts a TIFF file to a GMT-compatible NetCDF grid file.

Usage:

./tiff2grd.csh

What it does:

  • Converts Surabaya_demnas.tif to dem.grd using gdal_translate.
  • Assumes the input file is Surabaya_demnas.tif (output from the combine script).

Note: Input filename is hardcoded. Edit the script for different files.

3. Plot_DEMNAS_GMT.csh (Plot DEMNAS Data with GMT)

This script generates a shaded relief plot of DEMNAS data in EPS format using GMT.

Usage:

./Plot_DEMNAS_GMT.csh input.tif output.eps max_elevation

Parameters:

  • input.tif: The input DEMNAS TIFF file.
  • output.eps: The output EPS file for the plot.
  • max_elevation: The maximum elevation in meters for color scaling.

Example:

./Plot_DEMNAS_GMT.csh DEMNAS_0718-54_v1.0.tif DEMNAS_0718-54_v1.0.eps 200

What it does:

  • Extracts geographical bounds from the TIFF file.
  • Converts TIFF to NetCDF grid.
  • Creates a color palette and shaded relief.
  • Generates an EPS plot with the specified parameters.

Note: Requires GMT to be installed and properly configured.

Workflow Example

  1. Place your DEMNAS TIFF files (e.g., DEMNAS_*.tif) in the directory.
  2. Run ./combain_dem_demnas.csh to merge them into Surabaya_demnas.tif.
  3. Run ./tiff2grd.csh to convert to dem.grd.
  4. Run ./Plot_DEMNAS_GMT.csh Surabaya_demnas.tif plot.eps 500 to generate a plot.

Troubleshooting

  • Ensure all prerequisites are installed.
  • Check file permissions: Make scripts executable with chmod +x *.csh.
  • Verify input files exist and are in the correct format.
  • For GMT issues, consult the GMT documentation.

Contributing

Feel free to contribute improvements or report issues.

Contact

For questions, contact raudlahhawin@gmail.com.

About

Config files for my GitHub profile.

Topics

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages