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,67 @@
1
+ <?xml version="1.0" ?>
2
+ <!DOCTYPE html
3
+ PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
4
+ "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
5
+ <html xmlns="http://www.w3.org/1999/xhtml">
6
+ <head>
7
+ <title>../lib/numru/gphys/varraycomposite.rb</title>
8
+ </head>
9
+ <body>
10
+ <h1><a name="label-0" id="label-0">class NumRu::VArrayComposite &lt; NumRu::VArray</a></h1><!-- RDLabel: "class NumRu::VArrayComposite < NumRu::VArray" -->
11
+ <p>a VArray that consists of multiple VArrays tiled regularly
12
+ (possibly in multi-dimension). Except for the constructer
13
+ "new" and <!-- Reference, RDLabel "attr_update" doesn't exist --><em class="label-not-found">attr_update</em><!-- Reference end -->, the usage of this class is the same as VArray.</p>
14
+ <p>Note that the name and the attributes of a VArrayComposite is
15
+ borrowed form one of the VArrays contained (actually, the first one
16
+ is used). Currently, no check is made
17
+ regarding whether the names and attributes are the same among the
18
+ VArrays contained. If you rename a VArrayComposite, the change will
19
+ be made with all the VArrays contained. However, currently,
20
+ change of the attributes are only reflected only in the first
21
+ VArray. You have to call <!-- Reference, RDLabel "attr_update" doesn't exist --><em class="label-not-found">attr_update</em><!-- Reference end --> separately.</p>
22
+ <h2><a name="label-1" id="label-1">Class methods</a></h2><!-- RDLabel: "Class methods" -->
23
+ <dl>
24
+ <dt><h4><a name="label-2" id="label-2"><code>VArrayComposite.new(<var>varrays</var>)</code></a></h4></dt><!-- RDLabel: "VArrayComposite.new" -->
25
+ <dd>
26
+ <p>Constructor</p>
27
+ <p>ARGUMENTS</p>
28
+ <ul>
29
+ <li>varrays (NArray of VArray) : VArrays to be included, gridded
30
+ regularly in a NArray.</li>
31
+ </ul>
32
+ <p>RETURN VALUE</p>
33
+ <ul>
34
+ <li>a VArrayComposite</li>
35
+ </ul>
36
+ <p>EXAMPLES</p>
37
+ <ul>
38
+ <li><p>Suppose that you have VArrays va00, va01, va10, va00,
39
+ with va00 and va10 having a same 0th dimension length,
40
+ va01 and va11 having a same 0th dimension length,
41
+ and va00 and va01 having a same 1st dimention length.</p>
42
+ <pre>varrays = NArray[ [ va00, va01 ],
43
+ [ va10, va11 ] ]
44
+ vac = VArrayComposite.new(varrays)</pre>
45
+ <p>This will create a composite VArray tiled two-dimensionally.</p></li>
46
+ <li><p>You can create a VArray that lacks one or more VArrays as
47
+ long as the shape is unambiguous:</p>
48
+ <pre>vac = VArrayComposite.new( NArray[ [ va00, va01 ],
49
+ [ va10, nil ] ] )</pre>
50
+ <p>is allowed, but </p>
51
+ <pre>vac = VArrayComposite.new( NArray[ [ va00, nil ],
52
+ [ va10, nil ] ] )</pre>
53
+ <p>is prohibited.</p>
54
+ <p>NOTICE: At this moment, handling of such nil-contianing
55
+ VArrayComposite is very limited, and many methods do not work.</p></li>
56
+ <li><p>Suppose that you have 3D VArrays va0, va1, va2, va3,
57
+ and you want to concatenate them with the 3rd dimension.</p>
58
+ <pre>varrays = NArray[ va0,va1,va2,va3 ].newdim(0,0)</pre>
59
+ <p>This will create a 3D NArray with a shape of [1,1,4].
60
+ Then you can make the composite as follows:</p>
61
+ <pre>vac = VArrayComposite.new(varrays)</pre></li>
62
+ </ul></dd>
63
+ </dl>
64
+ <p>Usage of all the other class methods are the same as in VArray.</p>
65
+
66
+ </body>
67
+ </html>
data/ext_init.c CHANGED
@@ -4,4 +4,5 @@ Init_gphys_ext()
4
4
  init_ext_coord();
5
5
  init_gphys_interpo();
6
6
  init_gphys_multibitIO();
7
+ init_gphys_dim_op();
7
8
  }
data/extconf.rb CHANGED
@@ -1,3 +1,4 @@
1
+ require "rubygems" unless defined?(Gem)
1
2
  require "mkmf"
2
3
  $extout_prefix = '/numru'
3
4
  alias __install_dirs install_dirs
@@ -7,12 +8,21 @@ def install_dirs
7
8
  dirs
8
9
  end
9
10
 
10
- #dir_config('narray',$sitearchdir,$sitearchdir)
11
- gem_home=(`gem environment GEM_HOME`).chomp
12
- narray_dir = Dir.glob("#{gem_home}/gems/narray-*").sort[-1]
13
- narray_include = narray_dir
14
- narray_lib = narray_dir
15
- dir_config('narray',narray_include,narray_lib)
11
+ if Gem.respond_to?(:find_files)
12
+ require "rbconfig"
13
+ so = RbConfig::CONFIG["DLEXT"]
14
+ narray_include = File.expand_path(File.dirname(Gem.find_files("narray.h")[0]))
15
+ narray_lib = File.expand_path(File.dirname(Gem.find_files("narray." + so)[0]))
16
+ else
17
+ gem_home=(`gem environment GEM_HOME`).chomp
18
+ narray_dir = Dir.glob("#{gem_home}/gems/narray-*").sort[-1]
19
+ if narray_dir
20
+ narray_include = narray_lib = narray_dir
21
+ else
22
+ narray_include = narray_lib = [ $sitearchdir, $vendorarchdir]
23
+ end
24
+ end
25
+ dir_config('narray', narray_include, narray_lib)
16
26
 
17
27
  if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
18
28
  print <<EOS
@@ -1,34 +1,41 @@
1
- # -*- encoding: utf-8 -*-
1
+ # coding: utf-8
2
2
  lib = File.expand_path('../lib', __FILE__)
3
3
  $LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
4
- require 'version'
4
+ require 'numru/gphys/version'
5
5
 
6
- Gem::Specification.new do |gem|
7
- gem.name = "gphys"
8
- gem.version = GPhys::VERSION
9
- gem.authors = ["Takeshi Horinouchi", "Ryo Mizuta",\
6
+ Gem::Specification.new do |spec|
7
+ spec.name = "gphys"
8
+ spec.version = NumRu::GPhys::VERSION
9
+ spec.authors = ["Takeshi Horinouchi", "Ryo Mizuta",\
10
10
  "Daisuke Tsukahara", "Seiya Nishizawa", "Shin-ichi Takehiro"]
11
- gem.email = ["eriko@gfd-dennou.org"]
12
- gem.description = %q{comprehensive library for self-descriptive gridded physical data (in NetCDF, GrADS, or on memory) with graphicsgraphicsgraphicsgraphics.}
13
- gem.summary = %q{a multi-purpose class to handle Gridded Physical quantities}
14
- gem.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/gphys/'
11
+ spec.email = ["eriko@gfd-dennou.org"]
15
12
 
16
- gem.files = `git ls-files`.split($/)
17
- gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
18
- gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
19
- gem.require_paths = ["lib"]
20
- gem.extensions << "extconf.rb"
13
+ #if spec.respond_to?(:metadata)
14
+ # spec.metadata['allowed_push_host'] = "TODO: Set to 'http://mygemserver.com' to prevent pushes to rubygems.org, or delete to allow pushes to any server."
15
+ #end
21
16
 
22
- gem.required_ruby_version = Gem::Requirement.new(">= 1.8")
17
+ spec.summary = %q{a multi-purpose class to handle Gridded Physical quantities}
18
+ spec.description = %q{comprehensive library for self-descriptive gridded physical data (in NetCDF, GrADS, or on memory) with graphicsgraphicsgraphicsgraphics.}
19
+ spec.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/gphys/'
20
+ spec.licenses = ["GFD Dennou Club"]
23
21
 
24
- gem.add_runtime_dependency(%q<narray>, [">= 0.5.7"])
25
- gem.add_runtime_dependency(%q<numru-misc>, [">= 0.1.0"])
26
- gem.add_runtime_dependency(%q<numru-units>, [">= 1.7"])
27
- gem.add_runtime_dependency(%q<narray_miss>, [">= 1.2.4"])
28
- gem.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.6.6"])
29
- gem.add_runtime_dependency(%q<ruby-dcl>, [">= 1.6.1"])
30
- gem.add_runtime_dependency(%q<ruby-fftw3>, [">= 0.3"])
31
- gem.add_runtime_dependency(%q<gsl>, [">= 1.14"])
32
- gem.add_runtime_dependency(%q<ruby-lapack>, [">= 1.5"])
33
- gem.add_development_dependency(%q<rb-grib>, [">= 0.2.0"])
22
+ spec.files = `git ls-files -z`.split("\x0")
23
+ spec.bindir = "bin"
24
+ spec.executables = spec.files.grep(%r{^bin/}) { |f| File.basename(f) }
25
+ spec.require_paths = ["lib"]
26
+ spec.test_files = spec.files.grep(%r{^(test|test_old|sample|testdata)/})
27
+ spec.extensions << "extconf.rb"
28
+
29
+ spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
30
+
31
+ spec.add_runtime_dependency(%q<narray>, [">= 0.5.7"])
32
+ spec.add_runtime_dependency(%q<numru-misc>, [">= 0.1.0"])
33
+ spec.add_runtime_dependency(%q<numru-units>, [">= 1.7"])
34
+ spec.add_runtime_dependency(%q<narray_miss>, [">= 1.2.4"])
35
+ spec.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.6.6"])
36
+ spec.add_runtime_dependency(%q<ruby-dcl>, [">= 1.6.1"])
37
+ spec.add_runtime_dependency(%q<ruby-fftw3>, [">= 0.3"])
38
+ spec.add_runtime_dependency(%q<gsl>, [">= 1.14"])
39
+ spec.add_runtime_dependency(%q<ruby-lapack>, [">= 1.5"])
40
+ spec.add_development_dependency(%q<rb-grib>, [">= 0.2.0"])
34
41
  end
data/interpo.c CHANGED
@@ -211,7 +211,7 @@ interpo_do(obj, shape_to, idxmap, val_from, missval, extrapo)
211
211
  kf += idfc*cshf;
212
212
  cshf *= shf[j];
213
213
  }
214
- if (!nomiss && pt[it] == vmiss) {break;}
214
+ if (pt[it] == vmiss) {break;}
215
215
  if (nomiss || pf[kf] != vmiss){
216
216
  pt[it] += a*pf[kf];
217
217
  } else {
@@ -1,6 +1,6 @@
1
1
  require "numru/dcl"
2
2
  require "numru/misc"
3
- require "numru/dclext_datetime_ax"
3
+ require "date" # needs ruby >= 1.8 for DateTime class
4
4
  require "narray_miss"
5
5
 
6
6
  ############################################################
@@ -322,6 +322,55 @@ GRPH2
322
322
 
323
323
  ==Original methods:
324
324
 
325
+ ===Date and time axes
326
+
327
+ ---datetime_ax(date_from, date_to, options=nil)
328
+ Draw axes with date and hours.
329
+ The DCL window must have been defined in the units "days"
330
+ and to start with 0 (regarding the direction to draw the axis).
331
+
332
+ ARGUMENTS
333
+ * date_from (DateTime) : date&time to beggin
334
+ * date_to (DateTime) : date&time to end
335
+ * options (Hash) : options to change the default behavior if specified:
336
+ option name default value # description:
337
+ 'yax' false # true => y-axis, false => x-axis
338
+ 'cside' nil # "b", "t", "l", "r", nil (=>left/bottom),
339
+ # or false (=>right/top)'
340
+ 'dtick1' 1 # small tick interval in hours
341
+ 'dtick2' nil # large tick (with hour labels) interval in hours
342
+ 'year' false # true => add year to date label
343
+ 'month' true # true => add month to date label
344
+
345
+ ---date_ax(date_from, date_to, options=nil)
346
+ Similar to ((<datetime_ax>)) but
347
+ draws a calendar axis in terms of date (not hours).
348
+ This method uses DCL's UCPACK (DCL.uc[xy]acl) when appropritate;
349
+ i.e., when the period is short enough (typically with in a few
350
+ years) so that year labels are written. Unfortunately,
351
+ the current uc[xy]acl (or uc[xy]yr) suppress year labels
352
+ when the period is long to write year albels for each year.
353
+ In such a case, this method uses DCLExt.year_ax.
354
+ Note that future uc[xy]acl may cover all the situation,
355
+ so this method will not be needed.
356
+
357
+ ARGUMENTS
358
+ * date_from (DateTime) : date&time to beggin
359
+ * date_to (DateTime) : date&time to end
360
+ * options (Hash) : options to change the default behavior if specified:
361
+ option name default value # description:
362
+ "yax" false # true => y-axis, false => x-axis
363
+ "cside" nil # "b", "t", "l", "r", nil (=>left/bottom), or false
364
+ # (=>right/top)
365
+ "margin_factor" 0.9 # Factor to control the extent to use
366
+ # UCPACK; The smaller, the less, requiring more
367
+ # space between year labels
368
+ "dtick1" nil # (For long time series) small tick interval
369
+ # (years)
370
+ "dtick2" nil # (For long time series) large tick with year
371
+ # labels (years)
372
+ "help" false # show help message if true
373
+
325
374
  ===Longitude/Latitude Axes
326
375
  ---lon_ax( options=nil )
327
376
 
@@ -558,11 +607,12 @@ By default it is shown in the right margin of the viewport.
558
607
  * dx: length of the legend line (not used if mark).
559
608
  * nil : internally determined
560
609
  * Float && > 0 : set explicitly
561
- * vy: vy of the legend (not used if !first -- see below).
610
+ * vy: vy of the legend
562
611
  * nil : internally determined
563
612
  * Float && > 0 : set explicitly
564
613
  * Float && < 0 : move it relatively lower from the default
565
- * first : if false, vy is moved lower relatively from the previous vy.
614
+ * first : if it is false and vy is nil, vy is internally determined
615
+ relatively from the previous vy setting.
566
616
  * mark_size : size of the mark. if nil, size is used.
567
617
 
568
618
  ---quasi_log_levels_z(vals, nlev=nil, max=nil, min=nil, cycle=1)
@@ -653,23 +703,17 @@ module NumRu
653
703
  # maximum data values (Integer)
654
704
  # 'clr_max' 99 (if coloring) maximum color number for the
655
705
  # maximum data values (Integer)
656
- options = @@empty_hash if !options
706
+ options ||= @@empty_hash
657
707
  raise TypeError, "options must be a Hash" if !options.is_a?(Hash)
658
708
  min = options['min']
659
709
  max = options['max']
660
710
  nlev = options['nlev']
661
711
  interval = options['interval']
662
712
  nozero = options['nozero']
663
- if interval
664
- dx = interval
665
- elsif nlev
666
- dx = -nlev
667
- else
668
- dx = 0
669
- end
713
+ dx = interval || (nlev ? -nlev : 0)
670
714
  if min || max
671
- min = v.min if !min
672
- max = v.max if !max
715
+ min ||= v.min
716
+ max ||= v.max
673
717
  DCL.udgcla(min, max, dx)
674
718
  else
675
719
  DCL.udgclb(v, dx)
@@ -801,16 +845,10 @@ module NumRu
801
845
  max = options['max']
802
846
  nlev = options['nlev']
803
847
  interval = options['interval']
804
- if interval
805
- dx = interval
806
- elsif nlev
807
- dx = -nlev
808
- else
809
- dx = 0
810
- end
848
+ dx = interval || (nlev ? -nlev : 0)
811
849
  if min || max
812
- min = v.min if !min
813
- max = v.max if !max
850
+ min ||= v.min
851
+ max ||= v.max
814
852
  DCL.uegtla(min, max, dx)
815
853
  else
816
854
  v = v.reshape(v.length,1) if v.rank==1
@@ -866,42 +904,272 @@ module NumRu
866
904
  # RELATIVELY INDEPENDENT OF DCL SUBLIBRARIES
867
905
  ############################################################
868
906
 
869
- # <<< longitude/latitude axes package >>>
907
+ # <<< Date and time axes (moved from dclext_datetime_ax.rb) >>>
870
908
 
871
- @@lon_ax_options = Misc::KeywordOptAutoHelp.new(
909
+ @@datetime_ax_options = Misc::KeywordOptAutoHelp.new(
872
910
  ['yax', false, 'true => y-axis, false => x-axis'],
873
911
  ['cside', nil, '"b", "t", "l", "r", nil (=>left/bottom), or false (=>right/top)'],
874
- ['dtick1', nil, 'Interval of small tickmark (if nil, internally determined)'],
875
- ['dtick2', nil, 'Interval of large tickmark with labels (if nil, internally determined)']
912
+ ['dtick1', 1, 'small tick interval in hours'],
913
+ ['dtick2', nil, 'large tick (with hour labels) interval in hours'],
914
+ ['year', false, 'true => add year to date label'],
915
+ ['month', true, 'true => add month to date label']
876
916
  )
877
917
 
878
- def lon_ax(options=nil)
879
- opt = @@lon_ax_options.interpret(options)
918
+ def datetime_ax(date_from, date_to, options=nil)
919
+ # date_from [a DateTime] : start on this date&time
920
+ # date_to [a DateTime] : end on this date&time
921
+
922
+ opt = @@datetime_ax_options.interpret(options)
880
923
 
881
924
  yax = opt['yax']
882
925
  xax = !yax
883
926
  if xax
884
- xy='x'
927
+ xy='x'
885
928
  else
886
- xy='y'
929
+ xy='y'
887
930
  end
888
931
 
889
932
  if opt['cside']
890
- cside = opt['cside']
933
+ cside = opt['cside']
891
934
  elsif opt['cside'].nil?
935
+ if xax
936
+ cside='b'
937
+ else
938
+ cside='l'
939
+ end
940
+ else
941
+ if xax
942
+ cside='t'
943
+ else
944
+ cside='r'
945
+ end
946
+ end
947
+
948
+ if opt['year']
949
+ datefmt = '%Y/%m/%d'
950
+ elsif opt['month']
951
+ datefmt = '%m/%d'
952
+ else
953
+ datefmt = '%d'
954
+ end
955
+
956
+ # < window parameters >
957
+
958
+ ux1,ux2,uy1,uy2 = DCL.sgqwnd
959
+ if xax
960
+ u1, u2 = ux1, ux2
961
+ else
962
+ u1, u2 = uy1, uy2
963
+ end
964
+ if u1 > u2
965
+ u1, u2 = u2, u1
966
+ end
967
+
968
+ loffset_save = DCL.uzpget('loffset')
969
+ xyfact_save = DCL.uzpget(xy+'fact')
970
+ xyoffset_save = DCL.uzpget(xy+'offset')
971
+
972
+ tu1 = date_from.day_fraction.to_f
973
+ range_day = date_to - date_from # time btwn start and end (in days)
974
+ tu2 = tu1 + range_day
975
+
976
+ # < axis in hours >
977
+
978
+ DCL.uzpset('loffset',true)
979
+
980
+ DCL.uzpset(xy+'fact',24.0)
981
+ DCL.uzpset(xy+'offset',(tu1-u1)*24)
982
+
983
+ dtick1 = opt['dtick1']
984
+ if opt['dtick2']
985
+ dtick2 = opt['dtick2']
986
+ else
987
+ if range_day >= 4
988
+ dtick2 = 24
989
+ elsif range_day >= 2
990
+ dtick2 = 12
991
+ elsif range_day >= 1
992
+ dtick2 = 6
993
+ elsif range_day >= 0.5
994
+ dtick2 = 3
995
+ elsif range_day >= 0.25
996
+ dtick2 = 2
997
+ else
998
+ dtick2 = 1
999
+ end
1000
+ end
1001
+
1002
+ str_hour = (tu1*24).ceil
1003
+ end_hour = (tu2*24).floor
1004
+ tick1=Array.new
1005
+ tick2=Array.new
1006
+ labels=Array.new
1007
+ h1 = str_hour + (-str_hour % dtick1)
1008
+ (h1..end_hour).step(dtick1){|i| tick1.push(i)}
1009
+ h2 = str_hour + (-str_hour % dtick2)
1010
+ (h2..end_hour).step(dtick2) do |i|
1011
+ tick2.push(i)
1012
+ labels.push((i%24).to_s)
1013
+ end
1014
+ if xax
1015
+ DCL.uxaxlb(cside, tick1, tick2, labels, 2)
1016
+ else
1017
+ irotl_save = DCL.uzpget('irotly'+cside)
1018
+ icent_save = DCL.uzpget('icenty'+cside)
1019
+ DCL.uzpset('irotly'+cside,1)
1020
+ DCL.uzpset('icenty'+cside,0)
1021
+ DCL.uyaxlb(cside, tick1, tick2, labels, 2)
1022
+ end
1023
+
1024
+ # < labels in days >
1025
+
1026
+ if DCL.uzpget('label'+xy+cside)
1027
+ DCL.uzpset(xy+'fact',1.0)
1028
+ DCL.uzpset(xy+'offset',0.0)
1029
+
1030
+ str_day = tu1.floor
1031
+ end_day = tu2.floor
1032
+ pos=Array.new
1033
+ labels=Array.new
1034
+ (str_day..end_day).step(1) do |i|
1035
+ u = i.to_f + 0.5 + (u1- tu1)
1036
+ u = (u1+u+0.5)/2 if u < u1
1037
+ u = (u2+u-0.5)/2 if u > u2
1038
+ pos.push(u)
1039
+ str = (date_from+i).strftime(datefmt)
1040
+ str.sub!(/^0/,'') if !opt['year'] && opt['month']
1041
+ labels.push(str)
1042
+ end
1043
+
892
1044
  if xax
893
- cside='b'
894
- else
895
- cside='l'
896
- end
1045
+ DCL.uxsaxz(cside,DCL.uzpget('roffx'+cside))
1046
+ DCL.uxplbl(cside,1,pos,labels,10)
1047
+ else
1048
+ DCL.uysaxz(cside,DCL.uzpget('roffy'+cside))
1049
+ DCL.uyplbl(cside,1,pos,labels,10)
1050
+ # DCL.uzpset('irotly'+cside,irotl_save)
1051
+ # DCL.uzpset('icenty'+cside,icent_save)
1052
+ end
1053
+
1054
+ end
1055
+
1056
+ if xax
1057
+ else
1058
+ DCL.uzpset('irotly'+cside,irotl_save)
1059
+ DCL.uzpset('icenty'+cside,icent_save)
1060
+ end
1061
+
1062
+ # < to finish >
1063
+
1064
+ DCL.uzpset('loffset',loffset_save)
1065
+ DCL.uzpset(xy+'fact',xyfact_save)
1066
+ DCL.uzpset(xy+'offset',xyoffset_save)
1067
+
1068
+ end
1069
+
1070
+ # <<< Date axes >>>
1071
+
1072
+ @@date_ax_options = Misc::KeywordOptAutoHelp.new(
1073
+ ['yax', false, 'true => y-axis, false => x-axis'],
1074
+ ['cside', nil, '"b", "t", "l", "r", nil (=>left/bottom), or false (=>right/top)'],
1075
+ ['margin_factor', 0.9, 'Factor to control the extent to use UCPACK; The smaller, the less, requiring more space between year labels'],
1076
+ ['dtick1', nil, '(For long time series) small tick interval (years)'],
1077
+ ['dtick2', nil, '(For long time series) large tick with year labels (years)']
1078
+ )
1079
+
1080
+ def date_ax(date_from, date_to, options=nil)
1081
+ # < intepret the options >
1082
+ opt = @@date_ax_options.interpret(options)
1083
+
1084
+ mfact = opt['margin_factor']
1085
+
1086
+ yax = opt['yax']
1087
+ xax = !yax
1088
+ if xax
1089
+ xy = 'x'
1090
+ cside= opt['cside'] || 'b'
897
1091
  else
1092
+ xy = 'y'
1093
+ cside= opt['cside'] || 'l'
1094
+ end
1095
+
1096
+ # < examine the time period to see wheterh to use UCPACK >
1097
+ irot = DCL.uzpget("irotc"+xy+cside)
1098
+ rsize = DCL.uzpget("rsizel2")
1099
+ nday = date_to - date_from
1100
+ ny = nday / 365.25
1101
+ if (xax && irot%2 == 0) || (yax && irot%2 == 1)
1102
+ cw = (rsize*0.82)*4 # approximate width for 4 digits
1103
+ else
1104
+ cw = rsize
1105
+ end
1106
+ vx1,vx2,vy1,vy2 = DCL::sgqvpt
1107
+ if xax
1108
+ vw = (vx2-vx1)/ny
1109
+ else
1110
+ vw = (vy2-vy1)/ny
1111
+ end
1112
+
1113
+ use_ucpack = (cw <= vw*mfact)
1114
+
1115
+ # < draw the axes >
1116
+ if use_ucpack
1117
+ jd0 = date_from.strftime('%Y%m%d').to_i
898
1118
  if xax
899
- cside='t'
1119
+ DCL.ucxacl(cside,jd0,nday)
900
1120
  else
901
- cside='r'
1121
+ DCL.ucyacl(cside,jd0,nday)
902
1122
  end
1123
+ else
1124
+ year_ax(xax, cside, date_from, date_to)
903
1125
  end
904
1126
 
1127
+ end
1128
+
1129
+ def year_ax(xax, cside, date_from, date_to)
1130
+ y0 = date_from.year
1131
+ d0 = date_from.yday
1132
+ ry0 = y0 + ( date_from.leap? ? d0/366.0 : d0 / 365.0 )
1133
+ y1 = date_to.year
1134
+ d1 = date_to.yday
1135
+ ry1 = y1 + ( date_to.leap? ? d1/366.0 : d1 / 365.0 )
1136
+ if xax
1137
+ DCL.uzpset("xoffset",ry0)
1138
+ ux0,ux1, = DCL.sgqwnd
1139
+ DCL.uzpset("xfact",(ry1-ry0)/(ux1-ux0))
1140
+ DCL.usxaxs(cside)
1141
+ DCL.uzpset("xoffset",0.0)
1142
+ DCL.uzpset("xfact",1.0)
1143
+ else
1144
+ DCL.uzpset("yoffset",ry0)
1145
+ ux0,ux1,uy0,uy1 = DCL.sgqwnd
1146
+ DCL.uzpset("yfact",(ry1-ry0)/(uy1-uy0))
1147
+ DCL.usyaxs(cside)
1148
+ DCL.uzpset("yoffset",0.0)
1149
+ DCL.uzpset("yfact",1.0)
1150
+ end
1151
+ end
1152
+
1153
+ # <<< longitude/latitude axes package >>>
1154
+
1155
+ @@lon_ax_options = Misc::KeywordOptAutoHelp.new(
1156
+ ['yax', false, 'true => y-axis, false => x-axis'],
1157
+ ['cside', nil, '"b", "t", "l", "r", nil (=>left/bottom), or false (=>right/top)'],
1158
+ ['dtick1', nil, 'Interval of small tickmark (if nil, internally determined)'],
1159
+ ['dtick2', nil, 'Interval of large tickmark with labels (if nil, internally determined)']
1160
+ )
1161
+
1162
+ def lon_ax(options=nil)
1163
+ opt = @@lon_ax_options.interpret(options)
1164
+
1165
+ yax = opt['yax']
1166
+ xax = !yax
1167
+ xy = (xax ? 'x' : 'y')
1168
+
1169
+ cside = opt['cside']
1170
+ cside = (xax ? 'b' : 'l') if cside.nil?
1171
+ cside ||= (xax ? 't' : 'r') ### cside is false
1172
+
905
1173
  vxmin, vxmax, vymin, vymax = DCL.sgqvpt
906
1174
  uxmin, uxmax, uymin, uymax = DCL.sgqwnd
907
1175
  if xax
@@ -930,38 +1198,30 @@ module NumRu
930
1198
 
931
1199
  # generate numbers for small tickmarks
932
1200
  nn = 0
933
- rx = DCL.irle(umin/dtick1)*dtick1
934
- if DCL.lreq(umin,rx)
935
- x = rx
936
- else
937
- x = rx + dtick1
938
- end
1201
+ x = DCL.irle(umin / dtick1) * dtick1
1202
+ x += dtick1 unless DCL.lreq(umin, x)
939
1203
  u1 = []
940
1204
  while DCL.lrle(x,umax)
941
1205
  if x.abs < dtick1*repsl*nn
942
1206
  x = 0.0
943
1207
  end
944
1208
  u1[nn] = x
945
- nn = nn + 1
946
- x = x + dtick1
1209
+ nn += 1
1210
+ x += dtick1
947
1211
  end
948
1212
 
949
1213
  # generate numbers for large tickmarks and labels
950
1214
  nn = 0
951
- rx = DCL.irle(umin/dtick2)*dtick2
952
- if DCL.lreq(umin,rx)
953
- x = rx
954
- else
955
- x = rx + dtick2
956
- end
1215
+ x = DCL.irle(umin / dtick2) * dtick2
1216
+ x += dtick2 unless DCL.lreq(umin, x)
957
1217
  u2 = []
958
1218
  while DCL.lrle(x,umax)
959
1219
  if x.abs < dtick2*repsl*nn
960
1220
  x = 0
961
1221
  end
962
1222
  u2[nn] = x
963
- nn = nn + 1
964
- x = x + dtick2
1223
+ nn += 1
1224
+ x += dtick2
965
1225
  end
966
1226
 
967
1227
  # generate labels
@@ -981,11 +1241,9 @@ module NumRu
981
1241
  nc = c2.collect{|c| c.size}.max
982
1242
 
983
1243
  # call DCL.u[xy]axlb
984
- if xax
985
- DCL.uxaxlb(cside,u1,u2,c2,nc)
986
- else
987
- DCL.uyaxlb(cside,u1,u2,c2,nc)
988
- end
1244
+ DCL.__send__(xax ? :uxaxlb : :uyaxlb , cside, u1, u2, c2, nc)
1245
+
1246
+ DCL.glpset('lepsl', lepsl) # restore original value
989
1247
  end
990
1248
 
991
1249
  @@lat_ax_options = Misc::KeywordOptAutoHelp.new(
@@ -1000,27 +1258,11 @@ module NumRu
1000
1258
 
1001
1259
  xax = opt['xax']
1002
1260
  yax = !xax
1003
- if xax
1004
- xy='x'
1005
- else
1006
- xy='y'
1007
- end
1261
+ xy = (xax ? 'x' : 'y')
1008
1262
 
1009
- if opt['cside']
1010
- cside = opt['cside']
1011
- elsif opt['cside'].nil?
1012
- if xax
1013
- cside='b'
1014
- else
1015
- cside='l'
1016
- end
1017
- else
1018
- if xax
1019
- cside='t'
1020
- else
1021
- cside='r'
1022
- end
1023
- end
1263
+ cside = opt['cside']
1264
+ cside = (xax ? 'b' : 'l') if cside.nil?
1265
+ cside ||= (xax ? 't' : 'r') ### cside is false
1024
1266
 
1025
1267
  vxmin, vxmax, vymin, vymax = DCL.sgqvpt
1026
1268
  uxmin, uxmax, uymin, uymax = DCL.sgqwnd
@@ -1050,38 +1292,30 @@ module NumRu
1050
1292
 
1051
1293
  # generate numbers for small tickmarks
1052
1294
  nn = 0
1053
- rx = DCL.irle(umin/dtick1)*dtick1
1054
- if DCL.lreq(umin,rx)
1055
- x = rx
1056
- else
1057
- x = rx + dtick1
1058
- end
1295
+ x = DCL.irle(umin / dtick1) * dtick1
1296
+ x += dtick1 unless DCL.lreq(umin, x)
1059
1297
  u1 = []
1060
1298
  while DCL.lrle(x,umax)
1061
1299
  if x.abs < dtick1*repsl*nn
1062
1300
  x = 0.0
1063
1301
  end
1064
1302
  u1[nn] = x
1065
- nn = nn + 1
1066
- x = x + dtick1
1303
+ nn += 1
1304
+ x += dtick1
1067
1305
  end
1068
1306
 
1069
1307
  # generate numbers for large tickmarks and labels
1070
1308
  nn = 0
1071
- rx = DCL.irle(umin/dtick2)*dtick2
1072
- if DCL.lreq(umin,rx)
1073
- x = rx
1074
- else
1075
- x = rx + dtick2
1076
- end
1309
+ x = DCL.irle(umin / dtick2) * dtick2
1310
+ x += dtick2 unless DCL.lreq(umin, x)
1077
1311
  u2 = []
1078
1312
  while DCL.lrle(x,umax)
1079
1313
  if x.abs < dtick2*repsl*nn
1080
1314
  x = 0
1081
1315
  end
1082
1316
  u2[nn] = x
1083
- nn = nn + 1
1084
- x = x + dtick2
1317
+ nn += 1
1318
+ x += dtick2
1085
1319
  end
1086
1320
 
1087
1321
  # generate labels
@@ -1098,11 +1332,9 @@ module NumRu
1098
1332
  nc = c2.collect{|c| c.size}.max
1099
1333
 
1100
1334
  # call DCL.u[xy]axlb
1101
- if xax
1102
- DCL.uxaxlb(cside,u1,u2,c2,nc)
1103
- else
1104
- DCL.uyaxlb(cside,u1,u2,c2,nc)
1105
- end
1335
+ DCL.__send__(xax ? :uxaxlb : :uyaxlb , cside, u1, u2, c2, nc)
1336
+
1337
+ DCL.glpset('lepsl', lepsl) # restore original value
1106
1338
  end
1107
1339
 
1108
1340
  # <<< flow vector package >>>
@@ -1163,19 +1395,23 @@ module NumRu
1163
1395
 
1164
1396
  #< unit vector >
1165
1397
  if fxunit
1166
- vxunit = vxfxratio * fxunit
1398
+ vxunit = (vxfxratio * fxunit).abs
1167
1399
  else
1168
1400
  fxunit = vxunit / vxfxratio
1169
1401
  end
1170
1402
  if fyunit
1171
- vyunit = vyfyratio * fyunit
1403
+ vyunit = (vyfyratio * fyunit).abs
1172
1404
  else
1173
1405
  fyunit = vyunit / vyfyratio
1174
1406
  end
1175
- fxunit = __truncate( (uxusv=fxunit) )
1176
- fyunit = __truncate( (uyusv=fyunit) )
1177
- vxunit = vxunit * (fxunit/uxusv)
1178
- vyunit = vyunit * (fyunit/uyusv)
1407
+ if fxunit != 0
1408
+ fxunit = __truncate( (uxusv=fxunit) )
1409
+ vxunit = vxunit * (fxunit/uxusv)
1410
+ end
1411
+ if fyunit != 0
1412
+ fyunit = __truncate( (uyusv=fyunit) )
1413
+ vyunit = vyunit * (fyunit/uyusv)
1414
+ end
1179
1415
  if !(vxuloc && vyuloc)
1180
1416
  vx0,vx1,vy0,vy1 = DCL.sgqvpt
1181
1417
  vxuloc = vx1 + opt['vxuoff'] if !vxuloc
@@ -1189,10 +1425,14 @@ module NumRu
1189
1425
  sfyunit = sprintf("%.2g",fyunit)
1190
1426
  rsizet = DCL.uzpget('rsizel1') if !rsizet
1191
1427
  if opt['inplace']
1192
- DCL.sgtxzv(vxuloc, vyuloc-1.2*rsizet,
1193
- sfxunit, rsizet, 0, -1, index)
1194
- DCL.sgtxzv(vxuloc+1.2*rsizet, vyuloc+0.5*rsizet,
1195
- sfyunit, rsizet, 90, -1, index)
1428
+ if vxunit != 0
1429
+ DCL.sgtxzv(vxuloc, vyuloc-1.2*rsizet,
1430
+ sfxunit, rsizet, 0, -1, index)
1431
+ end
1432
+ if vyunit != 0
1433
+ DCL.sgtxzv(vxuloc+1.2*rsizet, vyuloc+0.5*rsizet,
1434
+ sfyunit, rsizet, 90, -1, index)
1435
+ end
1196
1436
  else
1197
1437
  msg= "UNIT VECTOR X:#{sfxunit} Y:#{sfyunit}"
1198
1438
  before = uz_set_params({'rsizec1'=>rsizet})
@@ -1226,8 +1466,7 @@ module NumRu
1226
1466
  vlen = vfratio * flen
1227
1467
  label = DCL.chval("B",flen)
1228
1468
 
1229
- lclip_bk = DCL::sglget("lclip")
1230
- DCL::sglset("lclip", false)
1469
+ lclip_bk = DCLExt.sg_set_params("lclip" => false)
1231
1470
  if vertical
1232
1471
  DCL.sglazv( vxuloc, vyuloc, vxuloc, vyuloc+vlen, 1, index )
1233
1472
  DCL.sgtxzv( vxuloc+1.2*rsizet, vyuloc+0.4*vlen,
@@ -1237,7 +1476,7 @@ module NumRu
1237
1476
  DCL.sgtxzv( vxuloc+0.4*vlen, vyuloc-1.2*rsizet,
1238
1477
  label, rsizet, 0, 0, index)
1239
1478
  end
1240
- DCL::sglset("lclip", lclip_bk)
1479
+ DCLExt.sg_set_params(lclip_bk)
1241
1480
  nil
1242
1481
  end
1243
1482
 
@@ -1274,7 +1513,7 @@ module NumRu
1274
1513
  fymx = fy.abs.max
1275
1514
  raise "fx has no data or all zero" if fxmx == 0
1276
1515
  raise "fy has no data or all zero" if fymx == 0
1277
- cn = [ dvx/(ax*fxmx), dvy/(ay*fymx) ].min # normarization constant
1516
+ cn = [ (dvx/(ax*fxmx)).abs, (dvy/(ay*fymx)).abs ].min # normalztn const
1278
1517
  vxfxratio = factor*cn*ax if !vxfxratio
1279
1518
  vyfyratio = factor*cn*ay if !vyfyratio
1280
1519
  before = ug_set_params( {'LNRMAL'=>false, 'LMSG'=>false,
@@ -1287,7 +1526,7 @@ module NumRu
1287
1526
 
1288
1527
  def flow_vect_anyproj(fx, fy, xg, yg,
1289
1528
  factor=1.0, xintv=1, yintv=1,
1290
- distvect_map=true, vfratio=nil, polar_thinning=nil)
1529
+ distvect_map=true, vfratio=nil, flenmax=nil, polar_thinning=nil)
1291
1530
 
1292
1531
  #< parameters to handle singularity of the projection >
1293
1532
 
@@ -1355,8 +1594,13 @@ module NumRu
1355
1594
  else
1356
1595
  ux0,ux1,uy0,uy1 = wnd
1357
1596
  end
1597
+
1358
1598
  flen = Misc::EMath.sqrt( fx*fx + fy*fy )
1359
- flenmax = flen.max
1599
+
1600
+ if !flenmax
1601
+ flenmax = flen.max
1602
+ end
1603
+
1360
1604
  if !vfratio
1361
1605
  vx0,vx1,vy0,vy1 = DCL.sgqvpt
1362
1606
  dvf = Math::sqrt( (vx1-vx0)*(vy1-vy0)/nx/ny )
@@ -1408,8 +1652,8 @@ module NumRu
1408
1652
  (0...nx).step(xstep) do |i|
1409
1653
  x = ( xg.rank==1 ? xg[i] : xg[i,j] )
1410
1654
  y = ( yg.rank==1 ? yg[j] : yg[i,j] )
1411
- if ( ( fx.is_a?(NArrayMiss) && !fx.valid?(i,j) ) ||
1412
- ( fy.is_a?(NArrayMiss) && !fy.valid?(i,j) ) )
1655
+ if ( ( fx.is_a?(NArrayMiss) && !fx.valid?[i,j] ) ||
1656
+ ( fy.is_a?(NArrayMiss) && !fy.valid?[i,j] ) )
1413
1657
  DCL.sgpmzu([x],[y],itype2,index,rsizem) if lmissp
1414
1658
  next
1415
1659
  end
@@ -1556,7 +1800,7 @@ module NumRu
1556
1800
  end
1557
1801
 
1558
1802
  def level_chval_fmt(max,min,dx)
1559
- # returns a format for DCL.chval suitable for color-ba labels
1803
+ # returns a format for DCL.chval suitable for color-bar labels
1560
1804
  dxabs = dx.abs
1561
1805
  eps = 1e-4 * dxabs
1562
1806
  order = log10_or_0(dxabs).floor
@@ -1602,11 +1846,7 @@ module NumRu
1602
1846
  fg = 'f'
1603
1847
  else
1604
1848
  n = log10_or_0(x.abs).floor
1605
- if 0 <= n and n <= 4
1606
- fg = 'f'
1607
- else
1608
- fg = 'g'
1609
- end
1849
+ fg = ((0 <= n) && (n <= 4)) ? 'f' : 'g'
1610
1850
  end
1611
1851
  eps = 1e-6
1612
1852
  if ( dx.abs % 10**log10_or_0(dx.abs) < eps )
@@ -1627,6 +1867,136 @@ module NumRu
1627
1867
  sprintf(fmt,x).sub(/\.0*$/,'')
1628
1868
  end
1629
1869
 
1870
+ def get_proj_params
1871
+ { :itr => DCL::sgqtrn,
1872
+ :vpt => DCL::sgqvpt,
1873
+ :wnd => DCL::sgqwnd,
1874
+ :sim => DCL::sgqsim,
1875
+ :cnt => DCL::umqcnt,
1876
+ :lglobe => DCL::umpget('lglobe'),
1877
+ :rsat => DCL::sgpget("rsat"),
1878
+ :txy => %w(txmin txmax tymin tymax).map{|key| DCL::sgrget(key)} }
1879
+ end
1880
+
1881
+ def restore_proj_params(hash) # hash: OUTPUT OF DCLExt::get_proj_params
1882
+ DCL::grsvpt(*(hash[:vpt]))
1883
+ DCL::grswnd(*(hash[:wnd]))
1884
+ if hash[:itr] <= 4
1885
+ DCL::grstrn(hash[:itr])
1886
+ elsif hash[:itr] <= 9
1887
+ DCL::sgssim(*(hash[:sim]))
1888
+ DCL::grstrn(hash[:itr])
1889
+ elsif hash[:itr] <= 34
1890
+ DCL::sgstrn(hash[:itr])
1891
+ DCL::umpset("lglobe", hash[:lglobe])
1892
+ DCL::grstxy(*(hash[:txy]))
1893
+ DCL::umscnt(*(hash[:cnt]))
1894
+ DCL::sgpset("rsat", hash[:rsat])
1895
+ DCL::umpfit
1896
+ DCL::sgssim(*(hash[:sim]))
1897
+ end
1898
+ DCL::grstrf
1899
+ end
1900
+
1901
+ def color_bar_draw_infinity(vxmin, vxmax, vymin, vymax, vwidth, portrait, inffact, sign, ipat, index)
1902
+ sign = (sign > 0) ? 1 : -1
1903
+ win = [vxmin, vxmax, vymin, vymax]
1904
+ win = win[2..3] + win[0..1] if portrait
1905
+ base = ((sign < 0) ? win[0] : win[1])
1906
+ v3 = [[base, base + vwidth * inffact * sign, base],
1907
+ [win[2], (win[2] + win[3]) / 2, win[3]]]
1908
+ v3 = [v3[1], v3[0]] if portrait
1909
+ DCL.sgtnzv(v3[0], v3[1], ipat)
1910
+ DCL.sgplzv(v3[0], v3[1], 1, index)
1911
+ end
1912
+
1913
+ def color_bar_title_units(vxmin, vxmax, vymin, vymax, portrait, voff, title, units, title_voff, units_voff)
1914
+ rsizel1 = DCL::uzrget('rsizel1')
1915
+ charindex = DCL::uziget('indexl1')
1916
+ pad1 = DCL::uzrget('pad1')
1917
+ if portrait
1918
+ if voff > 0
1919
+ # title
1920
+ DCL::sgtxzr(vxmin - (0.5 + pad1) * rsizel1, (vymin + vymax) / 2.0 + title_voff, title, rsizel1, 90, 0, charindex) if title
1921
+ # units
1922
+ DCL::sgtxzr(vxmax + pad1 * rsizel1, vymax + 2.6 * rsizel1 + units_voff, units, rsizel1, 0, -1, charindex) if units
1923
+ else
1924
+ # title
1925
+ DCL::sgtxzr(vxmax + (0.5 + pad1) * rsizel1, (vymin + vymax) / 2.0 - title_voff, title, rsizel1, -90, 0, charindex) if title
1926
+ # units
1927
+ DCL::sgtxzr(vxmin - pad1 * rsizel1, vymax + 2.6 * rsizel1 + units_voff, units, rsizel1, 0, 1, charindex) if units
1928
+ end
1929
+ else
1930
+ spacer = (0.5 + pad1) * rsizel1
1931
+ tmpvy = [vymin - spacer, vymax + spacer]
1932
+ tmpvy = [tmpvy[1], tmpvy[0]] if voff <= 0
1933
+ # title
1934
+ DCL::sgtxzr((vxmin + vxmax) / 2.0 + title_voff, tmpvy[0], title, rsizel1, 0, 0, charindex) if title
1935
+ # units
1936
+ DCL::sgtxzr(vxmax + 2.6 * rsizel1 + units_voff, tmpvy[1], units, rsizel1, 0, -1, charindex) if units
1937
+ end
1938
+ end
1939
+
1940
+ def color_bar_dual_log(levels, lv, patterns, portrait, opt)
1941
+ rmiss = DCL::glrget("rmiss")
1942
+ vx1, vx2, vy1, vy2 = DCL::sgqvpt
1943
+ iturn = 0
1944
+ for i in 0...levels.length
1945
+ if levels[i] != rmiss
1946
+ if levels[i] * lv[0] < 0
1947
+ iturn = i
1948
+ break
1949
+ end
1950
+ end
1951
+ end
1952
+ opt['vlength'] /= 2
1953
+ vc0 = opt['vcent'] || ( portrait && (vy1 + vy2) / 2) || (vx1 + vx2) / 2
1954
+
1955
+ zs = (portrait ? (opt["left"] ? "yl" : 'yr') : (opt["top"] ? "xt" : 'xb'))
1956
+ zssign = (zs == "xb" || zs == "yl") ? -1 : 1
1957
+ opt["voff"] ||=
1958
+ DCL.uzrget('pad1') * DCL::uzrget("rsizec2") + DCL::uzrget("roff#{zs}") * zssign
1959
+
1960
+ vsep2 = 0.02
1961
+
1962
+ has_zero = (levels[iturn - 1] == 0) # zero might be located just before the sign changes
1963
+ opt['levels'] = levels[0..(iturn - (has_zero ? 2 : 1))]
1964
+ opt['patterns'] = patterns[0..(iturn - (has_zero ? 3 : 2))]
1965
+ opt['vcent'] = vc0 - opt['vlength'] / 2 - vsep2
1966
+ units = opt['units']
1967
+ opt['units'] = nil
1968
+ DCLExt.color_bar(opt)
1969
+
1970
+ opt['levels'] = levels[iturn..-1]
1971
+ opt['patterns'] = patterns[iturn..-1]
1972
+ opt['vcent'] = vc0 + opt['vlength'] / 2 + vsep2
1973
+ opt['units'] = units
1974
+ DCLExt.color_bar(opt)
1975
+
1976
+ # fill between the two bars
1977
+ bk = DCLExt.sg_set_params('lclip' => false)
1978
+ (has_zero ? 2 : 1).times{|i|
1979
+ if portrait
1980
+ sign = opt["left"] ? -1 : 1
1981
+ base = opt["left"] ? vx1 : vx2
1982
+ x1 = base + opt["voff"] * sign
1983
+ x2 = x1 + opt['vwidth'] * sign
1984
+ y1 = vc0 - ((has_zero && (i == 0)) ? 0 : vsep2)
1985
+ y2 = vc0 + ((has_zero && (i == 1)) ? 0 : vsep2)
1986
+ else
1987
+ x1 = vc0 - ((has_zero && (i == 0)) ? 0 : vsep2)
1988
+ x2 = vc0 + ((has_zero && (i == 1)) ? 0 : vsep2)
1989
+ sign = opt["top"] ? 1 : -1
1990
+ base = opt["top"] ? vy2 : vy1
1991
+ y1 = base + opt["voff"] * sign
1992
+ y2 = y1 + opt['vwidth'] * sign
1993
+ end
1994
+ DCL.sgtnzv([x1, x2, x2, x1], [y1, y1, y2, y2], patterns[iturn - 1 - (has_zero ? i : 0)])
1995
+ DCL.sgplzv([x1, x2, x2, x1, x1], [y1, y1, y2, y2, y1], 1, 3)
1996
+ }
1997
+ DCLExt.sg_set_params(bk)
1998
+ end
1999
+
1630
2000
  def color_bar(options=nil)
1631
2001
 
1632
2002
  # < set parameters >
@@ -1644,55 +2014,34 @@ module NumRu
1644
2014
  end
1645
2015
 
1646
2016
  landscape = opt["landscape"] || !opt["portrait"]
1647
- portrait = ! landscape
2017
+ portrait = !landscape
1648
2018
 
1649
- if !levels.nil?
1650
- ue_set_tone(levels,patterns)
1651
- end
2019
+
2020
+ ue_set_tone(levels, patterns) if !levels.nil?
1652
2021
 
1653
2022
  labels_ud = opt["labels_ud"]
1654
- if !labels_ud.nil?
1655
- if labels_ud.class != Array
1656
- raise ArgumentError,"'labels_ud' must be an Array of String"
1657
- elsif labels_ud.size == 0
1658
- raise ArgumentError,"'labels_ud' must be an Array of String"
1659
- else
1660
- labels_ud.each do |lbl_ud|
1661
- if lbl_ud.class != String
1662
- raise ArgumentError,"'labels_ud' must be an Array of String"
1663
- end
1664
- end
1665
- end
1666
- end
1667
-
1668
- if opt["index"]
1669
- index = opt["index"]
1670
- index = 1 if index <= 0
1671
- else
1672
- index = DCL::uziget("indext2")
1673
- end
1674
- indext1_bk = DCL::uziget("indext1")
1675
- indext2_bk = DCL::uziget("indext2")
1676
- DCL::uziset("indext1",index)
1677
- DCL::uziset("indext2",index)
1678
-
1679
- if opt["charindex"]
1680
- charindex = opt["charindex"]
1681
- charindex = 1 if charindex <= 0
1682
- else
1683
- charindex = DCL::uziget("indexl1")
1684
- end
1685
- indexl1_bk = DCL::uziget("indexl1")
1686
- DCL::uziset("indexl1",charindex)
1687
-
2023
+ if (!labels_ud.nil? &&
2024
+ ((labels_ud.class != Array) ||
2025
+ labels_ud.empty? ||
2026
+ labels_ud.map{|lud| lud.class == String}.include?(false)))
2027
+ raise ArgumentError, "'labels_ud' must be an Array of String"
2028
+ end
2029
+
2030
+ # apply optional parameters for axes and labels
2031
+ index = opt["index"] || DCL::uziget("indext2")
2032
+ index = 1 if index <= 0
2033
+ charindex = opt["charindex"] || DCL::uziget("indexl1")
2034
+ charindex = 1 if charindex <= 0
1688
2035
  charfact = opt["charfact"]
1689
- rsizel1_bk = DCL::uzrget("rsizel1")
1690
- DCL::uzrset("rsizel1",charfact*rsizel1_bk)
2036
+ charfact = 1 if charfact < 0
2037
+ rsizel1 = charfact * DCL::uzrget("rsizel1")
2038
+ axparam_bk = DCLExt.uz_set_params("indext1" => index,
2039
+ "indext2" => index,
2040
+ "indexl1" => charindex,
2041
+ "rsizel1" => rsizel1)
1691
2042
 
1692
2043
  nton = DCL::ueqntl
1693
- if nton==0
1694
- raise "no tone patern was set\n"
1695
- end
2044
+ raise "no tone patern was set\n" if nton == 0
1696
2045
  lev1 = Array.new
1697
2046
  lev2 = Array.new
1698
2047
  patterns = Array.new if !opt['patterns']
@@ -1710,7 +2059,7 @@ module NumRu
1710
2059
  # raise "levels is not in order\n"
1711
2060
  #end
1712
2061
 
1713
- levels = lev1.push(lev2[-1]) if !levels
2062
+ levels ||= lev1.push(lev2[-1])
1714
2063
  levels = NArray.to_na(levels) if levels.is_a?(Array)
1715
2064
  patterns = NArray.to_na(patterns) if patterns.is_a?(Array)
1716
2065
 
@@ -1718,91 +2067,32 @@ module NumRu
1718
2067
 
1719
2068
  if opt['log']
1720
2069
  lv = levels[levels.ne(rmiss).where]
1721
- if lv.length >= 4 && lv[0]*lv[-1]<0
1722
- iturn = 0
1723
- for i in 0...levels.length
1724
- if levels[i] != rmiss
1725
- if levels[i]*lv[0] < 0
1726
- iturn = i
1727
- break
1728
- end
1729
- end
1730
- end
1731
- opt['vlength'] /= 2
1732
- vc0 = opt['vcent'] || ( portrait && (vy1+vy2)/2) || (vx1+vx2)/2
1733
-
1734
- opt["voff"] ||=
1735
- DCL.uzrget('pad1')*DCL::uzrget("rsizec2") +
1736
- ( portrait ? DCL.uzrget('roffyr') : - DCL.uzrget('roffxb') )
1737
-
1738
- vsep2 = 0.02
1739
-
1740
- opt['levels'] = levels[0..iturn-1]
1741
- opt['patterns'] = patterns[0..iturn-2]
1742
- opt['vcent'] = vc0 - opt['vlength']/2 - vsep2
1743
- units = opt['units']
1744
- opt['units'] = nil
1745
- color_bar(opt)
1746
-
1747
- opt['levels'] = levels[iturn..-1]
1748
- opt['patterns'] = patterns[iturn..-1]
1749
- opt['vcent'] = vc0 + opt['vlength']/2 + vsep2
1750
- opt['units'] = units
1751
- color_bar(opt)
1752
-
1753
- # fill between the two bars
1754
- if portrait
1755
- x1 = vx2 + opt["voff"]
1756
- x2 = x1 + opt['vwidth']
1757
- y1 = vc0 - vsep2
1758
- y2 = vc0 + vsep2
1759
- else
1760
- x1 = vc0 - vsep2
1761
- x2 = vc0 + vsep2
1762
- y1 = vy1 - opt["voff"]
1763
- y2 = y1 - opt['vwidth']
1764
- end
1765
- bk = DCLExt.sg_set_params({'lclip'=>false})
1766
- DCL.sgtnzv([x1,x2,x2,x1],[y1,y1,y2,y2],patterns[iturn-1])
1767
- DCL.sgplzv([x1,x2,x2,x1,x1],[y1,y1,y2,y2,y1],1,3)
1768
- DCLExt.sg_set_params(bk)
2070
+ if lv.length >= 4 && lv[0] * lv[-1] < 0 # log for both positive and negative
2071
+ DCLExt.color_bar_dual_log(levels, lv, patterns, portrait, opt)
2072
+ DCLExt.uz_set_params(axparam_bk)
1769
2073
  return
1770
2074
  end
1771
2075
  end
1772
2076
 
1773
2077
  if levels.length <= 1
1774
2078
  $stderr.print( "WARNING #{__FILE__}:#{__LINE__}: # of levels <= 1. No color bar is drawn." )
2079
+ DCLExt.uz_set_params(axparam_bk)
1775
2080
  return
1776
2081
  end
1777
2082
 
1778
- # BACKUP CURRENT PARAMETERS
1779
- itrsv = DCL::sgqtrn
1780
- if itrsv <= 4
1781
- ux1sv, ux2sv, uy1sv, uy2sv = DCL.sgqwnd
1782
- elsif itrsv <= 9
1783
- simfacsv, vxoffsv, vyoffsv = DCL.sgqsim
1784
- else
1785
- ux1sv, ux2sv, uy1sv, uy2sv = DCL.sgqwnd
1786
- simfacsv, vxoffsv, vyoffsv = DCL.sgqsim
1787
- #plxsv, plysv, plrotsv = DCL.sgqmpl()
1788
- plxsv, plysv, plrotsv = DCL.umqcnt
1789
- lglobesv = DCL::umpget('lglobe')
1790
- grstxysv = %w(txmin txmax tymin tymax).map{|key| DCL::sgrget(key)}
1791
- end
1792
- # END OF BACKUP
2083
+ proj_params = DCLExt.get_proj_params # BACKUP PARAMS FOR PROJECTION
1793
2084
 
1794
2085
  vwidth = opt["vwidth"]
1795
2086
  vlength = opt["vlength"]
1796
2087
 
2088
+ # compute offset from main diagram
1797
2089
  if portrait
1798
- if !opt["left"]
1799
- # left
2090
+ if !opt["left"] # right
1800
2091
  voff = opt["voff"] ||
1801
2092
  DCL.uzrget('roffyr') + DCL.uzrget('pad1')*DCL::uzrget("rsizec2")
1802
2093
  vxmin = vx2 + voff
1803
2094
  vxmax = vx2 + voff + vwidth
1804
- else
1805
- # right
2095
+ else # left
1806
2096
  voff = opt["voff"] ? -opt["voff"] : \
1807
2097
  DCL.uzrget('roffyl') - DCL.uzrget('pad1')*DCL::uzrget("rsizec2")
1808
2098
  vxmax = vx1 + voff
@@ -1811,16 +2101,14 @@ module NumRu
1811
2101
  vymin =( opt["vcent"] ? opt["vcent"]-vlength/2 : vy1 )
1812
2102
  vymax =( opt["vcent"] ? opt["vcent"]+vlength/2 : vy1+vlength )
1813
2103
  else ## landscape ##
1814
- vxmin =( opt["vcent"] ? opt["vcent"]-vlength/2 : (vx1+vx2)/2-vlength/2 )
1815
- vxmax =( opt["vcent"] ? opt["vcent"]+vlength/2 : (vx1+vx2)/2+vlength/2 )
1816
- if opt["top"]
1817
- # top
2104
+ vxmin = (opt["vcent"] || ((vx1 + vx2) / 2)) - vlength / 2
2105
+ vxmax = (opt["vcent"] || ((vx1 + vx2) / 2)) + vlength / 2
2106
+ if opt["top"] # top
1818
2107
  voff = opt["voff"] ||
1819
2108
  DCL.uzrget('roffxt') + DCL.uzrget('pad1')*DCL::uzrget("rsizec2")
1820
2109
  vymin = vy2 + voff
1821
2110
  vymax = vy2 + voff + vwidth
1822
- else
1823
- # bottom
2111
+ else # bottom
1824
2112
  voff = opt["voff"] ? -opt["voff"] : \
1825
2113
  DCL.uzrget('roffxb') - DCL.uzrget('pad1')*DCL::uzrget("rsizec2")
1826
2114
  vymax = vy1 + voff
@@ -1830,146 +2118,75 @@ module NumRu
1830
2118
 
1831
2119
  min = levels[levels.ne(rmiss).where].min
1832
2120
  max = levels[levels.ne(rmiss).where].max
1833
- if levels[0] == rmiss
1834
- inf0 = true
2121
+ if (inf0 = (levels[0] == rmiss))
1835
2122
  dummy1,dummy2,ipat0 = DCL::ueqtlv(1)
1836
- return if levels.length==2
1837
- else
1838
- inf0 = false
2123
+ if levels.length==2
2124
+ DCLExt.uz_set_params(axparam_bk)
2125
+ return
2126
+ end
1839
2127
  end
1840
- if levels[-1] == rmiss
1841
- inf1 = true
2128
+ if (inf1 = (levels[-1] == rmiss))
1842
2129
  dummy1,dummy2,ipat1 = DCL::ueqtlv(nton)
1843
- return if levels.length==2
1844
- else
1845
- inf1 = false
2130
+ if levels.length==2
2131
+ DCLExt.uz_set_params(axparam_bk)
2132
+ return
2133
+ end
1846
2134
  end
1847
2135
 
1848
2136
  # < paint color tones >
1849
2137
 
1850
- lclip_bk = DCL::sglget("lclip")
1851
- DCL::sglset("lclip", false)
2138
+ lclip_bk = DCLExt.sg_set_params("lclip" => false)
1852
2139
 
1853
2140
  inffact = opt["inffact"]
2141
+ # paint color tones for infinity (with drawing frame)
2142
+ if inf0
2143
+ DCLExt.color_bar_draw_infinity(vxmin, vxmax, vymin, vymax, vwidth, portrait, inffact, -1, ipat0, index)
2144
+ end
2145
+ if inf1
2146
+ DCLExt.color_bar_draw_infinity(vxmin, vxmax, vymin, vymax, vwidth, portrait, inffact, 1, ipat1, index)
2147
+ end
2148
+ # paint color tones for each range (with drawing long-side frame)
1854
2149
  if opt["constwidth"]
1855
2150
 
1856
- if inf0
1857
- levels = levels[1..-1]
1858
- patterns = patterns[1..-1]
1859
- end
1860
- if inf1
1861
- levels = levels[0..-2]
1862
- patterns = patterns[0..-2]
1863
- end
2151
+ levels = levels[(inf0 ? 1 : 0)..(inf1 ? -2 : -1)]
2152
+ patterns = patterns[(inf0 ? 1 : 0)..(inf1 ? -2 : -1)]
1864
2153
  nlev = levels.length
1865
2154
  npat = patterns.length
1866
2155
 
1867
2156
  if portrait
1868
2157
  vy = (NArray.sfloat(npat+1).indgen!)*(vymax-vymin)/npat + vymin
1869
-
1870
- # paint color tones for infinity (with drawing frame)
1871
- if inf0
1872
- vy3 = [vymin, vymin-vwidth*inffact, vymin]
1873
- vx3 = [vxmax, (vxmax+vxmin)/2, vxmin]
1874
- DCL.sgtnzv(vx3,vy3,ipat0)
1875
- DCL.sgplzv(vx3,vy3,1,index)
1876
- end
1877
- if inf1
1878
- vy3 = [vymax, vymax+vwidth*inffact, vymax]
1879
- vx3 = [vxmax, (vxmax+vxmin)/2, vxmin]
1880
- DCL.sgtnzv(vx3,vy3,ipat1)
1881
- DCL.sgplzv(vx3,vy3,1,index)
1882
- end
1883
-
1884
2158
  # paint color tones for each range (with drawing long-side frame)
1885
2159
  for i in 0..npat-1
1886
- DCL::sgtnzv([vxmin,vxmax,vxmax,vxmin],[vy[i],vy[i],vy[i+1],vy[i+1]],patterns[i])
1887
- DCL::sgplzv([vxmin,vxmin],[vy[i],vy[i+1]],1,index)
1888
- DCL::sgplzv([vxmax,vxmax],[vy[i],vy[i+1]],1,index)
2160
+ DCL::sgtnzv([vxmin, vxmax, vxmax, vxmin], vy[[i, i, i + 1, i + 1]], patterns[i])
1889
2161
  end
2162
+ [vxmin, vxmax].each{|x| DCL::sgplzv([x] * 2, vy[[0, -1]], 1, index)}
1890
2163
 
1891
2164
  else ## landscape ##
1892
2165
  vx = (NArray.sfloat(npat+1).indgen!)*(vxmax-vxmin)/npat + vxmin
1893
-
1894
- # paint color tones for infinity (with drawing frame)
1895
- if inf0
1896
- vx3 = [vxmin, vxmin-vwidth*inffact, vxmin]
1897
- vy3 = [vymax, (vymax+vymin)/2, vymin]
1898
- DCL.sgtnzv(vx3,vy3,ipat0)
1899
- DCL.sgplzv(vx3,vy3,1,index)
1900
- end
1901
- if inf1
1902
- vx3 = [vxmax, vxmax+vwidth*inffact, vxmax]
1903
- vy3 = [vymax, (vymax+vymin)/2, vymin]
1904
- DCL.sgtnzv(vx3,vy3,ipat1)
1905
- DCL.sgplzv(vx3,vy3,1,index)
1906
- end
1907
-
1908
2166
  # paint color tones for each range (with drawing long-side frame)
1909
2167
  for i in 0..npat-1
1910
- DCL::sgtnzv([vx[i],vx[i],vx[i+1],vx[i+1]],[vymin,vymax,vymax,vymin],patterns[i])
1911
- DCL::sgplzv([vx[i],vx[i+1]],[vymin,vymin],1,index)
1912
- DCL::sgplzv([vx[i],vx[i+1]],[vymax,vymax],1,index)
2168
+ DCL::sgtnzv(vx[[i, i, i + 1, i + 1]], [vymin, vymax, vymax, vymin], patterns[i])
1913
2169
  end
2170
+ [vymin, vymax].each{|y| DCL::sgplzv(vx[[0, -1]], [y] * 2, 1, index)}
1914
2171
  end
1915
2172
 
1916
2173
  else ### opt["constwidth"] == false ###
1917
-
1918
- # paint color tones for infinity (with drawing frame)
1919
- if portrait
1920
- if inf0
1921
- vy3 = [vymin, vymin-vwidth*inffact, vymin]
1922
- vx3 = [vxmax, (vxmax+vxmin)/2, vxmin]
1923
- DCL.sgtnzv(vx3,vy3,ipat0)
1924
- DCL.sgplzv(vx3,vy3,1,index)
1925
- end
1926
- if inf1
1927
- vy3 = [vymax, vymax+vwidth*inffact, vymax]
1928
- vx3 = [vxmax, (vxmax+vxmin)/2, vxmin]
1929
- DCL.sgtnzv(vx3,vy3,ipat1)
1930
- DCL.sgplzv(vx3,vy3,1,index)
1931
- end
1932
- else ## landscape ##
1933
- if inf0
1934
- vx3 = [vxmin, vxmin-vwidth*inffact, vxmin]
1935
- vy3 = [vymax, (vymax+vymin)/2, vymin]
1936
- DCL.sgtnzv(vx3,vy3,ipat0)
1937
- DCL.sgplzv(vx3,vy3,1,index)
1938
- end
1939
- if inf1
1940
- vx3 = [vxmax, vxmax+vwidth*inffact, vxmax]
1941
- vy3 = [vymax, (vymax+vymin)/2, vymin]
1942
- DCL.sgtnzv(vx3,vy3,ipat1)
1943
- DCL.sgplzv(vx3,vy3,1,index)
1944
- end
1945
- end
1946
-
1947
2174
  # paint color tones for each range
1948
2175
  nbar = 100
1949
2176
  bar = NArray.float(nbar,2)
1950
2177
  for i in 0..nbar-1
1951
2178
  bar[i,true] = min + (max-min).to_f/(nbar-1)*i
1952
2179
  end
1953
-
1954
- xb = DCL::uzlget("labelxb")
1955
- yl = DCL::uzlget("labelyl")
2180
+
2181
+ labelxbyl_bk = DCLExt.uz_set_params("labelxb" => landscape,
2182
+ "labelyl" => portrait)
1956
2183
  if portrait
1957
- xmin = 0.0
1958
- xmax = 1.0
1959
- ymin = min
1960
- ymax = max
1961
- DCL::uzlset("labelxb",false)
1962
- DCL::uzlset("labelyl",true)
2184
+ cbwindow = [0.0, 1.0, min, max]
1963
2185
  bar = bar.transpose(-1,0)
1964
2186
  DCL::uwsgxa([0,1])
1965
2187
  DCL::uwsgya(bar[0,true])
1966
2188
  else
1967
- xmin = min
1968
- xmax = max
1969
- ymin = 0.0
1970
- ymax = 1.0
1971
- DCL::uzlset("labelxb",true)
1972
- DCL::uzlset("labelyl",false)
2189
+ cbwindow = [min, max, 0.0, 1.0]
1973
2190
  DCL::uwsgxa(bar[true,0])
1974
2191
  DCL::uwsgya([0,1])
1975
2192
  end
@@ -1982,7 +2199,7 @@ module NumRu
1982
2199
 
1983
2200
  DCL::grfig
1984
2201
  DCL::grsvpt(vxmin,vxmax,vymin,vymax)
1985
- DCL::grswnd(xmin,xmax,ymin,ymax)
2202
+ DCL::grswnd(*cbwindow)
1986
2203
  DCL::grstrn(type)
1987
2204
  DCL::grstrf
1988
2205
 
@@ -2000,26 +2217,14 @@ module NumRu
2000
2217
  ntn = nton
2001
2218
  ntn -= 1 if inf0
2002
2219
  ntn -= 1 if inf1
2003
- if portrait
2004
- labelintv = (ntn-1) / 9 + 1
2005
- else
2006
- labelintv = (ntn-1) / 5 + 1
2007
- end
2008
- end
2009
- if labelintv <= 0
2010
- no_label = true
2011
- labelintv = 1
2012
- else
2013
- no_label = false
2220
+ labelintv = (ntn - 1) / (portrait ? 9 : 5) + 1
2014
2221
  end
2222
+ no_label = (labelintv <= 0)
2223
+ labelintv = 1 if no_label
2015
2224
 
2016
2225
  tickintv = opt["tickintv"]
2017
- if tickintv <= 0
2018
- no_tick = true
2019
- tickintv = labelintv
2020
- else
2021
- no_tick = false
2022
- end
2226
+ no_tick = (tickintv <= 0)
2227
+ tickintv = labelintv if no_tick
2023
2228
 
2024
2229
  eps = 1e-5
2025
2230
  dummy = -9.9e-38
@@ -2095,23 +2300,12 @@ module NumRu
2095
2300
  end
2096
2301
  end
2097
2302
 
2303
+ DCLExt.color_bar_title_units(vxmin, vxmax, vymin, vymax, portrait, voff,
2304
+ opt['title'], opt['units'], opt['title_voff'], opt['units_voff'])
2098
2305
  if portrait
2099
-
2100
- if voff > 0
2101
- cent = -1
2102
- vxlabel = vxmax+DCL::uzrget('pad1')*DCL::uzrget('rsizel1')
2103
- # title
2104
- DCL::sgtxzr(vxmin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), (vymin+vymax)/2.0+opt['title_voff'], opt['title'], DCL::uzrget('rsizel1'), 90, 0, charindex) if opt['title']
2105
- # units
2106
- DCL::sgtxzr(vxmax+DCL::uzrget('pad1')*DCL::uzrget('rsizel1'), vymax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2107
- else
2108
- cent = 1
2109
- vxlabel = vxmin-DCL::uzrget('pad1')*DCL::uzrget('rsizel1')
2110
- # title
2111
- DCL::sgtxzr(vxmax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), (vymin+vymax)/2.0-opt['title_voff'], opt['title'], DCL::uzrget('rsizel1'), -90, 0, charindex) if opt['title']
2112
- # units
2113
- DCL::sgtxzr(vxmin-DCL::uzrget('pad1')*DCL::uzrget('rsizel1'), vymax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], opt['units'], DCL::uzrget('rsizel1'), 0, 1, charindex) if opt['units']
2114
- end
2306
+ cent = ((voff > 0) ? -1 : 1)
2307
+ spacer = DCL::uzrget('pad1') * rsizel1
2308
+ vxlabel = (voff > 0) ? (vxmax + spacer) : (vxmin - spacer)
2115
2309
 
2116
2310
  ilbl_ud = 0
2117
2311
  for i in 0..nlev-1
@@ -2119,7 +2313,7 @@ module NumRu
2119
2313
  if !no_label && (i % labelintv) == offs_label
2120
2314
  if labels_ud
2121
2315
  char = labels_ud[ilbl_ud]
2122
- DCL::sgtxzr(vxlabel,vy[i],char,DCL::uzrget('rsizel1'),0,cent,charindex)
2316
+ DCL::sgtxzr(vxlabel, vy[i], char, rsizel1, 0, cent, charindex)
2123
2317
  ilbl_ud += 1
2124
2318
  else
2125
2319
  begin
@@ -2128,9 +2322,9 @@ module NumRu
2128
2322
  else
2129
2323
  char = sprintf_level(levels[i],lvmx,lvmn,dlv)
2130
2324
  end
2131
- DCL::sgtxzr(vxlabel,vy[i],char,DCL::uzrget('rsizel1'),0,cent,charindex)
2325
+ DCL::sgtxzr(vxlabel, vy[i], char, rsizel1, 0, cent, charindex)
2132
2326
  rescue
2133
- DCL::sgtxzr(vxlabel,vy[i],levels[i].to_s,DCL::uzrget('rsizel1'),0,cent,charindex)
2327
+ DCL::sgtxzr(vxlabel, vy[i], levels[i].to_s, rsizel1, 0, cent, charindex)
2134
2328
  end
2135
2329
  end
2136
2330
  end
@@ -2141,19 +2335,10 @@ module NumRu
2141
2335
  end
2142
2336
 
2143
2337
  else ## landscape ##
2144
- if voff > 0
2145
- vylabel = vymax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1')
2146
- # title
2147
- DCL::sgtxzr((vxmin+vxmax)/2.0+opt['title_voff'], vymin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['title'], DCL::uzrget('rsizel1'), 0, 0, charindex) if opt['title']
2148
- # units
2149
- DCL::sgtxzr(vxmax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], vymax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2150
- else
2151
- vylabel = vymin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1')
2152
- # title
2153
- DCL::sgtxzr((vxmin+vxmax)/2.0+opt['title_voff'], vymax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['title'], DCL::uzrget('rsizel1'), 0, 0, charindex) if opt['title']
2154
- # units
2155
- DCL::sgtxzr(vxmax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], vymin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2156
- end
2338
+ spacer = (0.5 + DCL::uzrget('pad1')) * rsizel1
2339
+ tmpvy = [vymin - spacer, vymax + spacer]
2340
+ tmpvy = [tmpvy[1], tmpvy[0]] if voff <= 0
2341
+ vylabel = tmpvy[1]
2157
2342
 
2158
2343
  ilbl_ud = 0
2159
2344
  for i in 0..nlev-1
@@ -2161,7 +2346,7 @@ module NumRu
2161
2346
  if !no_label && (i % labelintv) == offs_label
2162
2347
  if labels_ud
2163
2348
  char = labels_ud[ilbl_ud]
2164
- DCL::sgtxzr(vx[i],vylabel,char,DCL::uzrget('rsizel1'),0,0,charindex)
2349
+ DCL::sgtxzr(vx[i], vylabel, char, rsizel1, 0, 0, charindex)
2165
2350
  ilbl_ud += 1
2166
2351
  else
2167
2352
  begin
@@ -2170,9 +2355,9 @@ module NumRu
2170
2355
  else
2171
2356
  char = sprintf_level(levels[i],lvmx,lvmn,dlv)
2172
2357
  end
2173
- DCL::sgtxzr(vx[i],vylabel,char,DCL::uzrget('rsizel1'),0,0,charindex)
2358
+ DCL::sgtxzr(vx[i], vylabel, char, rsizel1, 0, 0, charindex)
2174
2359
  rescue
2175
- DCL::sgtxzr(vx[i],vylabel,levels[i].to_s,DCL::uzrget('rsizel1'),0,0,charindex)
2360
+ DCL::sgtxzr(vx[i], vylabel, levels[i].to_s, rsizel1, 0, 0, charindex)
2176
2361
  end
2177
2362
  end
2178
2363
  end
@@ -2185,8 +2370,7 @@ module NumRu
2185
2370
 
2186
2371
  else ### opt["constwidth"] == false ###
2187
2372
 
2188
- inner_bk = DCL::uziget('inner')
2189
- uz_set_params('inner'=>1)
2373
+ inner_bk = DCLExt.uz_set_params('inner' => 1)
2190
2374
 
2191
2375
  tick1 = Array.new
2192
2376
  tick2 = Array.new
@@ -2198,183 +2382,76 @@ module NumRu
2198
2382
  end
2199
2383
  end
2200
2384
 
2385
+ fmt = opt['chval_fmt'] || (opt["log"] ? "b" : DCLExt.level_chval_fmt(lvmx, lvmn, dlv))
2386
+ rsizet12_bk = DCLExt.uz_set_params('rsizet1' => no_tick ? 0.0 : vwidth, 'rsizet2' => 0.0)
2387
+
2201
2388
  if portrait
2202
2389
 
2203
- if voff > 0
2204
- before = uz_set_params('labelyl'=>false,'labelyr'=>true,'icentyr'=>-1.0)
2390
+ if no_label
2391
+ before = DCLExt.uz_set_params(Hash[*(%w(xt xb yl yr).map{|zs| ["label#{zs}", false]}.flatten)])
2205
2392
  else
2206
- before = uz_set_params('labelyl'=>true,'labelyr'=>false,'icentyl'=>1.0)
2393
+ before = DCLExt.uz_set_params('labelyl' => (voff <= 0),
2394
+ 'labelyr' => (voff > 0),
2395
+ 'icentyr' => ((voff > 0) ? -1.0 : 1.0))
2207
2396
  end
2208
2397
 
2209
2398
  # draw frame, tick lines, and labels
2210
2399
  cfmt_bk = DCL::uyqfmt
2211
- if opt["log"]
2212
- fmt = opt['chval_fmt'] || "b"
2213
- else
2214
- fmt = opt['chval_fmt'] || level_chval_fmt(lvmx,lvmn,dlv)
2215
- end
2216
2400
  DCL::uysfmt(fmt)
2217
2401
 
2218
- rsizet1_bk = DCL::uzrget("rsizet1")
2219
- rsizet2_bk = DCL::uzrget("rsizet2")
2220
- uz_set_params('rsizet1'=>vwidth,'rsizet2'=>0.0)
2221
- if no_label
2222
- nl_labelxt = DCL::uzlget('labelxt')
2223
- nl_labelxb = DCL::uzlget('labelxb')
2224
- nl_labelyl = DCL::uzlget('labelyl')
2225
- nl_labelyr = DCL::uzlget('labelyr')
2226
- uz_set_params('labelxt'=>false,'labelxb'=>false,'labelyl'=>false,'labelyr'=>false)
2227
- end
2228
- if no_tick
2229
- nt_rsizet1 = DCL::uzrget('rsizet1')
2230
- DCL::uzrset("rsizet1",0.0)
2231
- end
2232
-
2233
2402
  if labels_ud
2234
2403
  if labels_ud.size != tick2.size
2235
2404
  raise ArgumentError, "'labels_ud' must be an Array of length==#{tick2.size} in this case"
2236
2405
  end
2237
2406
  nc = labels_ud.collect{|c| c.size}.max
2238
- DCL::uyaxlb("l",tick1,tick2,labels_ud,nc)
2239
- DCL::uyaxlb("r",tick1,tick2,labels_ud,nc)
2407
+ ["l", "r"].each{|cs| DCL::uyaxlb(cs, tick1, tick2, labels_ud, nc)}
2240
2408
  else
2241
- DCL::uyaxnm("l",tick1,tick2)
2242
- DCL::uyaxnm("r",tick1,tick2)
2409
+ ["l", "r"].each{|cs| DCL::uyaxnm(cs, tick1, tick2)}
2243
2410
  end
2244
2411
  DCL::uxaxdv("b",1,index) if !inf0
2245
2412
  DCL::uxaxdv("t",1,index) if !inf1
2246
2413
 
2247
- if no_tick
2248
- DCL::uzrset("rsizet1",nt_rsizet1)
2249
- end
2250
- if no_label
2251
- uz_set_params('labelxt'=>nl_labelxt,'labelxb'=>nl_labelxb,'labelyl'=>nl_labelyl,'labelyr'=>nl_labelyr)
2252
- end
2253
- DCL::uzrset("rsizet1",rsizet1_bk)
2254
- DCL::uzrset("rsizet2",rsizet2_bk)
2255
-
2256
2414
  DCL::uysfmt(cfmt_bk)
2257
2415
 
2258
- if voff > 0
2259
- # title
2260
- DCL::sgtxzr(vxmin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), (vymin+vymax)/2.0+opt['title_voff'], opt['title'], DCL::uzrget('rsizel1'), 90, 0, charindex) if opt["title"]
2261
- # units
2262
- DCL::sgtxzr(vxmax+DCL::uzrget('pad1')*DCL::uzrget('rsizel1'), vymax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2263
- else
2264
- # title
2265
- DCL::sgtxzr(vxmax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), (vymin+vymax)/2.0-opt['title_voff'], opt['title'], DCL::uzrget('rsizel1'), -90, 0, charindex) if opt["title"]
2266
- # units
2267
- DCL::sgtxzr(vxmin-DCL::uzrget('pad1')*DCL::uzrget('rsizel1'), vymax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], opt['units'], DCL::uzrget('rsizel1'), 0, 1, charindex) if opt['units']
2268
- end
2269
-
2270
- uz_set_params(before)
2271
-
2272
2416
  else ## landscape ##
2273
2417
 
2274
- if voff > 0
2275
- before = uz_set_params('labelxt'=>true,'labelxb'=>false)
2418
+ if no_label
2419
+ before = DCLExt.uz_set_params(Hash[*(%w(xt xb yl yr).map{|zs| ["label#{zs}", false]}.flatten)])
2276
2420
  else
2277
- before = uz_set_params('labelxt'=>false,'labelxb'=>true)
2421
+ before = DCLExt.uz_set_params('labelxt' => (voff > 0), 'labelxb' => (voff <= 0))
2278
2422
  end
2279
2423
 
2280
2424
  # draw frame, tick lines, and labels
2281
2425
  cfmt_bk = DCL::uxqfmt
2282
- if opt["log"]
2283
- fmt = opt['chval_fmt'] || "b"
2284
- else
2285
- fmt = opt['chval_fmt'] || level_chval_fmt(lvmx,lvmn,dlv)
2286
- end
2287
2426
  DCL::uxsfmt(fmt)
2288
2427
 
2289
- rsizet1_bk = DCL::uzrget("rsizet1")
2290
- rsizet2_bk = DCL::uzrget("rsizet2")
2291
- uz_set_params('rsizet1'=>vwidth,'rsizet2'=>0.0)
2292
- if no_label
2293
- nl_labelxt = DCL::uzlget('labelxt')
2294
- nl_labelxb = DCL::uzlget('labelxb')
2295
- nl_labelyl = DCL::uzlget('labelyl')
2296
- nl_labelyr = DCL::uzlget('labelyr')
2297
- uz_set_params('labelxt'=>false,'labelxb'=>false,'labelyl'=>false,'labelyr'=>false)
2298
- end
2299
- if no_tick
2300
- nt_rsizet1 = DCL::uzrget('rsizet1')
2301
- DCL::uzrset("rsizet1",0.0)
2302
- end
2303
-
2304
2428
  if labels_ud
2305
2429
  if labels_ud.size != tick2.size
2306
2430
  raise ArgumentError, "'labels_ud' must be an Array of length==#{tick2.size} in this case"
2307
2431
  end
2308
2432
  nc = labels_ud.collect{|c| c.size}.max
2309
- DCL::uxaxlb("t",tick1,tick2,labels_ud,nc)
2310
- DCL::uxaxlb("b",tick1,tick2,labels_ud,nc)
2433
+ ["t", "b"].each{|cs| DCL::uxaxlb(cs, tick1, tick2, labels_ud, nc)}
2311
2434
  else
2312
- DCL::uxaxnm("t",tick1,tick2)
2313
- DCL::uxaxnm("b",tick1,tick2)
2435
+ ["t", "b"].each{|cs| DCL::uxaxnm(cs, tick1, tick2)}
2314
2436
  end
2315
2437
  DCL::uyaxdv("l",1,index) if !inf0
2316
2438
  DCL::uyaxdv("r",1,index) if !inf1
2317
2439
 
2318
- if no_tick
2319
- DCL::uzrset("rsizet1",nt_rsizet1)
2320
- end
2321
- if no_label
2322
- uz_set_params('labelxt'=>nl_labelxt,'labelxb'=>nl_labelxb,'labelyl'=>nl_labelyl,'labelyr'=>nl_labelyr)
2323
- end
2324
- DCL::uzrset("rsizet1",rsizet1_bk)
2325
- DCL::uzrset("rsizet2",rsizet2_bk)
2326
-
2327
2440
  DCL::uxsfmt(cfmt_bk)
2328
-
2329
- if voff > 0
2330
- # title
2331
- DCL::sgtxzr((vxmin+vxmax)/2.0+opt['title_voff'], vymin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['title'], DCL::uzrget('rsizel1'), 0, 0, charindex) if opt["title"]
2332
- # units
2333
- DCL::sgtxzr(vxmax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], vymax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2334
- else
2335
- # title
2336
- DCL::sgtxzr((vxmin+vxmax)/2.0+opt['title_voff'], vymax+(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['title'], DCL::uzrget('rsizel1'), 0, 0, charindex) if opt["title"]
2337
- # units
2338
- DCL::sgtxzr(vxmax+2.6*DCL::uzrget('rsizel1')+opt['units_voff'], vymin-(0.5+DCL::uzrget('pad1'))*DCL::uzrget('rsizel1'), opt['units'], DCL::uzrget('rsizel1'), 0, -1, charindex) if opt['units']
2339
- end
2340
-
2341
- uz_set_params(before)
2342
-
2343
2441
  end
2442
+ DCLExt.color_bar_title_units(vxmin, vxmax, vymin, vymax, portrait, voff,
2443
+ opt['title'], opt['units'], opt['title_voff'], opt['units_voff'])
2344
2444
 
2345
- DCL::uzlset("labelxb",xb)
2346
- DCL::uzlset("labelyl",yl)
2347
-
2348
- DCL::grsvpt(vx1,vx2,vy1,vy2)
2349
- if itrsv <= 4
2350
- DCL::grswnd(ux1sv, ux2sv, uy1sv, uy2sv)
2351
- DCL::grstrn(itrsv)
2352
- elsif itrsv <= 9
2353
- DCL::sgssim(simfacsv,vxoffsv,vyoffsv)
2354
- DCL::grstrn(itrsv)
2355
- ### TENTATIVE WORKAROUND (2012/2/9)
2356
- elsif itrsv <= 34
2357
- DCL::grswnd(ux1sv, ux2sv, uy1sv, uy2sv)
2358
- DCL.sgstrn(itrsv)
2359
- DCL.umpset('lglobe', lglobesv)
2360
- DCL::grstxy(*grstxysv)
2361
- DCL.umscnt(plxsv,plysv,plrotsv)
2362
- DCL.umpfit
2363
- ###
2364
- DCL.sgssim(simfacsv,vxoffsv,vyoffsv)
2365
- #DCL.sgsmpl(plxsv,plysv,plrotsv)
2366
- end
2367
- DCL::grstrf
2368
-
2369
- uz_set_params('inner'=>inner_bk)
2445
+ # RESTORE PARAMS
2446
+ DCLExt.restore_proj_params(proj_params)
2447
+ DCLExt.uz_set_params(before) ### labelzs
2448
+ DCLExt.uz_set_params(rsizet12_bk)
2449
+ DCLExt.uz_set_params(labelxbyl_bk) if labelxbyl_bk
2450
+ DCLExt.uz_set_params(inner_bk)
2370
2451
  end
2371
2452
 
2372
- DCL::uziset("indext1",indext1_bk)
2373
- DCL::uziset("indext2",indext2_bk)
2374
- DCL::uziset("indexl1",indexl1_bk)
2375
- DCL::uzrset("rsizel1",rsizel1_bk)
2376
-
2377
- DCL::sglset("lclip", lclip_bk)
2453
+ DCLExt.uz_set_params(axparam_bk)
2454
+ DCLExt.sg_set_params(lclip_bk)
2378
2455
  nil
2379
2456
  end
2380
2457
 
@@ -2399,29 +2476,23 @@ module NumRu
2399
2476
  def legend(str, type, index, line=false, size=nil,
2400
2477
  vx=nil, dx=nil, vy=nil, first=true, mark_size=nil)
2401
2478
 
2402
- size = DCL::uzrget("rsizel1")*0.95 if !size
2403
- mark_size = size if !mark_size
2479
+ size ||= DCL::uzrget("rsizel1") * 0.95
2480
+ mark_size ||= size
2404
2481
 
2405
2482
  vpx1,vpx2,vpy1,vpy2 = DCL.sgqvpt
2406
- if first
2407
- if !vy
2408
- vy = vpy2 - 0.04
2409
- elsif vy < 0
2410
- vy = ( vpy2 - 0.04 ) + vy
2411
- end
2412
- @vy = vy
2483
+ if first || (!@vy)
2484
+ vy ||= vpy2 - 0.04
2485
+ vy += vpy2 - 0.04 if vy < 0
2413
2486
  else
2414
- vy = @vy - 1.5*size
2487
+ vy ||= @vy - 1.5 * size
2415
2488
  end
2489
+ @vy = vy
2416
2490
 
2417
- if !vx
2418
- vx = vpx2 + 0.015
2419
- elsif vx < 0
2420
- vx = (vpx2 + 0.015) + vx
2421
- end
2491
+ vx ||= vpx2 + 0.015
2492
+ vx = (vpx2 + 0.015) + vx if vx < 0
2422
2493
 
2423
2494
  if line
2424
- dx=0.06 if !dx
2495
+ dx ||= 0.06
2425
2496
  vx2 = vx + dx
2426
2497
  DCL::sgplzv([vx,vx2],[vy,vy],type,index)
2427
2498
  DCL.sgtxzv(vx2+0.01,vy,str,size,0,-1,3)
@@ -2561,17 +2632,63 @@ if $0 == __FILE__
2561
2632
  #xdegc[-1] += 360
2562
2633
  xx = x.newdim(1)
2563
2634
  yy = y.newdim(0)
2564
- z = (cos(4*yy)-1)*sin(2*xx) - 2*cos(2*yy)
2635
+ #p exp(-0.1*(yy+xx)).to_a
2636
+ z = ( (cos(4*yy)-1)*sin(2*xx) - 2*cos(2*yy) ) * exp(0.4*yy)
2565
2637
  u = - Derivative.cderiv(z,y,1,Derivative::CYCLIC_EXT)
2566
2638
  v = Derivative.cderiv(z,x,0,Derivative::CYCLIC_EXT) / cos(yy)
2567
2639
  u = NArrayMiss.to_nam(u)
2568
2640
  #DCL.ugpset('lmissp',true)
2569
2641
  u.invalidation(2..6,-5..-2)
2570
- v[7..10,-5] = 999.0
2642
+ #v[7..10,-5] = 999.0
2571
2643
 
2644
+ DCL.swpset('iwidth',900)
2645
+ DCL.swpset('iheight',900)
2572
2646
  DCL.gropn(1)
2573
2647
  DCL.glpset('lmiss',true)
2574
2648
 
2649
+ DCL.sldiv("y",2,2)
2650
+ DCL.grfrm
2651
+ DCL.grstrn(1)
2652
+ DCL.grsvpt(0.1,0.9,0.1,0.9)
2653
+ DCL.grswnd(xdeg[0],xdeg[-1],ydeg[0],ydeg[-1])
2654
+ DCL.grstrf
2655
+ DCL.usdaxs
2656
+ unit_vect_info = DCLExt.flow_vect(u, v)
2657
+ p unit_vect_info
2658
+ DCLExt.unit_vect( *unit_vect_info )
2659
+
2660
+ DCL.grfrm
2661
+ DCL.grstrn(1)
2662
+ DCL.grsvpt(0.1,0.9,0.1,0.9)
2663
+ DCL.grswnd(xdeg[-1],xdeg[0],ydeg[0],ydeg[-1])
2664
+ DCL.grstrf
2665
+ DCL.usdaxs
2666
+ unit_vect_info = DCLExt.flow_vect(u[-1..0,true], v[-1..0,true])
2667
+ p unit_vect_info
2668
+ DCLExt.unit_vect( *unit_vect_info )
2669
+
2670
+ DCL.grfrm
2671
+ DCL.grstrn(1)
2672
+ DCL.grsvpt(0.1,0.9,0.1,0.9)
2673
+ DCL.grswnd(xdeg[0],xdeg[-1],ydeg[-1],ydeg[0])
2674
+ DCL.grstrf
2675
+ DCL.usdaxs
2676
+ unit_vect_info = DCLExt.flow_vect(u[true,-1..0], v[true,-1..0])
2677
+ p unit_vect_info
2678
+ DCLExt.unit_vect( *unit_vect_info )
2679
+
2680
+ DCL.grfrm
2681
+ DCL.grstrn(1)
2682
+ DCL.grsvpt(0.1,0.9,0.1,0.9)
2683
+ DCL.grswnd(xdeg[-1],xdeg[0],ydeg[-1],ydeg[0])
2684
+ DCL.grstrf
2685
+ DCL.usdaxs
2686
+ unit_vect_info = DCLExt.flow_vect(u[-1..0,-1..0], v[-1..0,-1..0])
2687
+ p unit_vect_info
2688
+ unit_vect_info[3] = 0.0
2689
+ DCLExt.unit_vect( *unit_vect_info )
2690
+
2691
+ =begin
2575
2692
  DCL.sgpset('lclip',true)
2576
2693
 
2577
2694
  for itr in [10,12]
@@ -2631,6 +2748,61 @@ if $0 == __FILE__
2631
2748
  DCLExt.unit_vect_single(vfratio, flenmax)
2632
2749
  DCL.umplim
2633
2750
 
2751
+ ## for datetime_ax
2752
+ date_from = DateTime.parse('2005-06-30 17:00')
2753
+ date_to = DateTime.parse('2005-07-01 5:00')
2754
+ date_from2 = DateTime.parse('2005-06-29 17:00')
2755
+ date_to2 = DateTime.parse('2005-07-02 5:00')
2756
+
2757
+ any_offst = 10
2758
+
2759
+ DCL.grfrm
2760
+ DCL.grswnd(0.0, date_to-date_from, any_offst, date_to2-date_from2+any_offst)
2761
+ DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
2762
+ DCL.grstrn(1)
2763
+ DCL.grstrf
2764
+ DCLExt.datetime_ax(date_from, date_to, 'year'=>true)
2765
+ DCLExt.datetime_ax(date_from, date_to, 'cside'=>'t', 'year'=>true)
2766
+ DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true)
2767
+ DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true, 'cside'=>'r')
2768
+ DCL.uxsttl('b','TIME AND DATE',0.0)
2769
+ DCL.uysttl('l','TIME AND DATE',0.0)
2770
+
2771
+ DCL.grfrm
2772
+ DCL.grswnd(0.0, date_to-date_from, 0, date_to2-date_from2)
2773
+ DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
2774
+ DCL.grstrn(1)
2775
+ DCL.grstrf
2776
+ DCL.uzpset('inner',-1)
2777
+ DCLExt.datetime_ax(date_from, date_to, 'dtick2'=>2)
2778
+ DCLExt.datetime_ax(date_from, date_to, 'cside'=>'t', 'dtick2'=>2)
2779
+ DCL.uzpset('inner',1)
2780
+ DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true,
2781
+ 'dtick1'=>2, 'dtick2'=>24)
2782
+ DCLExt.datetime_ax(date_from2, date_to2, 'yax'=>true, 'cside'=>'r',
2783
+ 'dtick1'=>2, 'dtick2'=>24)
2784
+ DCL.uxsttl('b','TIME AND DATE',0.0)
2785
+ DCL.uysttl('l','TIME AND DATE',0.0)
2786
+
2787
+ ## for date_ax
2788
+ date_from = DateTime.parse('1995-06-30 17:00')
2789
+ date_to = DateTime.parse('2000-02-01 5:00')
2790
+ any_offst = 10
2791
+
2792
+ 3.times do
2793
+ DCL.grfrm
2794
+ DCL.grswnd(0.0, date_to-date_from, any_offst, date_to-date_from+any_offst)
2795
+ DCL.grsvpt(0.2, 0.8, 0.2, 0.8)
2796
+ DCL.grstrn(1)
2797
+ DCL.grstrf
2798
+ #DCL.uzpset("irotcyl",0)
2799
+ #DCL.uzpset("irotcxb",1)
2800
+ DCLExt.date_ax(date_from, date_to)
2801
+ DCLExt.date_ax(date_from, date_to, "yax"=>true)
2802
+ date_to = date_to >> 15*12
2803
+ end
2804
+ =end
2805
+
2634
2806
  DCL.grcls
2635
2807
 
2636
2808
  end