Skip to content

Commit

Permalink
improve readme, add some comment to do_blenderplanet_fesom2.py
Browse files Browse the repository at this point in the history
  • Loading branch information
patrickscholz committed Oct 4, 2024
1 parent 753e268 commit e2f09f3
Show file tree
Hide file tree
Showing 2 changed files with 76 additions and 60 deletions.
86 changes: 45 additions & 41 deletions tools/blender/README.md
Original file line number Diff line number Diff line change
@@ -1,42 +1,46 @@

How to install tripyview in blender:

1) download and unpack Blender src code archive e.g. blender-4.2.2-linux-x64.tar.xz

2) unzip folder

3) go to directory /blender-4.2.2-linux-x64/4.2/python/bin/ and execute

/blender-4.2.2-linux-x64/4.2/python/bin/python3.11 -m pip -e install /path_to_tripyview/

--> This should install tripyview in the python version that blender is using

4) test if tripyview installation works:

/blender-4.2.2-linux-x64/4.2/python/bin/python3.11 -c "import tripyview"

6) Open Blender

7) go to the Scripting tab and load the script do_blenderplanet_fesom2.py
make sure all the path are correct

8) run that script!!!

9) There might occure the error message where the blender interface colides with pyvista:

Python: Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pscholz/Python/tripyview/tripyview/__init__.py", line 25, in <module>
from .sub_3dsphere import *
File "/home/pscholz/Python/tripyview/tripyview/sub_3dsphere.py", line 3, in <module>
import vtk
File "/home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtk.py", line 47, in <module>
from vtkmodules.vtkRenderingMatplotlib import *
ImportError: /home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtkmodules/libvtkPythonInterpreter-9.3.so: undefined symbol: Py_RunMain

simply open the file /home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtk.py
and comment line 47!
## How to install tripyview in blender:

1. download and unpack Blender src code archive e.g. blender-4.2.2-linux-x64.tar.xz

2. unzip folder

3. go to directory /blender-4.2.2-linux-x64/4.2/python/bin/ and execute (make
sure that the entire path to blenders python3.11 is used)

```bash
../blender-4.2.2-linux-x64/4.2/python/bin/python3.11 -m pip -e install /path_to_tripyview/
```
This should install tripyview in the python version that blender is using

4. test if tripyview installation works:

```bash
../blender-4.2.2-linux-x64/4.2/python/bin/python3.11 -c "import tripyview"
```
5. open Blender

6. go to the Scripting tab and load the script do_blenderplanet_fesom2.py
make sure all the path are correct

7. run that script!!!

8. There might occure the error message where the blender interface colides with pyvista:

```bash
Python: Traceback (most recent call last):
File "<frozen importlib._bootstrap>", line 1176, in _find_and_load
File "<frozen importlib._bootstrap>", line 1147, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 690, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 940, in exec_module
File "<frozen importlib._bootstrap>", line 241, in _call_with_frames_removed
File "/home/pscholz/Python/tripyview/tripyview/__init__.py", line 25, in <module>
from .sub_3dsphere import *
File "/home/pscholz/Python/tripyview/tripyview/sub_3dsphere.py", line 3, in <module>
import vtk
File "/home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtk.py", line 47, in <module>
from vtkmodules.vtkRenderingMatplotlib import *
ImportError: /home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtkmodules/libvtkPythonInterpreter-9.3.so: undefined symbol: Py_RunMain
```
simply open the file /home/pscholz/Software/blender-4.2.2-linux-x64/4.2/python/lib/python3.11/site-packages/vtk.py
and comment line 47!
50 changes: 31 additions & 19 deletions tools/blender/do_blenderplanet_fesom2.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,32 +16,44 @@
from sub_blender import blender_create_mesh, blender_create_txtremat

R_earth = 6371.0e3 # meter
potatoefac_ocean = 0.0
potatoefac_land = 0.0

gen_path = '/home/pscholz/Python/blender_fesom2/'

mesh_path, do_rot = '/home/pscholz/Python/blender_fesom2/data/core2_srt_dep@node/', 'None'

do_oce_data = False
oce_txturepath = gen_path+'texture/Albedo.jpg'
oce_alphamap = gen_path+'lsmask/core2_lsmask_ocean.jpg'

oce_datapath = '/home/pscholz/Python/blender_fesom2/data/'
oce_vname = 'ssh'
oce_year = [1958, 1958]
oce_mon = None
oce_day = None
oce_depth = None

oce_bumpmap = gen_path+'texture/Bump.jpg'
oce_bumpstrength = 0.5
# real extrusion for ocean and land when !=0
potatoefac_ocean = 0.0
potatoefac_land = 0.0

# main path of data for blender project is used now the structure
# blender_fesom2/
# |--data can contain fesom data and mesh folder
# | |--mesh
# |--texture contains texture and bump images
# |--lsmask contains land sea mask of original mesh to mask out regions
# | from texture files
# |--topo folder with etopo1 data
gen_path = '/home/pscholz/Python/blender_fesom2/'

mesh_path, do_rot = gen_path+'data/core2_srt_dep@node/', 'None'

oce_txturepath = gen_path+'texture/Albedo.jpg'
oce_alphamap = gen_path+'lsmask/core2_lsmask_ocean.jpg'
oce_bumpmap = gen_path+'texture/Bump.jpg'
oce_bumpstrength = 0.5

# load fesom2 data from path, if None no data are loaded
oce_datapath = None # gen_path+'/data/'
oce_vname = 'ssh'
oce_year = [1958, 1958]
oce_mon = None
oce_day = None
oce_depth = None

land_txturepath = gen_path+'texture/Albedo.jpg'
land_alphamap = gen_path+'lsmask/core2_lsmask_ocean.jpg'
land_bumpmap = gen_path+'texture/Bump.jpg'
land_bumpstrength = 0.5

# load topographic information to interpolate on land mesh part, to give it a
# real extrusion. I used here very coarse etopo1 data. It is maybe more efficient
# to do a fake extrusion via bump maps
topo_path, do_topo = gen_path+'topo/topo_1deg.nc', True
topo_varname, topo_dimname = 'topo', ['lon','lat']
topo_resol = 1
Expand Down

0 comments on commit e2f09f3

Please sign in to comment.