import pygmt grid_file = "elevation.nc" fig = pygmt.Figure() fig.grdview(grid_file, region=[-120, -115, 35, 40], perspective=[150, 30], cmap="geo", frame=True) fig.show()
import pygmt import numpy as np x, y = np.meshgrid(np.linspace(0, 10, 50), np.linspace(0, 10, 50)) z = np.sin(x) + np.cos(y) fig = pygmt.Figure() fig.grdview(x=x, y=y, z=z, perspective=[150, 30], cmap="viridis", frame=True) fig.show()This code will create a 3D map of temperature gradients using a mesh grid of x and y values and a z value calculated from a sine and cosine function. The resulting map will be displayed with a perspective angle of 150 and a tilt angle of 30 degrees. Overall, pygmt is a powerful Python package for working with geospatial data and creating visualizations. The Figure grdview function is just one example of the many tools available in the pygmt library.