This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| ########## N O T I C E ########## | |
| #此版本尚未實做時間維度(TDEF)的轉換 | |
| #因此只適用於轉換單一時間維度的檔案 | |
| ################################# | |
| import numpy as np | |
| import struct | |
| import netCDF4 | |
| import os, sys | |
| import glob |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| def wissdom_getvar(filename, nx, ny, nz, feild_id): | |
| #filename: wissdom_out bin檔位置 | |
| #nx, ny, nz: 反演範圍大小,可參考Grads ctl檔的XDEF、YDEF、ZDEF | |
| #feild_id: 欲讀取的參數場類別,可參考Grads ctl檔的VARS下面那一段 | |
| # 照順序下來第一個參數場為0,第二個為1,以此類推 | |
| # 常用0=u1, 1=v1, 2=w1, 3=u2, 4=v2, 5=w2 | |
| #輸出為Numpy矩陣,維度是(nz, ny, nx) | |
| data = [] | |
| with open(filename,"rb") as f: | |
| f.seek(4*nz*ny*nx*feild_id) #將指標偏移到欲讀取的參數場 |
NewerOlder