gphys 1.1.1 → 1.2.2

Sign up to get free protection for your applications and to get access to all the features.
Files changed (369) hide show
  1. data/.gitignore +17 -0
  2. data/ChangeLog +221 -0
  3. data/Gemfile +4 -0
  4. data/LICENSE.txt +18 -30
  5. data/README +23 -26
  6. data/README.md +29 -0
  7. data/Rakefile +1 -56
  8. data/bin/gpaop +2 -1
  9. data/bin/gpcut +3 -2
  10. data/bin/gpedit +6 -2
  11. data/bin/gpmath +3 -2
  12. data/bin/gpmaxmin +3 -2
  13. data/bin/gpprint +2 -1
  14. data/bin/gpvect +28 -5
  15. data/bin/gpview +43 -5
  16. data/extconf.rb +5 -6
  17. data/gphys.gemspec +34 -0
  18. data/interpo.c +63 -24
  19. data/lib/gphys.rb +2 -0
  20. data/lib/numru/dclext.rb +2636 -0
  21. data/lib/numru/derivative.rb +53 -12
  22. data/lib/numru/ganalysis/eof.rb +4 -0
  23. data/lib/numru/ganalysis/histogram.rb +73 -5
  24. data/lib/numru/ganalysis/met.rb +163 -2
  25. data/lib/numru/ganalysis/planet.rb +230 -20
  26. data/lib/numru/ggraph.rb +147 -2247
  27. data/lib/numru/gphys/assoccoords.rb +19 -3
  28. data/lib/numru/gphys/axis.rb +1 -1
  29. data/lib/numru/gphys/coordmapping.rb +2 -2
  30. data/lib/numru/gphys/derivative.rb +56 -13
  31. data/lib/numru/gphys/gphys.rb +17 -1
  32. data/lib/numru/gphys/gphys_grads_io.rb +6 -5
  33. data/lib/numru/gphys/gphys_grib_io.rb +6 -6
  34. data/lib/numru/gphys/gphys_io.rb +25 -6
  35. data/lib/numru/gphys/grads_gridded.rb +31 -29
  36. data/lib/numru/gphys/grib.rb +13 -9
  37. data/lib/numru/gphys/interpolate.rb +153 -29
  38. data/lib/numru/gphys/unumeric.rb +29 -6
  39. data/lib/numru/gphys/varray.rb +9 -0
  40. data/lib/numru/gphys/varraygrib.rb +70 -8
  41. data/lib/version.rb +3 -0
  42. metadata +247 -531
  43. data/doc/attribute.html +0 -19
  44. data/doc/attributenetcdf.html +0 -15
  45. data/doc/axis.html +0 -376
  46. data/doc/coordmapping.html +0 -111
  47. data/doc/coordtransform.html +0 -36
  48. data/doc/derivative/gphys-derivative.html +0 -80
  49. data/doc/derivative/index.html +0 -21
  50. data/doc/derivative/index.rd +0 -14
  51. data/doc/derivative/math-doc/document/document.css +0 -30
  52. data/doc/derivative/math-doc/document/document.html +0 -57
  53. data/doc/derivative/math-doc/document/images.aux +0 -1
  54. data/doc/derivative/math-doc/document/images.log +0 -385
  55. data/doc/derivative/math-doc/document/images.pl +0 -186
  56. data/doc/derivative/math-doc/document/images.tex +0 -364
  57. data/doc/derivative/math-doc/document/img1.png +0 -0
  58. data/doc/derivative/math-doc/document/img10.png +0 -0
  59. data/doc/derivative/math-doc/document/img11.png +0 -0
  60. data/doc/derivative/math-doc/document/img12.png +0 -0
  61. data/doc/derivative/math-doc/document/img13.png +0 -0
  62. data/doc/derivative/math-doc/document/img14.png +0 -0
  63. data/doc/derivative/math-doc/document/img15.png +0 -0
  64. data/doc/derivative/math-doc/document/img16.png +0 -0
  65. data/doc/derivative/math-doc/document/img17.png +0 -0
  66. data/doc/derivative/math-doc/document/img18.png +0 -0
  67. data/doc/derivative/math-doc/document/img19.png +0 -0
  68. data/doc/derivative/math-doc/document/img2.png +0 -0
  69. data/doc/derivative/math-doc/document/img20.png +0 -0
  70. data/doc/derivative/math-doc/document/img21.png +0 -0
  71. data/doc/derivative/math-doc/document/img22.png +0 -0
  72. data/doc/derivative/math-doc/document/img23.png +0 -0
  73. data/doc/derivative/math-doc/document/img24.png +0 -0
  74. data/doc/derivative/math-doc/document/img25.png +0 -0
  75. data/doc/derivative/math-doc/document/img26.png +0 -0
  76. data/doc/derivative/math-doc/document/img27.png +0 -0
  77. data/doc/derivative/math-doc/document/img28.png +0 -0
  78. data/doc/derivative/math-doc/document/img29.png +0 -0
  79. data/doc/derivative/math-doc/document/img3.png +0 -0
  80. data/doc/derivative/math-doc/document/img30.png +0 -0
  81. data/doc/derivative/math-doc/document/img4.png +0 -0
  82. data/doc/derivative/math-doc/document/img5.png +0 -0
  83. data/doc/derivative/math-doc/document/img6.png +0 -0
  84. data/doc/derivative/math-doc/document/img7.png +0 -0
  85. data/doc/derivative/math-doc/document/img8.png +0 -0
  86. data/doc/derivative/math-doc/document/img9.png +0 -0
  87. data/doc/derivative/math-doc/document/index.html +0 -57
  88. data/doc/derivative/math-doc/document/labels.pl +0 -13
  89. data/doc/derivative/math-doc/document/next.png +0 -0
  90. data/doc/derivative/math-doc/document/next_g.png +0 -0
  91. data/doc/derivative/math-doc/document/node1.html +0 -238
  92. data/doc/derivative/math-doc/document/node2.html +0 -75
  93. data/doc/derivative/math-doc/document/prev.png +0 -0
  94. data/doc/derivative/math-doc/document/prev_g.png +0 -0
  95. data/doc/derivative/math-doc/document/up.png +0 -0
  96. data/doc/derivative/math-doc/document/up_g.png +0 -0
  97. data/doc/derivative/math-doc/document.pdf +0 -0
  98. data/doc/derivative/math-doc/document.tex +0 -158
  99. data/doc/derivative/numru-derivative.html +0 -129
  100. data/doc/ep_flux/ep_flux.html +0 -469
  101. data/doc/ep_flux/ggraph_on_merdional_section.html +0 -71
  102. data/doc/ep_flux/index.html +0 -31
  103. data/doc/ep_flux/index.rd +0 -24
  104. data/doc/ep_flux/math-doc/document/WARNINGS +0 -1
  105. data/doc/ep_flux/math-doc/document/contents.png +0 -0
  106. data/doc/ep_flux/math-doc/document/crossref.png +0 -0
  107. data/doc/ep_flux/math-doc/document/document.css +0 -30
  108. data/doc/ep_flux/math-doc/document/document.html +0 -101
  109. data/doc/ep_flux/math-doc/document/images.aux +0 -1
  110. data/doc/ep_flux/math-doc/document/images.log +0 -1375
  111. data/doc/ep_flux/math-doc/document/images.pl +0 -1328
  112. data/doc/ep_flux/math-doc/document/images.tex +0 -1471
  113. data/doc/ep_flux/math-doc/document/img1.png +0 -0
  114. data/doc/ep_flux/math-doc/document/img10.png +0 -0
  115. data/doc/ep_flux/math-doc/document/img100.png +0 -0
  116. data/doc/ep_flux/math-doc/document/img101.png +0 -0
  117. data/doc/ep_flux/math-doc/document/img102.png +0 -0
  118. data/doc/ep_flux/math-doc/document/img103.png +0 -0
  119. data/doc/ep_flux/math-doc/document/img104.png +0 -0
  120. data/doc/ep_flux/math-doc/document/img105.png +0 -0
  121. data/doc/ep_flux/math-doc/document/img106.png +0 -0
  122. data/doc/ep_flux/math-doc/document/img107.png +0 -0
  123. data/doc/ep_flux/math-doc/document/img108.png +0 -0
  124. data/doc/ep_flux/math-doc/document/img109.png +0 -0
  125. data/doc/ep_flux/math-doc/document/img11.png +0 -0
  126. data/doc/ep_flux/math-doc/document/img110.png +0 -0
  127. data/doc/ep_flux/math-doc/document/img111.png +0 -0
  128. data/doc/ep_flux/math-doc/document/img112.png +0 -0
  129. data/doc/ep_flux/math-doc/document/img113.png +0 -0
  130. data/doc/ep_flux/math-doc/document/img114.png +0 -0
  131. data/doc/ep_flux/math-doc/document/img115.png +0 -0
  132. data/doc/ep_flux/math-doc/document/img116.png +0 -0
  133. data/doc/ep_flux/math-doc/document/img117.png +0 -0
  134. data/doc/ep_flux/math-doc/document/img118.png +0 -0
  135. data/doc/ep_flux/math-doc/document/img119.png +0 -0
  136. data/doc/ep_flux/math-doc/document/img12.png +0 -0
  137. data/doc/ep_flux/math-doc/document/img120.png +0 -0
  138. data/doc/ep_flux/math-doc/document/img121.png +0 -0
  139. data/doc/ep_flux/math-doc/document/img122.png +0 -0
  140. data/doc/ep_flux/math-doc/document/img123.png +0 -0
  141. data/doc/ep_flux/math-doc/document/img124.png +0 -0
  142. data/doc/ep_flux/math-doc/document/img125.png +0 -0
  143. data/doc/ep_flux/math-doc/document/img126.png +0 -0
  144. data/doc/ep_flux/math-doc/document/img127.png +0 -0
  145. data/doc/ep_flux/math-doc/document/img128.png +0 -0
  146. data/doc/ep_flux/math-doc/document/img129.png +0 -0
  147. data/doc/ep_flux/math-doc/document/img13.png +0 -0
  148. data/doc/ep_flux/math-doc/document/img130.png +0 -0
  149. data/doc/ep_flux/math-doc/document/img131.png +0 -0
  150. data/doc/ep_flux/math-doc/document/img132.png +0 -0
  151. data/doc/ep_flux/math-doc/document/img133.png +0 -0
  152. data/doc/ep_flux/math-doc/document/img134.png +0 -0
  153. data/doc/ep_flux/math-doc/document/img135.png +0 -0
  154. data/doc/ep_flux/math-doc/document/img136.png +0 -0
  155. data/doc/ep_flux/math-doc/document/img137.png +0 -0
  156. data/doc/ep_flux/math-doc/document/img138.png +0 -0
  157. data/doc/ep_flux/math-doc/document/img139.png +0 -0
  158. data/doc/ep_flux/math-doc/document/img14.png +0 -0
  159. data/doc/ep_flux/math-doc/document/img140.png +0 -0
  160. data/doc/ep_flux/math-doc/document/img141.png +0 -0
  161. data/doc/ep_flux/math-doc/document/img142.png +0 -0
  162. data/doc/ep_flux/math-doc/document/img143.png +0 -0
  163. data/doc/ep_flux/math-doc/document/img144.png +0 -0
  164. data/doc/ep_flux/math-doc/document/img145.png +0 -0
  165. data/doc/ep_flux/math-doc/document/img146.png +0 -0
  166. data/doc/ep_flux/math-doc/document/img147.png +0 -0
  167. data/doc/ep_flux/math-doc/document/img148.png +0 -0
  168. data/doc/ep_flux/math-doc/document/img149.png +0 -0
  169. data/doc/ep_flux/math-doc/document/img15.png +0 -0
  170. data/doc/ep_flux/math-doc/document/img150.png +0 -0
  171. data/doc/ep_flux/math-doc/document/img151.png +0 -0
  172. data/doc/ep_flux/math-doc/document/img152.png +0 -0
  173. data/doc/ep_flux/math-doc/document/img153.png +0 -0
  174. data/doc/ep_flux/math-doc/document/img154.png +0 -0
  175. data/doc/ep_flux/math-doc/document/img155.png +0 -0
  176. data/doc/ep_flux/math-doc/document/img156.png +0 -0
  177. data/doc/ep_flux/math-doc/document/img157.png +0 -0
  178. data/doc/ep_flux/math-doc/document/img158.png +0 -0
  179. data/doc/ep_flux/math-doc/document/img159.png +0 -0
  180. data/doc/ep_flux/math-doc/document/img16.png +0 -0
  181. data/doc/ep_flux/math-doc/document/img160.png +0 -0
  182. data/doc/ep_flux/math-doc/document/img161.png +0 -0
  183. data/doc/ep_flux/math-doc/document/img162.png +0 -0
  184. data/doc/ep_flux/math-doc/document/img163.png +0 -0
  185. data/doc/ep_flux/math-doc/document/img164.png +0 -0
  186. data/doc/ep_flux/math-doc/document/img165.png +0 -0
  187. data/doc/ep_flux/math-doc/document/img166.png +0 -0
  188. data/doc/ep_flux/math-doc/document/img167.png +0 -0
  189. data/doc/ep_flux/math-doc/document/img168.png +0 -0
  190. data/doc/ep_flux/math-doc/document/img169.png +0 -0
  191. data/doc/ep_flux/math-doc/document/img17.png +0 -0
  192. data/doc/ep_flux/math-doc/document/img170.png +0 -0
  193. data/doc/ep_flux/math-doc/document/img171.png +0 -0
  194. data/doc/ep_flux/math-doc/document/img172.png +0 -0
  195. data/doc/ep_flux/math-doc/document/img173.png +0 -0
  196. data/doc/ep_flux/math-doc/document/img174.png +0 -0
  197. data/doc/ep_flux/math-doc/document/img175.png +0 -0
  198. data/doc/ep_flux/math-doc/document/img176.png +0 -0
  199. data/doc/ep_flux/math-doc/document/img177.png +0 -0
  200. data/doc/ep_flux/math-doc/document/img178.png +0 -0
  201. data/doc/ep_flux/math-doc/document/img179.png +0 -0
  202. data/doc/ep_flux/math-doc/document/img18.png +0 -0
  203. data/doc/ep_flux/math-doc/document/img180.png +0 -0
  204. data/doc/ep_flux/math-doc/document/img181.png +0 -0
  205. data/doc/ep_flux/math-doc/document/img182.png +0 -0
  206. data/doc/ep_flux/math-doc/document/img183.png +0 -0
  207. data/doc/ep_flux/math-doc/document/img184.png +0 -0
  208. data/doc/ep_flux/math-doc/document/img185.png +0 -0
  209. data/doc/ep_flux/math-doc/document/img186.png +0 -0
  210. data/doc/ep_flux/math-doc/document/img187.png +0 -0
  211. data/doc/ep_flux/math-doc/document/img188.png +0 -0
  212. data/doc/ep_flux/math-doc/document/img189.png +0 -0
  213. data/doc/ep_flux/math-doc/document/img19.png +0 -0
  214. data/doc/ep_flux/math-doc/document/img190.png +0 -0
  215. data/doc/ep_flux/math-doc/document/img191.png +0 -0
  216. data/doc/ep_flux/math-doc/document/img192.png +0 -0
  217. data/doc/ep_flux/math-doc/document/img193.png +0 -0
  218. data/doc/ep_flux/math-doc/document/img194.png +0 -0
  219. data/doc/ep_flux/math-doc/document/img195.png +0 -0
  220. data/doc/ep_flux/math-doc/document/img196.png +0 -0
  221. data/doc/ep_flux/math-doc/document/img197.png +0 -0
  222. data/doc/ep_flux/math-doc/document/img198.png +0 -0
  223. data/doc/ep_flux/math-doc/document/img199.png +0 -0
  224. data/doc/ep_flux/math-doc/document/img2.png +0 -0
  225. data/doc/ep_flux/math-doc/document/img20.png +0 -0
  226. data/doc/ep_flux/math-doc/document/img200.png +0 -0
  227. data/doc/ep_flux/math-doc/document/img21.png +0 -0
  228. data/doc/ep_flux/math-doc/document/img22.png +0 -0
  229. data/doc/ep_flux/math-doc/document/img23.png +0 -0
  230. data/doc/ep_flux/math-doc/document/img24.png +0 -0
  231. data/doc/ep_flux/math-doc/document/img25.png +0 -0
  232. data/doc/ep_flux/math-doc/document/img26.png +0 -0
  233. data/doc/ep_flux/math-doc/document/img27.png +0 -0
  234. data/doc/ep_flux/math-doc/document/img28.png +0 -0
  235. data/doc/ep_flux/math-doc/document/img29.png +0 -0
  236. data/doc/ep_flux/math-doc/document/img3.png +0 -0
  237. data/doc/ep_flux/math-doc/document/img30.png +0 -0
  238. data/doc/ep_flux/math-doc/document/img31.png +0 -0
  239. data/doc/ep_flux/math-doc/document/img32.png +0 -0
  240. data/doc/ep_flux/math-doc/document/img33.png +0 -0
  241. data/doc/ep_flux/math-doc/document/img34.png +0 -0
  242. data/doc/ep_flux/math-doc/document/img35.png +0 -0
  243. data/doc/ep_flux/math-doc/document/img36.png +0 -0
  244. data/doc/ep_flux/math-doc/document/img37.png +0 -0
  245. data/doc/ep_flux/math-doc/document/img38.png +0 -0
  246. data/doc/ep_flux/math-doc/document/img39.png +0 -0
  247. data/doc/ep_flux/math-doc/document/img4.png +0 -0
  248. data/doc/ep_flux/math-doc/document/img40.png +0 -0
  249. data/doc/ep_flux/math-doc/document/img41.png +0 -0
  250. data/doc/ep_flux/math-doc/document/img42.png +0 -0
  251. data/doc/ep_flux/math-doc/document/img43.png +0 -0
  252. data/doc/ep_flux/math-doc/document/img44.png +0 -0
  253. data/doc/ep_flux/math-doc/document/img45.png +0 -0
  254. data/doc/ep_flux/math-doc/document/img46.png +0 -0
  255. data/doc/ep_flux/math-doc/document/img47.png +0 -0
  256. data/doc/ep_flux/math-doc/document/img48.png +0 -0
  257. data/doc/ep_flux/math-doc/document/img49.png +0 -0
  258. data/doc/ep_flux/math-doc/document/img5.png +0 -0
  259. data/doc/ep_flux/math-doc/document/img50.png +0 -0
  260. data/doc/ep_flux/math-doc/document/img51.png +0 -0
  261. data/doc/ep_flux/math-doc/document/img52.png +0 -0
  262. data/doc/ep_flux/math-doc/document/img53.png +0 -0
  263. data/doc/ep_flux/math-doc/document/img54.png +0 -0
  264. data/doc/ep_flux/math-doc/document/img55.png +0 -0
  265. data/doc/ep_flux/math-doc/document/img56.png +0 -0
  266. data/doc/ep_flux/math-doc/document/img57.png +0 -0
  267. data/doc/ep_flux/math-doc/document/img58.png +0 -0
  268. data/doc/ep_flux/math-doc/document/img59.png +0 -0
  269. data/doc/ep_flux/math-doc/document/img6.png +0 -0
  270. data/doc/ep_flux/math-doc/document/img60.png +0 -0
  271. data/doc/ep_flux/math-doc/document/img61.png +0 -0
  272. data/doc/ep_flux/math-doc/document/img62.png +0 -0
  273. data/doc/ep_flux/math-doc/document/img63.png +0 -0
  274. data/doc/ep_flux/math-doc/document/img64.png +0 -0
  275. data/doc/ep_flux/math-doc/document/img65.png +0 -0
  276. data/doc/ep_flux/math-doc/document/img66.png +0 -0
  277. data/doc/ep_flux/math-doc/document/img67.png +0 -0
  278. data/doc/ep_flux/math-doc/document/img68.png +0 -0
  279. data/doc/ep_flux/math-doc/document/img69.png +0 -0
  280. data/doc/ep_flux/math-doc/document/img7.png +0 -0
  281. data/doc/ep_flux/math-doc/document/img70.png +0 -0
  282. data/doc/ep_flux/math-doc/document/img71.png +0 -0
  283. data/doc/ep_flux/math-doc/document/img72.png +0 -0
  284. data/doc/ep_flux/math-doc/document/img73.png +0 -0
  285. data/doc/ep_flux/math-doc/document/img74.png +0 -0
  286. data/doc/ep_flux/math-doc/document/img75.png +0 -0
  287. data/doc/ep_flux/math-doc/document/img76.png +0 -0
  288. data/doc/ep_flux/math-doc/document/img77.png +0 -0
  289. data/doc/ep_flux/math-doc/document/img78.png +0 -0
  290. data/doc/ep_flux/math-doc/document/img79.png +0 -0
  291. data/doc/ep_flux/math-doc/document/img8.png +0 -0
  292. data/doc/ep_flux/math-doc/document/img80.png +0 -0
  293. data/doc/ep_flux/math-doc/document/img81.png +0 -0
  294. data/doc/ep_flux/math-doc/document/img82.png +0 -0
  295. data/doc/ep_flux/math-doc/document/img83.png +0 -0
  296. data/doc/ep_flux/math-doc/document/img84.png +0 -0
  297. data/doc/ep_flux/math-doc/document/img85.png +0 -0
  298. data/doc/ep_flux/math-doc/document/img86.png +0 -0
  299. data/doc/ep_flux/math-doc/document/img87.png +0 -0
  300. data/doc/ep_flux/math-doc/document/img88.png +0 -0
  301. data/doc/ep_flux/math-doc/document/img89.png +0 -0
  302. data/doc/ep_flux/math-doc/document/img9.png +0 -0
  303. data/doc/ep_flux/math-doc/document/img90.png +0 -0
  304. data/doc/ep_flux/math-doc/document/img91.png +0 -0
  305. data/doc/ep_flux/math-doc/document/img92.png +0 -0
  306. data/doc/ep_flux/math-doc/document/img93.png +0 -0
  307. data/doc/ep_flux/math-doc/document/img94.png +0 -0
  308. data/doc/ep_flux/math-doc/document/img95.png +0 -0
  309. data/doc/ep_flux/math-doc/document/img96.png +0 -0
  310. data/doc/ep_flux/math-doc/document/img97.png +0 -0
  311. data/doc/ep_flux/math-doc/document/img98.png +0 -0
  312. data/doc/ep_flux/math-doc/document/img99.png +0 -0
  313. data/doc/ep_flux/math-doc/document/index.html +0 -101
  314. data/doc/ep_flux/math-doc/document/internals.pl +0 -258
  315. data/doc/ep_flux/math-doc/document/labels.pl +0 -265
  316. data/doc/ep_flux/math-doc/document/next.png +0 -0
  317. data/doc/ep_flux/math-doc/document/next_g.png +0 -0
  318. data/doc/ep_flux/math-doc/document/node1.html +0 -104
  319. data/doc/ep_flux/math-doc/document/node10.html +0 -164
  320. data/doc/ep_flux/math-doc/document/node11.html +0 -86
  321. data/doc/ep_flux/math-doc/document/node12.html +0 -166
  322. data/doc/ep_flux/math-doc/document/node13.html +0 -897
  323. data/doc/ep_flux/math-doc/document/node14.html +0 -1065
  324. data/doc/ep_flux/math-doc/document/node15.html +0 -72
  325. data/doc/ep_flux/math-doc/document/node16.html +0 -81
  326. data/doc/ep_flux/math-doc/document/node2.html +0 -82
  327. data/doc/ep_flux/math-doc/document/node3.html +0 -91
  328. data/doc/ep_flux/math-doc/document/node4.html +0 -149
  329. data/doc/ep_flux/math-doc/document/node5.html +0 -330
  330. data/doc/ep_flux/math-doc/document/node6.html +0 -99
  331. data/doc/ep_flux/math-doc/document/node7.html +0 -98
  332. data/doc/ep_flux/math-doc/document/node8.html +0 -83
  333. data/doc/ep_flux/math-doc/document/node9.html +0 -140
  334. data/doc/ep_flux/math-doc/document/prev.png +0 -0
  335. data/doc/ep_flux/math-doc/document/prev_g.png +0 -0
  336. data/doc/ep_flux/math-doc/document/up.png +0 -0
  337. data/doc/ep_flux/math-doc/document/up_g.png +0 -0
  338. data/doc/ep_flux/math-doc/document.pdf +0 -0
  339. data/doc/ep_flux/math-doc/document.tex +0 -2018
  340. data/doc/gdir.html +0 -412
  341. data/doc/gdir_client.html +0 -16
  342. data/doc/gdir_connect_ftp-like.html +0 -61
  343. data/doc/gdir_server.html +0 -45
  344. data/doc/ggraph.html +0 -1615
  345. data/doc/gpcat.html +0 -44
  346. data/doc/gpcut.html +0 -41
  347. data/doc/gphys.html +0 -532
  348. data/doc/gphys_fft.html +0 -324
  349. data/doc/gphys_grads_io.html +0 -69
  350. data/doc/gphys_grib_io.html +0 -82
  351. data/doc/gphys_io.html +0 -120
  352. data/doc/gphys_io_common.html +0 -18
  353. data/doc/gphys_netcdf_io.html +0 -283
  354. data/doc/gplist.html +0 -24
  355. data/doc/gpmath.html +0 -51
  356. data/doc/gpmaxmin.html +0 -31
  357. data/doc/gpprint.html +0 -34
  358. data/doc/gpview.html +0 -270
  359. data/doc/grads2nc_with_gphys.html +0 -21
  360. data/doc/grads_gridded.html +0 -307
  361. data/doc/grib.html +0 -144
  362. data/doc/grid.html +0 -212
  363. data/doc/index.html +0 -133
  364. data/doc/index.rd +0 -127
  365. data/doc/netcdf_convention.html +0 -136
  366. data/doc/unumeric.html +0 -176
  367. data/doc/update +0 -64
  368. data/doc/varray.html +0 -299
  369. data/doc/varraycomposite.html +0 -67
@@ -1,5 +1,6 @@
1
1
  require "numru/gphys/gphys"
2
- require "numru/dcl" # math1/gt2dlib is used for pure-2D interpolation
2
+ require "numru/dcl" # math1/gt2dlib is used for pure-2D interpolation.
3
+ # Also for dcl_fig_cut
3
4
  require "numru/dcl_mouse" # for mouse_cut, mouse_cut_repeat
4
5
  require "narray_miss"
5
6
 
@@ -13,9 +14,21 @@ module NumRu
13
14
 
14
15
  @@interpo_previous_cutter = nil
15
16
  @@interpo_previous_modifier = nil
16
- @@interpo_missval = -1e30
17
+ @@interpo_missval = 9.9692099683868690e+36 # NC_FILL_DOUBLE/FLOAT ~15*2^119
18
+ @@interpo_extrapolation = false
17
19
 
18
- # = Makes a subset interactively by specifying a (poly-)line on the DCL viewport
20
+ # Change the behavior of the interpolation methods to extrapolate
21
+ # outside the grid coverage.
22
+ #
23
+ # ARGUMENTS
24
+ # * extrapo : true or false --- the default behaviour is false
25
+ # (not to extrapolate), so use this method if you
26
+ # want to set it to true.
27
+ def self.extrapolation=(extrapo)
28
+ @@interpo_extrapolation = extrapo
29
+ end
30
+
31
+ # Makes a subset interactively by specifying a (poly-)line on the DCL viewport
19
32
  #
20
33
  # ARGUMENTS
21
34
  # * dimx {String] : name of number (0,1,..) of the dimension
@@ -28,7 +41,7 @@ module NumRu
28
41
  #
29
42
  # RETURN VALUE
30
43
  # * a GPhys
31
- def mouse_cut(dimx, dimy, num=2)
44
+ def mouse_cut(dimx, dimy, num=2, line_type=1, line_index=1)
32
45
 
33
46
  # < preparation >
34
47
 
@@ -46,12 +59,40 @@ module NumRu
46
59
  break
47
60
  end
48
61
  end
49
- line.draw
62
+ line.draw(line_type, line_index)
50
63
  vx = line.vx
51
64
  vy = line.vy
52
65
  ux = line.ux
53
66
  uy = line.uy
67
+ gpnew = dcl_fig_cut(dimx,dimy,ux,uy)
68
+ [gpnew, line]
69
+ end
70
+
71
+ # Interpolation on the DCL window (automatic iso-interval interpolation
72
+ # along a poly line that can be drawn in the current viewport of the
73
+ # DCL window). Used in mouse_cut.
74
+ #
75
+ # ARGUMENTS
76
+ # * dimx [Integer or String] : specifies the dimension corresponding
77
+ # to the UX coordinate.
78
+ # (Here, the UX coordinate is the X coordinate of the DCL's USER
79
+ # coordinate. For exapmle, longitude if map projection.)
80
+ # * dimy [Integer or String] : specifies the dimension corresponding
81
+ # to the UY coordinate.
82
+ # (Here, the UY coordinate is the Y coordinate of the DCL's USER
83
+ # coordinate. For exapmle, latitude if map projection.)
84
+ # * ux [Array] : x values in terms of the UX coordinate
85
+ # * uy [Array] : y values in terms of the UY coordinate
86
+ # Lengths of ux and uy must be the same and greter or equal to 2.
87
+ #
88
+ def dcl_fig_cut(dimx,dimy,ux,uy)
54
89
  len = ux.length
90
+ raise("ux and uy must be arrays with the (same) length >= 2") if len<=1
91
+ raise("ux's len (#{len}) != uy's len (#{uy.length})") if uy.length != len
92
+ vx=Array.new; vy=Array.new
93
+ for i in 0...len
94
+ vx[i],vy[i] = NumRu::DCL.stftrf(ux[i],uy[i])
95
+ end
55
96
  kx = Array.new
56
97
  ky = Array.new
57
98
  cut = [true]*rank
@@ -66,13 +107,18 @@ module NumRu
66
107
  ndsum = [0]
67
108
  for i in 0...len-1
68
109
  ndiv[i] = Math.sqrt( (kx[i+1]-kx[i])**2 + (ky[i+1]-ky[i])**2).to_i
110
+ ndiv[i] += 1 if i==len-2
69
111
  ndsum.push ndsum[-1] + ndiv[i] # 0, ndiv[0], ndiv[0]+ndiv[1], ...
70
112
  end
71
113
  ndtot = ndsum[-1]
72
114
  vxdiv = NArray.float(ndtot)
73
115
  vydiv = NArray.float(ndtot)
74
116
  for i in 0...len-1
75
- a = NArray.float(ndiv[i]).indgen / ndiv[i]
117
+ if i!=len-2
118
+ a = NArray.float(ndiv[i]).indgen / ndiv[i]
119
+ else
120
+ a = NArray.float(ndiv[i]).indgen / (ndiv[i]-1)
121
+ end
76
122
  vxdiv[ndsum[i]...ndsum[i+1]] = (1.0-a)*vx[i] + a*vx[i+1]
77
123
  vydiv[ndsum[i]...ndsum[i+1]] = (1.0-a)*vy[i] + a*vy[i+1]
78
124
  end
@@ -115,10 +161,10 @@ module NumRu
115
161
 
116
162
  gpnew = interpolate(cutter)
117
163
  gpnew = modifier[gpnew] if modifier
118
- [gpnew, line]
164
+ gpnew
119
165
  end
120
166
 
121
- # = Interpolation onto grid points specified by the previous call of GPhys#mouse_cut
167
+ # Interpolation onto grid points specified by the previous call of GPhys#mouse_cut
122
168
  def mouse_cut_repeat
123
169
  if @@interpo_previous_cutter.nil?
124
170
  raise("You must first use GPhys#mouse_cut. This method repeats it")
@@ -150,7 +196,7 @@ module NumRu
150
196
  end
151
197
  private :__sp_dist
152
198
 
153
- # = Interpolate to conform the grid to a target GPhys object
199
+ # Interpolate to conform the grid to a target GPhys object
154
200
  #
155
201
  # ARGUMENTS
156
202
  # * to [GPhys] : the target gphys
@@ -163,7 +209,36 @@ module NumRu
163
209
  interpolate(*coords)
164
210
  end
165
211
 
166
- # = Wide-purpose multi-dimensional linear interpolation
212
+ # Reverse the main data (i.e., the dependent variable) and one of the
213
+ # coordinates (an independent variable) through interpolation.
214
+ #
215
+ # Returns a GPhys in which the main data is the specfied coordinate
216
+ # (argument: axname) sampled at specified locations (argument: pos)
217
+ # in terms of the main data of self. The main data of self is expected
218
+ # to be quai-monotonic with respect to the specfied coordinate.
219
+ #
220
+ # ARGUMENTS
221
+ # * axname [String] : one of the names of the axes (i.e. main
222
+ # coordinates. Auxiliary coordinates are not supported as the target.)
223
+ # * pos [NArray] : grid locations. For example, if the current data is
224
+ # potential temperature theta, pos consists of the theta levels to
225
+ # make sampling.
226
+ #
227
+ # RETURN VALUE
228
+ # * a GPhys
229
+ #
230
+ def coord_data_reverse(axname,pos)
231
+ gp = self.axis(axname).to_gphys
232
+ gp = self.shape_coerce_full(gp)[0] # conform the shape to that of self
233
+ gp = GPhys.new( gp.grid.copy, gp.data ) # copy grid to avoid side effect
234
+ # on the grid of self
235
+ gp.set_assoc_coords([self])
236
+ pos = NArray[*pos].to_type(NArray::FLOAT) if pos.is_a?(Array)
237
+ newcrd = VArray.new(pos,self.data,self.name) # succeeds the attributes
238
+ gp.interpolate(axname=>newcrd)
239
+ end
240
+
241
+ # Wide-purpose multi-dimensional linear interpolation
167
242
  #
168
243
  # This method supports interpolation regarding combinations of
169
244
  # 1D and 2D coordinate variables. For instance, suppose self is
@@ -320,16 +395,25 @@ module NumRu
320
395
  missval = ( (a=get_att('_FillValue')) ? a[0] : nil ) ||
321
396
  ( (a=get_att('missing_value')) ? a[0] : nil ) ||
322
397
  @@interpo_missval
323
- z = z.to_na(missval)
398
+ z = z.to_na(missval)
399
+ input_nomiss = false
324
400
  else
325
- missval = nil
401
+ input_nomiss = true
402
+ if @@interpo_extrapolation
403
+ missval = nil
404
+ else
405
+ missval = @@interpo_missval
406
+ end
326
407
  end
327
408
 
328
- na = c_interpo_do(newgrid.shape, idxmap, z, missval) # [C-extension]
409
+ na = c_interpo_do(newgrid.shape, idxmap, z, missval,
410
+ @@interpo_extrapolation) # [C-extension]
329
411
 
330
- if missval
412
+ if !input_nomiss || !@@interpo_extrapolation
331
413
  mask = na.ne(missval)
332
- na = NArrayMiss.to_nam_no_dup(na,mask)
414
+ if !input_nomiss || mask.min == 0
415
+ na = NArrayMiss.to_nam_no_dup(na,mask)
416
+ end
333
417
  end
334
418
 
335
419
  va = VArray.new(na, data, name)
@@ -353,7 +437,8 @@ module NumRu
353
437
  elsif cd.is_a?(Numeric) && mp[1].is_a?(NArray)
354
438
  xto = mp[1] # 1-D new coordinate var
355
439
  xfrom = mp[2] # 1-D original coordinate var
356
- ids, f = c_interpo_find_loc_1D(xto,xfrom) # [C-extension]
440
+ ids, f = c_interpo_find_loc_1D(xto,xfrom,@@interpo_missval,
441
+ @@interpo_extrapolation) # [C-extension]
357
442
  idxmap.push( [ m[0], cd, nil, ids, f ] ) # mapping from 1D
358
443
  else
359
444
  # partially 2D case
@@ -367,7 +452,8 @@ module NumRu
367
452
  break
368
453
  end
369
454
  end
370
- ids, f = c_interpo_find_loc_1D_MD(xto,xfrom,dimc) # [C-extension]
455
+ ids, f = c_interpo_find_loc_1D_MD(xto,xfrom,dimc,@@interpo_missval,
456
+ @@interpo_extrapolation) # [C-extension]
371
457
 
372
458
  dims_covd = mp[1] #dimensions covered by the coordinate variable(orig)
373
459
  idxmap.push( [ od, cd, dims_covd, ids, f ] ) # mapping from 2D
@@ -462,10 +548,14 @@ module NumRu
462
548
  for j in 0...coords[ic].length
463
549
  xto = coords[ic][j].val
464
550
  xfrom = org_coords[ic][j].val
465
- xto = xto.to_na if !xto.is_a?(NArray)
466
- # missing in the coordinate, if any, is ignored
467
- xfrom = xfrom.to_na if !xfrom.is_a?(NArray)
551
+ xto = xto.to_na if !xto.is_a?(NArray)
468
552
  # missing in the coordinate, if any, is ignored
553
+ if xfrom.is_a?(NArrayMiss)
554
+ xfrom = xfrom.to_type(NArray::FLOAT).to_na(@@interpo_missval)
555
+ # if xfrom is NArrayMiss, this fixed missing value is set.
556
+ # The conversion into double is just in case (not needed for
557
+ # the default @@interpo_missval).
558
+ end
469
559
  if org_dims[ic][j].length == 1
470
560
  crdmap1D.push( [ org_dims[ic][j][0], ic, xto,
471
561
  xfrom] )
@@ -731,14 +821,15 @@ if $0 == __FILE__
731
821
 
732
822
  gd.set_assoc_coords([gp,gq,gr,ga])
733
823
 
734
- print "GPhys with associated coordinates:\n"
735
- p gd
824
+ #print "GPhys with associated coordinates:\n"
825
+ #p gd
736
826
 
737
827
 
738
828
  DCL.swpset('iwidth',700)
739
829
  DCL.swpset('iheight',700)
740
830
  #DCL.sgscmn(4) # set colomap
741
831
  DCL.gropn(1)
832
+ DCL.sgpset('isub', 96) # control character of subscription: '_' --> '`'
742
833
  DCL.glpset("lmiss",true)
743
834
  DCL.sldiv("y",2,2)
744
835
  GGraph::set_fig "viewport"=>[0.15,0.85,0.15,0.85]
@@ -746,12 +837,13 @@ if $0 == __FILE__
746
837
  GGraph::color_bar
747
838
  GGraph::tone gd[true,ny/2,true]
748
839
  GGraph::color_bar
840
+ gdd = gd.copy
749
841
 
750
842
  #< prepare coordinates to interpolate >
751
843
 
752
844
  xi = NArray[1.0, 2.0, 3.0, 4.0, 5.0]
753
845
  # yi = NArray[1.0, 4.0, 5.0]
754
- yi = NArray[-0.1, 2.5, 4.0, 5.5, 6.8] # test of extrapolation
846
+ yi = NArray[-0.1,2.5, 4.0, 5.5, 6.8] # test of extrapolation
755
847
  vxi = VArray.new( xi, {"units"=>"m"}, "x") # "0.5m" to test unit conversion
756
848
  vyi = VArray.new( yi, {"units"=>"m"}, "y") # "0.5m" to test unit conversion
757
849
 
@@ -764,7 +856,7 @@ if $0 == __FILE__
764
856
  vpi = VArray.new( pi, {"units"=>"mm"}, "p")
765
857
  vqi = VArray.new( qi, {"units"=>"mm"}, "q")
766
858
 
767
- ai = NArray[2.0, 4.0]
859
+ ai = NArray[2.0, 2.5]
768
860
  vai = VArray.new( ai ).rename("a")
769
861
 
770
862
  #< test of interpolate >
@@ -774,6 +866,7 @@ if $0 == __FILE__
774
866
  gp = GPhys.new(xygrid,vp)
775
867
  gq = GPhys.new(xygrid,vq)
776
868
 
869
+ #GPhys::extrapolation = true
777
870
  gi = gd.interpolate(vxi,vyi,{"z"=>0.5})
778
871
  GGraph::tone gi,true,"color_bar"=>true
779
872
 
@@ -781,9 +874,9 @@ if $0 == __FILE__
781
874
 
782
875
  gi = gd.interpolate([vxi,vyi])
783
876
  #p gi.max, gi.min
784
- GGraph::tone gd,true,"min"=>-1.2,"max"=>1.2,"int"=>0.1
877
+ GGraph::tone gd[false,0],true,"min"=>-1.2,"max"=>1.2,"int"=>0.1
785
878
  GGraph::scatter gxi, gyi, false,"type"=>4,"size"=>0.027,"index"=>3
786
- GGraph::color_scatter gxi, gyi, gi, false,"min"=>-1.2,"max"=>1.2,"int"=>0.1,"type"=>10,"size"=>0.029
879
+ GGraph::color_scatter gxi, gyi, gi[true,0], false,"min"=>-1.2,"max"=>1.2,"int"=>0.1,"type"=>10,"size"=>0.029
787
880
  GGraph::color_bar
788
881
 
789
882
  gi = gd.interpolate(vyi,vxi)
@@ -833,21 +926,52 @@ if $0 == __FILE__
833
926
  GGraph::tone gi,true,"color_bar"=>true
834
927
 
835
928
  ###gd.interpolate(vpi) # must fail by insufficient specification
836
- =begin
837
- =end
838
929
 
839
930
 
840
931
  mask=d.lt(0.7)
841
932
  missv = -999.0
842
933
  d[mask.not] = missv
843
- p d[false,0]
934
+ #p d[false,0]
844
935
  dm = NArrayMiss.to_nam(d, mask )
845
936
  vdm = VArray.new( dm, {"missing_value"=>NArray[missv]}, "d")
846
937
  gdm = GPhys.new(xyzgrid, vdm)
847
938
  gi = gdm.interpolate(vpi,vqi)
848
939
  # gi = gdm.interpolate(vxi,vyi)
849
940
  GGraph::tone gi,true,"color_bar"=>true
941
+
942
+ print "start the test of coord_data_reverse\n"
943
+ GGraph::tone gp
944
+ GGraph::color_bar
945
+ xp = gp.coord_data_reverse("x",NArray.sfloat(30).indgen! )
946
+ GGraph::tone xp,true,"title"=>"#{xp.name} <-coord_data_reverse"
947
+ GGraph::color_bar
948
+
949
+ #< test of mouse_cut / dcl_fig_cut >
950
+ gdc = gdd[1..-1,1..-1,true]
951
+
952
+ =begin
953
+ GGraph.set_fig "itr"=>4
954
+ GGraph.tone gdc,true,"int"=>0.15,"min"=>-1.05,"max"=>1.05
955
+ gpcut, line = gdc.mouse_cut(0,1,3)
956
+ x = gpcut.coord("x")
957
+ y = gpcut.coord("y")
958
+ DCL.sgpmzu(x.val,y.val,2,1,0.015)
959
+ GGraph.set_fig "itr"=>1
960
+ GGraph.tone gpcut,true,"int"=>0.15,"min"=>-1.05,"max"=>1.05
961
+ GGraph.color_bar
962
+ =end
850
963
 
964
+ GGraph.set_fig "itr"=>4
965
+ GGraph.tone gdc,true,"int"=>0.15,"min"=>-1.05,"max"=>1.05
966
+ gpcut = gdc.dcl_fig_cut(0,1,[1.0,3.0,6.0],[1.1,2.2,5.5])
967
+ x = gpcut.coord("x")
968
+ y = gpcut.coord("y")
969
+ DCL.sgplu(x.val,y.val)
970
+ DCL.sgpmzu(x.val,y.val,2,1,0.015)
971
+ GGraph.set_fig "itr"=>1
972
+ GGraph.tone gpcut,true,"int"=>0.15,"min"=>-1.05,"max"=>1.05
973
+ GGraph.color_bar
974
+
851
975
 
852
976
  #< finish >
853
977
  DCL.grcls
@@ -187,8 +187,8 @@ module NumRu
187
187
  new(val, uni)
188
188
  end
189
189
 
190
- @@supported_calendars = [nil,"gregorian", "standard","noleap","365_day",
191
- "360_day"]
190
+ @@supported_calendars = [nil,"gregorian", "standard", "proleptic_gregorian",
191
+ "noleap", "365_day", "360_day"]
192
192
 
193
193
  def self::supported_calendar?(cal)
194
194
  @@supported_calendars.include?(cal)
@@ -216,6 +216,9 @@ module NumRu
216
216
  case calendar
217
217
  when nil, "gregorian", "standard"
218
218
  time = Units['days'].convert( date-since, tun )
219
+ when "proleptic_gregorian"
220
+ since = DateTime.parse(UNumeric::before_date_parse($2),false,Date::GREGORIAN)
221
+ time = Units['days'].convert( date-since, tun )
219
222
  when "noleap", "365_day"
220
223
  since_yday = since - DateTime.new(since.year,1,1) # day number of year (0..364)
221
224
  since_yday = since_yday - 1 if( since.leap? && since.mon > 2 )
@@ -224,14 +227,24 @@ module NumRu
224
227
  if date_yday >= 60.0 # after Mar1
225
228
  date_yday = date_yday - 1
226
229
  elsif date_yday >= 59.0 # Feb29
227
- raise "Feb.29 is specified, but calendar is #{calendar}."
230
+ raise("Feb.29 is specified, but calendar is #{calendar}.")
228
231
  end
229
232
  end
230
233
  days = (date.year - since.year)*365 + (date_yday - since_yday)
231
234
  time = Units['days'].convert( days, tun )
232
235
  when "360_day" # does not work perfectly
233
- days = (date.year - since.year)*360 + (date.mon - since.mon)*30 + (date.day - since.day)
234
- time = Units['days'].convert( days, tun )
236
+ if date.day == 31
237
+ raise("day=31 is specified, but calendar is #{calendar}.")
238
+ end
239
+ if date.is_a?(DateTime)
240
+ date_hour,date_min,date_sec = date.hour,date.min,date.sec
241
+ else
242
+ date_hour,date_min,date_sec = 0,0,0
243
+ end
244
+ days = (date.year-since.year)*360 + (date.mon-since.mon)*30 +
245
+ (date.day-since.day) + Rational(date_hour-since.hour,24) +
246
+ Rational(date_min-since.min,1440) + Rational(date_sec-since.sec,86400)
247
+ time = Units['days'].convert( days.to_f, tun )
235
248
  else
236
249
  #raise("Unrecognized calendar: #{calendar}")
237
250
  return nil
@@ -313,6 +326,11 @@ module NumRu
313
326
  elsif( tun =~ Units['days since 0001-01-01'] )
314
327
  case calendar
315
328
  when nil, "gregorian", "standard"
329
+ # default: Julian calendar before 1582-10-15, Gregorian calendar afterward
330
+ datetime = since + tun.convert( time, Units['days'] )
331
+ when "proleptic_gregorian"
332
+ # Gregorian calendar extended to the past
333
+ since = DateTime.parse(UNumeric::before_date_parse(sincestr),false,Date::GREGORIAN)
316
334
  datetime = since + tun.convert( time, Units['days'] )
317
335
  when "noleap", "365_day"
318
336
  since_yday = since - DateTime.new(since.year,1,1) # day number of year (0..364)
@@ -327,7 +345,12 @@ module NumRu
327
345
  days = (since.mon-1)*30 + since_day + tun.convert( time, Units['days'] )
328
346
  year = since.year + (days/360).to_i
329
347
  mon = ((days%360)/30).to_i + 1
330
- datetime = DateTime.new(year,mon,1) + days%30
348
+ datetime = DateTime.new(year,mon,1) + days%30 # Feb29->Mar1,Feb30->Mar2
349
+ #datetime = DateTime.new(year,mon,days%30 + 1) # stops if Feb29,Feb30
350
+ if datetime.mon != mon # Feb29,Feb30
351
+ $stderr.print("cannot convert #{year}-#{mon}-#{(days%30+1).to_i} to DateTime instance\n")
352
+ return nil
353
+ end
331
354
  else
332
355
  #raise("Unrecognized calendar: #{calendar}")
333
356
  return nil
@@ -987,6 +987,15 @@ These methods returns a NArray (not a VArray).
987
987
 
988
988
  alias shape_current shape
989
989
 
990
+ ## < marshal dump/load >
991
+ def marshal_dump
992
+ [@name, @mapping, @varray, @ary, @attr]
993
+ end
994
+
995
+ def marshal_load(ary)
996
+ @name, @mapping, @varray, @ary, @attr = *ary
997
+ end
998
+
990
999
  ## < private methods >
991
1000
  private
992
1001
  def __rubber_expansion( args )
@@ -4,6 +4,14 @@
4
4
  =end
5
5
 
6
6
  require "numru/gphys/grib"
7
+
8
+ ### to be made below in the definition of VArrayGrib in order to record
9
+ ### whetehr its successfull or not
10
+ #begin
11
+ # require "numru/grib"
12
+ #rescue LoadError
13
+ #end
14
+
7
15
  require "numru/gphys/varray"
8
16
 
9
17
  module NumRu
@@ -16,8 +24,50 @@ module NumRu
16
24
  =end
17
25
  class VArrayGrib < VArray
18
26
 
27
+ begin
28
+ require "numru/grib"
29
+ @@rbgribloaded = true
30
+ rescue LoadError
31
+ @@rbgribloaded = false
32
+ end
33
+
34
+ @@GribLib = :gphys_grib
35
+
36
+ class << self
37
+ def use_gphys_grib
38
+ @@GribLib = :gphys_grib
39
+ set_grib_lib
40
+ end
41
+ def use_rb_grib
42
+ if !@@rbgribloaded
43
+ raise LoadError, "Loading rb-GRIB has been failed. You probably need to install it."
44
+ end
45
+ @@GribLib = :rb_grib
46
+ set_grib_lib
47
+ end
48
+ def grib_lib
49
+ @@GribLib.dup
50
+ end
51
+ def grib
52
+ @@Grib
53
+ end
54
+ def set_grib_lib
55
+ case @@GribLib
56
+ when :gphys_grib
57
+ @@GribDim = GPhys::GribDim
58
+ @@GribVar = GPhys::GribVar
59
+ @@Grib = GPhys::Grib
60
+ when :rb_grib
61
+ @@GribDim = GribDim
62
+ @@GribVar = GribVar
63
+ @@Grib = Grib
64
+ end
65
+ end
66
+ end
67
+ set_grib_lib
68
+
19
69
  def initialize(aGribVar)
20
- if !GribVar===aGribVar && !GribDim===aGribVar
70
+ if !@@GribVar===aGribVar && !@@GribDim===aGribVar
21
71
  raise ArgumentError,"Not a GribVar or GribDim"
22
72
  end
23
73
  @name = aGribVar.name
@@ -26,9 +76,11 @@ module NumRu
26
76
  @ary = aGribVar
27
77
  @attr = Attribute.new
28
78
  aGribVar.att_names.each{|name|
29
- @attr[name] = aGribVar.att(name)
79
+ val = aGribVar.att(name)
80
+ val = [val] if val.is_a?(Numeric)
81
+ @attr[name] = val
30
82
  }
31
- if GribDim===@ary
83
+ if @@GribDim===@ary
32
84
  class << @ary
33
85
  def rank
34
86
  return 1
@@ -41,9 +93,9 @@ module NumRu
41
93
  end
42
94
 
43
95
  def inspect
44
- if GribVar===@ary
96
+ if @@GribVar===@ary
45
97
  "<'#{@name}' in '#{@ary.file.path}' [#{@ary.shape.join(", ")}]>"
46
- elsif GribDim===@ary
98
+ elsif @@GribDim===@ary
47
99
  "<'#{@name}' in '#{@ary.var.name}' #{@ary.length}>"
48
100
  end
49
101
  end
@@ -55,7 +107,7 @@ module NumRu
55
107
  v = file.def_var(name)
56
108
  dims.length.times{|n|
57
109
  d = dims[n]
58
- if GribDim===d
110
+ if @@GribDim===d
59
111
  gd = v.def_dim(d.name,n)
60
112
  gd.put(d.get)
61
113
  d.att_names.each{|name| gd.put_att(name,d.att(name)) }
@@ -80,7 +132,7 @@ module NumRu
80
132
  ## < additional class methods > ##
81
133
 
82
134
  def write(file,vary,dims=nil)
83
- Grib===file || raise(ArgumentError,"1st arg: not a Grib")
135
+ @@Grib===file || raise(ArgumentError,"1st arg: not a Grib")
84
136
  VArray===vary || raise(ArgumentError,"2st arg: not a VArray")
85
137
  rank = vary.rank
86
138
  if !dims
@@ -157,7 +209,7 @@ if $0 == __FILE__
157
209
 
158
210
  include NumRu
159
211
 
160
- grib = Grib.open("../../../testdata/T.jan.grib")
212
+ grib = VArrayGrib.grib.open("../../../testdata/T.jan.grib")
161
213
  gv = grib.var("TMP")
162
214
 
163
215
  va = VArrayGrib.new(gv)
@@ -174,4 +226,14 @@ if $0 == __FILE__
174
226
  p va2.shape
175
227
  p va2.val
176
228
 
229
+ begin
230
+ VArrayGrib.use_rb_grib
231
+ grib = VArrayGrib.grib.open("../../../testdata/T.jan.grib")
232
+ p grib.var_names
233
+ gv = grib.var("t")
234
+ p gv.val
235
+ rescue LoadError
236
+ print "...error rescued & test skipped\n\n"
237
+ end
238
+
177
239
  end
data/lib/version.rb ADDED
@@ -0,0 +1,3 @@
1
+ class GPhys
2
+ VERSION = "1.2.2"
3
+ end