gphys 1.2.2.1 → 1.4.3

Sign up to get free protection for your applications and to get access to all the features.
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
@@ -0,0 +1,11 @@
1
+ require 'spec_helper'
2
+
3
+ describe Gphys do
4
+ it 'has a version number' do
5
+ expect(Gphys::VERSION).not_to be nil
6
+ end
7
+
8
+ it 'does something useful' do
9
+ expect(false).to eq(true)
10
+ end
11
+ end
@@ -0,0 +1,2 @@
1
+ $LOAD_PATH.unshift File.expand_path('../../lib', __FILE__)
2
+ require 'gphys'
@@ -0,0 +1,102 @@
1
+ $LOAD_PATH.unshift("../lib/")
2
+ require "numru/gphys/gphys.rb"
3
+ require "test/unit"
4
+ include NumRu
5
+ include NMath
6
+
7
+ class AssocCoordsTest < Test::Unit::TestCase
8
+ def setup
9
+ #@nx = 10
10
+ #@ny = 7
11
+ @nx = 5
12
+ @ny = 3
13
+ @nz = 2
14
+ @nt = 2
15
+ x = (NArray.sfloat(@nx).indgen! + 0.5) * (2*PI/@nx)
16
+ y = NArray.sfloat(@ny).indgen! * (2*PI/(@ny-1))
17
+ z = NArray.sfloat(@nz).indgen!
18
+ t = NArray.sfloat(@nt).indgen!
19
+ vx = VArray.new( x ).rename("x")
20
+ vy = VArray.new( y ).rename("y")
21
+ vz = VArray.new( z ).rename("z")
22
+ vt = VArray.new( t ).rename("t")
23
+ xax = Axis.new().set_pos(vx)
24
+ yax = Axis.new().set_pos(vy)
25
+ zax = Axis.new().set_pos(vz)
26
+ tax = Axis.new().set_pos(vt)
27
+ xygrid = Grid.new(xax, yax)
28
+ xyzgrid = Grid.new(xax, yax, zax)
29
+ xyztgrid = Grid.new(xax, yax, zax, tax)
30
+
31
+ sqrt2 = sqrt(2.0)
32
+ p = NArray.sfloat(@nx,@ny)
33
+ q = NArray.sfloat(@nx,@ny)
34
+ for j in 0...@ny
35
+ p[true,j] = NArray.sfloat(@nx).indgen!(2*j,1)*sqrt2
36
+ q[true,j] = NArray.sfloat(@nx).indgen!(2*j,-1)*sqrt2
37
+ end
38
+ vp = VArray.new( p ).rename("p")
39
+ vq = VArray.new( q ).rename("q")
40
+ gp = GPhys.new(xygrid, vp)
41
+ gq = GPhys.new(xygrid, vq)
42
+ r = NArray.sfloat(@nz).indgen! * 2
43
+ vr = VArray.new( r ).rename("r")
44
+ gr = GPhys.new( Grid.new(zax), vr )
45
+
46
+ d = sin(x.newdim(1,1)) * cos(y.newdim(0,1)) + z.newdim(0,0)
47
+ vd = VArray.new( d ).rename("d")
48
+ @gd = GPhys.new(xyzgrid, vd)
49
+ @gd.set_assoc_coords([gp,gq,gr])
50
+
51
+ s = p + r.reshape(1,1,@nz)
52
+ vs = VArray.new( s ).rename("s")
53
+ gs = GPhys.new( Grid.new(xax,yax,zax), vs )
54
+ u = NArray.sfloat(@ny).indgen!
55
+ vu = VArray.new( u ).rename("u")
56
+ gu = GPhys.new( Grid.new(yax), vu )
57
+ d2 = d * NArray.sfloat(1,1,1,@nt).indgen
58
+ vd2 = VArray.new( d2 ).rename("d2")
59
+ @gd2 = GPhys.new( xyztgrid, vd2 )
60
+ @gd2.set_assoc_coords([gp,gq,gs,gu])
61
+
62
+ #p @gd
63
+ end
64
+
65
+ def test_gd
66
+ # make sure @gd has proper associated coordinates.
67
+ assert_equal( @gd.coord("p").rank, 2 )
68
+ assert_equal( @gd.coord("p").shape, [@nx,@ny] )
69
+ assert_equal( @gd.coord("q").rank, 2 )
70
+ assert_equal( @gd.coord("r").rank, 1 )
71
+ end
72
+
73
+ def test_divide_and_join
74
+ # make sure to divide a GPhys into chunks and joining them
75
+ # restores the original assoccoords.
76
+ chunks = Array.new
77
+ [0..@nx/2,@nx/2+1..-1].each do |ix|
78
+ [0..@ny/2,@ny/2+1..-1].each do |iy|
79
+ chunks.push( @gd[ix,iy,true].copy )
80
+ end
81
+ end
82
+ gd2 = GPhys.join(chunks)
83
+ assert_equal( gd2.coord("p").shape, [@nx,@ny] )
84
+ assert_equal( gd2.coord("p").val, @gd.coord("p").val )
85
+ end
86
+
87
+ def test_cut_twice
88
+ c = @gd2[true,0,true,true] #=> [@nx,@nz,@nt]
89
+ c2 = c[true,true,0] #=> [@nx,@nz]
90
+ assert_equal( c2.coord("p").shape, [@nx] )
91
+ assert_equal( c2.coord("q").shape, [@nx] )
92
+ assert_equal( c2.coord("s").shape, [@nx,@nz] )
93
+ end
94
+
95
+ def test_mean
96
+ c = @gd2.mean("y") #=> [@nx,@nz,@nt]
97
+ assert_equal( c.coord("p").shape, [@nx] )
98
+ assert_equal( c.coord("q").shape, [@nx] )
99
+ assert_equal( c.coord("s").shape, [@nx,@nz] )
100
+ end
101
+
102
+ end
@@ -0,0 +1,61 @@
1
+ ##$LOAD_PATH.clear
2
+ ##$LOAD_PATH.push("/usr/lib/ruby/1.8")
3
+ ##$LOAD_PATH.push("/usr/lib/ruby/1.8/i686-linux")
4
+ $LOAD_PATH.unshift("../lib/")
5
+ require "numru/gphys/axis.rb"
6
+ require "test/unit"
7
+ include NumRu
8
+
9
+ class AxisTest < Test::Unit::TestCase
10
+ def setup
11
+ @len = 10
12
+ xc = VArray.new( NArray.float(@len).indgen! + 0.5 ).rename("x")
13
+ xb = VArray.new( NArray.float(@len+1).indgen! ).rename("xb")
14
+ @axpt = Axis.new().set_pos(xc)
15
+ axcel = Axis.new(true).set_cell(xc,xb)
16
+ @axcel_c = axcel.dup.set_pos_to_center
17
+ @axcel_b = axcel.dup.set_pos_to_bounds
18
+ #axcel2 = Axis.new(true).set_cell_guess_bounds(xc)
19
+
20
+ xcc = xc.copy
21
+ xcc.set_att("modulo", [@len.to_f])
22
+ @axcyc = Axis.new().set_pos(xcc)
23
+ end
24
+
25
+ def test_cell
26
+ assert_equal(@axcel_c.cell_center?, true)
27
+ assert_equal(@axcel_b.cell_bounds?, true)
28
+ end
29
+
30
+ def test_length
31
+ assert_equal(@axpt.length, @len)
32
+ assert_equal(@axcel_c.length, @len)
33
+ assert_equal(@axcel_b.length, @len+1)
34
+ end
35
+
36
+ def test_cyclic
37
+ assert_equal(@axcyc.cyclic?, true)
38
+ assert_equal(@axcyc.cyclic_extendible?, true)
39
+ assert( @axcyc.cut(14.9)[0].is_a?(String) ) # cut by scalar
40
+ ax, sl = @axcyc.cut([5.6, 13.1, 14.9]) # cut by Array
41
+ assert_equal( ax.pos.val.to_a, [5.5, 13.5, 14.5] )
42
+ assert_equal( sl, [5, 3, 4] )
43
+ ax, sl = @axcyc.cut(-3..3)
44
+ assert_equal( ax.pos.val.to_a, [-2.5, -1.5, -0.5, 0.5, 1.5, 2.5] )
45
+ assert_equal( sl, [7,8,9,0,1,2] )
46
+ ax, sl = @axcyc.cut(-3..13)
47
+ assert_equal( ax.length, 16 )
48
+ assert_equal( sl.length, 16 )
49
+ p "###", ax.pos.val.to_a,sl.to_a
50
+ ##p "###", @axcyc.cut(0.1..0.2)
51
+ end
52
+
53
+ def test_add
54
+ assert_equal( @axpt.add(3.0).pos.val[0], @axpt.pos.val[0]+3.0 )
55
+ axcel_b2 = @axcel_b.add( NArray.float(@axcel_b.length).indgen! )
56
+ len = axcel_b2.length
57
+ assert_equal( @axcel_b.pos[-1].val + (len-1), axcel_b2.pos[-1].val )
58
+ assert_not_equal( @axcel_b.cell_center.val, axcel_b2.cell_center.val )
59
+ assert_nothing_raised{@axcel_c.add(NArray.float(@axcel_c.length).indgen!)}
60
+ end
61
+ end
@@ -0,0 +1,116 @@
1
+ $LOAD_PATH.unshift( File.expand_path("../lib") )
2
+ require "narray"
3
+ require "numru/ganalysis/fitting"
4
+ require "test/unit"
5
+ include NumRu
6
+
7
+ class FittingTest < Test::Unit::TestCase
8
+ def setup
9
+ nx = 7
10
+ ny = 5
11
+ @x = NArray.float(nx).indgen! - nx/2
12
+ @y = NArray.float(ny).indgen! - ny/2
13
+
14
+ x = @x.newdim(-1)
15
+ y = @y.newdim(0)
16
+ @data = x + 2*y + 10 # then the coefficients will be [1, 2, 10]
17
+ dist = (x*x)*(y*y)*1e-1
18
+ dist -= dist.mean
19
+ @data += dist # disturbance that does not change the fitting result
20
+
21
+ @data2 = NArray.float(nx,2,ny)
22
+ @data2[true,0,true] = @data - 1
23
+ @data2[true,1,true] = @data + 1
24
+
25
+ @data3 = 2*NMath.cos(x) + 3*NMath.sin(y)
26
+
27
+ @f_cosx = proc {|x,y| NMath.cos(x).newdim!(-1)}
28
+ @f_sinx = proc {|x,y| NMath.sin(x).newdim!(-1)}
29
+ @f_cosy = proc {|x,y| NMath.cos(y).newdim!(0)}
30
+ @f_siny = proc {|x,y| NMath.sin(y).newdim!(0)}
31
+
32
+ d = NArray.float(nx,2,ny)
33
+ d[true,0,true] = x + 2*y + 10 - 1
34
+ d[true,1,true] = x + 2*y + 10 + 1
35
+ mask = NArray.byte( *d.shape )
36
+ mask[0..3,true,0..3] = mask[-3..-1,true,true] = 1
37
+ mask[0,0,0] = 0 # this is the source of a small descrepancy
38
+ @data2m = NArrayMiss.to_nam( d, mask )
39
+
40
+ @data4 = NArray.float(nx,2,ny,2)
41
+ @data4[false,0] = d - 0.1
42
+ @data4[false,1] = d + 0.1
43
+ end
44
+
45
+ def test_least_square_fit_1
46
+ f_x = GAnalysis::Fitting::X
47
+ f_y = GAnalysis::Fitting::Y
48
+
49
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data, [@x,@y], [f_x, f_y])
50
+ err = (c - NArray[1.0, 2.0, 10.0]).abs.max
51
+ assert( err < 1e-5 )
52
+
53
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data2, [@x,@y],
54
+ [f_x,f_y], [1])
55
+ err = (c - NArray[1.0, 2.0, 10.0]).abs.max
56
+ assert( err < 1e-5 )
57
+ end
58
+
59
+ def test_least_square_fit_2
60
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data3, [@x,@y],
61
+ [@f_cosx, @f_sinx, @f_cosy, @f_siny])
62
+ err = (c - NArray[2.0, 0, 0, 3, 0]).abs.max
63
+ assert( err < 1e-10 )
64
+ assert( dif < 1e-10 )
65
+ end
66
+
67
+ def test_least_square_fit_3
68
+ f_x = GAnalysis::Fitting::X
69
+ f_y = GAnalysis::Fitting::Y
70
+
71
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data2m, [@x,@y],
72
+ [f_x,f_y],[1])
73
+ err = (c - NArray[1.0, 2.0, 10.0]).abs.max
74
+ assert( err < 3e-2 )
75
+ end
76
+
77
+ def test_least_square_fit_4
78
+ f_x = GAnalysis::Fitting::X
79
+ f_y = GAnalysis::Fitting::Y
80
+
81
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data4, [@x,@y], [f_x,f_y],
82
+ nil, [1,3])
83
+ assert_equal( c.rank, 3 )
84
+ assert( dif < 1e-10 ) # should be a perfect fit (except round-off)
85
+
86
+
87
+ c, bf, dif = GAnalysis::Fitting.least_square_fit(@data4, [@x,@y], [f_x,f_y],
88
+ [3], [1])
89
+ assert_equal( c.rank, 2 )
90
+ assert_equal( bf.rank, 4 )
91
+ assert_equal( bf.shape[3], 1 )
92
+ end
93
+
94
+ def test_least_square_fit_5
95
+ va = VArray.new(@data4,{"long_name"=>"data4","units"=>""},"data4")
96
+ xax = Axis.new().set_pos( VArray.new(@x,{"units"=>""},"x") )
97
+ yax = Axis.new().set_pos( VArray.new(@y,{"units"=>""},"y") )
98
+ v1 = NArray.float(@data4.shape[1]).indgen!
99
+ ax1 = Axis.new().set_pos( VArray.new(v1,nil,"d1") )
100
+ v3 = NArray.float(@data4.shape[3]).indgen!
101
+ ax3 = Axis.new().set_pos( VArray.new(v3,nil,"d3") )
102
+ grid = Grid.new(xax, ax1, yax, ax3)
103
+ gphys = GPhys.new(grid, va)
104
+
105
+ f_x = GAnalysis::Fitting::X
106
+ f_y = GAnalysis::Fitting::Y
107
+
108
+ c, bf, dif = gphys.least_square_fit([f_x,f_y], [3], [1])
109
+ assert_equal( c.rank, 2 )
110
+ assert_equal( bf.class, NumRu::GPhys )
111
+ assert_equal( bf.rank, 3 ) # rank reduced <-- ensemble_dims are deleted
112
+ assert_equal( bf.shape, [7,2,5] ) # [nx, len of indep_dim, ny ]
113
+ end
114
+
115
+ end
116
+
@@ -0,0 +1,20 @@
1
+ $LOAD_PATH.unshift("../lib/")
2
+ require "numru/gphys/gphys.rb"
3
+ require "numru/gphys/gphys_io.rb"
4
+ require "test/unit"
5
+ include NumRu
6
+
7
+ class GPhysTest < Test::Unit::TestCase
8
+ def setup
9
+ @T = GPhys::IO.open("../testdata/T.jan.nc","T") # NetCDF data
10
+ @Tgd = GPhys::IO.open("../testdata/T.jan.ctl","T") # GrADS data
11
+ end
12
+
13
+ def test_cyclic_ext
14
+ te = @T.cyclic_ext(0)
15
+ assert_equal( te.shape[0], @T.shape[0]+1 ) # to make sure it is extened
16
+ assert_equal( te.axis(0).pos.max.to_f, 360.0 ) # to make sure it is extened
17
+ te = @Tgd.cyclic_ext(0)
18
+ assert_equal( te.axis(0).pos.max.to_f, 360.0 ) # to make sure it is extened
19
+ end
20
+ end
@@ -0,0 +1,96 @@
1
+ $LOAD_PATH.unshift( File.expand_path("../lib") )
2
+ require "narray"
3
+ require "../gphys_ext" # extention library is currently at the top directory
4
+ require "numru/gphys"
5
+ require "numru/ganalysis/met_z"
6
+ require "numru/ganalysis/sigma_coord"
7
+ require "test/unit"
8
+ include NumRu
9
+
10
+
11
+ class MetZTest < Test::Unit::TestCase
12
+ def setup
13
+ nx = 6
14
+ x = NArray.float(nx).indgen!*60
15
+ lam = ( x * (Math::PI/180) ).newdim(-1)
16
+ ny = 5
17
+ y = NArray.float(ny).indgen!*30 - 60.0
18
+ phi = ( y * (Math::PI/180) ).newdim(0)
19
+ ns = 5
20
+ s = 1.0 - NArray.float(ns).indgen / ns
21
+ vx = VArray.new(x,{"units"=>"degrees_east", "long_name"=>"longitude"},"lon")
22
+ vy = VArray.new(y,{"units"=>"degrees_north","long_name"=>"latitude"},"lat")
23
+ vs = VArray.new(s,{"units"=>"1","long_name"=>"sigma"},"sig")
24
+ ax = Axis.new().set_pos(vx)
25
+ ay = Axis.new().set_pos(vy)
26
+ as = Axis.new().set_pos(vs)
27
+ grid_xy = Grid.new(ax, ay)
28
+ grid_xys = Grid.new(ax, ay, as)
29
+
30
+ p = s * 1000.0
31
+ vp = VArray.new(p,{"units"=>"hPa","long_name"=>"pressure"},"p")
32
+ ap = Axis.new().set_pos(vp)
33
+ grid_xyp = Grid.new(ax, ay, ap)
34
+
35
+ ps = NArray.float(nx,ny).fill!(1000) + NMath.cos(lam)*NMath.cos(phi)*50
36
+ ps[1,1] = 750
37
+ ps[2,1] = 500
38
+ ps[3,1] = 700
39
+
40
+ #< for test_mass_strm_p_* and test_mass_strm_* >
41
+
42
+ @ps = GPhys.new( grid_xy, VArray.new(ps, {"units"=>"hPa"}, "ps") )
43
+
44
+ #v = NArray.float(nx,ny,ns) + (NMath.cos(lam)*NMath.sin(2*phi)*10).newdim(-1)
45
+ v = NArray.float(nx,ny,ns).fill!(1.0)
46
+
47
+ @v_on_sig = GPhys.new( grid_xys, VArray.new(v, {"units"=>"m.s-1"}, "v") )
48
+ @v_on_p = GPhys.new( grid_xyp, VArray.new(v, {"units"=>"m.s-1"}, "v") )
49
+
50
+ #v2 = v.clone
51
+ #(0...ns).each{|k| v2[false,k]=ns-k}
52
+ #v2[2,0,false]=300
53
+ #@v_on_p2 = GPhys.new( grid_xyp, VArray.new(v2, {"units"=>"m.s-1"}, "v") )
54
+
55
+ @ans1 = NArray[ 5.41667e+07, 6.5e+09, 1.3e+10, 1.95e+10, 2.57292e+10 ]
56
+
57
+ #< additionally for test_mass_strm_* >
58
+
59
+ @p_on_sig = GAnalysis::SigmaCoord.sig_ps2p(@ps, s, 2)
60
+
61
+ @pcoord = vs * 1000
62
+ @pcoord.units = "hPa"
63
+ @pcoord.name = "p"
64
+ @pcoord.long_name = "pressure"
65
+ @pcoord.put_att("standard_name","air_pressure")
66
+ @pcoord.put_att("positive","down")
67
+
68
+ end
69
+
70
+ def test_mass_strm_p_1
71
+ mstr = GAnalysis::MetZ.mass_strm_p(@v_on_sig, @ps)
72
+ v = mstr[0,true].val / (2 * Math::PI)
73
+ eps = (v-@ans1).abs.max / v.abs.max
74
+ assert( eps < 1e-5 )
75
+ end
76
+
77
+ #def test_mass_strm_p_2
78
+ # mstr = GAnalysis::MetZ.mass_strm_p(@v_on_p2, @ps)
79
+ #end
80
+
81
+ def test_mass_strm_p_3
82
+ mstr = GAnalysis::MetZ.mass_strm_p(@v_on_p, @ps)
83
+ v = mstr[0,true].val / (2 * Math::PI)
84
+ ans = NArray[ 0, 6.5e+09, 1.3e+10, 1.95e+10, 2.57292e+10 ]
85
+ eps = (v-ans).abs.max / v.abs.max
86
+ assert( eps < 1e-5 )
87
+ end
88
+
89
+ def test_mass_strm_any_1
90
+ mstr = GAnalysis::MetZ.mass_strm_any(@v_on_sig, @ps, @p_on_sig/10, @pcoord/10)
91
+ v = mstr[0,true].val / (2 * Math::PI)
92
+ eps = (v - @ans1).abs.max / v.abs.max
93
+ assert( eps < 1e-5 )
94
+ end
95
+
96
+ end
@@ -0,0 +1,50 @@
1
+ $LOAD_PATH.unshift( File.expand_path("../lib") )
2
+ require "numru/gphys"
3
+ require "numru/ganalysis/sigma_coord"
4
+ require "test/unit"
5
+ include NumRu
6
+
7
+ class SigmaCoordTest < Test::Unit::TestCase
8
+ def setup
9
+ nx = 6
10
+ x = NArray.float(nx).indgen!*60
11
+ lam = ( x * (Math::PI/180) ).newdim(-1)
12
+ ny = 5
13
+ y = NArray.float(ny).indgen!*30 - 60.0
14
+ phi = ( y * (Math::PI/180) ).newdim(0)
15
+ ns = 4
16
+ s = 1.0 - NArray.float(ns).indgen / ns
17
+ vx = VArray.new(x,{"units"=>"degrees_east", "long_name"=>"longitude"},"lon")
18
+ vy = VArray.new(y,{"units"=>"degrees_north","long_name"=>"latitude"},"lat")
19
+ vs = VArray.new(s,{"units"=>"1","long_name"=>"sigma"},"sig")
20
+ ax = Axis.new().set_pos(vx)
21
+ ay = Axis.new().set_pos(vy)
22
+ as = Axis.new().set_pos(vs)
23
+ grid_xy = Grid.new(ax, ay)
24
+ grid_xys = Grid.new(ax, ay, as)
25
+
26
+ ps = NArray.float(nx,ny).fill!(1000) + NMath.cos(lam)*NMath.cos(phi)*10
27
+ @ps = GPhys.new( grid_xy, VArray.new(ps, {"units"=>"hPa"}, "ps") )
28
+
29
+ u = NArray.float(nx,ny,ns) + (NMath.cos(lam)*NMath.sin(2*phi)*10).newdim(-1)
30
+ @u = GPhys.new( grid_xys, VArray.new(u, {"units"=>"m.s-1"}, "u") )
31
+ end
32
+
33
+ def test_find_sigma_d
34
+ assert_equal( GAnalysis::SigmaCoord.find_sigma_d(@u), 2 )
35
+ end
36
+
37
+ def test_sig_ps2p
38
+ sig = @u.coord(2)
39
+ sigval = sig.val
40
+ p1 = GAnalysis::SigmaCoord.sig_ps2p(@ps.val, sigval, 2 )
41
+ assert( p1.is_a?(NArray) )
42
+ assert_equal( p1.shape, @u.shape )
43
+
44
+ p2 = GAnalysis::SigmaCoord.sig_ps2p(@ps, sig, 2 )
45
+ assert( p2.is_a?(GPhys) )
46
+ assert_equal( p2.shape, @u.shape )
47
+ assert_equal( p2.val, p1 )
48
+ end
49
+
50
+ end