# # 仮温位をだす # ########################################################################## require "numru/gphys" # Gphys を使う include NumRu include NMath # NArray で計算できるように #-- 定数 m_d = 0.2896864 # J/kg 乾燥気体の分子量 m_v = 0.1801528 # J/kg 水蒸気の分子量 coef = (m_d/m_v)-1.0 p coef #-- netCDF づくり ncFile = NetCDF.create("VPT.nc") #-- 必要な netCDF ファイルを open する theta = GPhys::IO.open('./thermal1_PTempAll.nc','PTempAll') qAll = GPhys::IO.open('./thermal1_H2O-gAll.nc','H2O-gAll') #-- 仮温位 ptemp_v を計算 theta_v = (1 + coef*qAll)*theta theta_v.data.set_att('long_name', "virtual potential temerature") theta_v.units = 'K' GPhys::NetCDF_IO.write(ncFile, theta_v.rename('VPT')) ncFile.close