Giter VIP home page Giter VIP logo

christiansteger / terrain3d Goto Github PK

View Code? Open in Web Editor NEW
4.0 1.0 0.0 6.3 MB

Three-dimensional visualisation of terrain data from digital elevation models (DEMs) or climate model topography with PyVista. A set of Python example scripts illustrates how this data can be plotted for various domains and with auxiliary information.

License: MIT License

Python 100.00%
python pyvista climate-model terrain

terrain3d's Introduction

Terrain3D

Three-dimensional visualisation of terrain data from digital elevation models (DEMs) or climate model topography with PyVista. A set of Python example scripts illustrates how this data can be plotted for various domains and with auxiliary information.

When you use Terrain3D, please cite:

DOI

Package dependencies

The following Python packages are required to run Terrain3D: NumPy, SciPy, Xarray, Numba, Shapely, descartes, Fiona, Rasterio, tqdm, requests, PyVista, Matplotlib, pyproj, cmcrameri, netCDF4, cartopy, xESMF, scikit-image and Pillow. Combining the individual output images of the example scripts tri_mesh_globe.py and triangles_terrain_horizon.py into a movie or GIF requires FFmpeg or ImageMagick, respecitvely.

Installation

First, create a Conda environment with all the required Python packages:

conda create -n terrain3d -c conda-forge numpy scipy matplotlib netcdf4 shapely xarray pyproj cartopy rasterio descartes fiona scikit-image numba xesmf cmcrameri tqdm requests pyvista pillow

and activate this environment. The Terrain3D package can then be installed with:

git clone https://github.com/ChristianSteger/Terrain3D.git
cd Terrain3D
python -m pip install .

Known issues

Under Mac OS X, the current default version of xESMF that is installed with Conda might cause problems. This can be resolved by installed a specific version (xesmf=0.7.0) and adding

import os
os.environ["ESMFMKFILE"] = "<specify path to file 'esmf.mk'; something like ../miniconda3/envs/terrain3d/lib/esmf.mk>"
import xesmf as xe

to visualisation scripts, in which the xESMF library is imported.

Visualisation

A number of examples scripts are provided in the folder visualisation:

  • tri_mesh_globe.py: Visualise entire GEBCO data set on sphere with a triangle mesh. The elevation of quad vertices, which are below sea level and are land according to the GSHHG data base, are set to 0.0 m. Ice covered quads (land glaciers or ice shelves) are represented as white areas. Alt text

  • tri_mesh_vertical_grid.py: Visualise GEBCO or MERIT data for subregion in Switzerland with a triangle mesh. Use a planar map projection and display 'idealised' vertical grid of a GCM/RCM. Optionally display lakes. Alt text

  • tri_mesh_terrain_horizon.py: Visualise MERIT data for a subregion in Switzerland with a triangle mesh on a planar map projection. Illustrate the algorithm to compute terrain horizon (according to HORAYZON) in an animation. Combining the invividual images of the animation into a movie or GIF requires FFmpeg or ImageMagick, respecitvely. Alt text

  • tri_mesh_cosmo_multi.py: Visualise COSMO topography for the Hengduan Mountains (Southeastern Tibetan Plateau) with a triangle mesh. Plot three different topographies (present-day, reduced and envelope). Alt text

  • rect_columns_gebco.py: Visualise GEBCO data set with rectangular columns (→ terrain representation in climate models). The elevation of grid cells, which are below sea level and are land according to the GSHHG data base, are set to 0.0 m. Lakes can optionally be displayed. Alt text

  • rect_columns_gebco_res_ch.py: Visualise GEBCO data set for Switzerland with rectangular columns (→ terrain representation in climate models). The elevation of grid cells, which are below sea level and are land according to the GSHHG data base, are set to 0.0 m. Lakes are additionally displayed. Different spatial resolutions are visualised. Alt text

  • rect_columns_gebco_res_eu.py: Visualise GEBCO data set for Middle/South Europe with rectangular columns (→ terrain representation in climate models). The elevation of grid cells, which are below sea level and are land according to the GSHHG data base, are set to 0.0 m. Different spatial resolutions are visualised. Alt text

  • rect_columns_cosmo_vertical_grid.py: Visualise COSMO topography for a subregion of the Alps with rectangular columns. Vertical height-based hybrid (Gal-Chen) coordinates are additionally represented. Alt text

Digital elevation model and auxiliary data

The following DEM data is available in Terrain3D:

And the following auxiliary data is applied:

Support and collaboration

In case of issues or questions, contact Christian R. Steger ([email protected]). Please report any bugs you find in Terrain3D. You are welcome to fork this repository to modify the source code.

terrain3d's People

Contributors

christiansteger avatar

Stargazers

 avatar  avatar  avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.