gphys 1.1.1a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (428) hide show
  1. data/ChangeLog +1777 -0
  2. data/LICENSE.txt +34 -0
  3. data/README +33 -0
  4. data/Rakefile +57 -0
  5. data/TODO_ep_flux +6 -0
  6. data/bin/gdir_client +27 -0
  7. data/bin/gdir_server +129 -0
  8. data/bin/gpaop +146 -0
  9. data/bin/gpcat +148 -0
  10. data/bin/gpcut +102 -0
  11. data/bin/gpedit +228 -0
  12. data/bin/gplist +68 -0
  13. data/bin/gpmath +120 -0
  14. data/bin/gpmaxmin +128 -0
  15. data/bin/gpprint +60 -0
  16. data/bin/gpvect +706 -0
  17. data/bin/gpview +704 -0
  18. data/bin/grads2nc_with_gphys +61 -0
  19. data/doc/attribute.html +19 -0
  20. data/doc/attributenetcdf.html +15 -0
  21. data/doc/axis.html +376 -0
  22. data/doc/coordmapping.html +111 -0
  23. data/doc/coordtransform.html +36 -0
  24. data/doc/derivative/gphys-derivative.html +80 -0
  25. data/doc/derivative/index.html +21 -0
  26. data/doc/derivative/index.rd +14 -0
  27. data/doc/derivative/math-doc/document/document.css +30 -0
  28. data/doc/derivative/math-doc/document/document.html +57 -0
  29. data/doc/derivative/math-doc/document/images.aux +1 -0
  30. data/doc/derivative/math-doc/document/images.log +385 -0
  31. data/doc/derivative/math-doc/document/images.pl +186 -0
  32. data/doc/derivative/math-doc/document/images.tex +364 -0
  33. data/doc/derivative/math-doc/document/img1.png +0 -0
  34. data/doc/derivative/math-doc/document/img10.png +0 -0
  35. data/doc/derivative/math-doc/document/img11.png +0 -0
  36. data/doc/derivative/math-doc/document/img12.png +0 -0
  37. data/doc/derivative/math-doc/document/img13.png +0 -0
  38. data/doc/derivative/math-doc/document/img14.png +0 -0
  39. data/doc/derivative/math-doc/document/img15.png +0 -0
  40. data/doc/derivative/math-doc/document/img16.png +0 -0
  41. data/doc/derivative/math-doc/document/img17.png +0 -0
  42. data/doc/derivative/math-doc/document/img18.png +0 -0
  43. data/doc/derivative/math-doc/document/img19.png +0 -0
  44. data/doc/derivative/math-doc/document/img2.png +0 -0
  45. data/doc/derivative/math-doc/document/img20.png +0 -0
  46. data/doc/derivative/math-doc/document/img21.png +0 -0
  47. data/doc/derivative/math-doc/document/img22.png +0 -0
  48. data/doc/derivative/math-doc/document/img23.png +0 -0
  49. data/doc/derivative/math-doc/document/img24.png +0 -0
  50. data/doc/derivative/math-doc/document/img25.png +0 -0
  51. data/doc/derivative/math-doc/document/img26.png +0 -0
  52. data/doc/derivative/math-doc/document/img27.png +0 -0
  53. data/doc/derivative/math-doc/document/img28.png +0 -0
  54. data/doc/derivative/math-doc/document/img29.png +0 -0
  55. data/doc/derivative/math-doc/document/img3.png +0 -0
  56. data/doc/derivative/math-doc/document/img30.png +0 -0
  57. data/doc/derivative/math-doc/document/img4.png +0 -0
  58. data/doc/derivative/math-doc/document/img5.png +0 -0
  59. data/doc/derivative/math-doc/document/img6.png +0 -0
  60. data/doc/derivative/math-doc/document/img7.png +0 -0
  61. data/doc/derivative/math-doc/document/img8.png +0 -0
  62. data/doc/derivative/math-doc/document/img9.png +0 -0
  63. data/doc/derivative/math-doc/document/index.html +57 -0
  64. data/doc/derivative/math-doc/document/labels.pl +13 -0
  65. data/doc/derivative/math-doc/document/next.png +0 -0
  66. data/doc/derivative/math-doc/document/next_g.png +0 -0
  67. data/doc/derivative/math-doc/document/node1.html +238 -0
  68. data/doc/derivative/math-doc/document/node2.html +75 -0
  69. data/doc/derivative/math-doc/document/prev.png +0 -0
  70. data/doc/derivative/math-doc/document/prev_g.png +0 -0
  71. data/doc/derivative/math-doc/document/up.png +0 -0
  72. data/doc/derivative/math-doc/document/up_g.png +0 -0
  73. data/doc/derivative/math-doc/document.pdf +0 -0
  74. data/doc/derivative/math-doc/document.tex +158 -0
  75. data/doc/derivative/numru-derivative.html +129 -0
  76. data/doc/ep_flux/ep_flux.html +469 -0
  77. data/doc/ep_flux/ggraph_on_merdional_section.html +71 -0
  78. data/doc/ep_flux/index.html +31 -0
  79. data/doc/ep_flux/index.rd +24 -0
  80. data/doc/ep_flux/math-doc/document/WARNINGS +1 -0
  81. data/doc/ep_flux/math-doc/document/contents.png +0 -0
  82. data/doc/ep_flux/math-doc/document/crossref.png +0 -0
  83. data/doc/ep_flux/math-doc/document/document.css +30 -0
  84. data/doc/ep_flux/math-doc/document/document.html +101 -0
  85. data/doc/ep_flux/math-doc/document/images.aux +1 -0
  86. data/doc/ep_flux/math-doc/document/images.log +1375 -0
  87. data/doc/ep_flux/math-doc/document/images.pl +1328 -0
  88. data/doc/ep_flux/math-doc/document/images.tex +1471 -0
  89. data/doc/ep_flux/math-doc/document/img1.png +0 -0
  90. data/doc/ep_flux/math-doc/document/img10.png +0 -0
  91. data/doc/ep_flux/math-doc/document/img100.png +0 -0
  92. data/doc/ep_flux/math-doc/document/img101.png +0 -0
  93. data/doc/ep_flux/math-doc/document/img102.png +0 -0
  94. data/doc/ep_flux/math-doc/document/img103.png +0 -0
  95. data/doc/ep_flux/math-doc/document/img104.png +0 -0
  96. data/doc/ep_flux/math-doc/document/img105.png +0 -0
  97. data/doc/ep_flux/math-doc/document/img106.png +0 -0
  98. data/doc/ep_flux/math-doc/document/img107.png +0 -0
  99. data/doc/ep_flux/math-doc/document/img108.png +0 -0
  100. data/doc/ep_flux/math-doc/document/img109.png +0 -0
  101. data/doc/ep_flux/math-doc/document/img11.png +0 -0
  102. data/doc/ep_flux/math-doc/document/img110.png +0 -0
  103. data/doc/ep_flux/math-doc/document/img111.png +0 -0
  104. data/doc/ep_flux/math-doc/document/img112.png +0 -0
  105. data/doc/ep_flux/math-doc/document/img113.png +0 -0
  106. data/doc/ep_flux/math-doc/document/img114.png +0 -0
  107. data/doc/ep_flux/math-doc/document/img115.png +0 -0
  108. data/doc/ep_flux/math-doc/document/img116.png +0 -0
  109. data/doc/ep_flux/math-doc/document/img117.png +0 -0
  110. data/doc/ep_flux/math-doc/document/img118.png +0 -0
  111. data/doc/ep_flux/math-doc/document/img119.png +0 -0
  112. data/doc/ep_flux/math-doc/document/img12.png +0 -0
  113. data/doc/ep_flux/math-doc/document/img120.png +0 -0
  114. data/doc/ep_flux/math-doc/document/img121.png +0 -0
  115. data/doc/ep_flux/math-doc/document/img122.png +0 -0
  116. data/doc/ep_flux/math-doc/document/img123.png +0 -0
  117. data/doc/ep_flux/math-doc/document/img124.png +0 -0
  118. data/doc/ep_flux/math-doc/document/img125.png +0 -0
  119. data/doc/ep_flux/math-doc/document/img126.png +0 -0
  120. data/doc/ep_flux/math-doc/document/img127.png +0 -0
  121. data/doc/ep_flux/math-doc/document/img128.png +0 -0
  122. data/doc/ep_flux/math-doc/document/img129.png +0 -0
  123. data/doc/ep_flux/math-doc/document/img13.png +0 -0
  124. data/doc/ep_flux/math-doc/document/img130.png +0 -0
  125. data/doc/ep_flux/math-doc/document/img131.png +0 -0
  126. data/doc/ep_flux/math-doc/document/img132.png +0 -0
  127. data/doc/ep_flux/math-doc/document/img133.png +0 -0
  128. data/doc/ep_flux/math-doc/document/img134.png +0 -0
  129. data/doc/ep_flux/math-doc/document/img135.png +0 -0
  130. data/doc/ep_flux/math-doc/document/img136.png +0 -0
  131. data/doc/ep_flux/math-doc/document/img137.png +0 -0
  132. data/doc/ep_flux/math-doc/document/img138.png +0 -0
  133. data/doc/ep_flux/math-doc/document/img139.png +0 -0
  134. data/doc/ep_flux/math-doc/document/img14.png +0 -0
  135. data/doc/ep_flux/math-doc/document/img140.png +0 -0
  136. data/doc/ep_flux/math-doc/document/img141.png +0 -0
  137. data/doc/ep_flux/math-doc/document/img142.png +0 -0
  138. data/doc/ep_flux/math-doc/document/img143.png +0 -0
  139. data/doc/ep_flux/math-doc/document/img144.png +0 -0
  140. data/doc/ep_flux/math-doc/document/img145.png +0 -0
  141. data/doc/ep_flux/math-doc/document/img146.png +0 -0
  142. data/doc/ep_flux/math-doc/document/img147.png +0 -0
  143. data/doc/ep_flux/math-doc/document/img148.png +0 -0
  144. data/doc/ep_flux/math-doc/document/img149.png +0 -0
  145. data/doc/ep_flux/math-doc/document/img15.png +0 -0
  146. data/doc/ep_flux/math-doc/document/img150.png +0 -0
  147. data/doc/ep_flux/math-doc/document/img151.png +0 -0
  148. data/doc/ep_flux/math-doc/document/img152.png +0 -0
  149. data/doc/ep_flux/math-doc/document/img153.png +0 -0
  150. data/doc/ep_flux/math-doc/document/img154.png +0 -0
  151. data/doc/ep_flux/math-doc/document/img155.png +0 -0
  152. data/doc/ep_flux/math-doc/document/img156.png +0 -0
  153. data/doc/ep_flux/math-doc/document/img157.png +0 -0
  154. data/doc/ep_flux/math-doc/document/img158.png +0 -0
  155. data/doc/ep_flux/math-doc/document/img159.png +0 -0
  156. data/doc/ep_flux/math-doc/document/img16.png +0 -0
  157. data/doc/ep_flux/math-doc/document/img160.png +0 -0
  158. data/doc/ep_flux/math-doc/document/img161.png +0 -0
  159. data/doc/ep_flux/math-doc/document/img162.png +0 -0
  160. data/doc/ep_flux/math-doc/document/img163.png +0 -0
  161. data/doc/ep_flux/math-doc/document/img164.png +0 -0
  162. data/doc/ep_flux/math-doc/document/img165.png +0 -0
  163. data/doc/ep_flux/math-doc/document/img166.png +0 -0
  164. data/doc/ep_flux/math-doc/document/img167.png +0 -0
  165. data/doc/ep_flux/math-doc/document/img168.png +0 -0
  166. data/doc/ep_flux/math-doc/document/img169.png +0 -0
  167. data/doc/ep_flux/math-doc/document/img17.png +0 -0
  168. data/doc/ep_flux/math-doc/document/img170.png +0 -0
  169. data/doc/ep_flux/math-doc/document/img171.png +0 -0
  170. data/doc/ep_flux/math-doc/document/img172.png +0 -0
  171. data/doc/ep_flux/math-doc/document/img173.png +0 -0
  172. data/doc/ep_flux/math-doc/document/img174.png +0 -0
  173. data/doc/ep_flux/math-doc/document/img175.png +0 -0
  174. data/doc/ep_flux/math-doc/document/img176.png +0 -0
  175. data/doc/ep_flux/math-doc/document/img177.png +0 -0
  176. data/doc/ep_flux/math-doc/document/img178.png +0 -0
  177. data/doc/ep_flux/math-doc/document/img179.png +0 -0
  178. data/doc/ep_flux/math-doc/document/img18.png +0 -0
  179. data/doc/ep_flux/math-doc/document/img180.png +0 -0
  180. data/doc/ep_flux/math-doc/document/img181.png +0 -0
  181. data/doc/ep_flux/math-doc/document/img182.png +0 -0
  182. data/doc/ep_flux/math-doc/document/img183.png +0 -0
  183. data/doc/ep_flux/math-doc/document/img184.png +0 -0
  184. data/doc/ep_flux/math-doc/document/img185.png +0 -0
  185. data/doc/ep_flux/math-doc/document/img186.png +0 -0
  186. data/doc/ep_flux/math-doc/document/img187.png +0 -0
  187. data/doc/ep_flux/math-doc/document/img188.png +0 -0
  188. data/doc/ep_flux/math-doc/document/img189.png +0 -0
  189. data/doc/ep_flux/math-doc/document/img19.png +0 -0
  190. data/doc/ep_flux/math-doc/document/img190.png +0 -0
  191. data/doc/ep_flux/math-doc/document/img191.png +0 -0
  192. data/doc/ep_flux/math-doc/document/img192.png +0 -0
  193. data/doc/ep_flux/math-doc/document/img193.png +0 -0
  194. data/doc/ep_flux/math-doc/document/img194.png +0 -0
  195. data/doc/ep_flux/math-doc/document/img195.png +0 -0
  196. data/doc/ep_flux/math-doc/document/img196.png +0 -0
  197. data/doc/ep_flux/math-doc/document/img197.png +0 -0
  198. data/doc/ep_flux/math-doc/document/img198.png +0 -0
  199. data/doc/ep_flux/math-doc/document/img199.png +0 -0
  200. data/doc/ep_flux/math-doc/document/img2.png +0 -0
  201. data/doc/ep_flux/math-doc/document/img20.png +0 -0
  202. data/doc/ep_flux/math-doc/document/img200.png +0 -0
  203. data/doc/ep_flux/math-doc/document/img21.png +0 -0
  204. data/doc/ep_flux/math-doc/document/img22.png +0 -0
  205. data/doc/ep_flux/math-doc/document/img23.png +0 -0
  206. data/doc/ep_flux/math-doc/document/img24.png +0 -0
  207. data/doc/ep_flux/math-doc/document/img25.png +0 -0
  208. data/doc/ep_flux/math-doc/document/img26.png +0 -0
  209. data/doc/ep_flux/math-doc/document/img27.png +0 -0
  210. data/doc/ep_flux/math-doc/document/img28.png +0 -0
  211. data/doc/ep_flux/math-doc/document/img29.png +0 -0
  212. data/doc/ep_flux/math-doc/document/img3.png +0 -0
  213. data/doc/ep_flux/math-doc/document/img30.png +0 -0
  214. data/doc/ep_flux/math-doc/document/img31.png +0 -0
  215. data/doc/ep_flux/math-doc/document/img32.png +0 -0
  216. data/doc/ep_flux/math-doc/document/img33.png +0 -0
  217. data/doc/ep_flux/math-doc/document/img34.png +0 -0
  218. data/doc/ep_flux/math-doc/document/img35.png +0 -0
  219. data/doc/ep_flux/math-doc/document/img36.png +0 -0
  220. data/doc/ep_flux/math-doc/document/img37.png +0 -0
  221. data/doc/ep_flux/math-doc/document/img38.png +0 -0
  222. data/doc/ep_flux/math-doc/document/img39.png +0 -0
  223. data/doc/ep_flux/math-doc/document/img4.png +0 -0
  224. data/doc/ep_flux/math-doc/document/img40.png +0 -0
  225. data/doc/ep_flux/math-doc/document/img41.png +0 -0
  226. data/doc/ep_flux/math-doc/document/img42.png +0 -0
  227. data/doc/ep_flux/math-doc/document/img43.png +0 -0
  228. data/doc/ep_flux/math-doc/document/img44.png +0 -0
  229. data/doc/ep_flux/math-doc/document/img45.png +0 -0
  230. data/doc/ep_flux/math-doc/document/img46.png +0 -0
  231. data/doc/ep_flux/math-doc/document/img47.png +0 -0
  232. data/doc/ep_flux/math-doc/document/img48.png +0 -0
  233. data/doc/ep_flux/math-doc/document/img49.png +0 -0
  234. data/doc/ep_flux/math-doc/document/img5.png +0 -0
  235. data/doc/ep_flux/math-doc/document/img50.png +0 -0
  236. data/doc/ep_flux/math-doc/document/img51.png +0 -0
  237. data/doc/ep_flux/math-doc/document/img52.png +0 -0
  238. data/doc/ep_flux/math-doc/document/img53.png +0 -0
  239. data/doc/ep_flux/math-doc/document/img54.png +0 -0
  240. data/doc/ep_flux/math-doc/document/img55.png +0 -0
  241. data/doc/ep_flux/math-doc/document/img56.png +0 -0
  242. data/doc/ep_flux/math-doc/document/img57.png +0 -0
  243. data/doc/ep_flux/math-doc/document/img58.png +0 -0
  244. data/doc/ep_flux/math-doc/document/img59.png +0 -0
  245. data/doc/ep_flux/math-doc/document/img6.png +0 -0
  246. data/doc/ep_flux/math-doc/document/img60.png +0 -0
  247. data/doc/ep_flux/math-doc/document/img61.png +0 -0
  248. data/doc/ep_flux/math-doc/document/img62.png +0 -0
  249. data/doc/ep_flux/math-doc/document/img63.png +0 -0
  250. data/doc/ep_flux/math-doc/document/img64.png +0 -0
  251. data/doc/ep_flux/math-doc/document/img65.png +0 -0
  252. data/doc/ep_flux/math-doc/document/img66.png +0 -0
  253. data/doc/ep_flux/math-doc/document/img67.png +0 -0
  254. data/doc/ep_flux/math-doc/document/img68.png +0 -0
  255. data/doc/ep_flux/math-doc/document/img69.png +0 -0
  256. data/doc/ep_flux/math-doc/document/img7.png +0 -0
  257. data/doc/ep_flux/math-doc/document/img70.png +0 -0
  258. data/doc/ep_flux/math-doc/document/img71.png +0 -0
  259. data/doc/ep_flux/math-doc/document/img72.png +0 -0
  260. data/doc/ep_flux/math-doc/document/img73.png +0 -0
  261. data/doc/ep_flux/math-doc/document/img74.png +0 -0
  262. data/doc/ep_flux/math-doc/document/img75.png +0 -0
  263. data/doc/ep_flux/math-doc/document/img76.png +0 -0
  264. data/doc/ep_flux/math-doc/document/img77.png +0 -0
  265. data/doc/ep_flux/math-doc/document/img78.png +0 -0
  266. data/doc/ep_flux/math-doc/document/img79.png +0 -0
  267. data/doc/ep_flux/math-doc/document/img8.png +0 -0
  268. data/doc/ep_flux/math-doc/document/img80.png +0 -0
  269. data/doc/ep_flux/math-doc/document/img81.png +0 -0
  270. data/doc/ep_flux/math-doc/document/img82.png +0 -0
  271. data/doc/ep_flux/math-doc/document/img83.png +0 -0
  272. data/doc/ep_flux/math-doc/document/img84.png +0 -0
  273. data/doc/ep_flux/math-doc/document/img85.png +0 -0
  274. data/doc/ep_flux/math-doc/document/img86.png +0 -0
  275. data/doc/ep_flux/math-doc/document/img87.png +0 -0
  276. data/doc/ep_flux/math-doc/document/img88.png +0 -0
  277. data/doc/ep_flux/math-doc/document/img89.png +0 -0
  278. data/doc/ep_flux/math-doc/document/img9.png +0 -0
  279. data/doc/ep_flux/math-doc/document/img90.png +0 -0
  280. data/doc/ep_flux/math-doc/document/img91.png +0 -0
  281. data/doc/ep_flux/math-doc/document/img92.png +0 -0
  282. data/doc/ep_flux/math-doc/document/img93.png +0 -0
  283. data/doc/ep_flux/math-doc/document/img94.png +0 -0
  284. data/doc/ep_flux/math-doc/document/img95.png +0 -0
  285. data/doc/ep_flux/math-doc/document/img96.png +0 -0
  286. data/doc/ep_flux/math-doc/document/img97.png +0 -0
  287. data/doc/ep_flux/math-doc/document/img98.png +0 -0
  288. data/doc/ep_flux/math-doc/document/img99.png +0 -0
  289. data/doc/ep_flux/math-doc/document/index.html +101 -0
  290. data/doc/ep_flux/math-doc/document/internals.pl +258 -0
  291. data/doc/ep_flux/math-doc/document/labels.pl +265 -0
  292. data/doc/ep_flux/math-doc/document/next.png +0 -0
  293. data/doc/ep_flux/math-doc/document/next_g.png +0 -0
  294. data/doc/ep_flux/math-doc/document/node1.html +104 -0
  295. data/doc/ep_flux/math-doc/document/node10.html +164 -0
  296. data/doc/ep_flux/math-doc/document/node11.html +86 -0
  297. data/doc/ep_flux/math-doc/document/node12.html +166 -0
  298. data/doc/ep_flux/math-doc/document/node13.html +897 -0
  299. data/doc/ep_flux/math-doc/document/node14.html +1065 -0
  300. data/doc/ep_flux/math-doc/document/node15.html +72 -0
  301. data/doc/ep_flux/math-doc/document/node16.html +81 -0
  302. data/doc/ep_flux/math-doc/document/node2.html +82 -0
  303. data/doc/ep_flux/math-doc/document/node3.html +91 -0
  304. data/doc/ep_flux/math-doc/document/node4.html +149 -0
  305. data/doc/ep_flux/math-doc/document/node5.html +330 -0
  306. data/doc/ep_flux/math-doc/document/node6.html +99 -0
  307. data/doc/ep_flux/math-doc/document/node7.html +98 -0
  308. data/doc/ep_flux/math-doc/document/node8.html +83 -0
  309. data/doc/ep_flux/math-doc/document/node9.html +140 -0
  310. data/doc/ep_flux/math-doc/document/prev.png +0 -0
  311. data/doc/ep_flux/math-doc/document/prev_g.png +0 -0
  312. data/doc/ep_flux/math-doc/document/up.png +0 -0
  313. data/doc/ep_flux/math-doc/document/up_g.png +0 -0
  314. data/doc/ep_flux/math-doc/document.pdf +0 -0
  315. data/doc/ep_flux/math-doc/document.tex +2018 -0
  316. data/doc/gdir.html +412 -0
  317. data/doc/gdir_client.html +16 -0
  318. data/doc/gdir_connect_ftp-like.html +61 -0
  319. data/doc/gdir_server.html +45 -0
  320. data/doc/ggraph.html +1615 -0
  321. data/doc/gpcat.html +44 -0
  322. data/doc/gpcut.html +41 -0
  323. data/doc/gphys.html +532 -0
  324. data/doc/gphys_fft.html +324 -0
  325. data/doc/gphys_grads_io.html +69 -0
  326. data/doc/gphys_grib_io.html +82 -0
  327. data/doc/gphys_io.html +120 -0
  328. data/doc/gphys_io_common.html +18 -0
  329. data/doc/gphys_netcdf_io.html +283 -0
  330. data/doc/gplist.html +24 -0
  331. data/doc/gpmath.html +51 -0
  332. data/doc/gpmaxmin.html +31 -0
  333. data/doc/gpprint.html +34 -0
  334. data/doc/gpview.html +270 -0
  335. data/doc/grads2nc_with_gphys.html +21 -0
  336. data/doc/grads_gridded.html +307 -0
  337. data/doc/grib.html +144 -0
  338. data/doc/grid.html +212 -0
  339. data/doc/index.html +133 -0
  340. data/doc/index.rd +127 -0
  341. data/doc/netcdf_convention.html +136 -0
  342. data/doc/unumeric.html +176 -0
  343. data/doc/update +64 -0
  344. data/doc/varray.html +299 -0
  345. data/doc/varraycomposite.html +67 -0
  346. data/ext_coord.c +209 -0
  347. data/ext_init.c +7 -0
  348. data/extconf.rb +42 -0
  349. data/install.rb +130 -0
  350. data/interpo.c +497 -0
  351. data/lib/numru/dcl_mouse.rb +71 -0
  352. data/lib/numru/dclext_datetime_ax.rb +220 -0
  353. data/lib/numru/derivative.rb +348 -0
  354. data/lib/numru/ganalysis/covariance.rb +154 -0
  355. data/lib/numru/ganalysis/eof.rb +298 -0
  356. data/lib/numru/ganalysis/histogram.rb +252 -0
  357. data/lib/numru/ganalysis/met.rb +317 -0
  358. data/lib/numru/ganalysis/planet.rb +182 -0
  359. data/lib/numru/ganalysis.rb +7 -0
  360. data/lib/numru/gdir.rb +1038 -0
  361. data/lib/numru/gdir_connect_ftp-like.rb +149 -0
  362. data/lib/numru/ggraph.rb +5838 -0
  363. data/lib/numru/ggraph_on_merdional_section.rb +178 -0
  364. data/lib/numru/gphys/assoccoords.rb +359 -0
  365. data/lib/numru/gphys/attribute.rb +129 -0
  366. data/lib/numru/gphys/attributenetcdf.rb +80 -0
  367. data/lib/numru/gphys/axis.rb +963 -0
  368. data/lib/numru/gphys/coordmapping.rb +286 -0
  369. data/lib/numru/gphys/coordtransform.rb +209 -0
  370. data/lib/numru/gphys/derivative.rb +314 -0
  371. data/lib/numru/gphys/ep_flux.rb +868 -0
  372. data/lib/numru/gphys/gpcommon.rb +52 -0
  373. data/lib/numru/gphys/gphys.rb +1207 -0
  374. data/lib/numru/gphys/gphys_fft.rb +886 -0
  375. data/lib/numru/gphys/gphys_grads_io.rb +212 -0
  376. data/lib/numru/gphys/gphys_grib_io.rb +214 -0
  377. data/lib/numru/gphys/gphys_gtool3_io.rb +162 -0
  378. data/lib/numru/gphys/gphys_hdfeos5_io.rb +672 -0
  379. data/lib/numru/gphys/gphys_io.rb +452 -0
  380. data/lib/numru/gphys/gphys_io_common.rb +126 -0
  381. data/lib/numru/gphys/gphys_netcdf_io.rb +800 -0
  382. data/lib/numru/gphys/gphys_nusdas_io.rb +132 -0
  383. data/lib/numru/gphys/grads_gridded.rb +1638 -0
  384. data/lib/numru/gphys/grib.rb +2049 -0
  385. data/lib/numru/gphys/grib_params.rb +1465 -0
  386. data/lib/numru/gphys/grid.rb +723 -0
  387. data/lib/numru/gphys/gtool3.rb +771 -0
  388. data/lib/numru/gphys/interpolate.rb +854 -0
  389. data/lib/numru/gphys/narray_ext.rb +34 -0
  390. data/lib/numru/gphys/netcdf_convention.rb +406 -0
  391. data/lib/numru/gphys/subsetmapping.rb +332 -0
  392. data/lib/numru/gphys/unumeric.rb +522 -0
  393. data/lib/numru/gphys/varray.rb +1109 -0
  394. data/lib/numru/gphys/varraycomposite.rb +415 -0
  395. data/lib/numru/gphys/varraygrads.rb +225 -0
  396. data/lib/numru/gphys/varraygrib.rb +177 -0
  397. data/lib/numru/gphys/varraygtool3.rb +226 -0
  398. data/lib/numru/gphys/varrayhdfeos5.rb +451 -0
  399. data/lib/numru/gphys/varraynetcdf.rb +350 -0
  400. data/lib/numru/gphys/varraynusdas.rb +59 -0
  401. data/lib/numru/gphys.rb +9 -0
  402. data/lib/numru/htdir.rb +170 -0
  403. data/multibitIO.c +567 -0
  404. data/sample/cira86_to_nc.rb +122 -0
  405. data/sample/druby_cli1.rb +21 -0
  406. data/sample/druby_cli2.rb +34 -0
  407. data/sample/druby_serv1.rb +30 -0
  408. data/sample/druby_serv2.rb +64 -0
  409. data/sample/ep_flux/demo_NCEP_1.rb +48 -0
  410. data/sample/ep_flux/demo_NCEP_2.rb +57 -0
  411. data/sample/ep_flux/demo_NCEP_3.rb +81 -0
  412. data/sample/ggraph_latlon_labelling_dr002690.rb +159 -0
  413. data/sample/ggraph_mapfit-axes_dr002687.rb +131 -0
  414. data/sample/map_projection.rb +121 -0
  415. data/sample/ncep_theta_coord.rb +79 -0
  416. data/test/eof_slp.rb +28 -0
  417. data/test/mltbit.dat +0 -0
  418. data/test/test_ep_flux.rb +533 -0
  419. data/test/test_multibitIO.rb +19 -0
  420. data/testdata/T.jan.ctl +12 -0
  421. data/testdata/T.jan.dat +0 -0
  422. data/testdata/T.jan.grib +0 -0
  423. data/testdata/T.jan.nc +0 -0
  424. data/testdata/T.jan.packed.withmiss.nc +0 -0
  425. data/testdata/UV.jan.nc +0 -0
  426. data/testdata/assoc_crds.nc +0 -0
  427. data/testdata/cira86.dat +1332 -0
  428. metadata +621 -0
@@ -0,0 +1,868 @@
1
+ require 'narray'
2
+ require 'numru/gphys/derivative'
3
+
4
+
5
+ ############################################################
6
+
7
+ =begin
8
+ =module NumRu::GPhys::EP_Flux in ep_flux.
9
+
10
+ ==Testprogram
11
+ Test script path is 'test/test_ep_flux.rb' in expand dir of gphys.tar.gz.
12
+
13
+ ==Index
14
+ * ((<module NumRu::GPhys::EP_Flux>))
15
+ * ((<Functions:>))
16
+ * ((<ep_full_sphere>))
17
+ * calculate EP Flux with full set equations on spherical coordinate.
18
+ * ((<div_sphere>))
19
+ * calculate divergence on spherical coordinate, Not only for EP Flux!
20
+ * ((<strm_rmean>))
21
+ * calculate residual mass stream function in spherical coordinate
22
+ (it might be good precision, but enough test has not done yet.)
23
+ * ((<scale_height>))
24
+ * get the scale height.
25
+ * ((<scale_height=>))
26
+ * set the scale height.
27
+ * ((<radius>))
28
+ * get the radus of planet.
29
+ * ((<radius=>))
30
+ * set the radus of planet.
31
+ * ((<rot_period>))
32
+ * get the rotation period of planet.
33
+ * ((<rot_period=>))
34
+ * set the rotation period of planet.
35
+ * ((<g_forces>))
36
+ * get the gravitational acceleration in surface.
37
+ * ((<g_forces=>))
38
+ * set the gravitational acceleration in surface.
39
+ * ((<p00>))
40
+ * get the reference surface pressure.
41
+ * ((<p00=>))
42
+ * set the reference surface pressure.
43
+ * ((<cp>))
44
+ * get the the specific heat at constant pressure of the atmosphere.
45
+ * ((<cp=>))
46
+ * set the the specific heat at constant pressure of the atmosphere.
47
+ * ((<gas_const>))
48
+ * get the specific heat at constant pressure of the atmosphere.
49
+ * ((<gas_const=>))
50
+ * set the specific heat at constant pressure of the atmosphere.
51
+ * ((<get_constants>))
52
+ * get the module variables
53
+ * ((<set_constants>))
54
+ * set the module variables
55
+ * ((<make_gphys>))
56
+ * convert ((<Axis>)) to ((<GPhys>)).
57
+ * ((<to_w_if_omega>))
58
+ * convert to velocity if ((<gp>)) is pressure velocity.
59
+ * ((<to_z_if_pressure>))
60
+ * convert to altitude if ((<gp>)) is pressure.
61
+ * ((<to_p_if_altitude>))
62
+ * convert to pressure if ((<gp>)) is altitude.
63
+ * ((<to_theta_if_temperature>))
64
+ * convert to potential temperature of temperature if ((<flag>)) is true.
65
+ * ((<to_rad_if_deg>))
66
+ * convert to radian if ((<gp>)) is degrees.
67
+ * ((<eddy_products>))
68
+ * calculate eddy flux respect to ((<dimname>)).
69
+ * ((<remove_0_at_poles>))
70
+ * set value if the cos(phi) is 0 at poles (phi is latitude).
71
+ * ((<preparate_for_vector_on_merdional_section>))
72
+ * preparate for ((<GGraph::vector_on_merdional_section>))
73
+ in vector_on_merdional_section.rb
74
+ * ((<Constants:>))
75
+ * ((<Deriv_methods>))
76
+ * derivative method names.
77
+
78
+ =module NumRu::GPhys::EP_Flux
79
+
80
+ Module functions of EP_Flux Operater for GPhys.
81
+
82
+ ==Functions:
83
+
84
+ ---ep_full_sphere(gp_u, gp_v, gp_w_or_omega, gp_temp_or_theta, flag_temp_or_theta, xyzdims=[0,1,2])
85
+
86
+ Calculate Eliassen-Palm Flux(EP-Flux) from full set equations on the
87
+ spherical coordinate. this method calculates EP-Flux from 4 GPhys objects,
88
+ zonal-wind velocity(U), merdional-wind velocity(V), vertical-wind velocity(W)
89
+ or pressure velocity(Omega), and temperature(T) or potential(Theta)
90
+ temperature. check the equations on documents.
91
+
92
+ Furthermore, Residual mean merdional circulation (0, v*, w*) can be calculated.
93
+
94
+ ARGUMENTS
95
+ * gp_u (GPhys): a GPhys which data is U.
96
+ * gp_v (GPhys): a GPhys which data is V.
97
+ * gp_w_or_omega (GPhys): a GPhys which data is W or Omega. if you give
98
+ gp_omega, convert to W in this method and calculate EP-Flux.
99
+ * gp_temp_or_theta (GPhys): a GPhys which data is T or Theta.
100
+ * xyzdims (Array): an Array which represents location of upper gphyses's
101
+ coordinate. if coordinate configuration is
102
+ (longitude, latitude, z), then xyzdims = [0, 1, 2].
103
+ else if coordinate configuration is
104
+ (z, latitude, longitude), then xyzdims = [2, 1, 0].
105
+
106
+ RETURN VALUE
107
+ * epflx_y (GPhys): EP-Flux y-component. it is on the merdional hoge.
108
+ * epflx_z (GPhys): EP-Flux z-component.
109
+ * v_rmean (GPhys): residual zonal mean V.
110
+ * w_rmean (GPhys): residual zonal mean W.
111
+ * gp_lat (GPhys): latitude (its units is radian)
112
+ * gp_z (GPhys): from vertical axis (z)
113
+ * u_mean (GPhys): zonal-mean U.
114
+ * theta_mean (GPhys): zonal-mean Theta.
115
+ * uv_dash (GPhys): zonal mean of zonal-eddy products U and V.
116
+ * vt_dash (GPhys): zonal mean of zonal-eddy products V and Theta.
117
+ * uw_dash (GPhys): zonal mean of zonal-eddy products U and W.
118
+ * dtheta_dz (GPhys): zonal mean Theta derivate with z.
119
+
120
+ ---div_sphere(gp_y, gp_z)
121
+
122
+ Calculate divergence on the spherical coordinate. it is exclusive to in
123
+ merdional cross section.
124
+
125
+ ARGUMENTS
126
+ * gp_y (GPhys): a GPhys which is merdional component you want to calculate
127
+ divergence.
128
+ * gp_z (GPhys): a GPhys which is vertical component you want to calculate
129
+ divergence.
130
+
131
+ RETURN VALUE
132
+ * gp_div (GPhys): a GPhys which is divergence on the spherical coordinate.
133
+
134
+ ---set_deriv_method( method_name )
135
+
136
+ Set derivative method. methods are defined in ((<GPhys::derivative>)).
137
+ Now ((<cderiv>)) and ((<threepoint_O2nd_deriv>)) supported
138
+
139
+ ARGUMENTS
140
+ * method_name (String): derivative method name.
141
+
142
+ RETURN VALUE
143
+ * nil
144
+
145
+ ---deriv( *args )
146
+
147
+ Call derivative method defined in ((<GPhys::Derivative>)) refer to
148
+ ((<@@deriv_method>)).
149
+
150
+ ARGUMENTS
151
+ *args : Option for derivative method. Pleaase see ((<GPhys::Derivative>)).
152
+
153
+ RETURN VALUE
154
+ * nil
155
+
156
+ ---scale_height
157
+
158
+ return a value of the scale height on the log-pressure coordinate.
159
+ default value is "7000 m".
160
+
161
+ RETURN VALUE
162
+ * scale height (UNumeric)
163
+
164
+ ---scale_height=(h)
165
+
166
+ set a value of the scale height on the log-pressure coordinate.
167
+
168
+ RETURN VALUE
169
+ * nil
170
+
171
+ ---radius
172
+
173
+ return a value of the radius of the planet. default value is "6.37E6 m".
174
+
175
+ RETURN VALUE
176
+ * radius (UNumeric)
177
+
178
+ ---radius=(a)
179
+
180
+ set a value of the radius of the planet.
181
+
182
+ RETURN VALUE
183
+ * nil
184
+
185
+ ---rot_period
186
+
187
+ return a value of the rotation period of the planet.
188
+ default value is "8.64E4 s".
189
+
190
+ RETURN VALUE
191
+ * rotation period (UNumeric)
192
+
193
+ ---rot_period=(rp)
194
+
195
+ set a value of the rotation period of the planet.
196
+
197
+ RETURN VALUE
198
+ * nil
199
+
200
+ ---g_forces
201
+
202
+ return a value of the gravitational acceleration on the surface.
203
+ default value is "9.81 m/s2".
204
+
205
+ RETURN VALUE
206
+ * rotation period (UNumeric)
207
+
208
+ ---g_forces=(g)
209
+
210
+ set a value of the gravitational acceleration on the surface.
211
+
212
+ RETURN VALUE
213
+ * nil
214
+
215
+ ---p00
216
+
217
+ return a value of the reference surface pressure.
218
+ default value is "1.0E5 Pa".
219
+
220
+ RETURN VALUE
221
+ * reference surface pressure (UNumeric)
222
+
223
+ ---p00=(p00)
224
+
225
+ set a value of the reference surface pressure.
226
+
227
+ RETURN VALUE
228
+ * nil
229
+
230
+ ---cp
231
+
232
+ return a value of the specific heat at constant pressure of the atmosphere.
233
+ default value is "1004.0[J.K-1.kg-1]"
234
+
235
+ RETURN VALUE
236
+ * reference surface pressure (UNumeric)
237
+
238
+ ---cp=(cp)
239
+
240
+ set a value of the specific heat at constant pressure of the atmosphere.
241
+
242
+ RETURN VALUE
243
+ * nil
244
+
245
+ ---gas_const
246
+
247
+ return a value of the gas constant divided by molecular mass.
248
+ default value is "287.0[J.K-1.kg-1]".
249
+
250
+ RETURN VALUE
251
+ * reference surface pressure (UNumeric)
252
+
253
+ ---gas_const=(r)
254
+
255
+ set a value of the gas constant divided by molecular mass.
256
+
257
+ RETURN VALUE
258
+ * nil
259
+
260
+ ---get_constants
261
+
262
+ return values of the scale height, radius, rotation period,
263
+ gravitational acceleration, reference surface pressure, specific heat,
264
+ gas constant.
265
+
266
+ RETURN VALUE
267
+ * scale height (UNumeric)
268
+ * radius (UNumeric)
269
+ * rotation period (UNumeric)
270
+ * gravitational acceleration (UNumeric)
271
+ * reference surface pressure (UNumeric)
272
+ * specific heat at constant pressure of the atmosphere (UNumeric)
273
+ * gas constant divided by molecular mass (UNumeric)
274
+
275
+ ---set_constants(scale_height, radius, rot_period, g_forces, p00, cp, gas_const)
276
+
277
+ set values of the scale height, radius, rotation period, and gravitational
278
+ acceleration.
279
+
280
+ ARGUMENTS
281
+ * scale height (UNumeric)
282
+ * radius (UNumeric)
283
+ * rotation period (UNumeric)
284
+ * gravitational acceleration (UNumeric)
285
+ * reference surface pressure (UNumeric)
286
+ * specific heat at constant pressure of the atmosphere (UNumeric)
287
+ * gas constant divided by molecular mass (UNumeric)
288
+
289
+ RETURN VALUE
290
+ * nil
291
+
292
+ ---make_gphys(*ax_ary)
293
+
294
+ make GPhys objects from Axis or VArray. data components is VArray of
295
+ ((<Axis.pos>)).
296
+
297
+ ARGUMENTS
298
+ * ax_ary (Array): an Array each objects are ((<Axis>)) or ((<VArray>)).
299
+
300
+ RETURN VALUE
301
+ * gp_ary (Array): an Array each objects are ((<GPhys>)).
302
+
303
+ ---to_w_if_omega(gp, z)
304
+
305
+ convert to velocity(W) if ((<gp>)) is pressure velocity(Omega).
306
+ decide from units ((<gp.data.units>)). if it compatible with "m/s" then
307
+ deem it ((<W>)), else if "Pa/s" then deem it ((<Omega>)).
308
+
309
+ ARGUMENTS
310
+ * gp(GPhys): a GPhys which data represents velocity or pressure velocity.
311
+ * z(GPhys): a GPhys which data represents z-coordinate.
312
+
313
+ RETURN VALUE
314
+ * gp_w(GPhys): a GPhys which data represents velocity or pressure velocity
315
+
316
+ ---to_z_if_pressure(gp)
317
+
318
+ convert to altitude(z) if ((<gp>)) is pressure coordinate (p).
319
+ decide from units ((<gp.data.units>)). if it compatible with "Pa" then
320
+ deem it (p).
321
+
322
+ ARGUMENTS
323
+ * gp(GPhys): a GPhys which data represents z or pressure coordinate.
324
+
325
+ RETURN VALUE
326
+ * gp_z(GPhys): a GPhys which data represents z-coordinate.
327
+
328
+ ---to_p_if_altitude(gp)
329
+
330
+ convert to pressure(p) if ((<gp>)) is altitude(z).
331
+ decide from units ((<gp.data.units>)). if it compatible with "m" then
332
+ deem it (z).
333
+
334
+ ARGUMENTS
335
+ * gp(GPhys): a GPhys which data represents z or pressure coordinate.
336
+
337
+ RETURN VALUE
338
+ * gp_p(GPhys): a GPhys which data represents p-coordinate.
339
+
340
+
341
+ ---to_theta_if_temperature(gp_t, z, flag_temp_or_theta=true)
342
+
343
+ convert ((<gp>)) to potential temperature(\theta) if
344
+ ((<flag_temp_or_theta>)) is true.
345
+
346
+ ARGUMENTS
347
+ * gp_t(GPhys): a GPhys which data represents potential temperature or
348
+ temperature.
349
+ * z(GPhys) : a GPhys which data represents z-coordinate.
350
+ * flag_temp_or_theta(True or False): a flagment if ((<gp_t>)) convert to.
351
+
352
+ RETURN VALUE
353
+ * gp_theta(GPhys): a GPhys which data represents potential temperature.
354
+
355
+ ---to_rad_if_deg(gp)
356
+
357
+
358
+ convert to radian if ((<gp.data.units>)) is degrees.
359
+
360
+ ARGUMENTS
361
+ * gp(GPhys): a GPhys which represents angle (radian or degree).
362
+
363
+ RETURN VALUE
364
+ * gp_rad(GPhys): a GPhys which units is radian.
365
+
366
+ ---eddy_products(gp_u, gp_v, gp_w, gp_t, dimname)
367
+
368
+ calculate eddy products along "dimname" dimension. now in this documents,
369
+ ' means eddy from zonal mean, and () means zonal mean.
370
+
371
+ ARGUMENTS
372
+ * gp_u(GPhys): a GPhys which data represents zonal-wind velocity(m/s).
373
+ * gp_v(GPhys): a GPhys which data represents merdional-wind velocity(m/s).
374
+ * gp_w(GPhys): a GPhys which data represents vertical-wind velocity(m/s).
375
+ * gp_t(GPhys): a GPhys which data represents temperature(K).
376
+
377
+ RETURN VALUE
378
+ * uv_dash(GPhys): a GPhys which represents (gp_u'*gp_v').
379
+ * vt_dash(GPhys): a GPhys which represents (gp_v'*gp_t').
380
+ * uw_dash(GPhys): a GPhys which represents (gp_u'*gp_w').
381
+
382
+ ---remove_0_at_poles(cos_gp)
383
+
384
+ set value if the cos(latitude) is nearly equal to 0 (|x|< 1e-6) at poles.
385
+ at North pole, new value is ((<(a_cos_lat.val[0] + a_cos_lat.val[1])/2>))
386
+ and at South pole ((<(a_cos_lat.val[-1] + a_cos_lat.val[-2])/2>))
387
+
388
+ ARGUMENTS
389
+ * cos_gp(GPhys): a GPhys which represents latitude.
390
+
391
+ RETURN VALUE
392
+ * new_cos_gp(GPhys): a GPhys which value at poles displaceed.
393
+
394
+ ---preparate_for_vector_on_merdional_section(xax, yax)
395
+
396
+ preparate for ((<GGraph::vector_on_merdional_section>)) in
397
+ vector_on_merdional_section.
398
+
399
+ (1) check ((<yax>)) if it is proportional to p
400
+ (2) get axis ( a*phi, z )
401
+
402
+ ARGUMENTS
403
+ * xax(VArray): a VArray which represents x axis.
404
+ * yax(VArray): a VArray which represents y axis.
405
+
406
+ RETURN VALUE
407
+ * va_aphi(VArray): a VArray which represents x-coordinate(radius * phi).
408
+ * va_z(VArray): a VArray which represents z-coordinate.
409
+ * was_proportional_to_p(True or False): flag original axis proportional to
410
+ pressure or z.
411
+
412
+ ---strm_rmean(v_rmean, yzdims=[0,1])
413
+
414
+ Calculate mass stream function for residual zonal mean circulation.
415
+
416
+ ARGUMENTS
417
+ * v_rmean (GPhys): a GPhys which is residual zonal mean V.
418
+ * yzdims (Array): an Array which represents axis.
419
+
420
+ RETURN VALUE
421
+ * gp_strm (GPhys): a GPhys which is mass stream function on merdional section.
422
+
423
+ ==Constants:
424
+
425
+ ---Deriv_methods
426
+
427
+ derivative method name [ 'cderiv', 'threepoint_O2nd_deriv' ]
428
+
429
+ =end
430
+ ############################################################
431
+
432
+ module NumRu
433
+ class GPhys
434
+ module EP_Flux
435
+
436
+ include Misc::EMath
437
+ extend Misc::EMath
438
+
439
+ #<<< module constants >>>
440
+ # C_p = 1004.0 # specific heat at constant pressure of the earth's atmosphere [J.K-1.kg-1]
441
+ # R = 287.0 # gas constant per unit mass for dry air of the earth [J.K-1.kg-1]
442
+ Deriv_methods = [ 'cderiv', 'threepoint_O2nd_deriv' ] # list of derivatave method
443
+
444
+ #<<< module variable >>>
445
+ @@scale_height = UNumeric.new(7000, "m") # log-pressure scale height
446
+ @@radius = UNumeric.new(6.37E6,"m") # radius of the planet
447
+ @@rot_period = UNumeric.new(8.64E4,"s") # rotation period of the planet
448
+ @@g_forces = UNumeric.new(9.81,"m.s-2")
449
+ # gravitational acceleration in the surface
450
+ @@p00 = UNumeric.new(1.0E5,"Pa") # reference surface pressure
451
+ @@cp = UNumeric.new(1004.0, "J.K-1.kg-1")
452
+ # specific heat at constant pressure
453
+ @@gas_const = UNumeric.new(287.0, "J.K-1.kg-1")
454
+ # gas constant per molecular mass
455
+ @@deriv_method = Proc.new{|*args|
456
+ GPhys::Derivative::threepoint_O2nd_deriv(*args)
457
+ } # deriv_method. default method is three*
458
+
459
+ module_function
460
+
461
+ #<<< access to constants method >>> -------------------------------------
462
+ def scale_height
463
+ @@scale_height
464
+ end
465
+ def scale_height=(h)
466
+ @@scale_height = h
467
+ return nil
468
+ end
469
+ def radius
470
+ @@radius
471
+ end
472
+ def radius=(a)
473
+ @@radius = a
474
+ return nil
475
+ end
476
+ def rot_period
477
+ @@rot_period
478
+ end
479
+ def g_forces=(g)
480
+ @@g_forces = g
481
+ return nil
482
+ end
483
+ def g_forces
484
+ @@g_forces
485
+ end
486
+ def rot_period=(rp)
487
+ @@rot_period = rp
488
+ return nil
489
+ end
490
+ def p00
491
+ @@p00
492
+ end
493
+ def p00=(p00)
494
+ @@p00 = p00
495
+ return nil
496
+ end
497
+ def cp
498
+ @@cp
499
+ end
500
+ def cp=(cp)
501
+ @@cp = cp
502
+ return nil
503
+ end
504
+ def gas_const
505
+ @@gas_const
506
+ end
507
+ def gas_const=(r)
508
+ @@gas_const = r
509
+ return nil
510
+ end
511
+ def set_constants(scale_height, radius, rot_period, g_forces, p00, cp, gas_const)
512
+ @@scale_height = scale_height
513
+ @@radius = radius
514
+ @@rot_period = rot_period
515
+ @@g_forces = g_forces
516
+ @@p00 = p00
517
+ @@cp = cp
518
+ @@gas_const = gas_const
519
+ return nil
520
+ end
521
+ def get_constants
522
+ return @@scale_height, @@radius, @@rot_period, @@g_forces,
523
+ @@p00, @@cp, @@gas_const
524
+ end
525
+
526
+ #<<< derivation method >>> ---------------------------------------------
527
+
528
+ def set_deriv_method( method_name )
529
+ if Deriv_methods.include?( method_name )
530
+ @@deriv_method = eval <<-EOS
531
+ Proc.new{|*args|
532
+ GPhys::Derivative::#{method_name}(*args)
533
+ }
534
+ EOS
535
+ else
536
+ raise ArgumentError, "Unsupported method: #{method_name}. " +
537
+ "(Supported are #{Deriv_methods.inspect}.)"
538
+ end
539
+ nil
540
+ end
541
+
542
+ def deriv(*args)
543
+ @@deriv_method.call(*args)
544
+ end
545
+
546
+ #<<< calculation method >>> ---------------------------------------------
547
+ def ep_full_sphere(gp_u, gp_v, gp_w, gp_t,
548
+ flag_temp_or_theta=true, xyzdims=[0,1,2]) ## get axis and name
549
+ raise ArgumentError,"xyzdims's size (#{xyzdims.size}) must be 3." if xyzdims.size != 3
550
+ ax_lon = gp_u.axis(xyzdims[0]) # Axis of longitude
551
+ ax_lat = gp_u.axis(xyzdims[1]) # Axis of latitude
552
+ ax_z = gp_u.axis(xyzdims[2]) # Axis of vertical
553
+ lon_nm, lat_nm, z_nm = ax_lon.pos.name, ax_lat.pos.name, ax_z.pos.name
554
+ gp_lon, gp_lat, gp_z = make_gphys(ax_lon, ax_lat, ax_z)
555
+
556
+ ## convert axes
557
+ gp_z = to_z_if_pressure(gp_z) # P => z=-H*log(P/P00) (units-based)
558
+ gp_lon = to_rad_if_deg(gp_lon) # deg => rad (unit convesion)
559
+ gp_lat = to_rad_if_deg(gp_lat) # deg => rad (unit convesion)
560
+ gp_w = to_w_if_omega(gp_w, gp_z) # dP/dt => dz/dt (units-based)
561
+ gp_t = to_theta_if_temperature(gp_t, gp_z, flag_temp_or_theta)
562
+ # temperature => potential temperature (if flag is true)
563
+
564
+ ## replace grid (without duplicating data)
565
+ grid = gp_u.grid_copy
566
+ old_grid = gp_u.grid_copy # saved to use in outputs
567
+ grid.axis(lon_nm).pos = gp_lon.data # in radian
568
+ grid.axis(lat_nm).pos = gp_lat.data # in radian
569
+ grid.axis(z_nm).pos = gp_z.data # log-p height
570
+ gp_u = GPhys.new(grid, gp_u.data)
571
+ gp_v = GPhys.new(grid, gp_v.data)
572
+ gp_w = GPhys.new(grid, gp_w.data)
573
+ gp_t = GPhys.new(grid, gp_t.data)
574
+ ## get each term
575
+ # needed in F_y and F_z
576
+ uv_dash, vt_dash, uw_dash = eddy_products(gp_u, gp_v, gp_w, gp_t, lon_nm)
577
+ theta_mean = gp_t.mean(lon_nm)
578
+ dtheta_dz = deriv(theta_mean, z_nm)
579
+ cos_lat = cos(gp_lat)
580
+ a_cos_lat = @@radius * cos_lat
581
+ a_cos_lat.data.rename!('a_cos_lat')
582
+ a_cos_lat.data.set_att('long_name', 'radius * cos_lat')
583
+ remove_0_at_poles(a_cos_lat)
584
+ # needed in F_y only
585
+ u_mean = gp_u.mean(lon_nm)
586
+ du_dz = deriv(u_mean, z_nm)
587
+ # needed in F_z only
588
+ f_cor = 2 * (2 * PI / @@rot_period) * sin(gp_lat)
589
+ f_cor.data.rename!('f_cor')
590
+ f_cor.data.set_att('long_name', 'Coriolis parameter')
591
+ ducos_dphi = deriv( u_mean * cos_lat, lat_nm)
592
+ avort = (-ducos_dphi/a_cos_lat) + f_cor # -- absolute vorticity
593
+ avort.data.units = "s-1"
594
+ avort.data.rename!('avort')
595
+ avort.data.set_att('long_name', 'zonal mean absolute vorticity')
596
+
597
+ ## F_y, F_z
598
+ sigma = exp(-gp_z/@@scale_height)
599
+ epflx_y = ( - uv_dash + du_dz*vt_dash/dtheta_dz ) * cos_lat * sigma
600
+ epflx_z = ( - uw_dash + avort*vt_dash/dtheta_dz ) * cos_lat * sigma
601
+ epflx_y.data.name = "epflx_y"; epflx_z.data.name = "epflx_z"
602
+ epflx_y.data.set_att("long_name", "EP flux y component")
603
+ epflx_z.data.set_att("long_name", "EP flux z component")
604
+
605
+ ## v_rmean, w_rmean
606
+ z_nm = gp_z.data.name # change z_nm from pressure to z
607
+ v_mean = gp_v.mean(lon_nm); w_mean = gp_w.mean(lon_nm)
608
+ v_rmean = ( v_mean - deriv( (vt_dash/dtheta_dz*sigma), z_nm )/sigma )
609
+ w_rmean = ( w_mean + deriv( (vt_dash/dtheta_dz*cos_lat), lat_nm )/a_cos_lat )
610
+ v_rmean.data.name = "v_rmean"; w_rmean.data.name = "w_rmean"
611
+ v_rmean.data.set_att("long_name", "residual zonal mean V")
612
+ w_rmean.data.set_att("long_name", "residual zonal mean W")
613
+
614
+ ## convert with past grid
615
+ gp_ary = [] # grid convertes gphyss into
616
+ grid_xmean = old_grid.delete_axes(lon_nm)
617
+ [epflx_y, epflx_z, v_rmean, w_rmean, gp_lat, gp_z, u_mean, theta_mean,
618
+ uv_dash, vt_dash, uw_dash, dtheta_dz].each {|gp|
619
+ if grid_xmean.shape.size != gp.shape.size
620
+ gp_ary << gp
621
+ else
622
+ gp_ary << GPhys.new(grid_xmean, gp.data) #back to the original grid
623
+ end
624
+ }
625
+ return gp_ary
626
+ end
627
+
628
+ def div_sphere(gp_fy, gp_fz, yzdims=[0,1])
629
+ raise ArgumentError,"yzdims's size (#{yzdims.size}) must be 2." if yzdims.size != 2
630
+ ## get axis and name
631
+ ax_lat = gp_fy.axis(yzdims[0]) # Axis of latitude
632
+ ax_z = gp_fy.axis(yzdims[1]) # Axis of vertical
633
+ lat_nm, z_nm = ax_lat.pos.name, ax_z.pos.name
634
+ gp_lat, gp_z = make_gphys(ax_lat, ax_z)
635
+ ## convert
636
+ gp_z = to_z_if_pressure(gp_z) # P => z=-H*log(P/P00) (units-based)
637
+ gp_lat = to_rad_if_deg(gp_lat) # deg => rad (unit convesion)
638
+
639
+ ## replace grid (without duplicating data)
640
+ grid = gp_fy.grid_copy
641
+ cp_grid = gp_fy.grid_copy # saved to use in outputs
642
+ grid.axis(lat_nm).pos = gp_lat.data
643
+ grid.axis(z_nm).pos = gp_z.data
644
+ gp_fy = GPhys.new(grid, gp_fy.data)
645
+ gp_fz = GPhys.new(grid, gp_fz.data)
646
+
647
+ ## d_F_phi_dz
648
+ a_cos_lat = @@radius * cos(gp_lat)
649
+ remove_0_at_poles(a_cos_lat)
650
+ d_gp_fy_d_phi = deriv(gp_fy * cos(gp_lat), lat_nm)
651
+ ## d_F_z_dz
652
+ d_gp_fz_d_z = deriv(gp_fz, z_nm)
653
+ f_div = ( d_gp_fy_d_phi / a_cos_lat ) + d_gp_fz_d_z
654
+
655
+ f_div.data.name = "epflx_div"
656
+ f_div.data.set_att("long_name", "EP Flux divergence")
657
+ ## convert with past grid
658
+ return GPhys.new(cp_grid, f_div.data)
659
+ end
660
+
661
+ def make_gphys(*ax_ary)
662
+ # it will be lost when new grid.rb released : to use delete_ax
663
+ gp_ary = []
664
+ ax_ary.each{|ax|
665
+ if ax.is_a?(Axis)
666
+ ax_data = ax.pos
667
+ ax_grid = Grid.new(ax)
668
+ elsif ax.is_a?(VArray)
669
+ ax_data = ax
670
+ ax_grid = Grid.new(Axis.new().set_pos(ax))
671
+ end
672
+ gp = GPhys.new(ax_grid, ax_data)
673
+ gp_ary << gp
674
+ }
675
+ return gp_ary
676
+ end
677
+
678
+ def to_w_if_omega(gp, z) # it is only for z coordinate!!!
679
+ gp_units = gp.data.units
680
+ if gp_units =~ Units.new("Pa/s")
681
+ pr = @@p00*exp(-z/@@scale_height)
682
+ gp_un = gp_units
683
+ pr = pr.convert_units(gp_un*Units.new('s'))
684
+ gp = gp*(-@@scale_height/pr)
685
+ gp.data.rename!("wwnd")
686
+ gp.data.set_att('long_name', "log-P vertical wind")
687
+ elsif gp_units =~ Units.new("m/s")
688
+ gp = gp.convert_units(Units.new('m/s'))
689
+ else
690
+ raise ArgumentError,"units of gp.data (#{gp.data.units})
691
+ must be dimention of pressure/time
692
+ or length/time."
693
+ end
694
+ return gp
695
+ end
696
+
697
+ def to_theta_if_temperature(gp_t, z, flag_temp_or_theta=true)
698
+ # it is only for z coordinate!!!
699
+ if flag_temp_or_theta
700
+ gp_un = gp_t.data.units
701
+ gp_t = gp_t.convert_units(Units.new("K"))
702
+ gp_t = gp_t*exp((@@gas_const/@@cp)*z/@@scale_height)
703
+ gp_t.data.set_att('long_name', "Potential Temperature")
704
+ end
705
+ return gp_t
706
+ end
707
+
708
+ def to_z_if_pressure(gp_z)
709
+ # number in units is not considerd operater as log.
710
+ if ( gp_z.data.units =~ Units.new('Pa') )
711
+ p00 = @@p00.convert(gp_z.units)
712
+ gp_z = -@@scale_height*log(gp_z.to_type(NArray::DFLOAT)/p00)
713
+ # it will be change if GPhys is modified for scalor production
714
+ gp_z.data.set_att('long_name', "z").rename!("z")
715
+ elsif ( gp_z.data.units =~ Units.new('m') )
716
+ gp_z = gp_z.convert_units(Units.new("m"))
717
+ else
718
+ raise ArgumentError,"units of gp_z (#{gp_z.data.units})
719
+ must be dimention of pressure or length."
720
+ end
721
+ return gp_z
722
+ end
723
+
724
+ def to_p_if_altitude(gp_z)
725
+ # number in units is not considerd operater as log.
726
+ if ( gp_z.data.units =~ Units.new('m') )
727
+ h = @@scale_height.convert(gp_z.units)
728
+ gp_z = @@p00*exp(-gp_z/h)
729
+ gp_z.data.set_att('long_name', "p").rename!("p")
730
+ elsif ( gp_z.data.units =~ Units.new('Pa') )
731
+ gp_z = gp_z.convert_units(Units.new("Pa"))
732
+ else
733
+ raise ArgumentError,"units of gp_z (#{gp_z.data.units})
734
+ must be dimention of pressure or length."
735
+ end
736
+ return gp_z
737
+ end
738
+
739
+ def to_rad_if_deg(gp)
740
+ if gp.data.units =~ Units.new("degrees")
741
+ gp = gp.convert_units(Units.new('rad'))
742
+ gp.units = Units[""]
743
+ gp
744
+ elsif gp.data.units =~ Units.new('rad')
745
+ gp.data = gp.data.copy
746
+ gp.data.units = Units[""]
747
+ gp
748
+ else
749
+ raise ArgumentError,"units of gp #{gp.data.units} must be equal to deg or radian."
750
+ end
751
+ return gp
752
+ end
753
+
754
+ def eddy_products(gp_u, gp_v, gp_w, gp_t, dimname)
755
+ # get zonal_eddy
756
+ u_dash = gp_u - gp_u.mean(dimname)
757
+ v_dash = gp_v - gp_v.mean(dimname)
758
+ w_dash = gp_w - gp_w.mean(dimname)
759
+ t_dash = gp_t - gp_t.mean(dimname)
760
+
761
+ # get eddy_product
762
+ uv_dash = u_dash*v_dash # u'v'
763
+ vt_dash = v_dash*t_dash # v't'
764
+ uw_dash = u_dash*w_dash # u'w'
765
+
766
+ # set attribute
767
+ uv_dash.data.set_att("long_name", "U'V'")
768
+ vt_dash.data.set_att("long_name", "V'T'")
769
+ uw_dash.data.set_att("long_name", "U'W'")
770
+ uv_dash.data.rename!("uv_dash")
771
+ vt_dash.data.rename!("vt_dash")
772
+ uw_dash.data.rename!("uw_dash")
773
+
774
+ return uv_dash.mean(dimname), vt_dash.mean(dimname), uw_dash.mean(dimname)
775
+ end
776
+
777
+ def remove_0_at_poles(a_cos_lat)
778
+ eps = 1e-6
779
+ if ( (a_cos_lat.val[0]/@@radius).abs.val < eps )
780
+ a_cos_lat[0] = (a_cos_lat.val[0] + a_cos_lat.val[1])/2
781
+ end
782
+ if ( (a_cos_lat.val[-1]/@@radius).abs.val < eps )
783
+ a_cos_lat[-1] = (a_cos_lat.val[-1] + a_cos_lat.val[-2])/2
784
+ end
785
+ if a_cos_lat.min.val <= 0
786
+ raise "Illegal cos(phi) data. phi must between -pi/2 and +pi/2 " +
787
+ "and aligned in increasing or decreasing order."
788
+ end
789
+ nil
790
+ end
791
+
792
+ def preparate_for_vector_on_merdional_section(xax, zax)
793
+ gp_x, gp_z = make_gphys(xax, zax) # make gphys from axis
794
+ gp_phi = to_rad_if_deg(gp_x) # deg => rad (unit convesion)
795
+ gp_aphi = @@radius * gp_phi # radius * phi
796
+ # check zax units, if proportional to z or p
797
+ if ( gp_z.data.units =~ Units.new('Pa') )
798
+ was_proportional_to_p = true
799
+ elsif ( gp_z.data.units =~ Units.new('m') )
800
+ was_proportional_to_p = false
801
+ else
802
+ raise ArgumentError,'unit of zax #{gp_z.data.units} must be
803
+ compatible to length or pressure.'
804
+ end
805
+ gp_z = to_z_if_pressure(gp_z) # convert to z if gp_z is pressure
806
+ gp_z[0] = +1E-6 if gp_z.data.val[0] == -0.0
807
+ return gp_aphi.data, gp_z.data, was_proportional_to_p
808
+ end
809
+
810
+ def strm_rmean(gp_v, yzdims=[0,1])
811
+
812
+ raise ArgumentError,"yzdims's size (#{yzdims.size}) must be 2." if yzdims.size != 2
813
+ ## get axis and name
814
+ lat_dim, z_dim = yzdims # Index of dims
815
+ ax_lat = gp_v.axis(lat_dim) # Axis of latitude
816
+ ax_z = gp_v.axis(z_dim) # Axis of vertical
817
+ lat_nm, z_nm = ax_lat.pos.name, ax_z.pos.name
818
+ gp_lat, gp_z = make_gphys(ax_lat, ax_z)
819
+ ## convert
820
+ gp_lat = to_rad_if_deg(gp_lat) # deg. to rad.
821
+ gp_p = to_p_if_altitude(gp_z) # z => p=p00exp(-z/H) (units-based) and "Pa"
822
+
823
+ ## copy grid
824
+ grid = gp_v.grid_copy
825
+
826
+ ## calculate stream function
827
+ na_v = gp_v.data.val # for integration box
828
+ int_v = gp_v.data.val.dup.fill!(0.0) # for integration box
829
+ pres = gp_p.data.val.dup
830
+ if pres[0] < pres[-1]
831
+ int_v[*([true]*z_dim+[0, false])] = 0.5*(na_v[*([true] + [0, false])])*pres[0]
832
+ 1.upto( pres.size-1 ) do |idx|
833
+ dp = (pres[idx] - pres[idx-1])
834
+ int_v[*([true]*z_dim+[idx, false])] = \
835
+ 0.5 * (na_v[*([true] + [idx-1, false])] + na_v[*([true] + [idx, false])]) * dp \
836
+ + int_v[*([true] + [idx-1, false])]
837
+ end
838
+ else
839
+ int_v[*([true]*z_dim+[-1, false])] = 0.5*(na_v[*([true] + [-1, false])])*pres[-1]
840
+ ( pres.size-2 ).downto(0) do |idx|
841
+ dp = (pres[idx] - pres[idx+1])
842
+ int_v[*([true]*z_dim+[idx, false])] = \
843
+ 0.5 * (na_v[*([true] + [idx+1, false])] + na_v[*([true] + [idx, false])]) * dp \
844
+ + int_v[*([true] + [idx+1, false])]
845
+ end
846
+ end
847
+ int_v = VArray.new( int_v, gp_v.data, gp_v.data.name )
848
+ int_v.units = Units.new("Pa.m.s-1")
849
+ gp_int_v = GPhys.new(grid, int_v)
850
+ strm_rmean = gp_int_v * cos(gp_lat) * 2 * PI * @@radius / @@g_forces
851
+
852
+ ## change attribute
853
+ strm_rmean.name = "strm_rmean"
854
+ strm_rmean.set_att("long_name", "Residual mean mass stream function")
855
+
856
+ ## convert with past grid
857
+ return strm_rmean
858
+ end
859
+
860
+ end
861
+ end
862
+ end
863
+
864
+ #########################################################
865
+
866
+ if __FILE__ == $0
867
+ print "Test script path is 'test/test_ep_flux.rb' in expand gphys dir.\n"
868
+ end