gphys 1.1.1a

Sign up to get free protection for your applications and to get access to all the features.
Files changed (428) hide show
  1. data/ChangeLog +1777 -0
  2. data/LICENSE.txt +34 -0
  3. data/README +33 -0
  4. data/Rakefile +57 -0
  5. data/TODO_ep_flux +6 -0
  6. data/bin/gdir_client +27 -0
  7. data/bin/gdir_server +129 -0
  8. data/bin/gpaop +146 -0
  9. data/bin/gpcat +148 -0
  10. data/bin/gpcut +102 -0
  11. data/bin/gpedit +228 -0
  12. data/bin/gplist +68 -0
  13. data/bin/gpmath +120 -0
  14. data/bin/gpmaxmin +128 -0
  15. data/bin/gpprint +60 -0
  16. data/bin/gpvect +706 -0
  17. data/bin/gpview +704 -0
  18. data/bin/grads2nc_with_gphys +61 -0
  19. data/doc/attribute.html +19 -0
  20. data/doc/attributenetcdf.html +15 -0
  21. data/doc/axis.html +376 -0
  22. data/doc/coordmapping.html +111 -0
  23. data/doc/coordtransform.html +36 -0
  24. data/doc/derivative/gphys-derivative.html +80 -0
  25. data/doc/derivative/index.html +21 -0
  26. data/doc/derivative/index.rd +14 -0
  27. data/doc/derivative/math-doc/document/document.css +30 -0
  28. data/doc/derivative/math-doc/document/document.html +57 -0
  29. data/doc/derivative/math-doc/document/images.aux +1 -0
  30. data/doc/derivative/math-doc/document/images.log +385 -0
  31. data/doc/derivative/math-doc/document/images.pl +186 -0
  32. data/doc/derivative/math-doc/document/images.tex +364 -0
  33. data/doc/derivative/math-doc/document/img1.png +0 -0
  34. data/doc/derivative/math-doc/document/img10.png +0 -0
  35. data/doc/derivative/math-doc/document/img11.png +0 -0
  36. data/doc/derivative/math-doc/document/img12.png +0 -0
  37. data/doc/derivative/math-doc/document/img13.png +0 -0
  38. data/doc/derivative/math-doc/document/img14.png +0 -0
  39. data/doc/derivative/math-doc/document/img15.png +0 -0
  40. data/doc/derivative/math-doc/document/img16.png +0 -0
  41. data/doc/derivative/math-doc/document/img17.png +0 -0
  42. data/doc/derivative/math-doc/document/img18.png +0 -0
  43. data/doc/derivative/math-doc/document/img19.png +0 -0
  44. data/doc/derivative/math-doc/document/img2.png +0 -0
  45. data/doc/derivative/math-doc/document/img20.png +0 -0
  46. data/doc/derivative/math-doc/document/img21.png +0 -0
  47. data/doc/derivative/math-doc/document/img22.png +0 -0
  48. data/doc/derivative/math-doc/document/img23.png +0 -0
  49. data/doc/derivative/math-doc/document/img24.png +0 -0
  50. data/doc/derivative/math-doc/document/img25.png +0 -0
  51. data/doc/derivative/math-doc/document/img26.png +0 -0
  52. data/doc/derivative/math-doc/document/img27.png +0 -0
  53. data/doc/derivative/math-doc/document/img28.png +0 -0
  54. data/doc/derivative/math-doc/document/img29.png +0 -0
  55. data/doc/derivative/math-doc/document/img3.png +0 -0
  56. data/doc/derivative/math-doc/document/img30.png +0 -0
  57. data/doc/derivative/math-doc/document/img4.png +0 -0
  58. data/doc/derivative/math-doc/document/img5.png +0 -0
  59. data/doc/derivative/math-doc/document/img6.png +0 -0
  60. data/doc/derivative/math-doc/document/img7.png +0 -0
  61. data/doc/derivative/math-doc/document/img8.png +0 -0
  62. data/doc/derivative/math-doc/document/img9.png +0 -0
  63. data/doc/derivative/math-doc/document/index.html +57 -0
  64. data/doc/derivative/math-doc/document/labels.pl +13 -0
  65. data/doc/derivative/math-doc/document/next.png +0 -0
  66. data/doc/derivative/math-doc/document/next_g.png +0 -0
  67. data/doc/derivative/math-doc/document/node1.html +238 -0
  68. data/doc/derivative/math-doc/document/node2.html +75 -0
  69. data/doc/derivative/math-doc/document/prev.png +0 -0
  70. data/doc/derivative/math-doc/document/prev_g.png +0 -0
  71. data/doc/derivative/math-doc/document/up.png +0 -0
  72. data/doc/derivative/math-doc/document/up_g.png +0 -0
  73. data/doc/derivative/math-doc/document.pdf +0 -0
  74. data/doc/derivative/math-doc/document.tex +158 -0
  75. data/doc/derivative/numru-derivative.html +129 -0
  76. data/doc/ep_flux/ep_flux.html +469 -0
  77. data/doc/ep_flux/ggraph_on_merdional_section.html +71 -0
  78. data/doc/ep_flux/index.html +31 -0
  79. data/doc/ep_flux/index.rd +24 -0
  80. data/doc/ep_flux/math-doc/document/WARNINGS +1 -0
  81. data/doc/ep_flux/math-doc/document/contents.png +0 -0
  82. data/doc/ep_flux/math-doc/document/crossref.png +0 -0
  83. data/doc/ep_flux/math-doc/document/document.css +30 -0
  84. data/doc/ep_flux/math-doc/document/document.html +101 -0
  85. data/doc/ep_flux/math-doc/document/images.aux +1 -0
  86. data/doc/ep_flux/math-doc/document/images.log +1375 -0
  87. data/doc/ep_flux/math-doc/document/images.pl +1328 -0
  88. data/doc/ep_flux/math-doc/document/images.tex +1471 -0
  89. data/doc/ep_flux/math-doc/document/img1.png +0 -0
  90. data/doc/ep_flux/math-doc/document/img10.png +0 -0
  91. data/doc/ep_flux/math-doc/document/img100.png +0 -0
  92. data/doc/ep_flux/math-doc/document/img101.png +0 -0
  93. data/doc/ep_flux/math-doc/document/img102.png +0 -0
  94. data/doc/ep_flux/math-doc/document/img103.png +0 -0
  95. data/doc/ep_flux/math-doc/document/img104.png +0 -0
  96. data/doc/ep_flux/math-doc/document/img105.png +0 -0
  97. data/doc/ep_flux/math-doc/document/img106.png +0 -0
  98. data/doc/ep_flux/math-doc/document/img107.png +0 -0
  99. data/doc/ep_flux/math-doc/document/img108.png +0 -0
  100. data/doc/ep_flux/math-doc/document/img109.png +0 -0
  101. data/doc/ep_flux/math-doc/document/img11.png +0 -0
  102. data/doc/ep_flux/math-doc/document/img110.png +0 -0
  103. data/doc/ep_flux/math-doc/document/img111.png +0 -0
  104. data/doc/ep_flux/math-doc/document/img112.png +0 -0
  105. data/doc/ep_flux/math-doc/document/img113.png +0 -0
  106. data/doc/ep_flux/math-doc/document/img114.png +0 -0
  107. data/doc/ep_flux/math-doc/document/img115.png +0 -0
  108. data/doc/ep_flux/math-doc/document/img116.png +0 -0
  109. data/doc/ep_flux/math-doc/document/img117.png +0 -0
  110. data/doc/ep_flux/math-doc/document/img118.png +0 -0
  111. data/doc/ep_flux/math-doc/document/img119.png +0 -0
  112. data/doc/ep_flux/math-doc/document/img12.png +0 -0
  113. data/doc/ep_flux/math-doc/document/img120.png +0 -0
  114. data/doc/ep_flux/math-doc/document/img121.png +0 -0
  115. data/doc/ep_flux/math-doc/document/img122.png +0 -0
  116. data/doc/ep_flux/math-doc/document/img123.png +0 -0
  117. data/doc/ep_flux/math-doc/document/img124.png +0 -0
  118. data/doc/ep_flux/math-doc/document/img125.png +0 -0
  119. data/doc/ep_flux/math-doc/document/img126.png +0 -0
  120. data/doc/ep_flux/math-doc/document/img127.png +0 -0
  121. data/doc/ep_flux/math-doc/document/img128.png +0 -0
  122. data/doc/ep_flux/math-doc/document/img129.png +0 -0
  123. data/doc/ep_flux/math-doc/document/img13.png +0 -0
  124. data/doc/ep_flux/math-doc/document/img130.png +0 -0
  125. data/doc/ep_flux/math-doc/document/img131.png +0 -0
  126. data/doc/ep_flux/math-doc/document/img132.png +0 -0
  127. data/doc/ep_flux/math-doc/document/img133.png +0 -0
  128. data/doc/ep_flux/math-doc/document/img134.png +0 -0
  129. data/doc/ep_flux/math-doc/document/img135.png +0 -0
  130. data/doc/ep_flux/math-doc/document/img136.png +0 -0
  131. data/doc/ep_flux/math-doc/document/img137.png +0 -0
  132. data/doc/ep_flux/math-doc/document/img138.png +0 -0
  133. data/doc/ep_flux/math-doc/document/img139.png +0 -0
  134. data/doc/ep_flux/math-doc/document/img14.png +0 -0
  135. data/doc/ep_flux/math-doc/document/img140.png +0 -0
  136. data/doc/ep_flux/math-doc/document/img141.png +0 -0
  137. data/doc/ep_flux/math-doc/document/img142.png +0 -0
  138. data/doc/ep_flux/math-doc/document/img143.png +0 -0
  139. data/doc/ep_flux/math-doc/document/img144.png +0 -0
  140. data/doc/ep_flux/math-doc/document/img145.png +0 -0
  141. data/doc/ep_flux/math-doc/document/img146.png +0 -0
  142. data/doc/ep_flux/math-doc/document/img147.png +0 -0
  143. data/doc/ep_flux/math-doc/document/img148.png +0 -0
  144. data/doc/ep_flux/math-doc/document/img149.png +0 -0
  145. data/doc/ep_flux/math-doc/document/img15.png +0 -0
  146. data/doc/ep_flux/math-doc/document/img150.png +0 -0
  147. data/doc/ep_flux/math-doc/document/img151.png +0 -0
  148. data/doc/ep_flux/math-doc/document/img152.png +0 -0
  149. data/doc/ep_flux/math-doc/document/img153.png +0 -0
  150. data/doc/ep_flux/math-doc/document/img154.png +0 -0
  151. data/doc/ep_flux/math-doc/document/img155.png +0 -0
  152. data/doc/ep_flux/math-doc/document/img156.png +0 -0
  153. data/doc/ep_flux/math-doc/document/img157.png +0 -0
  154. data/doc/ep_flux/math-doc/document/img158.png +0 -0
  155. data/doc/ep_flux/math-doc/document/img159.png +0 -0
  156. data/doc/ep_flux/math-doc/document/img16.png +0 -0
  157. data/doc/ep_flux/math-doc/document/img160.png +0 -0
  158. data/doc/ep_flux/math-doc/document/img161.png +0 -0
  159. data/doc/ep_flux/math-doc/document/img162.png +0 -0
  160. data/doc/ep_flux/math-doc/document/img163.png +0 -0
  161. data/doc/ep_flux/math-doc/document/img164.png +0 -0
  162. data/doc/ep_flux/math-doc/document/img165.png +0 -0
  163. data/doc/ep_flux/math-doc/document/img166.png +0 -0
  164. data/doc/ep_flux/math-doc/document/img167.png +0 -0
  165. data/doc/ep_flux/math-doc/document/img168.png +0 -0
  166. data/doc/ep_flux/math-doc/document/img169.png +0 -0
  167. data/doc/ep_flux/math-doc/document/img17.png +0 -0
  168. data/doc/ep_flux/math-doc/document/img170.png +0 -0
  169. data/doc/ep_flux/math-doc/document/img171.png +0 -0
  170. data/doc/ep_flux/math-doc/document/img172.png +0 -0
  171. data/doc/ep_flux/math-doc/document/img173.png +0 -0
  172. data/doc/ep_flux/math-doc/document/img174.png +0 -0
  173. data/doc/ep_flux/math-doc/document/img175.png +0 -0
  174. data/doc/ep_flux/math-doc/document/img176.png +0 -0
  175. data/doc/ep_flux/math-doc/document/img177.png +0 -0
  176. data/doc/ep_flux/math-doc/document/img178.png +0 -0
  177. data/doc/ep_flux/math-doc/document/img179.png +0 -0
  178. data/doc/ep_flux/math-doc/document/img18.png +0 -0
  179. data/doc/ep_flux/math-doc/document/img180.png +0 -0
  180. data/doc/ep_flux/math-doc/document/img181.png +0 -0
  181. data/doc/ep_flux/math-doc/document/img182.png +0 -0
  182. data/doc/ep_flux/math-doc/document/img183.png +0 -0
  183. data/doc/ep_flux/math-doc/document/img184.png +0 -0
  184. data/doc/ep_flux/math-doc/document/img185.png +0 -0
  185. data/doc/ep_flux/math-doc/document/img186.png +0 -0
  186. data/doc/ep_flux/math-doc/document/img187.png +0 -0
  187. data/doc/ep_flux/math-doc/document/img188.png +0 -0
  188. data/doc/ep_flux/math-doc/document/img189.png +0 -0
  189. data/doc/ep_flux/math-doc/document/img19.png +0 -0
  190. data/doc/ep_flux/math-doc/document/img190.png +0 -0
  191. data/doc/ep_flux/math-doc/document/img191.png +0 -0
  192. data/doc/ep_flux/math-doc/document/img192.png +0 -0
  193. data/doc/ep_flux/math-doc/document/img193.png +0 -0
  194. data/doc/ep_flux/math-doc/document/img194.png +0 -0
  195. data/doc/ep_flux/math-doc/document/img195.png +0 -0
  196. data/doc/ep_flux/math-doc/document/img196.png +0 -0
  197. data/doc/ep_flux/math-doc/document/img197.png +0 -0
  198. data/doc/ep_flux/math-doc/document/img198.png +0 -0
  199. data/doc/ep_flux/math-doc/document/img199.png +0 -0
  200. data/doc/ep_flux/math-doc/document/img2.png +0 -0
  201. data/doc/ep_flux/math-doc/document/img20.png +0 -0
  202. data/doc/ep_flux/math-doc/document/img200.png +0 -0
  203. data/doc/ep_flux/math-doc/document/img21.png +0 -0
  204. data/doc/ep_flux/math-doc/document/img22.png +0 -0
  205. data/doc/ep_flux/math-doc/document/img23.png +0 -0
  206. data/doc/ep_flux/math-doc/document/img24.png +0 -0
  207. data/doc/ep_flux/math-doc/document/img25.png +0 -0
  208. data/doc/ep_flux/math-doc/document/img26.png +0 -0
  209. data/doc/ep_flux/math-doc/document/img27.png +0 -0
  210. data/doc/ep_flux/math-doc/document/img28.png +0 -0
  211. data/doc/ep_flux/math-doc/document/img29.png +0 -0
  212. data/doc/ep_flux/math-doc/document/img3.png +0 -0
  213. data/doc/ep_flux/math-doc/document/img30.png +0 -0
  214. data/doc/ep_flux/math-doc/document/img31.png +0 -0
  215. data/doc/ep_flux/math-doc/document/img32.png +0 -0
  216. data/doc/ep_flux/math-doc/document/img33.png +0 -0
  217. data/doc/ep_flux/math-doc/document/img34.png +0 -0
  218. data/doc/ep_flux/math-doc/document/img35.png +0 -0
  219. data/doc/ep_flux/math-doc/document/img36.png +0 -0
  220. data/doc/ep_flux/math-doc/document/img37.png +0 -0
  221. data/doc/ep_flux/math-doc/document/img38.png +0 -0
  222. data/doc/ep_flux/math-doc/document/img39.png +0 -0
  223. data/doc/ep_flux/math-doc/document/img4.png +0 -0
  224. data/doc/ep_flux/math-doc/document/img40.png +0 -0
  225. data/doc/ep_flux/math-doc/document/img41.png +0 -0
  226. data/doc/ep_flux/math-doc/document/img42.png +0 -0
  227. data/doc/ep_flux/math-doc/document/img43.png +0 -0
  228. data/doc/ep_flux/math-doc/document/img44.png +0 -0
  229. data/doc/ep_flux/math-doc/document/img45.png +0 -0
  230. data/doc/ep_flux/math-doc/document/img46.png +0 -0
  231. data/doc/ep_flux/math-doc/document/img47.png +0 -0
  232. data/doc/ep_flux/math-doc/document/img48.png +0 -0
  233. data/doc/ep_flux/math-doc/document/img49.png +0 -0
  234. data/doc/ep_flux/math-doc/document/img5.png +0 -0
  235. data/doc/ep_flux/math-doc/document/img50.png +0 -0
  236. data/doc/ep_flux/math-doc/document/img51.png +0 -0
  237. data/doc/ep_flux/math-doc/document/img52.png +0 -0
  238. data/doc/ep_flux/math-doc/document/img53.png +0 -0
  239. data/doc/ep_flux/math-doc/document/img54.png +0 -0
  240. data/doc/ep_flux/math-doc/document/img55.png +0 -0
  241. data/doc/ep_flux/math-doc/document/img56.png +0 -0
  242. data/doc/ep_flux/math-doc/document/img57.png +0 -0
  243. data/doc/ep_flux/math-doc/document/img58.png +0 -0
  244. data/doc/ep_flux/math-doc/document/img59.png +0 -0
  245. data/doc/ep_flux/math-doc/document/img6.png +0 -0
  246. data/doc/ep_flux/math-doc/document/img60.png +0 -0
  247. data/doc/ep_flux/math-doc/document/img61.png +0 -0
  248. data/doc/ep_flux/math-doc/document/img62.png +0 -0
  249. data/doc/ep_flux/math-doc/document/img63.png +0 -0
  250. data/doc/ep_flux/math-doc/document/img64.png +0 -0
  251. data/doc/ep_flux/math-doc/document/img65.png +0 -0
  252. data/doc/ep_flux/math-doc/document/img66.png +0 -0
  253. data/doc/ep_flux/math-doc/document/img67.png +0 -0
  254. data/doc/ep_flux/math-doc/document/img68.png +0 -0
  255. data/doc/ep_flux/math-doc/document/img69.png +0 -0
  256. data/doc/ep_flux/math-doc/document/img7.png +0 -0
  257. data/doc/ep_flux/math-doc/document/img70.png +0 -0
  258. data/doc/ep_flux/math-doc/document/img71.png +0 -0
  259. data/doc/ep_flux/math-doc/document/img72.png +0 -0
  260. data/doc/ep_flux/math-doc/document/img73.png +0 -0
  261. data/doc/ep_flux/math-doc/document/img74.png +0 -0
  262. data/doc/ep_flux/math-doc/document/img75.png +0 -0
  263. data/doc/ep_flux/math-doc/document/img76.png +0 -0
  264. data/doc/ep_flux/math-doc/document/img77.png +0 -0
  265. data/doc/ep_flux/math-doc/document/img78.png +0 -0
  266. data/doc/ep_flux/math-doc/document/img79.png +0 -0
  267. data/doc/ep_flux/math-doc/document/img8.png +0 -0
  268. data/doc/ep_flux/math-doc/document/img80.png +0 -0
  269. data/doc/ep_flux/math-doc/document/img81.png +0 -0
  270. data/doc/ep_flux/math-doc/document/img82.png +0 -0
  271. data/doc/ep_flux/math-doc/document/img83.png +0 -0
  272. data/doc/ep_flux/math-doc/document/img84.png +0 -0
  273. data/doc/ep_flux/math-doc/document/img85.png +0 -0
  274. data/doc/ep_flux/math-doc/document/img86.png +0 -0
  275. data/doc/ep_flux/math-doc/document/img87.png +0 -0
  276. data/doc/ep_flux/math-doc/document/img88.png +0 -0
  277. data/doc/ep_flux/math-doc/document/img89.png +0 -0
  278. data/doc/ep_flux/math-doc/document/img9.png +0 -0
  279. data/doc/ep_flux/math-doc/document/img90.png +0 -0
  280. data/doc/ep_flux/math-doc/document/img91.png +0 -0
  281. data/doc/ep_flux/math-doc/document/img92.png +0 -0
  282. data/doc/ep_flux/math-doc/document/img93.png +0 -0
  283. data/doc/ep_flux/math-doc/document/img94.png +0 -0
  284. data/doc/ep_flux/math-doc/document/img95.png +0 -0
  285. data/doc/ep_flux/math-doc/document/img96.png +0 -0
  286. data/doc/ep_flux/math-doc/document/img97.png +0 -0
  287. data/doc/ep_flux/math-doc/document/img98.png +0 -0
  288. data/doc/ep_flux/math-doc/document/img99.png +0 -0
  289. data/doc/ep_flux/math-doc/document/index.html +101 -0
  290. data/doc/ep_flux/math-doc/document/internals.pl +258 -0
  291. data/doc/ep_flux/math-doc/document/labels.pl +265 -0
  292. data/doc/ep_flux/math-doc/document/next.png +0 -0
  293. data/doc/ep_flux/math-doc/document/next_g.png +0 -0
  294. data/doc/ep_flux/math-doc/document/node1.html +104 -0
  295. data/doc/ep_flux/math-doc/document/node10.html +164 -0
  296. data/doc/ep_flux/math-doc/document/node11.html +86 -0
  297. data/doc/ep_flux/math-doc/document/node12.html +166 -0
  298. data/doc/ep_flux/math-doc/document/node13.html +897 -0
  299. data/doc/ep_flux/math-doc/document/node14.html +1065 -0
  300. data/doc/ep_flux/math-doc/document/node15.html +72 -0
  301. data/doc/ep_flux/math-doc/document/node16.html +81 -0
  302. data/doc/ep_flux/math-doc/document/node2.html +82 -0
  303. data/doc/ep_flux/math-doc/document/node3.html +91 -0
  304. data/doc/ep_flux/math-doc/document/node4.html +149 -0
  305. data/doc/ep_flux/math-doc/document/node5.html +330 -0
  306. data/doc/ep_flux/math-doc/document/node6.html +99 -0
  307. data/doc/ep_flux/math-doc/document/node7.html +98 -0
  308. data/doc/ep_flux/math-doc/document/node8.html +83 -0
  309. data/doc/ep_flux/math-doc/document/node9.html +140 -0
  310. data/doc/ep_flux/math-doc/document/prev.png +0 -0
  311. data/doc/ep_flux/math-doc/document/prev_g.png +0 -0
  312. data/doc/ep_flux/math-doc/document/up.png +0 -0
  313. data/doc/ep_flux/math-doc/document/up_g.png +0 -0
  314. data/doc/ep_flux/math-doc/document.pdf +0 -0
  315. data/doc/ep_flux/math-doc/document.tex +2018 -0
  316. data/doc/gdir.html +412 -0
  317. data/doc/gdir_client.html +16 -0
  318. data/doc/gdir_connect_ftp-like.html +61 -0
  319. data/doc/gdir_server.html +45 -0
  320. data/doc/ggraph.html +1615 -0
  321. data/doc/gpcat.html +44 -0
  322. data/doc/gpcut.html +41 -0
  323. data/doc/gphys.html +532 -0
  324. data/doc/gphys_fft.html +324 -0
  325. data/doc/gphys_grads_io.html +69 -0
  326. data/doc/gphys_grib_io.html +82 -0
  327. data/doc/gphys_io.html +120 -0
  328. data/doc/gphys_io_common.html +18 -0
  329. data/doc/gphys_netcdf_io.html +283 -0
  330. data/doc/gplist.html +24 -0
  331. data/doc/gpmath.html +51 -0
  332. data/doc/gpmaxmin.html +31 -0
  333. data/doc/gpprint.html +34 -0
  334. data/doc/gpview.html +270 -0
  335. data/doc/grads2nc_with_gphys.html +21 -0
  336. data/doc/grads_gridded.html +307 -0
  337. data/doc/grib.html +144 -0
  338. data/doc/grid.html +212 -0
  339. data/doc/index.html +133 -0
  340. data/doc/index.rd +127 -0
  341. data/doc/netcdf_convention.html +136 -0
  342. data/doc/unumeric.html +176 -0
  343. data/doc/update +64 -0
  344. data/doc/varray.html +299 -0
  345. data/doc/varraycomposite.html +67 -0
  346. data/ext_coord.c +209 -0
  347. data/ext_init.c +7 -0
  348. data/extconf.rb +42 -0
  349. data/install.rb +130 -0
  350. data/interpo.c +497 -0
  351. data/lib/numru/dcl_mouse.rb +71 -0
  352. data/lib/numru/dclext_datetime_ax.rb +220 -0
  353. data/lib/numru/derivative.rb +348 -0
  354. data/lib/numru/ganalysis/covariance.rb +154 -0
  355. data/lib/numru/ganalysis/eof.rb +298 -0
  356. data/lib/numru/ganalysis/histogram.rb +252 -0
  357. data/lib/numru/ganalysis/met.rb +317 -0
  358. data/lib/numru/ganalysis/planet.rb +182 -0
  359. data/lib/numru/ganalysis.rb +7 -0
  360. data/lib/numru/gdir.rb +1038 -0
  361. data/lib/numru/gdir_connect_ftp-like.rb +149 -0
  362. data/lib/numru/ggraph.rb +5838 -0
  363. data/lib/numru/ggraph_on_merdional_section.rb +178 -0
  364. data/lib/numru/gphys/assoccoords.rb +359 -0
  365. data/lib/numru/gphys/attribute.rb +129 -0
  366. data/lib/numru/gphys/attributenetcdf.rb +80 -0
  367. data/lib/numru/gphys/axis.rb +963 -0
  368. data/lib/numru/gphys/coordmapping.rb +286 -0
  369. data/lib/numru/gphys/coordtransform.rb +209 -0
  370. data/lib/numru/gphys/derivative.rb +314 -0
  371. data/lib/numru/gphys/ep_flux.rb +868 -0
  372. data/lib/numru/gphys/gpcommon.rb +52 -0
  373. data/lib/numru/gphys/gphys.rb +1207 -0
  374. data/lib/numru/gphys/gphys_fft.rb +886 -0
  375. data/lib/numru/gphys/gphys_grads_io.rb +212 -0
  376. data/lib/numru/gphys/gphys_grib_io.rb +214 -0
  377. data/lib/numru/gphys/gphys_gtool3_io.rb +162 -0
  378. data/lib/numru/gphys/gphys_hdfeos5_io.rb +672 -0
  379. data/lib/numru/gphys/gphys_io.rb +452 -0
  380. data/lib/numru/gphys/gphys_io_common.rb +126 -0
  381. data/lib/numru/gphys/gphys_netcdf_io.rb +800 -0
  382. data/lib/numru/gphys/gphys_nusdas_io.rb +132 -0
  383. data/lib/numru/gphys/grads_gridded.rb +1638 -0
  384. data/lib/numru/gphys/grib.rb +2049 -0
  385. data/lib/numru/gphys/grib_params.rb +1465 -0
  386. data/lib/numru/gphys/grid.rb +723 -0
  387. data/lib/numru/gphys/gtool3.rb +771 -0
  388. data/lib/numru/gphys/interpolate.rb +854 -0
  389. data/lib/numru/gphys/narray_ext.rb +34 -0
  390. data/lib/numru/gphys/netcdf_convention.rb +406 -0
  391. data/lib/numru/gphys/subsetmapping.rb +332 -0
  392. data/lib/numru/gphys/unumeric.rb +522 -0
  393. data/lib/numru/gphys/varray.rb +1109 -0
  394. data/lib/numru/gphys/varraycomposite.rb +415 -0
  395. data/lib/numru/gphys/varraygrads.rb +225 -0
  396. data/lib/numru/gphys/varraygrib.rb +177 -0
  397. data/lib/numru/gphys/varraygtool3.rb +226 -0
  398. data/lib/numru/gphys/varrayhdfeos5.rb +451 -0
  399. data/lib/numru/gphys/varraynetcdf.rb +350 -0
  400. data/lib/numru/gphys/varraynusdas.rb +59 -0
  401. data/lib/numru/gphys.rb +9 -0
  402. data/lib/numru/htdir.rb +170 -0
  403. data/multibitIO.c +567 -0
  404. data/sample/cira86_to_nc.rb +122 -0
  405. data/sample/druby_cli1.rb +21 -0
  406. data/sample/druby_cli2.rb +34 -0
  407. data/sample/druby_serv1.rb +30 -0
  408. data/sample/druby_serv2.rb +64 -0
  409. data/sample/ep_flux/demo_NCEP_1.rb +48 -0
  410. data/sample/ep_flux/demo_NCEP_2.rb +57 -0
  411. data/sample/ep_flux/demo_NCEP_3.rb +81 -0
  412. data/sample/ggraph_latlon_labelling_dr002690.rb +159 -0
  413. data/sample/ggraph_mapfit-axes_dr002687.rb +131 -0
  414. data/sample/map_projection.rb +121 -0
  415. data/sample/ncep_theta_coord.rb +79 -0
  416. data/test/eof_slp.rb +28 -0
  417. data/test/mltbit.dat +0 -0
  418. data/test/test_ep_flux.rb +533 -0
  419. data/test/test_multibitIO.rb +19 -0
  420. data/testdata/T.jan.ctl +12 -0
  421. data/testdata/T.jan.dat +0 -0
  422. data/testdata/T.jan.grib +0 -0
  423. data/testdata/T.jan.nc +0 -0
  424. data/testdata/T.jan.packed.withmiss.nc +0 -0
  425. data/testdata/UV.jan.nc +0 -0
  426. data/testdata/assoc_crds.nc +0 -0
  427. data/testdata/cira86.dat +1332 -0
  428. metadata +621 -0
data/LICENSE.txt ADDED
@@ -0,0 +1,34 @@
1
+ GPhys is copyrighted free software by Takeshi Horinouchi and
2
+ GFD Dennou Club (http://www.gfd-dennou.org/).
3
+
4
+ Copyright 2011 (C) Takeshi Horinouchi and GFD Dennou Club
5
+ (http://www.gfd-dennou.org/) All rights reserved.
6
+
7
+ Redistribution and use in source and binary forms, with or without
8
+ modification, are permitted provided that the following conditions are
9
+ met:
10
+
11
+ 1. Redistributions of source code must retain the above copyright
12
+ notice, this list of conditions and the following disclaimer.
13
+
14
+ 2. Redistributions in binary form must reproduce the above copyright
15
+ notice, this list of conditions and the following disclaimer in
16
+ the documentation and/or other materials provided with the
17
+ distribution.
18
+
19
+ THIS SOFTWARE IS PROVIDED BY GFD DENNOU CLUB AND CONTRIBUTORS ``AS IS''
20
+ AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO,
21
+ THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
22
+ PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GFD DENNOU CLUB OR
23
+ CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
24
+ EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
25
+ PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
26
+ PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
27
+ LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
28
+ NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
29
+ SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
30
+
31
+ The views and conclusions contained in the software and documentation
32
+ are those of the authors and should not be interpreted as representing
33
+ official policies, either expressed or implied, of Takeshi Horinouchi
34
+ and GFD Dennou Club.
data/README ADDED
@@ -0,0 +1,33 @@
1
+
2
+ GPhys -- a class of multi-dimensional Gridded Physical quantities
3
+
4
+ by T Horinouchi
5
+ 2003/05/14
6
+
7
+ * DESCRIPTION
8
+
9
+ To be written.
10
+ See http://ruby.gfd-dennou.org/workshop200303/horinout/ (in Japanese).
11
+
12
+ * INSTALL
13
+
14
+ # ruby extconf.rb && make && make install
15
+ # ruby ./install.rb
16
+
17
+ * SAMPLE PROGRAMS
18
+
19
+ Each library file has a sample program part, which is invoked by
20
+ directly feeding the file to Ruby. For example
21
+
22
+ % cd lib/numru/
23
+ % ruby ggraph.rb
24
+
25
+ % cd lib/numru/gphys
26
+ % ruby gphys.rb
27
+ % ruby gphys_netcdf_io.rb
28
+
29
+ Sample programs are also found in the
30
+
31
+ ./sample
32
+
33
+ diredtory.
data/Rakefile ADDED
@@ -0,0 +1,57 @@
1
+ require 'rake/gempackagetask'
2
+
3
+ NAME = 'gphys'
4
+ VER = '1.1.1a'
5
+
6
+ PKG_FILES = FileList[
7
+ '**',
8
+ 'bin/**/*',
9
+ 'doc/**/*',
10
+ 'lib/**/*',
11
+ 'sample/**/*',
12
+ 'test/**/*',
13
+ 'testdata/**/*'
14
+ ]
15
+
16
+ spec = Gem::Specification.new do |s|
17
+ s.name = NAME
18
+ s.version = VER
19
+ s.authors = ["Takeshi Horinouchi", "Ryo Mizuta",\
20
+ "Daisuke Tsukahara", "Seiya Nishizawa", "Shin-ichi Takehiro"]
21
+ s.email = ['eriko@gfd-dennou.org']
22
+ s.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/gphys/'
23
+ s.licenses = ["GFD Dennou Club"]
24
+ s.platform = Gem::Platform::RUBY
25
+ s.summary = %q{a multi-purpose class to handle Gridded Physical quantities}
26
+ s.description = %q{comprehensive library for self-descriptive gridded physical data (in NetCDF, GrADS, or on memory) with graphicsgraphicsgraphicsgraphics.}
27
+
28
+ s.files = PKG_FILES.to_a
29
+ s.require_paths = ['lib']
30
+ s.test_files = Dir.glob("test/*")
31
+ s.bindir = 'bin'
32
+ s.executables = ['gdir_client','gpaop','gpcut','gplist'\
33
+ ,'gpmaxmin','gpvect','grads2nc_with_gphys','gdir_server'\
34
+ ,'gpcat','gpedit','gpmath','gpprint','gpview']
35
+
36
+ s.has_rdoc = false
37
+ #s.extra_rdoc_files = ['README']
38
+
39
+ s.required_ruby_version = Gem::Requirement.new(">= 1.6")
40
+
41
+ s.add_runtime_dependency(%q<narray>, [">= 0"])
42
+ s.add_runtime_dependency(%q<numru-misc>, [">= 0.0.4"])
43
+ s.add_runtime_dependency(%q<numru-units>, [">= 1.5"])
44
+ s.add_runtime_dependency(%q<narray_miss>, [">= 0"])
45
+ s.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.5.2"])
46
+ s.add_runtime_dependency(%q<ruby-dcl>, [">= 1.2.1"])
47
+ s.add_runtime_dependency(%q<ruby-fftw3>, [">= 0.3"])
48
+
49
+ s.extensions << "extconf.rb"
50
+ #s.extensions << "extconf.rb --enable-shared"
51
+ end
52
+
53
+ Rake::GemPackageTask.new(spec) do |pkg|
54
+ pkg.gem_spec = spec
55
+ pkg.need_tar = true
56
+ end
57
+
data/TODO_ep_flux ADDED
@@ -0,0 +1,6 @@
1
+ * mathmatical documents
2
+ * add method reference
3
+ * write tutrial
4
+ * for user
5
+ * about precision
6
+ * for devloper
data/bin/gdir_client ADDED
@@ -0,0 +1,27 @@
1
+ #!/usr/bin/env ruby
2
+ irb -r numru/gdir_connect_ftp-like
3
+
4
+ =begin
5
+ = NAME
6
+
7
+ gdir_client - A client of gdir_server using irb.
8
+
9
+ = SYNOPSIS
10
+
11
+ % gdir_client top_dir [[host:]port] [-a allowed_address] ...
12
+
13
+ = DESCRIPTION
14
+
15
+ ((*gdir_client*)) command is just equal to
16
+
17
+ irb -r numru/gdir_connect_ftp-like
18
+
19
+ = OPTIONS
20
+
21
+ same as gdir_server
22
+
23
+ = SEE ALSO
24
+
25
+ ((*gdir_server(1)*))
26
+
27
+ =end
data/bin/gdir_server ADDED
@@ -0,0 +1,129 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ = NAME
4
+
5
+ gdir_server - A stand-alone server program to provide a directory service of GPhys
6
+
7
+ = SYNOPSIS
8
+
9
+ % gdir_server top_dir [[host:]port] [-a allowed_address]..
10
+
11
+ = DESCRIPTION
12
+
13
+ A stand-alone server program to provide a directory service of GPhys
14
+ objects by using GDir.
15
+
16
+ = OPTION
17
+
18
+ :top_dir:
19
+ can be ".", "/", or whatever directory in your files system.
20
+ :host:
21
+ host address (name or ip) -- use it if you want to specify
22
+ explicitly, such as "localhost", which is useful for ssh port forwarding.
23
+ :port:
24
+ the port number you want to assign (internally determined
25
+ if not specified). A complete URI is printed if the server is started.
26
+ :-a:
27
+ limits accesses from remote hosts only to the ones specified.
28
+ Can be repeated multiple times. (Need the space between '-a' and the rest)
29
+
30
+ % gdir_server . 12345
31
+ % gdir_server . localhost:12345 -a all
32
+ % gdir_server . -a hoge.hero.org -a localhost
33
+ % gdir_server . 12345 -a '192.168.1.*' -a localhost
34
+
35
+ =end
36
+
37
+ require "drb/drb"
38
+ require "drb/timeridconv"
39
+ require "drb/acl"
40
+ require "numru/gdir"
41
+
42
+ DRb.install_id_conv(DRb::TimerIdConv.new(1200))
43
+
44
+ module NumRu
45
+ class GDir
46
+ include DRbUndumped
47
+ end
48
+ end
49
+
50
+ class NArray
51
+ def self._load(o) to_na(*Marshal::load(o)).ntoh end
52
+ def _dump(limit)
53
+ Marshal::dump([hton.to_s, typecode, *shape])
54
+ end
55
+ end
56
+
57
+ include NumRu
58
+
59
+ usage = <<EOS
60
+
61
+
62
+ USAGE: % #{$0} top_dir [[host:]port] [-a allowed_address]..
63
+
64
+ where
65
+ * top_dir: can be ".", "/", or whatever directory in your files system.
66
+ * host: host address (name or ip) -- use it if you want to specify
67
+ explicitly, such as "localhost", which is useful for ssh port forwarding.
68
+ * port: the port number you want to assign (internally determined
69
+ if not specified). A complete URI is printed if the server is started.
70
+ * -a: Allows accesses from those hosts specified with this option.
71
+ Can be repeated multiple times. (Need the space between '-a' and the rest)
72
+ By default, only connections from the localhost is allowed.
73
+ If you use this option, you need to specify localhost explicitly
74
+ if connection from the localhost is needed.
75
+
76
+ EXAMPLES:
77
+ % #{$0} . 12345
78
+ % #{$0} . localhost:12345 -a all
79
+ % #{$0} . -a hoge.hero.org -a localhost
80
+ % #{$0} . 12345 -a '192.168.1.*' -a localhost
81
+ EOS
82
+
83
+ # <interpret comman-line arguments>
84
+
85
+ if ARGV.include?('-a')
86
+ # Access control
87
+ list = ['deny', 'all']
88
+ while(idx=ARGV.index('-a'))
89
+ ARGV.delete_at(idx)
90
+ begin
91
+ list.push( 'allow', ARGV.delete_at(idx) )
92
+ rescue
93
+ raise usage
94
+ end
95
+ end
96
+ acl = ACL.new(list)
97
+ DRb.install_acl(acl)
98
+ else
99
+ list = %W!deny all allow localhost allow 127.0.0.1 allow #{Socket.gethostname}!
100
+ acl = ACL.new(list)
101
+ DRb.install_acl(acl)
102
+ end
103
+
104
+ top = ARGV.shift || raise(usage)
105
+ host_port = ARGV.shift
106
+
107
+ # <set the top & direcotry>
108
+ begin
109
+ GDir.top = top
110
+ rootdir = GDir.new('/')
111
+ rescue
112
+ print "\n",usage,"\n"
113
+ raise
114
+ end
115
+
116
+ # <start the server>
117
+ if !host_port
118
+ uri_seed = nil
119
+ elsif /:/ =~ host_port
120
+ uri_seed = 'druby://'+host_port
121
+ else
122
+ port = host_port # port number only
123
+ print usage if port && port.to_i.to_s != port # make sure it is an integer
124
+ uri_seed = 'druby://:'+port
125
+ end
126
+ DRb.start_service(uri_seed, rootdir)
127
+ puts 'URI: '+DRb.uri
128
+ puts '[return] to exit'
129
+ gets
data/bin/gpaop ADDED
@@ -0,0 +1,146 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ = NAME
4
+
5
+ gpaop - Carrying out an arithmetric operation multiple GPhys variables.
6
+
7
+ = USAGE
8
+
9
+ % gpaop -f func [options] gturl1 gturl2 ...
10
+
11
+ = DESCRIPTION
12
+
13
+ Carrying out an arithmetric operation (addition, subtraction,
14
+ multiplication and division) multiple GPhys variables.
15
+
16
+ = SYNOPSYS
17
+
18
+ Operation, gphys1 (+-*/) gphys2 (+-*/) gphys3 (+-*/) ... is performed
19
+ by the following command formats.
20
+
21
+ % gpaop -f func [options] gturl1 gturl2 ...
22
+
23
+ Format of 'gturl*' is 'path@varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]'
24
+
25
+ % gpaop -f func --var varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]] [options] gtfile1 gtfile2 ...
26
+
27
+ Commands which compute arithmetric operation on gphys variables are
28
+ successively installed by linking this sciript as a
29
+ "gp+(add|sub|multi|div)". You can omit '--func' option by using
30
+ these commands.
31
+
32
+ = OPTIONS
33
+
34
+ :-f func, --func func
35
+ kind of operation (add|sub|multi|div|)
36
+ :-v url, --var url
37
+ set the variable name and slicing parameters.
38
+ :-h, --help
39
+ print this message.
40
+ :-o file, --output file
41
+ output filename (optional).
42
+ Default output filename is 'gphys.nc'.
43
+
44
+ Usage Examples
45
+
46
+ % gpaop -f add gtool.nc@temp gtool.nc@temp
47
+ % gpaop -f sub gtool.nc@temp,t=1 gtool.nc@temp,t=2
48
+
49
+ % gpaop -f multi --var temp gtool*.nc
50
+ % gpaop -f div --var temp,t=1 gtool*.nc
51
+ % gpaop -o temp.nc --var temp,t=1 gtool*.nc
52
+
53
+ = HISTORY
54
+
55
+ 2005/08/21 S Takehiro (created)
56
+ 2005/08/23 S Takehiro (common methods to gp* commandmoved to gpcommon.rb)
57
+ 2010/03/10 Y SASAKI (change help block into RD format)
58
+
59
+ =end
60
+
61
+ require "numru/gphys"
62
+ require "numru/gphys/gpcommon"
63
+ include NumRu
64
+
65
+ require "getoptlong"
66
+
67
+ #------------------------ Default Settings ------------------------
68
+ Output_default = 'gphys.nc' # default ouptput file name
69
+ command = File.basename($0)+" "+ARGV.join(' ') # keep an input command line
70
+
71
+ #---------------------- Option Configuration ----------------------
72
+ parser = GetoptLong.new(
73
+ ["--func", "-f", GetoptLong::REQUIRED_ARGUMENT],
74
+ ["--var", "-v", GetoptLong::REQUIRED_ARGUMENT],
75
+ ["--output", "-o", GetoptLong::REQUIRED_ARGUMENT],
76
+ ["--help", "-h", GetoptLong::NO_ARGUMENT ])
77
+ begin
78
+ parser.each{|opt, arg|
79
+ case opt
80
+ when "--func" then eval "$OPT_func='#{arg}'"
81
+ when "--var" then eval "$OPT_var='#{arg}'"
82
+ when "--output" then eval "$OPT_output='#{arg}'"
83
+ when "--help" then eval "$OPT_help=true"
84
+ else
85
+ raise "must not happen"
86
+ end
87
+ }
88
+ rescue GetoptLong::AmbigousOption, GetoptLong::InvalidOption,
89
+ GetoptLong::MissingArgument,
90
+ GetoptLong::NeedlessArgument => err
91
+ help
92
+ $srderr.puts err.message
93
+ exit 1
94
+ end
95
+
96
+ #------------------------ Help message ------------------------
97
+ if $OPT_help then
98
+ help
99
+ exit(0)
100
+ end
101
+
102
+ #------------------------ Option check ------------------------
103
+ $OPT_output ||= Output_default
104
+ $OPT_func ||= $0.sub(/^gp/,'')
105
+ raise "Operation '#{$OPT_func}' not supported. It should be add,sub,multi or div." unless /(add|sub|multi|div)/ =~ $OPT_func
106
+
107
+ unless ARGV[0]
108
+ help
109
+ exit 1
110
+ end
111
+
112
+ #------------------------ Output file check --------------------------
113
+ raise "#{$OPT_output} already exists." if FileTest.exist?($OPT_output)
114
+ outncfile=NetCDF.create($OPT_output)
115
+
116
+ #------------------------ Open gphys variable ------------------------
117
+ # Reading the first Gphys variable
118
+ gturl = ARGV[0]
119
+ gturl = gturl+'@'+$OPT_var if $OPT_var
120
+ gphys = GPhys::IO.open_gturl(gturl)
121
+ print " Reading #{gturl}\n"
122
+ gphys_aop = gphys.copy
123
+ outncfile.copy_global_att(gphys) # Copy global attributes (only for NetCDF)
124
+ ARGV.shift
125
+
126
+
127
+ # Reading Gphys variables after the first one.
128
+ while ARGV[0] do
129
+ gturl = ARGV[0]
130
+ gturl = gturl+'@'+$OPT_var if $OPT_var
131
+ gphys = GPhys::IO.open_gturl(gturl)
132
+ print " Reading #{gturl}\n"
133
+
134
+ gphys_aop = gphys_aop + gphys if $OPT_func=="add"
135
+ gphys_aop = gphys_aop - gphys if $OPT_func=="sub"
136
+ gphys_aop = gphys_aop * gphys if $OPT_func=="multi"
137
+ gphys_aop = gphys_aop / gphys if $OPT_func=="div"
138
+ ARGV.shift
139
+ end
140
+
141
+ #---------------------- Output GPhys variable ------------------------
142
+ GPhys::IO.write( outncfile, gphys_aop )
143
+ NetCDF_Conventions.add_history(outncfile, command) # Exec command written as a history
144
+ outncfile.close
145
+
146
+ print File.basename($0) +": Output is written to #{$OPT_output}.\n"
data/bin/gpcat ADDED
@@ -0,0 +1,148 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ = NAME
4
+
5
+ gpcat - Read a variable in multiple NetCDF files, concatenate and write them to a single netcdf file.
6
+
7
+ = DESCRIPTION
8
+
9
+ ((*gpcat*)) is command line tools for read a variable in multiple
10
+ NetCDF files, concatenate and write them to a single netcdf file.
11
+
12
+ = USAGE
13
+
14
+ % gpcat -v VAR [options] FILE1 FILE2...
15
+
16
+ = OPTIONS
17
+
18
+ :-h, --help
19
+ print this message.
20
+ :-v var, --variable var
21
+ variable name (required).
22
+ :-s sfmt, --slice sfmt
23
+ slice,thinnng (optional).
24
+ :-o file, --output file
25
+ output filename (optional). Default output filename is 'gphys.nc'.
26
+
27
+
28
+ = HISTORY
29
+
30
+ 2005/05/17 S Takehiro (created)
31
+ 2005/08/10 S Takehiro (utilize internal function for printing help message)
32
+ 2005/08/21 S Takehiro (global attributes copied to the output file)
33
+ 2005/08/23 S Takehiro (common methods to gp* command moved to gpcommon.rb)
34
+ 2010/03/10 Y SASAKI (change help block into RD format)
35
+
36
+ =end
37
+
38
+ require "numru/gphys"
39
+ require "numru/gphys/gpcommon"
40
+ include NumRu
41
+
42
+ require "getoptlong"
43
+
44
+
45
+ #-------------------- Slice parameter analysis --------------------
46
+ def parse_slice(arg_slice)
47
+
48
+ slice = Hash.new
49
+ thinning = Hash.new
50
+ arg_slice_descr = arg_slice.split(/,/)
51
+ # arg_slice = arg_slice_descr.shift
52
+ arg_slice_descr.each do |s|
53
+ if /(.*)=(.*)/ =~ s
54
+ dimname = $1
55
+ subset = $2
56
+ case subset
57
+ when /(.*):(.*):(.*)/
58
+ slice[dimname] = ($1.to_f)..($2.to_f)
59
+ thinning[dimname] = {0..-1,$3.to_i}
60
+ when /(.*):(.*)/
61
+ slice[dimname] = ($1.to_f)..($2.to_f)
62
+ else
63
+ slice[dimname] = subset.to_f
64
+ end
65
+ else
66
+ raise "invalid slice format\n\n"
67
+ "slice format: " + SliceFMT
68
+ end
69
+ end
70
+ thinning = nil if thinning.length == 0
71
+ [slice, thinning]
72
+ end
73
+
74
+ #------------------------ Default Settings ------------------------
75
+ Output_default = 'gphys.nc'
76
+ SliceFMT = "dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]"
77
+
78
+ #---------------------- Option Configuration ----------------------
79
+ parser = GetoptLong.new(
80
+ ["--variable", "-v", GetoptLong::REQUIRED_ARGUMENT],
81
+ ["--output", "-o", GetoptLong::REQUIRED_ARGUMENT],
82
+ ["--slice", "-s", GetoptLong::REQUIRED_ARGUMENT],
83
+ ["--help", "-h", GetoptLong::NO_ARGUMENT ])
84
+ begin
85
+ parser.each{|opt, arg|
86
+ case opt
87
+ when "--variable" then eval "$OPT_var='#{arg}'"
88
+ when "--output" then eval "$OPT_output='#{arg}'"
89
+ when "--slice" then eval "$OPT_slice='#{arg}'"
90
+ when "--help" then eval "$HELP=true"
91
+ else
92
+ raise "must not happen"
93
+ end
94
+ }
95
+ rescue GetoptLong::AmbigousOption, GetoptLong::InvalidOption,
96
+ GetoptLong::MissingArgument,
97
+ GetoptLong::NeedlessArgument => err
98
+ help
99
+ $srderr.puts err.message
100
+ exit 1
101
+ end
102
+
103
+ #------------------------ Help message ------------------------
104
+ if $HELP then
105
+ help
106
+ exit(0)
107
+ end
108
+
109
+ #------------------------ Option check ------------------------
110
+ unless $OPT_var then
111
+ raise "Variable must be set with '-v' or '--var' option."
112
+ end
113
+
114
+ unless $OPT_output then
115
+ $OPT_output = Output_default
116
+ end
117
+
118
+ slice, thinning = parse_slice($OPT_slice) if $OPT_slice
119
+
120
+ #------------------------ Output file check --------------------------
121
+ raise "#{$OPT_output} already exists." if FileTest.exist?($OPT_output)
122
+ outncfile=NetCDF.create($OPT_output)
123
+
124
+ #------------------------ Open gphys variable ------------------------
125
+ # Copy global attributes (only for NetCDF file)
126
+ gphys = GPhys::IO.open(ARGV[0],$OPT_var)
127
+ outncfile.copy_global_att(gphys) # Copy global attributes (only for NetCDF)
128
+
129
+ case ARGV.length
130
+ when 1 then
131
+ gphys = GPhys::IO.open(ARGV[0],$OPT_var)
132
+ print "#{$0}: Gphys variable '#{$OPT_var}' in NetCDF file, " + ARGV[0] +", was opened successfully.\n"
133
+ else
134
+ gphys = GPhys::IO.open(ARGV, $OPT_var)
135
+ print "#{$0}: GPhys variable '#{$OPT_var}' in NetCDF files, " + ARGV.join(', ') +", was opened successfully.\n"
136
+ end
137
+
138
+
139
+ #------------------- Slice/thinning gphys variable --------------------
140
+ gphys = gphys.cut(slice) if slice
141
+ gphys = gphys[thinning] if thinning
142
+
143
+ #---------------------- Output GPhys variable ------------------------
144
+ GPhys::IO.write( outncfile, gphys )
145
+ NetCDF_Conventions.add_history(outncfile, File.basename($0)+" "+ARGV[0])
146
+ outncfile.close
147
+
148
+ print File.basename($0)+": GPhys variable '#{$OPT_var}' in " + ARGV.join(', ') + ", is written to #{$OPT_output}.\n"
data/bin/gpcut ADDED
@@ -0,0 +1,102 @@
1
+ #!/usr/bin/env ruby
2
+ =begin
3
+ = NAME
4
+
5
+ gpcut - Extract, slicing and thinning a GPhys variable.
6
+
7
+ = DESCRIPTION
8
+
9
+ ((*gpcut*)) is command line tools for extract, slicing and thinning a GPhys variables.
10
+
11
+ = USAGE
12
+
13
+ % gpcut [options] path@varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
14
+
15
+ = OPTIONS
16
+
17
+ :-h, --help
18
+ print this message.
19
+ :-m dim, --mean dim
20
+ average along dim axis (optional).
21
+ :-o file, --output file
22
+ output filename (optional).
23
+ Default output filename is 'gphys.nc'.
24
+
25
+ = HISTORY
26
+
27
+ 2005/05/17 S Takehiro (created)
28
+ 2005/07/15 S Takehiro (open_gturl method is used for opening gphys variable)
29
+ 2005/08/10 S Takehiro (utilize internal function for printing help message)
30
+ 2005/08/21 S Takehiro (global attributes copied to the output file)
31
+ 2005/08/23 S Takehiro (common methods to gp* command moved to gpcommon.rb)
32
+ 2010/03/10 Y SASAKI (change help block into RD format)
33
+
34
+ =end
35
+
36
+ require "numru/gphys"
37
+ require "numru/gphys/gpcommon"
38
+ include NumRu
39
+
40
+ require "getoptlong"
41
+
42
+ #------------------------ Default Settings ------------------------
43
+ Output_default = 'gphys.nc'
44
+ URLfmt = "path@varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]"
45
+
46
+ #---------------------- Option Configuration ----------------------
47
+ parser = GetoptLong.new(
48
+ ["--mean", "-m", GetoptLong::REQUIRED_ARGUMENT],
49
+ ["--output", "-o", GetoptLong::REQUIRED_ARGUMENT],
50
+ ["--help", "-h", GetoptLong::NO_ARGUMENT ])
51
+ begin
52
+ parser.each{|opt, arg|
53
+ case opt
54
+ when "--mean" then eval "$OPT_mean='#{arg}'"
55
+ when "--output" then eval "$OPT_output='#{arg}'"
56
+ when "--help" then eval "$OPT_help=true"
57
+ else
58
+ raise "must not happen"
59
+ end
60
+ }
61
+ rescue GetoptLong::AmbigousOption, GetoptLong::InvalidOption,
62
+ GetoptLong::MissingArgument,
63
+ GetoptLong::NeedlessArgument => err
64
+ help
65
+ $srderr.puts err.message
66
+ exit 1
67
+ end
68
+
69
+ #------------------------ Help message ------------------------
70
+ if $OPT_help then
71
+ help
72
+ exit(0)
73
+ end
74
+
75
+ #------------------------ Option check ------------------------
76
+ $OPT_output = Output_default unless $OPT_output
77
+
78
+ #------------------------ Output file check --------------------------
79
+ raise "#{$OPT_output} already exists." if FileTest.exist?($OPT_output)
80
+ outncfile=NetCDF.create($OPT_output)
81
+
82
+ #------------------------ Open gphys variable ------------------------
83
+ gturl = ARGV[0]
84
+ gphys = GPhys::IO.open_gturl(gturl)
85
+ outncfile.copy_global_att(gphys) # Copy global attributes (only for NetCDF)
86
+
87
+ #----------------------- mean along any axis -------------------------
88
+ if ($OPT_mean)
89
+ dims = ($OPT_mean).split(/\s*,\s*/)
90
+ dims.each{|dim|
91
+ dim = dim.to_i if dim.to_i.to_s == dim
92
+ gphys = gphys.mean(dim)
93
+ }
94
+ end
95
+
96
+
97
+ #---------------------- Output GPhys variable ------------------------
98
+ GPhys::IO.write( outncfile, gphys )
99
+ NetCDF_Conventions.add_history(outncfile, File.basename($0)+" "+ARGV[0])
100
+ outncfile.close
101
+
102
+ print File.basename($0) +": "+ARGV[0]+ " is written to #{$OPT_output}.\n"