With PyGMT, how do I get a grid of maximum dip (in degrees) of a topography grid?
I see how to get azimuth …
azimuth_grid = pygmt.grdgradient(grid=topo_grid, direction=‘a’)
… but I don’t see an option for dip.
Thanks!
With PyGMT, how do I get a grid of maximum dip (in degrees) of a topography grid?
I see how to get azimuth …
azimuth_grid = pygmt.grdgradient(grid=topo_grid, direction=‘a’)
… but I don’t see an option for dip.
Thanks!
Hi Trevor
Check the -S option. (I am not sure if it was implemented in pygmt).
Thanks. I think -S is implemented with the “slope_file=” option, but I’m still struggling to understand the right syntax and what it actually does … the help pages are still under development I think.
Here’s a work-around … write a temporary netCDF file to disk and read it back in.
try:
os.remove(‘tmp_slope.nc’)
except OSError:
pass
da_az = pygmt.grdgradient(da_topo, direction=‘a’, slope_file=‘tmp_slope.nc’)
da_slope = xr.open_dataarray(‘tmp_slope.nc’)
da_dip = np.arctan(da_slope) * (180/np.pi)