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).
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
.cshextension.
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.
This script merges multiple DEMNAS TIFF files into a single combined TIFF file.
Usage:
./combain_dem_demnas.cshWhat it does:
- Looks for files matching
DEMNAS_*.tifin the current directory. - Merges them into
Surabaya_demnas.tifusinggdal_merge.py. - Cleans up temporary files.
Note: The output filename is hardcoded as Surabaya_demnas. Modify the script if you need a different name.
This script converts a TIFF file to a GMT-compatible NetCDF grid file.
Usage:
./tiff2grd.cshWhat it does:
- Converts
Surabaya_demnas.tiftodem.grdusinggdal_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.
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_elevationParameters:
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 200What 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.
- Place your DEMNAS TIFF files (e.g.,
DEMNAS_*.tif) in the directory. - Run
./combain_dem_demnas.cshto merge them intoSurabaya_demnas.tif. - Run
./tiff2grd.cshto convert todem.grd. - Run
./Plot_DEMNAS_GMT.csh Surabaya_demnas.tif plot.eps 500to generate a plot.
- 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.
Feel free to contribute improvements or report issues.
For questions, contact raudlahhawin@gmail.com.