gphys 1.2.2.1 → 1.4.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (405) hide show
  1. checksums.yaml +7 -0
  2. data/.gitignore +8 -17
  3. data/.rspec +2 -0
  4. data/.travis.yml +3 -0
  5. data/ChangeLog +5762 -753
  6. data/LICENSE.txt +30 -18
  7. data/Rakefile +1 -0
  8. data/bin/console +14 -0
  9. data/bin/gpcat +43 -2
  10. data/bin/gpcut +16 -0
  11. data/bin/gpvect +167 -15
  12. data/bin/gpview +254 -51
  13. data/bin/setup +7 -0
  14. data/dim_op.c +1220 -0
  15. data/doc/attribute.html +19 -0
  16. data/doc/attributenetcdf.html +15 -0
  17. data/doc/axis.html +387 -0
  18. data/doc/coordmapping.html +111 -0
  19. data/doc/coordtransform.html +36 -0
  20. data/doc/dclext.html +821 -0
  21. data/doc/derivative/gphys-derivative.html +100 -0
  22. data/doc/derivative/index.html +21 -0
  23. data/doc/derivative/index.rd +14 -0
  24. data/doc/derivative/math-doc/document.pdf +0 -0
  25. data/doc/derivative/math-doc/document.tex +158 -0
  26. data/doc/derivative/math-doc/document/document.css +30 -0
  27. data/doc/derivative/math-doc/document/document.html +57 -0
  28. data/doc/derivative/math-doc/document/images.aux +1 -0
  29. data/doc/derivative/math-doc/document/images.log +385 -0
  30. data/doc/derivative/math-doc/document/images.pl +186 -0
  31. data/doc/derivative/math-doc/document/images.tex +364 -0
  32. data/doc/derivative/math-doc/document/img1.png +0 -0
  33. data/doc/derivative/math-doc/document/img10.png +0 -0
  34. data/doc/derivative/math-doc/document/img11.png +0 -0
  35. data/doc/derivative/math-doc/document/img12.png +0 -0
  36. data/doc/derivative/math-doc/document/img13.png +0 -0
  37. data/doc/derivative/math-doc/document/img14.png +0 -0
  38. data/doc/derivative/math-doc/document/img15.png +0 -0
  39. data/doc/derivative/math-doc/document/img16.png +0 -0
  40. data/doc/derivative/math-doc/document/img17.png +0 -0
  41. data/doc/derivative/math-doc/document/img18.png +0 -0
  42. data/doc/derivative/math-doc/document/img19.png +0 -0
  43. data/doc/derivative/math-doc/document/img2.png +0 -0
  44. data/doc/derivative/math-doc/document/img20.png +0 -0
  45. data/doc/derivative/math-doc/document/img21.png +0 -0
  46. data/doc/derivative/math-doc/document/img22.png +0 -0
  47. data/doc/derivative/math-doc/document/img23.png +0 -0
  48. data/doc/derivative/math-doc/document/img24.png +0 -0
  49. data/doc/derivative/math-doc/document/img25.png +0 -0
  50. data/doc/derivative/math-doc/document/img26.png +0 -0
  51. data/doc/derivative/math-doc/document/img27.png +0 -0
  52. data/doc/derivative/math-doc/document/img28.png +0 -0
  53. data/doc/derivative/math-doc/document/img29.png +0 -0
  54. data/doc/derivative/math-doc/document/img3.png +0 -0
  55. data/doc/derivative/math-doc/document/img30.png +0 -0
  56. data/doc/derivative/math-doc/document/img4.png +0 -0
  57. data/doc/derivative/math-doc/document/img5.png +0 -0
  58. data/doc/derivative/math-doc/document/img6.png +0 -0
  59. data/doc/derivative/math-doc/document/img7.png +0 -0
  60. data/doc/derivative/math-doc/document/img8.png +0 -0
  61. data/doc/derivative/math-doc/document/img9.png +0 -0
  62. data/doc/derivative/math-doc/document/index.html +57 -0
  63. data/doc/derivative/math-doc/document/labels.pl +13 -0
  64. data/doc/derivative/math-doc/document/next.png +0 -0
  65. data/doc/derivative/math-doc/document/next_g.png +0 -0
  66. data/doc/derivative/math-doc/document/node1.html +238 -0
  67. data/doc/derivative/math-doc/document/node2.html +75 -0
  68. data/doc/derivative/math-doc/document/prev.png +0 -0
  69. data/doc/derivative/math-doc/document/prev_g.png +0 -0
  70. data/doc/derivative/math-doc/document/up.png +0 -0
  71. data/doc/derivative/math-doc/document/up_g.png +0 -0
  72. data/doc/derivative/numru-derivative.html +158 -0
  73. data/doc/ep_flux/ep_flux.html +469 -0
  74. data/doc/ep_flux/ggraph_on_merdional_section.html +71 -0
  75. data/doc/ep_flux/index.html +31 -0
  76. data/doc/ep_flux/index.rd +24 -0
  77. data/doc/ep_flux/math-doc/document.pdf +0 -0
  78. data/doc/ep_flux/math-doc/document.tex +2018 -0
  79. data/doc/ep_flux/math-doc/document/WARNINGS +1 -0
  80. data/doc/ep_flux/math-doc/document/contents.png +0 -0
  81. data/doc/ep_flux/math-doc/document/crossref.png +0 -0
  82. data/doc/ep_flux/math-doc/document/document.css +30 -0
  83. data/doc/ep_flux/math-doc/document/document.html +101 -0
  84. data/doc/ep_flux/math-doc/document/images.aux +1 -0
  85. data/doc/ep_flux/math-doc/document/images.log +1375 -0
  86. data/doc/ep_flux/math-doc/document/images.pl +1328 -0
  87. data/doc/ep_flux/math-doc/document/images.tex +1471 -0
  88. data/doc/ep_flux/math-doc/document/img1.png +0 -0
  89. data/doc/ep_flux/math-doc/document/img10.png +0 -0
  90. data/doc/ep_flux/math-doc/document/img100.png +0 -0
  91. data/doc/ep_flux/math-doc/document/img101.png +0 -0
  92. data/doc/ep_flux/math-doc/document/img102.png +0 -0
  93. data/doc/ep_flux/math-doc/document/img103.png +0 -0
  94. data/doc/ep_flux/math-doc/document/img104.png +0 -0
  95. data/doc/ep_flux/math-doc/document/img105.png +0 -0
  96. data/doc/ep_flux/math-doc/document/img106.png +0 -0
  97. data/doc/ep_flux/math-doc/document/img107.png +0 -0
  98. data/doc/ep_flux/math-doc/document/img108.png +0 -0
  99. data/doc/ep_flux/math-doc/document/img109.png +0 -0
  100. data/doc/ep_flux/math-doc/document/img11.png +0 -0
  101. data/doc/ep_flux/math-doc/document/img110.png +0 -0
  102. data/doc/ep_flux/math-doc/document/img111.png +0 -0
  103. data/doc/ep_flux/math-doc/document/img112.png +0 -0
  104. data/doc/ep_flux/math-doc/document/img113.png +0 -0
  105. data/doc/ep_flux/math-doc/document/img114.png +0 -0
  106. data/doc/ep_flux/math-doc/document/img115.png +0 -0
  107. data/doc/ep_flux/math-doc/document/img116.png +0 -0
  108. data/doc/ep_flux/math-doc/document/img117.png +0 -0
  109. data/doc/ep_flux/math-doc/document/img118.png +0 -0
  110. data/doc/ep_flux/math-doc/document/img119.png +0 -0
  111. data/doc/ep_flux/math-doc/document/img12.png +0 -0
  112. data/doc/ep_flux/math-doc/document/img120.png +0 -0
  113. data/doc/ep_flux/math-doc/document/img121.png +0 -0
  114. data/doc/ep_flux/math-doc/document/img122.png +0 -0
  115. data/doc/ep_flux/math-doc/document/img123.png +0 -0
  116. data/doc/ep_flux/math-doc/document/img124.png +0 -0
  117. data/doc/ep_flux/math-doc/document/img125.png +0 -0
  118. data/doc/ep_flux/math-doc/document/img126.png +0 -0
  119. data/doc/ep_flux/math-doc/document/img127.png +0 -0
  120. data/doc/ep_flux/math-doc/document/img128.png +0 -0
  121. data/doc/ep_flux/math-doc/document/img129.png +0 -0
  122. data/doc/ep_flux/math-doc/document/img13.png +0 -0
  123. data/doc/ep_flux/math-doc/document/img130.png +0 -0
  124. data/doc/ep_flux/math-doc/document/img131.png +0 -0
  125. data/doc/ep_flux/math-doc/document/img132.png +0 -0
  126. data/doc/ep_flux/math-doc/document/img133.png +0 -0
  127. data/doc/ep_flux/math-doc/document/img134.png +0 -0
  128. data/doc/ep_flux/math-doc/document/img135.png +0 -0
  129. data/doc/ep_flux/math-doc/document/img136.png +0 -0
  130. data/doc/ep_flux/math-doc/document/img137.png +0 -0
  131. data/doc/ep_flux/math-doc/document/img138.png +0 -0
  132. data/doc/ep_flux/math-doc/document/img139.png +0 -0
  133. data/doc/ep_flux/math-doc/document/img14.png +0 -0
  134. data/doc/ep_flux/math-doc/document/img140.png +0 -0
  135. data/doc/ep_flux/math-doc/document/img141.png +0 -0
  136. data/doc/ep_flux/math-doc/document/img142.png +0 -0
  137. data/doc/ep_flux/math-doc/document/img143.png +0 -0
  138. data/doc/ep_flux/math-doc/document/img144.png +0 -0
  139. data/doc/ep_flux/math-doc/document/img145.png +0 -0
  140. data/doc/ep_flux/math-doc/document/img146.png +0 -0
  141. data/doc/ep_flux/math-doc/document/img147.png +0 -0
  142. data/doc/ep_flux/math-doc/document/img148.png +0 -0
  143. data/doc/ep_flux/math-doc/document/img149.png +0 -0
  144. data/doc/ep_flux/math-doc/document/img15.png +0 -0
  145. data/doc/ep_flux/math-doc/document/img150.png +0 -0
  146. data/doc/ep_flux/math-doc/document/img151.png +0 -0
  147. data/doc/ep_flux/math-doc/document/img152.png +0 -0
  148. data/doc/ep_flux/math-doc/document/img153.png +0 -0
  149. data/doc/ep_flux/math-doc/document/img154.png +0 -0
  150. data/doc/ep_flux/math-doc/document/img155.png +0 -0
  151. data/doc/ep_flux/math-doc/document/img156.png +0 -0
  152. data/doc/ep_flux/math-doc/document/img157.png +0 -0
  153. data/doc/ep_flux/math-doc/document/img158.png +0 -0
  154. data/doc/ep_flux/math-doc/document/img159.png +0 -0
  155. data/doc/ep_flux/math-doc/document/img16.png +0 -0
  156. data/doc/ep_flux/math-doc/document/img160.png +0 -0
  157. data/doc/ep_flux/math-doc/document/img161.png +0 -0
  158. data/doc/ep_flux/math-doc/document/img162.png +0 -0
  159. data/doc/ep_flux/math-doc/document/img163.png +0 -0
  160. data/doc/ep_flux/math-doc/document/img164.png +0 -0
  161. data/doc/ep_flux/math-doc/document/img165.png +0 -0
  162. data/doc/ep_flux/math-doc/document/img166.png +0 -0
  163. data/doc/ep_flux/math-doc/document/img167.png +0 -0
  164. data/doc/ep_flux/math-doc/document/img168.png +0 -0
  165. data/doc/ep_flux/math-doc/document/img169.png +0 -0
  166. data/doc/ep_flux/math-doc/document/img17.png +0 -0
  167. data/doc/ep_flux/math-doc/document/img170.png +0 -0
  168. data/doc/ep_flux/math-doc/document/img171.png +0 -0
  169. data/doc/ep_flux/math-doc/document/img172.png +0 -0
  170. data/doc/ep_flux/math-doc/document/img173.png +0 -0
  171. data/doc/ep_flux/math-doc/document/img174.png +0 -0
  172. data/doc/ep_flux/math-doc/document/img175.png +0 -0
  173. data/doc/ep_flux/math-doc/document/img176.png +0 -0
  174. data/doc/ep_flux/math-doc/document/img177.png +0 -0
  175. data/doc/ep_flux/math-doc/document/img178.png +0 -0
  176. data/doc/ep_flux/math-doc/document/img179.png +0 -0
  177. data/doc/ep_flux/math-doc/document/img18.png +0 -0
  178. data/doc/ep_flux/math-doc/document/img180.png +0 -0
  179. data/doc/ep_flux/math-doc/document/img181.png +0 -0
  180. data/doc/ep_flux/math-doc/document/img182.png +0 -0
  181. data/doc/ep_flux/math-doc/document/img183.png +0 -0
  182. data/doc/ep_flux/math-doc/document/img184.png +0 -0
  183. data/doc/ep_flux/math-doc/document/img185.png +0 -0
  184. data/doc/ep_flux/math-doc/document/img186.png +0 -0
  185. data/doc/ep_flux/math-doc/document/img187.png +0 -0
  186. data/doc/ep_flux/math-doc/document/img188.png +0 -0
  187. data/doc/ep_flux/math-doc/document/img189.png +0 -0
  188. data/doc/ep_flux/math-doc/document/img19.png +0 -0
  189. data/doc/ep_flux/math-doc/document/img190.png +0 -0
  190. data/doc/ep_flux/math-doc/document/img191.png +0 -0
  191. data/doc/ep_flux/math-doc/document/img192.png +0 -0
  192. data/doc/ep_flux/math-doc/document/img193.png +0 -0
  193. data/doc/ep_flux/math-doc/document/img194.png +0 -0
  194. data/doc/ep_flux/math-doc/document/img195.png +0 -0
  195. data/doc/ep_flux/math-doc/document/img196.png +0 -0
  196. data/doc/ep_flux/math-doc/document/img197.png +0 -0
  197. data/doc/ep_flux/math-doc/document/img198.png +0 -0
  198. data/doc/ep_flux/math-doc/document/img199.png +0 -0
  199. data/doc/ep_flux/math-doc/document/img2.png +0 -0
  200. data/doc/ep_flux/math-doc/document/img20.png +0 -0
  201. data/doc/ep_flux/math-doc/document/img200.png +0 -0
  202. data/doc/ep_flux/math-doc/document/img21.png +0 -0
  203. data/doc/ep_flux/math-doc/document/img22.png +0 -0
  204. data/doc/ep_flux/math-doc/document/img23.png +0 -0
  205. data/doc/ep_flux/math-doc/document/img24.png +0 -0
  206. data/doc/ep_flux/math-doc/document/img25.png +0 -0
  207. data/doc/ep_flux/math-doc/document/img26.png +0 -0
  208. data/doc/ep_flux/math-doc/document/img27.png +0 -0
  209. data/doc/ep_flux/math-doc/document/img28.png +0 -0
  210. data/doc/ep_flux/math-doc/document/img29.png +0 -0
  211. data/doc/ep_flux/math-doc/document/img3.png +0 -0
  212. data/doc/ep_flux/math-doc/document/img30.png +0 -0
  213. data/doc/ep_flux/math-doc/document/img31.png +0 -0
  214. data/doc/ep_flux/math-doc/document/img32.png +0 -0
  215. data/doc/ep_flux/math-doc/document/img33.png +0 -0
  216. data/doc/ep_flux/math-doc/document/img34.png +0 -0
  217. data/doc/ep_flux/math-doc/document/img35.png +0 -0
  218. data/doc/ep_flux/math-doc/document/img36.png +0 -0
  219. data/doc/ep_flux/math-doc/document/img37.png +0 -0
  220. data/doc/ep_flux/math-doc/document/img38.png +0 -0
  221. data/doc/ep_flux/math-doc/document/img39.png +0 -0
  222. data/doc/ep_flux/math-doc/document/img4.png +0 -0
  223. data/doc/ep_flux/math-doc/document/img40.png +0 -0
  224. data/doc/ep_flux/math-doc/document/img41.png +0 -0
  225. data/doc/ep_flux/math-doc/document/img42.png +0 -0
  226. data/doc/ep_flux/math-doc/document/img43.png +0 -0
  227. data/doc/ep_flux/math-doc/document/img44.png +0 -0
  228. data/doc/ep_flux/math-doc/document/img45.png +0 -0
  229. data/doc/ep_flux/math-doc/document/img46.png +0 -0
  230. data/doc/ep_flux/math-doc/document/img47.png +0 -0
  231. data/doc/ep_flux/math-doc/document/img48.png +0 -0
  232. data/doc/ep_flux/math-doc/document/img49.png +0 -0
  233. data/doc/ep_flux/math-doc/document/img5.png +0 -0
  234. data/doc/ep_flux/math-doc/document/img50.png +0 -0
  235. data/doc/ep_flux/math-doc/document/img51.png +0 -0
  236. data/doc/ep_flux/math-doc/document/img52.png +0 -0
  237. data/doc/ep_flux/math-doc/document/img53.png +0 -0
  238. data/doc/ep_flux/math-doc/document/img54.png +0 -0
  239. data/doc/ep_flux/math-doc/document/img55.png +0 -0
  240. data/doc/ep_flux/math-doc/document/img56.png +0 -0
  241. data/doc/ep_flux/math-doc/document/img57.png +0 -0
  242. data/doc/ep_flux/math-doc/document/img58.png +0 -0
  243. data/doc/ep_flux/math-doc/document/img59.png +0 -0
  244. data/doc/ep_flux/math-doc/document/img6.png +0 -0
  245. data/doc/ep_flux/math-doc/document/img60.png +0 -0
  246. data/doc/ep_flux/math-doc/document/img61.png +0 -0
  247. data/doc/ep_flux/math-doc/document/img62.png +0 -0
  248. data/doc/ep_flux/math-doc/document/img63.png +0 -0
  249. data/doc/ep_flux/math-doc/document/img64.png +0 -0
  250. data/doc/ep_flux/math-doc/document/img65.png +0 -0
  251. data/doc/ep_flux/math-doc/document/img66.png +0 -0
  252. data/doc/ep_flux/math-doc/document/img67.png +0 -0
  253. data/doc/ep_flux/math-doc/document/img68.png +0 -0
  254. data/doc/ep_flux/math-doc/document/img69.png +0 -0
  255. data/doc/ep_flux/math-doc/document/img7.png +0 -0
  256. data/doc/ep_flux/math-doc/document/img70.png +0 -0
  257. data/doc/ep_flux/math-doc/document/img71.png +0 -0
  258. data/doc/ep_flux/math-doc/document/img72.png +0 -0
  259. data/doc/ep_flux/math-doc/document/img73.png +0 -0
  260. data/doc/ep_flux/math-doc/document/img74.png +0 -0
  261. data/doc/ep_flux/math-doc/document/img75.png +0 -0
  262. data/doc/ep_flux/math-doc/document/img76.png +0 -0
  263. data/doc/ep_flux/math-doc/document/img77.png +0 -0
  264. data/doc/ep_flux/math-doc/document/img78.png +0 -0
  265. data/doc/ep_flux/math-doc/document/img79.png +0 -0
  266. data/doc/ep_flux/math-doc/document/img8.png +0 -0
  267. data/doc/ep_flux/math-doc/document/img80.png +0 -0
  268. data/doc/ep_flux/math-doc/document/img81.png +0 -0
  269. data/doc/ep_flux/math-doc/document/img82.png +0 -0
  270. data/doc/ep_flux/math-doc/document/img83.png +0 -0
  271. data/doc/ep_flux/math-doc/document/img84.png +0 -0
  272. data/doc/ep_flux/math-doc/document/img85.png +0 -0
  273. data/doc/ep_flux/math-doc/document/img86.png +0 -0
  274. data/doc/ep_flux/math-doc/document/img87.png +0 -0
  275. data/doc/ep_flux/math-doc/document/img88.png +0 -0
  276. data/doc/ep_flux/math-doc/document/img89.png +0 -0
  277. data/doc/ep_flux/math-doc/document/img9.png +0 -0
  278. data/doc/ep_flux/math-doc/document/img90.png +0 -0
  279. data/doc/ep_flux/math-doc/document/img91.png +0 -0
  280. data/doc/ep_flux/math-doc/document/img92.png +0 -0
  281. data/doc/ep_flux/math-doc/document/img93.png +0 -0
  282. data/doc/ep_flux/math-doc/document/img94.png +0 -0
  283. data/doc/ep_flux/math-doc/document/img95.png +0 -0
  284. data/doc/ep_flux/math-doc/document/img96.png +0 -0
  285. data/doc/ep_flux/math-doc/document/img97.png +0 -0
  286. data/doc/ep_flux/math-doc/document/img98.png +0 -0
  287. data/doc/ep_flux/math-doc/document/img99.png +0 -0
  288. data/doc/ep_flux/math-doc/document/index.html +101 -0
  289. data/doc/ep_flux/math-doc/document/internals.pl +258 -0
  290. data/doc/ep_flux/math-doc/document/labels.pl +265 -0
  291. data/doc/ep_flux/math-doc/document/next.png +0 -0
  292. data/doc/ep_flux/math-doc/document/next_g.png +0 -0
  293. data/doc/ep_flux/math-doc/document/node1.html +104 -0
  294. data/doc/ep_flux/math-doc/document/node10.html +164 -0
  295. data/doc/ep_flux/math-doc/document/node11.html +86 -0
  296. data/doc/ep_flux/math-doc/document/node12.html +166 -0
  297. data/doc/ep_flux/math-doc/document/node13.html +897 -0
  298. data/doc/ep_flux/math-doc/document/node14.html +1065 -0
  299. data/doc/ep_flux/math-doc/document/node15.html +72 -0
  300. data/doc/ep_flux/math-doc/document/node16.html +81 -0
  301. data/doc/ep_flux/math-doc/document/node2.html +82 -0
  302. data/doc/ep_flux/math-doc/document/node3.html +91 -0
  303. data/doc/ep_flux/math-doc/document/node4.html +149 -0
  304. data/doc/ep_flux/math-doc/document/node5.html +330 -0
  305. data/doc/ep_flux/math-doc/document/node6.html +99 -0
  306. data/doc/ep_flux/math-doc/document/node7.html +98 -0
  307. data/doc/ep_flux/math-doc/document/node8.html +83 -0
  308. data/doc/ep_flux/math-doc/document/node9.html +140 -0
  309. data/doc/ep_flux/math-doc/document/prev.png +0 -0
  310. data/doc/ep_flux/math-doc/document/prev_g.png +0 -0
  311. data/doc/ep_flux/math-doc/document/up.png +0 -0
  312. data/doc/ep_flux/math-doc/document/up_g.png +0 -0
  313. data/doc/gdir.html +412 -0
  314. data/doc/gdir_client.html +16 -0
  315. data/doc/gdir_connect_ftp-like.html +61 -0
  316. data/doc/gdir_server.html +45 -0
  317. data/doc/ggraph.html +1119 -0
  318. data/doc/gpcat.html +45 -0
  319. data/doc/gpcut.html +47 -0
  320. data/doc/gphys.html +624 -0
  321. data/doc/gphys_fft.html +324 -0
  322. data/doc/gphys_grads_io.html +69 -0
  323. data/doc/gphys_grib_io.html +82 -0
  324. data/doc/gphys_io.html +183 -0
  325. data/doc/gphys_io_common.html +18 -0
  326. data/doc/gphys_netcdf_io.html +283 -0
  327. data/doc/gplist.html +24 -0
  328. data/doc/gpmath.html +52 -0
  329. data/doc/gpmaxmin.html +32 -0
  330. data/doc/gpprint.html +35 -0
  331. data/doc/gpview.html +349 -0
  332. data/doc/grads2nc_with_gphys.html +21 -0
  333. data/doc/grads_gridded.html +307 -0
  334. data/doc/grib.html +149 -0
  335. data/doc/grid.html +224 -0
  336. data/doc/index.html +145 -0
  337. data/doc/index.rd +138 -0
  338. data/doc/netcdf_convention.html +136 -0
  339. data/doc/unumeric.html +176 -0
  340. data/doc/update +69 -0
  341. data/doc/update_rdoc +8 -0
  342. data/doc/varray.html +299 -0
  343. data/doc/varraycomposite.html +67 -0
  344. data/ext_init.c +1 -0
  345. data/extconf.rb +16 -6
  346. data/gphys.gemspec +33 -26
  347. data/interpo.c +1 -1
  348. data/lib/numru/dclext.rb +718 -546
  349. data/lib/numru/derivative.rb +2 -0
  350. data/lib/numru/ganalysis.rb +38 -0
  351. data/lib/numru/ganalysis/beta_plane.rb +103 -0
  352. data/lib/numru/ganalysis/eof.rb +3 -2
  353. data/lib/numru/ganalysis/fitting.rb +559 -0
  354. data/lib/numru/ganalysis/histogram.rb +36 -19
  355. data/lib/numru/ganalysis/log_p.rb +130 -0
  356. data/lib/numru/ganalysis/met.rb +396 -2
  357. data/lib/numru/ganalysis/met_z.rb +300 -0
  358. data/lib/numru/ganalysis/planet.rb +17 -7
  359. data/lib/numru/ganalysis/qg.rb +685 -0
  360. data/lib/numru/ganalysis/sigma_coord.rb +90 -0
  361. data/lib/numru/gdir.rb +2 -1
  362. data/lib/numru/ggraph.rb +204 -60
  363. data/lib/numru/ggraph_on_merdional_section.rb +1 -1
  364. data/lib/numru/gphys.rb +6 -0
  365. data/lib/numru/gphys/assoccoords.rb +18 -3
  366. data/lib/numru/gphys/axis.rb +209 -8
  367. data/lib/numru/gphys/derivative.rb +11 -0
  368. data/lib/numru/gphys/gphys.rb +539 -48
  369. data/lib/numru/gphys/gphys_dim_op.rb +331 -0
  370. data/lib/numru/gphys/gphys_fft.rb +48 -2
  371. data/lib/numru/gphys/gphys_io.rb +241 -13
  372. data/lib/numru/gphys/gphys_netcdf_io.rb +77 -39
  373. data/lib/numru/gphys/gphys_nusdas_io.rb +3 -0
  374. data/lib/numru/gphys/grib.rb +133 -54
  375. data/lib/numru/gphys/grib_params.rb +26 -3
  376. data/lib/numru/gphys/grid.rb +75 -34
  377. data/lib/numru/gphys/interpolate.rb +24 -10
  378. data/lib/numru/gphys/mdstorage.rb +160 -0
  379. data/lib/numru/gphys/netcdf_convention.rb +4 -2
  380. data/lib/numru/gphys/subsetmapping.rb +0 -1
  381. data/lib/numru/gphys/unumeric.rb +50 -5
  382. data/lib/numru/gphys/varray.rb +15 -30
  383. data/lib/numru/gphys/varraycomposite.rb +107 -24
  384. data/lib/numru/gphys/varraynetcdf.rb +9 -3
  385. data/lib/numru/gphys/version.rb +5 -0
  386. data/sample/druby_cli1.rb +2 -0
  387. data/sample/druby_cli2.rb +0 -6
  388. data/sample/druby_serv2.rb +0 -13
  389. data/spec/gphys_spec.rb +11 -0
  390. data/spec/spec_helper.rb +2 -0
  391. data/test/test_assoccoords.rb +102 -0
  392. data/test/test_axis.rb +61 -0
  393. data/test/test_fitting.rb +116 -0
  394. data/test/test_gphys.rb +20 -0
  395. data/test/test_met_z.rb +96 -0
  396. data/test/test_sigma_coord.rb +50 -0
  397. data/{test → test_old}/eof_slp.rb +0 -0
  398. data/{test → test_old}/mltbit.dat +0 -0
  399. data/{test → test_old}/test_ep_flux.rb +0 -0
  400. data/{test → test_old}/test_multibitIO.rb +0 -0
  401. metadata +530 -191
  402. data/README.md +0 -29
  403. data/lib/gphys.rb +0 -2
  404. data/lib/numru/dclext_datetime_ax.rb +0 -220
  405. data/lib/version.rb +0 -3
@@ -34,14 +34,21 @@ module NumRu
34
34
  nbins = 10 if nbins < 10
35
35
  min = opts["min"] || gphys0.min.val
36
36
  max = opts["max"] || gphys0.max.val
37
+ if log_bins = (opts["log_bins"] && (min > 0))
38
+ min = Math.log10(min)
39
+ max = Math.log10(max)
40
+ end
37
41
  hist = GSL::Histogram.alloc(nbins,[min,max])
38
42
  end
39
43
  val = gphys0.val
40
44
  val = val.get_array![val.get_mask!] if NArrayMiss === val
45
+ val = NMath.log10(val) if log_bins
41
46
  hist.increment(val)
42
47
 
43
48
  bounds = hist.range.to_na
49
+ bounds = 10 ** bounds if log_bins
44
50
  center = (bounds[0..-2]+bounds[1..-1])/2
51
+ cell_width = (bounds[1..-1] - bounds[0..-2]) / 2
45
52
  name = gphys0.name
46
53
  attr = gphys0.data.attr_copy
47
54
  bounds = VArray.new(bounds, attr, name)
@@ -51,8 +58,9 @@ module NumRu
51
58
  axis.set_pos_to_center
52
59
 
53
60
  bin = hist.bin.to_na
61
+ bin /= cell_width if opts["log_bins"]
54
62
  bin = VArray.new(bin,
55
- {"long_name"=>"number in bins", "units"=>"1"},
63
+ {"long_name" => (log_bins ? "number per unit bin width" : "number in bins"), "units"=>"1"},
56
64
  "bin")
57
65
  new_gphys = GPhys.new(Grid.new(axis), bin)
58
66
  new_gphys.set_att("mean",[hist.mean])
@@ -157,7 +165,8 @@ module NumRu
157
165
  ['window', [nil,nil,nil,nil], "window bounds"],
158
166
  ['title', "histogram", "window title"],
159
167
  ['exchange', false, "exchange x and y"],
160
- ['fill', false, "fill bars"]
168
+ ['fill', false, "fill bars"],
169
+ ['fill_pattern', nil, "fill pattern"]
161
170
  )
162
171
  def histogram(gphys, newframe=true, options=nil)
163
172
  gropn_1_if_not_yet
@@ -173,7 +182,10 @@ module NumRu
173
182
  # if window is specified via GGraph#fig or GGraph#set_fig, use it.
174
183
  opts = @@histogram_options.interpret(options)
175
184
  exchange = opts["exchange"]
176
- window = opts["window"] || @@fig['window']
185
+ raise "Option 'window' must be an Array of length == 4" unless opts["window"].is_a?(Array) && opts["window"].length == 4
186
+ window = opts["window"].dup
187
+ 4.times{|i| window[i] ||= @@fig['window'][i]} if @@fig['window']
188
+ 4.times{|i| window[i] ||= DCL::sgqwnd[i]} unless newframe
177
189
  unless exchange
178
190
  x = gphys.axis(0).cell_bounds
179
191
  y = gphys
@@ -201,7 +213,9 @@ module NumRu
201
213
  tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
202
214
  end
203
215
  y.replace_val(tmp)
204
- window[2] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
216
+ if(window[2].nil? || window[2] == 0)
217
+ window[2] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
218
+ end
205
219
  end
206
220
  if (itr==3 || itr==4)
207
221
  tmp = x.val
@@ -220,38 +234,35 @@ module NumRu
220
234
  tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
221
235
  end
222
236
  x.replace_val(tmp)
223
- window[0] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
237
+ if(window[0].nil? || window[0] == 0)
238
+ window[0] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
239
+ end
224
240
  end
225
241
  opts["window"] = window
226
242
 
227
- if newframe
228
- fig(x, y, "window"=>opts["window"])
229
- axes(x, y, "title"=>opts["title"])
230
- end
243
+ fig(x, y, "window" => window) if newframe
231
244
  lmiss = DCL::gllget("lmiss")
232
245
  DCL::gllset("lmiss", true)
246
+ if opts["fill"]
247
+ itps = DCL::uuqarp
248
+ itps[0] = itps[1] = opts["fill_pattern"] if opts["fill_pattern"]
249
+ DCL::uusarp(*itps)
250
+ end
233
251
  unless exchange
234
252
  if opts["fill"]
235
253
  DCL::uvbxa(x.val, [window[2]] * y.length, y.val)
236
254
  end
237
- if (itr == 2) || (itr == 4)
238
- bottom = [y.val.min] * y.length
239
- else
240
- bottom = [window[2]] * y.length
241
- end
255
+ bottom = [window[2]] * y.length
242
256
  DCL::uvbxf(x.val, bottom, y.val)
243
257
  else
244
258
  if opts["fill"]
245
259
  DCL::uhbxa([window[0]] * x.length, x.val, y.val)
246
260
  end
247
- if (itr == 3) || (itr == 4)
248
- bottom = [x.val.min] * x.length
249
- else
250
- bottom = [window[0]] * x.length
251
- end
261
+ bottom = [window[0]] * x.length
252
262
  DCL::uhbxf(bottom, x.val, y.val)
253
263
  end
254
264
  DCL::gllset("lmiss", lmiss)
265
+ axes(x, y, "title" => opts["title"]) if newframe
255
266
  return nil
256
267
  end
257
268
  alias :histogram1D :histogram
@@ -308,10 +319,16 @@ if $0 == __FILE__
308
319
  GGraph.set_fig("itr"=>4)
309
320
  GGraph.histogram(hist)
310
321
 
322
+ GGraph.set_fig("itr"=>1)
323
+ GGraph.histogram(hist, true, "fill" => true, "fill_pattern" => 15999)
324
+
311
325
  GGraph.set_fig("itr"=>1)
312
326
  hist = gphys1D.histogram("nbins"=>10)
313
327
  GGraph.histogram(hist, true, "title"=>"histogram 1D")
314
328
 
329
+ hist = GAnalysis.histogram(gphys1D, 'log_bins' => true)
330
+ GGraph.histogram(hist)
331
+
315
332
  hist = GAnalysis.histogram2D(gphys2D_0, gphys2D_1, "nbins0"=>50)
316
333
  GGraph.tone(hist, true, "tonc"=>true)
317
334
 
@@ -0,0 +1,130 @@
1
+ require "numru/gphys"
2
+ require 'numru/gphys/derivative'
3
+ require "numru/ganalysis/met"
4
+
5
+ module NumRu
6
+ module GAnalysis
7
+
8
+ # module LogP : log-pressure coordinate support
9
+ #
10
+ module LogP
11
+ module_function
12
+
13
+ # P00 = 1e5 Pa (1000 hPa)
14
+ P00 = UNumeric[1e5,"Pa"]
15
+
16
+ @@H = UNumeric[7e3,"m"]
17
+
18
+ # set the constant log-p scale height (default 7e3 m)
19
+ #
20
+ # Argument
21
+ # * h [Unumeric]
22
+ def set_h(h)
23
+ @@H = h
24
+ end
25
+
26
+ # returns the current value of the log-p scale height (in UNumeric)
27
+ def h
28
+ @@H.clone
29
+ end
30
+
31
+ # convert pressure to log-p height
32
+ def p2z(p)
33
+ z = (p/P00).convert_units("1").log * (-@@H)
34
+ z.name = "z"
35
+ z.long_name = "log-p z"
36
+ z.del_att("positive")
37
+ z
38
+ end
39
+
40
+ # del/delz applied to data with the p coordinate
41
+ def pcdata_dz(gphys, pdim=nil)
42
+ pdim = Met.find_prs_d(gphys) if !pdim
43
+ p = gphys.axis(pdim).to_gphys
44
+ z = p2z(p.data)
45
+ bc = Derivative::LINEAR_EXT
46
+ delz = gphys.threepoint_O2nd_deriv(pdim, bc, z)
47
+ delz.name = gphys.name+"_z"
48
+ delz.long_name = "del/delz (#{gphys.long_name})"
49
+ delz
50
+ end
51
+
52
+ # del2/del2z applied to data with the p coordinate
53
+ def pcdata_dz2(gphys, pdim=nil)
54
+ pdim = Met.find_prs_d(gphys) if !pdim
55
+ p = gphys.axis(pdim).to_gphys
56
+ z = p2z(p.data)
57
+ bc = Derivative::LINEAR_EXT
58
+ delz = gphys.deriv2nd(pdim, bc, z)
59
+ delz.name = gphys.name+"_zz"
60
+ delz.long_name = "del2/del2z (#{gphys.long_name})"
61
+ delz
62
+ end
63
+
64
+ # p^{-1} del_z ( p del_z self )
65
+ # where del_z = del/del z
66
+ def pcdata_pi_dz_p_dz(gphys, pdim=nil)
67
+ pdim = Met.find_prs_d(gphys) if !pdim
68
+ p = gphys.axis(pdim).to_gphys
69
+ z = p2z(p.data)
70
+ bc = Derivative::LINEAR_EXT
71
+ p_dz = gphys.threepoint_O2nd_deriv(pdim, bc, z) * p
72
+ pi_dz_p_p_dz = p_dz.threepoint_O2nd_deriv(pdim, bc, z) / p
73
+ pi_dz_p_p_dz.long_name = "1/p del_z (p del_z #{gphys.name})"
74
+ pi_dz_p_p_dz
75
+ end
76
+
77
+ end
78
+ end
79
+
80
+ class GPhys
81
+ # Convert the pressure coordinate in self to log-pressure height (after duplicating self)
82
+ #
83
+ # Return value: a GPhys
84
+ def logp_coord_p2z(pdim=nil)
85
+ pdim = GAnalysis::Met.find_prs_d(self) if !pdim
86
+ p = self.coord(pdim)
87
+ z = GAnalysis::LogP.p2z(p)
88
+ ax = self.axis(pdim).copy
89
+ ax.set_pos(z)
90
+ ax.name = z.name
91
+ grid = self.grid.copy.set_axis(pdim, ax)
92
+ GPhys.new(grid,self.data)
93
+ end
94
+
95
+ end
96
+ end
97
+
98
+
99
+ ########################################
100
+ ##### test part ######
101
+ if $0 == __FILE__
102
+ require "numru/ggraph"
103
+ include NumRu
104
+ u = GPhys::IO.open("../../../testdata/UV.jan.nc","U")
105
+ u2 = u.logp_coord_p2z
106
+ p u2.axnames
107
+ puts u2.coord(2).units
108
+ DCL.swpset('iwidth',1000)
109
+ DCL.swpset('iheight',500)
110
+ DCL.gropn(4)
111
+ DCL.sldiv('y',2,1)
112
+ DCL.sgpset('isub', 96) # control character of subscription: '_' --> '`'
113
+ DCL.glpset('lmiss',true)
114
+ GGraph.contour u2[0,false]
115
+ u_zz = GAnalysis::LogP.pcdata_pi_dz_p_dz(u[0,false])
116
+ GGraph.tone u_zz
117
+ GGraph.contour u[0,false], false
118
+ GGraph.color_bar
119
+ puts u2.units, u_zz.units
120
+
121
+ #sig = (u.axis(2).to_gphys / GAnalysis::LogP::P00).convert_units("1")
122
+ z = GAnalysis::LogP.p2z(u.axis(2).to_gphys)
123
+ p z.val
124
+ y = u[0,false] * 0 - z
125
+ y_zz = GAnalysis::LogP.pcdata_pi_dz_p_dz(y)
126
+ GGraph.line y_zz[0,false], true, "exchange"=>true
127
+ GGraph.color_bar
128
+
129
+ DCL.grcls
130
+ end
@@ -5,6 +5,16 @@ require 'numru/ganalysis/planet'
5
5
 
6
6
  module NumRu
7
7
 
8
+ class GPhys
9
+ for f in %w!temp2theta interpolate_onto_theta z2geostrophic_wind q2r r2q r2e e2r q2e e2q lat e_sat rh2e theta_e theta_es!
10
+ eval <<-EOS
11
+ def #{f}(*args)
12
+ GAnalysis::Met.#{f}(self,*args)
13
+ end
14
+ EOS
15
+ end
16
+ end
17
+
8
18
  module GAnalysis
9
19
 
10
20
  # Meteorological analysis
@@ -133,7 +143,7 @@ module NumRu
133
143
  # potential temperature values (Kelvin) on which PV is derived.
134
144
  #
135
145
  # RETURN VALUE
136
- # * potential temperature [GPhys] on a theta coordinate, where
146
+ # * potential voticity [GPhys] on a theta coordinate, where
137
147
  # levels are set to theta_levs
138
148
  def pv_on_theta(u, v, theta, theta_levs)
139
149
  sigi = GAnalysis::Met.sigma_inv(theta)
@@ -147,6 +157,40 @@ module NumRu
147
157
  pv
148
158
  end
149
159
 
160
+ # Derive Ertel's potential vorticity on the pressure
161
+ # coordinate
162
+ #
163
+ #
164
+ # ARGUMENTS
165
+ # * u [GPhys] : zonal wind on pressure coordinate
166
+ # (u, v, and theta must share same coordinates)
167
+ # * v [GPhys] : meridional wind on pressure coordinate
168
+ # * theta [GPhys] : potential temperature on pressure coordinate
169
+ #
170
+ # RETURN VALUE
171
+ # * potential vorticity [GPhys] on the same grid as the inputs
172
+ #
173
+ def pv_on_p(u, v, theta)
174
+ up,vp,thp = del_ngp(u,v,theta) # -g del/del p
175
+ pv = Planet.absvor_s(u, v) * thp \
176
+ - vp * Planet.grad_sx(theta) \
177
+ + up * Planet.grad_sy(theta)
178
+ pv.long_name = "potential vorticity"
179
+ pv.name = "PV"
180
+ pv.units = pv.units.reduce5 # express in the MKS fundamental units
181
+ pv
182
+ end
183
+
184
+ # -g del/del p
185
+ def del_ngp(*gps) # gps: array of GPhys objects having the same grid
186
+ d = find_prs_d(gps[0])
187
+ prs = gps[0].coord(d).convert_units(Units["Pa"])
188
+ dngps = gps.collect{|gp|
189
+ gp.threepoint_O2nd_deriv(d,Derivative::LINEAR_EXT,prs) * (-@@g)
190
+ }
191
+ end
192
+ private :del_ngp
193
+
150
194
  # Derive geostrophic wind from geopotential hight (spherical but fixed f)
151
195
  #
152
196
  # ARGUMENTS
@@ -194,7 +238,7 @@ module NumRu
194
238
  # Here, the 2nd line (vertical advection) is optional;
195
239
  # [vx, vy] = gradH v; [thetax, thetay] = gradH theta;
196
240
  # [ux, uy] = cos_phi * gradH (u/cos_phi)
197
- # va = v/tan_phi/a (a=radius).
241
+ # va = v*tan_phi/a (a=radius).
198
242
  # z and w is the vertical coordinate and the lagrangian
199
243
  # "velocity" in that coordinate --- Typically they are
200
244
  # p and omega, or log-p height and log-p w.
@@ -405,6 +449,327 @@ module NumRu
405
449
  dfdz / x
406
450
  end
407
451
 
452
+ ##### moist thermodynamics ###
453
+
454
+ @@consider_ice = true
455
+ @@ice_thres = T0 # Celcius
456
+
457
+ # whether or not ice is considered in the water phase change
458
+ def consider_ice
459
+ @@consider_ice
460
+ end
461
+
462
+ # set whether or not ice is considered in the water phase change
463
+ def consider_ice=(t_or_f)
464
+ @@consider_ice=t_or_f
465
+ end
466
+
467
+ # the threshold temperature for liquid/ice-phase treatment
468
+ def ice_thres
469
+ @@ice_thres
470
+ end
471
+
472
+ # set the threshold temperature for liquid/ice-phase treatment (default: O degC)
473
+ def ice_thres=(temp)
474
+ @@ice_thres=temp
475
+ end
476
+
477
+ # specific humidity -> mixing ratio
478
+ #
479
+ # ARGUMENTS
480
+ # * q: specific humidty
481
+ #
482
+ # RETURN VALUE
483
+ # * r: mixing ratio
484
+ def q2r(q)
485
+ r = q/(1.0-q)
486
+ r.name = "r"
487
+ r.long_name = "mixing ratio"
488
+ r
489
+ end
490
+
491
+ # mixing ratio -> specific humidity
492
+ #
493
+ # ARGUMENTS
494
+ # * r: mixing ratio
495
+ #
496
+ # RETURN VALUE
497
+ # * q: specific humidty
498
+ def r2q(r)
499
+ q = r/(1.0+r)
500
+ q.name = "q"
501
+ q.long_name = "specific humidity"
502
+ q
503
+ end
504
+
505
+ # water vapor mixing ratio -> water vapor pressure
506
+ #
507
+ # ARGUMENTS
508
+ # * r: water vapor mixing ratio
509
+ # * prs: pressure
510
+ #
511
+ # RETURN VALUE
512
+ # * e: water vapor pressure
513
+ def r2e(r,prs=nil)
514
+ prs = get_prs(r) if !prs
515
+ prs = convert_units2Pa(prs)
516
+ rratio = R / Rv
517
+ e = prs*r/(rratio+r) # water vapor pertial pressure
518
+ e.name = "e"
519
+ e.long_name = "water vapor pressure"
520
+ e
521
+ end
522
+
523
+ # water vapor pressure -> mixing ratio
524
+ #
525
+ # ARGUMENTS
526
+ # * e: water vapor pressure
527
+ # * prs: pressure
528
+ #
529
+ # RETURN VALUE
530
+ # * r: mixing ratio
531
+ def e2r(e,prs=nil)
532
+ prs = get_prs(e) if !prs
533
+ prs = convert_units(prs,e.units)
534
+ rratio = R / Rv
535
+ r = rratio * e / (prs-e)
536
+ r.name = "r"
537
+ r.long_name = "mixing ratio"
538
+ r
539
+ end
540
+
541
+ # specific humidity -> water vapor pressure
542
+ #
543
+ # ARGUMENTS
544
+ # * q: specific humidity[g/g]
545
+ # * prs: pressure[hPa]
546
+ #
547
+ # RETURN VALUE
548
+ # * e: water vapor pressure
549
+ def q2e(q,prs=nil)
550
+ prs = get_prs(q) if !prs
551
+ prs = convert_units2Pa(prs)
552
+ rratio = R / Rv
553
+ e = prs*q/(rratio+(1-rratio)*q) # water vapor pertial pressure
554
+ e.name = "e"
555
+ e.long_name = "water vapor pressure"
556
+ e
557
+ end
558
+
559
+ # water vapor pressure -> specific humidity
560
+ #
561
+ # ARGUMENTS
562
+ # * e: water vapor pressure
563
+ # * prs: pressure
564
+ #
565
+ # RETURN VALUE
566
+ # * q: specific humidity
567
+ def e2q(e,prs=nil)
568
+ prs = get_prs(e) if !prs
569
+ prs = convert_units(prs,e.units)
570
+ rratio = R / Rv
571
+ q = rratio * e / (prs-(1-rratio)*e)
572
+ q.name = "q"
573
+ q.long_name = "specific humidity"
574
+ q
575
+ end
576
+
577
+ # temperature --> latent heat [J.kg-1]
578
+ #
579
+ # good for -100<T<50
580
+ #
581
+ # ARGUMENTS
582
+ # * temp: temperature
583
+ #
584
+ # RETURN VALUE
585
+ # * lat: latent heat
586
+ def lat(temp)
587
+ tempK = temp.convert_units("K")
588
+ lat = Lat0*(T0/tempK)**(0.167+tempK.val*3.67E-4)
589
+ lat.name = "L"
590
+ lat.long_name = "Latent heat"
591
+ lat
592
+ end
593
+
594
+ # Bolton formula for saturation water vapor pressure against water
595
+ #
596
+ # ARGUMENTS
597
+ # * temp: temperature
598
+ #
599
+ # RETURN VALUE
600
+ # * es: saturation water vapor pressure [Pa]
601
+ def e_sat_bolton(temp)
602
+ tempC = temp.convert_units("degC")
603
+ es = UNumeric[6.112e2,"Pa"] *
604
+ Misc::EMath.exp( 17.67 * tempC / (tempC + UNumeric[243.5,"degC"] ) )
605
+ es.name = "e_sat"
606
+ es.long_name = "e_sat_water bolton"
607
+ es
608
+ end
609
+
610
+ # saturation water vapor pressure against ice.
611
+ #
612
+ # Emanuel (1994) eq.(4.4.15)
613
+ #
614
+ # ARGUMENTS
615
+ # * temp: temperature
616
+ #
617
+ # RETURN VALUE
618
+ # * es: saturation water vapor pressure [Pa]
619
+ def e_sat_emanuel_water(temp, mask=nil)
620
+ es = temp.copy
621
+ tempK = temp.convert_units("K").val # units removed
622
+ tempK = tempK[mask] if mask
623
+ e = 53.67957 - 6743.769/tempK \
624
+ - 4.8451 * Misc::EMath.log(tempK)
625
+ if !mask
626
+ es.replace_val( Misc::EMath.exp(e) * 100.0 )
627
+ else
628
+ es[false] = 0
629
+ es[mask] = Misc::EMath.exp(e) * 100.0
630
+ end
631
+ es.units = "Pa"
632
+ es.name = "e_sat_ice"
633
+ es.long_name = "e_sat_ice emanuel"
634
+ es
635
+ end
636
+
637
+ # Saturation water vapor pressure against ice.
638
+ #
639
+ # Emanuel (1994) eq.(4.4.15)
640
+ #
641
+ # ARGUMENTS
642
+ # * temp: temperature
643
+ #
644
+ # RETURN VALUE
645
+ # * es: saturation water vapor pressure [Pa]
646
+ def e_sat_emanuel_ice(temp, mask=nil)
647
+ es = temp.copy
648
+ tempK = temp.convert_units("K").val # units removed
649
+ tempK = tempK[mask] if mask
650
+ e = 23.33086 - 6111.72784/tempK \
651
+ + 0.15215 * Misc::EMath.log(tempK)
652
+ if !mask
653
+ es.replace_val( Misc::EMath.exp(e) * 100.0 )
654
+ else
655
+ es[false] = 0
656
+ es[mask] = Misc::EMath.exp(e) * 100.0
657
+ end
658
+ es.units = "Pa"
659
+ es.name = "e_sat_ice"
660
+ es.long_name = "e_sat_ice emanuel"
661
+ es
662
+ end
663
+
664
+ # Selector of the formulat to compute saturation water vapor pressure against water (default: Bolton)
665
+ #
666
+ # ARGUMENTS
667
+ # * formula: nil(default), "bolton", "emanuel"
668
+ #
669
+ # RETURN VALUE
670
+ # * nil
671
+ def set_e_sat_water(formula=nil)
672
+ case formula
673
+ when nil,"bolton"
674
+ alias :e_sat_water :e_sat_bolton
675
+ when "emanuel"
676
+ alias :e_sat_water :e_sat_emanuel_water
677
+ module_function :e_sat_water
678
+ end
679
+ nil
680
+ end
681
+ set_e_sat_water
682
+ module_function :e_sat_water
683
+
684
+ # currently, only a single formula is avilable for ice
685
+ alias :e_sat_ice :e_sat_emanuel_ice
686
+ module_function :e_sat_ice
687
+
688
+ # Calculates saturation water vapor pressure using enhanced
689
+ #
690
+ # ARGUMENTS
691
+ # * temp: temperature
692
+ #
693
+ # RETURN VALUE
694
+ # * es: saturation water vapor pressure
695
+ def e_sat(temp)
696
+
697
+ ice = @@consider_ice && ( temp.lt(@@ice_thres) )
698
+ #ice = ice.to_na
699
+ water = !@@consider_ice || ( (ice==true||ice==false) ? !ice : ice.not)
700
+
701
+ if water
702
+ es = e_sat_water(temp)
703
+ end
704
+
705
+ case ice
706
+ when true
707
+ es = e_sat_ice(temp)
708
+ when NArray, NArrayMiss
709
+ es[ice] = e_sat_ice(temp,ice).val[ice]
710
+ end
711
+ es.name = "e_sat"
712
+ es.long_name = "e_sat"
713
+ es
714
+ end
715
+
716
+ # relative humidity -> water vapor pressure
717
+ #
718
+ # ARGUMENTS
719
+ # * rh: relative humidity
720
+ # * temp: temperature
721
+ #
722
+ # RETURN VALUE
723
+ # * e: water vapor pressure
724
+ def rh2e(rh,temp)
725
+ es = e_sat(temp)
726
+ rh = rh.convert_units("1")
727
+ e = es * rh
728
+ e.name = "e"
729
+ e.long_name = "water vapor pressure"
730
+ e
731
+ end
732
+
733
+ # Derive equivalent potential temperature
734
+ #
735
+ # ARGUMENTS
736
+ # * temp [GPhys] : temperature (ok whether degC or K)
737
+ # * q [GPhys] : specific humidity
738
+ # * prs [GPhys or VArray] : the pressure values.
739
+ # If nil, searched from coordinates (for data on
740
+ # the pressure coordinate)
741
+ #
742
+ # RETURN VALUE
743
+ # * theta_e: equivalent potential temperature
744
+ def theta_e(temp,q,prs=nil)
745
+ tempK = temp.convert_units("K")
746
+ theta = temp2theta(tempK, prs)
747
+ theta_e = theta * Misc::EMath.exp( lat(tempK)*q/(Cp*tempK) )
748
+ theta_e.name = "theta_e"
749
+ theta_e.long_name = "equivalent potential temperature"
750
+ theta_e
751
+ end
752
+
753
+ # Derive the saturation equivalent potential temperature
754
+ #
755
+ # ARGUMENTS
756
+ # * temp [GPhys] : temperature (ok whether degC or K)
757
+ # * prs [GPhys or VArray] : the pressure values.
758
+ # If nil, searched from coordinates (for data on
759
+ # the pressure coordinate)
760
+ #
761
+ # RETURN VALUE
762
+ # * theta_es: saturation equivalent potential temperature
763
+ def theta_es(temp,prs=nil)
764
+ tempK = temp.convert_units("K")
765
+ theta = temp2theta(tempK, prs)
766
+ q = e_sat(temp).e2q(prs)
767
+ theta_e = theta * Misc::EMath.exp( lat(tempK)*q/(Cp*tempK) )
768
+ theta_e.name = "theta_es"
769
+ theta_e.long_name = "theta_e sat"
770
+ theta_e
771
+ end
772
+
408
773
  end
409
774
  end
410
775
  end
@@ -473,6 +838,35 @@ if $0 == __FILE__
473
838
  GGraph::tone pv.cut("theta"=>320),true,"nlev"=>20,"color_bar"=>true
474
839
  GGraph::tone pv.cut("theta"=>600),true,"nlev"=>20,"color_bar"=>true
475
840
 
841
+
842
+ #< moist thermo >
843
+ DCL.grfrm
844
+
845
+ GGraph::set_fig "itr"=>2
846
+
847
+ sel = [0,true,0..-4]
848
+
849
+ es = temp[*sel].e_sat
850
+ # es = GAnalysis::Met.e_sat(temp[*sel]) # same as temp[*sel].e_sat
851
+ GGraph::tone es,true,"int"=>2e2,"max"=>4e3,"min"=>0,"tonf"=>true
852
+ GGraph::contour temp[*sel],false
853
+ GGraph.color_bar
854
+
855
+ GAnalysis::Met.consider_ice=false
856
+ es2 = temp[*sel].e_sat
857
+ GGraph::tone( (es2-es)/es,true )
858
+ GGraph.color_bar
859
+
860
+ # GAnalysis::Met.set_e_sat_water("emanuel")
861
+ # es3 = GAnalysis::Met.e_sat(temp[*sel])
862
+ # GGraph::tone (es2-es3)/es3,true,"tonf"=>true
863
+ # GGraph.color_bar
864
+
865
+ qs = es.e2r
866
+ GGraph::tone qs,true,"nlev"=>20
867
+ GGraph.color_bar
868
+
476
869
  #< finish >
477
870
  DCL.grcls
871
+
478
872
  end