SHTOOLS / SHTOOLS

SHTOOLS - Spherical Harmonic Tools

Home Page:https://shtools.github.io/SHTOOLS/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Exporting grid data to 3D model

Debnathopu opened this issue · comments

Hi, I am trying the basic examples of Shtools.
for my purpose, I need the output 3D model preferably in .stl format
Here is the snap of the example
If anyone could help me.
regards,
opu

import matplotlib.pyplot as plt
import pyshtools as pysh

pysh.utils.figstyle(rel_width=0.75)

lmax = 40 # This determines the spatial resolution of the gridded data and 3d image
clm = pysh.SHCoeffs.from_zeros(lmax)
clm.coeffs[0, 10, 0] = 1.
grid = clm.expand()
#grid.to_file('test.dat')
fig, ax = grid.plot3d(show=False) # show=False is used to avoid a warning when plotting in inline mode

image