目的
時間と円柱座標上に記録された4次元データの配列をt,zで固定し、角度と半径の座標の2次元配列になった物理量をカラーマップで表示する。
問題点と質問
今,t=100,z=500のときに
python
1import matplotlib.pyplot as plt 2import numpy as np 3import sys 4from dac_read import dac_read 5t=100 6dac_name='./data/0???_rank=*.dac' 7data1, r, theta, z = dac_read(dac_name,dimension=3) 8#座標の配列r, theta, zと物理量データの配列を作成 9theta_matrix, z_matrix, radius_matrix = np.meshgrid(theta, z, r) 10x = radius_matrix * np.cos(theta_matrix) 11y = radius_matrix * np.sin(theta_matrix) 12z = z_matrix 13#x,y,z座標に変換 14z_grid=500 15plt.pcolormesh(x[z_grid,:,:],y[z_grid,:,:],data1[t,z_grid,:,:]) 16plt.axes().set_aspect('equal') 17pp=plt.colorbar (orientation="vertical") 18pp.set_label(str(br), fontname="Arial", fontsize=24) 19plt.show()
こうするとカラーマップが表示されるのですが、
このようにマップの一部が表示されずパックマンのような状態になってしまいます。
どうすれば全体の画面を表示することができるでしょうか。
なおデータの形状は
python
1print(data1[t,z_grid,0,:]) 2print(type(data1[t,z_grid,0,:])) 3print(data1[t,z_grid,0,:].shape) 4print(data1[t,z_grid,:,:]) 5print(type(data1[t,z_grid,:,:])) 6print(data1[t,z_grid,:,:].shape)
に対して
[ 5.93998474e-01 2.72014498e-01 1.60743782e-01 1.22071128e-01 8.54242388e-02 5.62375102e-02 3.98297251e-02 3.85923555e-02 5.46078552e-02 7.67571167e-02 1.04584462e-01 1.26286600e-01 1.34653855e-01 1.39972098e-01 1.25589692e-01 1.16475245e-01 1.09645720e-01 9.72632270e-02 8.55016597e-02 6.79821852e-02 4.53994824e-02 1.75779108e-02 -2.45879872e-03 -1.13406932e-02 -1.24115496e-02 -9.70184050e-03 -7.05966531e-03 1.49696385e-04 1.06662043e-02 2.39036877e-02 3.44667117e-02 4.23717256e-02 4.74437975e-02 5.29893432e-02 5.70193959e-02 6.11525840e-02 6.44646737e-02 6.68481411e-02 6.85947844e-02 7.30249992e-02 7.18245570e-02 7.01765132e-02 6.95374731e-02 6.76733260e-02 6.42950335e-02 6.00402268e-02 5.54000349e-02 4.79503256e-02 4.05109896e-02 3.62117791e-02 3.37975817e-02 3.03632699e-02 2.63984166e-02 2.31925551e-02 2.02030340e-02 1.75660329e-02 1.53736619e-02 1.35047584e-02 1.19334207e-02 1.08147802e-02 1.02420795e-02 9.64802706e-03 8.73544865e-03 7.98980898e-03 7.24708634e-03 6.67050472e-03 5.67588498e-03 4.78841771e-03 4.41521114e-03 4.15168019e-03 3.95074908e-03 3.74238664e-03 3.51991669e-03 3.32391537e-03 3.18267812e-03 3.01851968e-03 2.86565330e-03 2.72578900e-03 2.67246484e-03 2.67342684e-03] <type 'numpy.ndarray'> (80,) [[ 0.59399847 0.2720145 0.16074378 ..., 0.00272579 0.00267246 0.00267343] [ 0.58965775 0.24002432 0.13586343 ..., 0.00834293 0.00825524 0.00826126] [ 0.5609483 0.21450841 0.11150027 ..., 0.02227583 0.02232245 0.02211417] ..., [ 0.36540269 0.20545923 0.0943813 ..., 0.00173673 0.00159774 0.00155259] [ 0.47055532 0.25848592 0.1373705 ..., 0.00167634 0.00156395 0.00150603] [ 0.55152032 0.28228408 0.16413585 ..., 0.00186905 0.00178926 0.00167145]] <type 'numpy.ndarray'> (16, 80)
試したこと
角度の配列が[0, π/8, 2π/8, 3π/8, ,,,15π/8]
になっており、2πの部分がないのが良くないのではないかと考え、
data1[t,z_grid,:,:]にdata1[t,z_grid,0,:]を加えようとしました。
python
1np.append(data1[t,z_mesh,:,:], data1[t,z_mesh,0,:], axis=0)
こうするとエラーが発生し
File "/System/Library/Frameworks/Python.framework/Versions/2.7/Extras/lib/python/numpy/lib/function_base.py", line 3543, in append return concatenate((arr, values), axis=axis) ValueError: all the input arrays must have same number of dimensions
となって、そもそもこの方法の実行方法でうまく行くのか試せませんでした。
この方法で追加できる場合は配列の追加方法を教えてください。
回答1件
あなたの回答
tips
プレビュー
バッドをするには、ログインかつ
こちらの条件を満たす必要があります。
2020/01/11 02:45