gphys 1.1.1a
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +1777 -0
- data/LICENSE.txt +34 -0
- data/README +33 -0
- data/Rakefile +57 -0
- data/TODO_ep_flux +6 -0
- data/bin/gdir_client +27 -0
- data/bin/gdir_server +129 -0
- data/bin/gpaop +146 -0
- data/bin/gpcat +148 -0
- data/bin/gpcut +102 -0
- data/bin/gpedit +228 -0
- data/bin/gplist +68 -0
- data/bin/gpmath +120 -0
- data/bin/gpmaxmin +128 -0
- data/bin/gpprint +60 -0
- data/bin/gpvect +706 -0
- data/bin/gpview +704 -0
- data/bin/grads2nc_with_gphys +61 -0
- data/doc/attribute.html +19 -0
- data/doc/attributenetcdf.html +15 -0
- data/doc/axis.html +376 -0
- data/doc/coordmapping.html +111 -0
- data/doc/coordtransform.html +36 -0
- data/doc/derivative/gphys-derivative.html +80 -0
- data/doc/derivative/index.html +21 -0
- data/doc/derivative/index.rd +14 -0
- data/doc/derivative/math-doc/document/document.css +30 -0
- data/doc/derivative/math-doc/document/document.html +57 -0
- data/doc/derivative/math-doc/document/images.aux +1 -0
- data/doc/derivative/math-doc/document/images.log +385 -0
- data/doc/derivative/math-doc/document/images.pl +186 -0
- data/doc/derivative/math-doc/document/images.tex +364 -0
- data/doc/derivative/math-doc/document/img1.png +0 -0
- data/doc/derivative/math-doc/document/img10.png +0 -0
- data/doc/derivative/math-doc/document/img11.png +0 -0
- data/doc/derivative/math-doc/document/img12.png +0 -0
- data/doc/derivative/math-doc/document/img13.png +0 -0
- data/doc/derivative/math-doc/document/img14.png +0 -0
- data/doc/derivative/math-doc/document/img15.png +0 -0
- data/doc/derivative/math-doc/document/img16.png +0 -0
- data/doc/derivative/math-doc/document/img17.png +0 -0
- data/doc/derivative/math-doc/document/img18.png +0 -0
- data/doc/derivative/math-doc/document/img19.png +0 -0
- data/doc/derivative/math-doc/document/img2.png +0 -0
- data/doc/derivative/math-doc/document/img20.png +0 -0
- data/doc/derivative/math-doc/document/img21.png +0 -0
- data/doc/derivative/math-doc/document/img22.png +0 -0
- data/doc/derivative/math-doc/document/img23.png +0 -0
- data/doc/derivative/math-doc/document/img24.png +0 -0
- data/doc/derivative/math-doc/document/img25.png +0 -0
- data/doc/derivative/math-doc/document/img26.png +0 -0
- data/doc/derivative/math-doc/document/img27.png +0 -0
- data/doc/derivative/math-doc/document/img28.png +0 -0
- data/doc/derivative/math-doc/document/img29.png +0 -0
- data/doc/derivative/math-doc/document/img3.png +0 -0
- data/doc/derivative/math-doc/document/img30.png +0 -0
- data/doc/derivative/math-doc/document/img4.png +0 -0
- data/doc/derivative/math-doc/document/img5.png +0 -0
- data/doc/derivative/math-doc/document/img6.png +0 -0
- data/doc/derivative/math-doc/document/img7.png +0 -0
- data/doc/derivative/math-doc/document/img8.png +0 -0
- data/doc/derivative/math-doc/document/img9.png +0 -0
- data/doc/derivative/math-doc/document/index.html +57 -0
- data/doc/derivative/math-doc/document/labels.pl +13 -0
- data/doc/derivative/math-doc/document/next.png +0 -0
- data/doc/derivative/math-doc/document/next_g.png +0 -0
- data/doc/derivative/math-doc/document/node1.html +238 -0
- data/doc/derivative/math-doc/document/node2.html +75 -0
- data/doc/derivative/math-doc/document/prev.png +0 -0
- data/doc/derivative/math-doc/document/prev_g.png +0 -0
- data/doc/derivative/math-doc/document/up.png +0 -0
- data/doc/derivative/math-doc/document/up_g.png +0 -0
- data/doc/derivative/math-doc/document.pdf +0 -0
- data/doc/derivative/math-doc/document.tex +158 -0
- data/doc/derivative/numru-derivative.html +129 -0
- data/doc/ep_flux/ep_flux.html +469 -0
- data/doc/ep_flux/ggraph_on_merdional_section.html +71 -0
- data/doc/ep_flux/index.html +31 -0
- data/doc/ep_flux/index.rd +24 -0
- data/doc/ep_flux/math-doc/document/WARNINGS +1 -0
- data/doc/ep_flux/math-doc/document/contents.png +0 -0
- data/doc/ep_flux/math-doc/document/crossref.png +0 -0
- data/doc/ep_flux/math-doc/document/document.css +30 -0
- data/doc/ep_flux/math-doc/document/document.html +101 -0
- data/doc/ep_flux/math-doc/document/images.aux +1 -0
- data/doc/ep_flux/math-doc/document/images.log +1375 -0
- data/doc/ep_flux/math-doc/document/images.pl +1328 -0
- data/doc/ep_flux/math-doc/document/images.tex +1471 -0
- data/doc/ep_flux/math-doc/document/img1.png +0 -0
- data/doc/ep_flux/math-doc/document/img10.png +0 -0
- data/doc/ep_flux/math-doc/document/img100.png +0 -0
- data/doc/ep_flux/math-doc/document/img101.png +0 -0
- data/doc/ep_flux/math-doc/document/img102.png +0 -0
- data/doc/ep_flux/math-doc/document/img103.png +0 -0
- data/doc/ep_flux/math-doc/document/img104.png +0 -0
- data/doc/ep_flux/math-doc/document/img105.png +0 -0
- data/doc/ep_flux/math-doc/document/img106.png +0 -0
- data/doc/ep_flux/math-doc/document/img107.png +0 -0
- data/doc/ep_flux/math-doc/document/img108.png +0 -0
- data/doc/ep_flux/math-doc/document/img109.png +0 -0
- data/doc/ep_flux/math-doc/document/img11.png +0 -0
- data/doc/ep_flux/math-doc/document/img110.png +0 -0
- data/doc/ep_flux/math-doc/document/img111.png +0 -0
- data/doc/ep_flux/math-doc/document/img112.png +0 -0
- data/doc/ep_flux/math-doc/document/img113.png +0 -0
- data/doc/ep_flux/math-doc/document/img114.png +0 -0
- data/doc/ep_flux/math-doc/document/img115.png +0 -0
- data/doc/ep_flux/math-doc/document/img116.png +0 -0
- data/doc/ep_flux/math-doc/document/img117.png +0 -0
- data/doc/ep_flux/math-doc/document/img118.png +0 -0
- data/doc/ep_flux/math-doc/document/img119.png +0 -0
- data/doc/ep_flux/math-doc/document/img12.png +0 -0
- data/doc/ep_flux/math-doc/document/img120.png +0 -0
- data/doc/ep_flux/math-doc/document/img121.png +0 -0
- data/doc/ep_flux/math-doc/document/img122.png +0 -0
- data/doc/ep_flux/math-doc/document/img123.png +0 -0
- data/doc/ep_flux/math-doc/document/img124.png +0 -0
- data/doc/ep_flux/math-doc/document/img125.png +0 -0
- data/doc/ep_flux/math-doc/document/img126.png +0 -0
- data/doc/ep_flux/math-doc/document/img127.png +0 -0
- data/doc/ep_flux/math-doc/document/img128.png +0 -0
- data/doc/ep_flux/math-doc/document/img129.png +0 -0
- data/doc/ep_flux/math-doc/document/img13.png +0 -0
- data/doc/ep_flux/math-doc/document/img130.png +0 -0
- data/doc/ep_flux/math-doc/document/img131.png +0 -0
- data/doc/ep_flux/math-doc/document/img132.png +0 -0
- data/doc/ep_flux/math-doc/document/img133.png +0 -0
- data/doc/ep_flux/math-doc/document/img134.png +0 -0
- data/doc/ep_flux/math-doc/document/img135.png +0 -0
- data/doc/ep_flux/math-doc/document/img136.png +0 -0
- data/doc/ep_flux/math-doc/document/img137.png +0 -0
- data/doc/ep_flux/math-doc/document/img138.png +0 -0
- data/doc/ep_flux/math-doc/document/img139.png +0 -0
- data/doc/ep_flux/math-doc/document/img14.png +0 -0
- data/doc/ep_flux/math-doc/document/img140.png +0 -0
- data/doc/ep_flux/math-doc/document/img141.png +0 -0
- data/doc/ep_flux/math-doc/document/img142.png +0 -0
- data/doc/ep_flux/math-doc/document/img143.png +0 -0
- data/doc/ep_flux/math-doc/document/img144.png +0 -0
- data/doc/ep_flux/math-doc/document/img145.png +0 -0
- data/doc/ep_flux/math-doc/document/img146.png +0 -0
- data/doc/ep_flux/math-doc/document/img147.png +0 -0
- data/doc/ep_flux/math-doc/document/img148.png +0 -0
- data/doc/ep_flux/math-doc/document/img149.png +0 -0
- data/doc/ep_flux/math-doc/document/img15.png +0 -0
- data/doc/ep_flux/math-doc/document/img150.png +0 -0
- data/doc/ep_flux/math-doc/document/img151.png +0 -0
- data/doc/ep_flux/math-doc/document/img152.png +0 -0
- data/doc/ep_flux/math-doc/document/img153.png +0 -0
- data/doc/ep_flux/math-doc/document/img154.png +0 -0
- data/doc/ep_flux/math-doc/document/img155.png +0 -0
- data/doc/ep_flux/math-doc/document/img156.png +0 -0
- data/doc/ep_flux/math-doc/document/img157.png +0 -0
- data/doc/ep_flux/math-doc/document/img158.png +0 -0
- data/doc/ep_flux/math-doc/document/img159.png +0 -0
- data/doc/ep_flux/math-doc/document/img16.png +0 -0
- data/doc/ep_flux/math-doc/document/img160.png +0 -0
- data/doc/ep_flux/math-doc/document/img161.png +0 -0
- data/doc/ep_flux/math-doc/document/img162.png +0 -0
- data/doc/ep_flux/math-doc/document/img163.png +0 -0
- data/doc/ep_flux/math-doc/document/img164.png +0 -0
- data/doc/ep_flux/math-doc/document/img165.png +0 -0
- data/doc/ep_flux/math-doc/document/img166.png +0 -0
- data/doc/ep_flux/math-doc/document/img167.png +0 -0
- data/doc/ep_flux/math-doc/document/img168.png +0 -0
- data/doc/ep_flux/math-doc/document/img169.png +0 -0
- data/doc/ep_flux/math-doc/document/img17.png +0 -0
- data/doc/ep_flux/math-doc/document/img170.png +0 -0
- data/doc/ep_flux/math-doc/document/img171.png +0 -0
- data/doc/ep_flux/math-doc/document/img172.png +0 -0
- data/doc/ep_flux/math-doc/document/img173.png +0 -0
- data/doc/ep_flux/math-doc/document/img174.png +0 -0
- data/doc/ep_flux/math-doc/document/img175.png +0 -0
- data/doc/ep_flux/math-doc/document/img176.png +0 -0
- data/doc/ep_flux/math-doc/document/img177.png +0 -0
- data/doc/ep_flux/math-doc/document/img178.png +0 -0
- data/doc/ep_flux/math-doc/document/img179.png +0 -0
- data/doc/ep_flux/math-doc/document/img18.png +0 -0
- data/doc/ep_flux/math-doc/document/img180.png +0 -0
- data/doc/ep_flux/math-doc/document/img181.png +0 -0
- data/doc/ep_flux/math-doc/document/img182.png +0 -0
- data/doc/ep_flux/math-doc/document/img183.png +0 -0
- data/doc/ep_flux/math-doc/document/img184.png +0 -0
- data/doc/ep_flux/math-doc/document/img185.png +0 -0
- data/doc/ep_flux/math-doc/document/img186.png +0 -0
- data/doc/ep_flux/math-doc/document/img187.png +0 -0
- data/doc/ep_flux/math-doc/document/img188.png +0 -0
- data/doc/ep_flux/math-doc/document/img189.png +0 -0
- data/doc/ep_flux/math-doc/document/img19.png +0 -0
- data/doc/ep_flux/math-doc/document/img190.png +0 -0
- data/doc/ep_flux/math-doc/document/img191.png +0 -0
- data/doc/ep_flux/math-doc/document/img192.png +0 -0
- data/doc/ep_flux/math-doc/document/img193.png +0 -0
- data/doc/ep_flux/math-doc/document/img194.png +0 -0
- data/doc/ep_flux/math-doc/document/img195.png +0 -0
- data/doc/ep_flux/math-doc/document/img196.png +0 -0
- data/doc/ep_flux/math-doc/document/img197.png +0 -0
- data/doc/ep_flux/math-doc/document/img198.png +0 -0
- data/doc/ep_flux/math-doc/document/img199.png +0 -0
- data/doc/ep_flux/math-doc/document/img2.png +0 -0
- data/doc/ep_flux/math-doc/document/img20.png +0 -0
- data/doc/ep_flux/math-doc/document/img200.png +0 -0
- data/doc/ep_flux/math-doc/document/img21.png +0 -0
- data/doc/ep_flux/math-doc/document/img22.png +0 -0
- data/doc/ep_flux/math-doc/document/img23.png +0 -0
- data/doc/ep_flux/math-doc/document/img24.png +0 -0
- data/doc/ep_flux/math-doc/document/img25.png +0 -0
- data/doc/ep_flux/math-doc/document/img26.png +0 -0
- data/doc/ep_flux/math-doc/document/img27.png +0 -0
- data/doc/ep_flux/math-doc/document/img28.png +0 -0
- data/doc/ep_flux/math-doc/document/img29.png +0 -0
- data/doc/ep_flux/math-doc/document/img3.png +0 -0
- data/doc/ep_flux/math-doc/document/img30.png +0 -0
- data/doc/ep_flux/math-doc/document/img31.png +0 -0
- data/doc/ep_flux/math-doc/document/img32.png +0 -0
- data/doc/ep_flux/math-doc/document/img33.png +0 -0
- data/doc/ep_flux/math-doc/document/img34.png +0 -0
- data/doc/ep_flux/math-doc/document/img35.png +0 -0
- data/doc/ep_flux/math-doc/document/img36.png +0 -0
- data/doc/ep_flux/math-doc/document/img37.png +0 -0
- data/doc/ep_flux/math-doc/document/img38.png +0 -0
- data/doc/ep_flux/math-doc/document/img39.png +0 -0
- data/doc/ep_flux/math-doc/document/img4.png +0 -0
- data/doc/ep_flux/math-doc/document/img40.png +0 -0
- data/doc/ep_flux/math-doc/document/img41.png +0 -0
- data/doc/ep_flux/math-doc/document/img42.png +0 -0
- data/doc/ep_flux/math-doc/document/img43.png +0 -0
- data/doc/ep_flux/math-doc/document/img44.png +0 -0
- data/doc/ep_flux/math-doc/document/img45.png +0 -0
- data/doc/ep_flux/math-doc/document/img46.png +0 -0
- data/doc/ep_flux/math-doc/document/img47.png +0 -0
- data/doc/ep_flux/math-doc/document/img48.png +0 -0
- data/doc/ep_flux/math-doc/document/img49.png +0 -0
- data/doc/ep_flux/math-doc/document/img5.png +0 -0
- data/doc/ep_flux/math-doc/document/img50.png +0 -0
- data/doc/ep_flux/math-doc/document/img51.png +0 -0
- data/doc/ep_flux/math-doc/document/img52.png +0 -0
- data/doc/ep_flux/math-doc/document/img53.png +0 -0
- data/doc/ep_flux/math-doc/document/img54.png +0 -0
- data/doc/ep_flux/math-doc/document/img55.png +0 -0
- data/doc/ep_flux/math-doc/document/img56.png +0 -0
- data/doc/ep_flux/math-doc/document/img57.png +0 -0
- data/doc/ep_flux/math-doc/document/img58.png +0 -0
- data/doc/ep_flux/math-doc/document/img59.png +0 -0
- data/doc/ep_flux/math-doc/document/img6.png +0 -0
- data/doc/ep_flux/math-doc/document/img60.png +0 -0
- data/doc/ep_flux/math-doc/document/img61.png +0 -0
- data/doc/ep_flux/math-doc/document/img62.png +0 -0
- data/doc/ep_flux/math-doc/document/img63.png +0 -0
- data/doc/ep_flux/math-doc/document/img64.png +0 -0
- data/doc/ep_flux/math-doc/document/img65.png +0 -0
- data/doc/ep_flux/math-doc/document/img66.png +0 -0
- data/doc/ep_flux/math-doc/document/img67.png +0 -0
- data/doc/ep_flux/math-doc/document/img68.png +0 -0
- data/doc/ep_flux/math-doc/document/img69.png +0 -0
- data/doc/ep_flux/math-doc/document/img7.png +0 -0
- data/doc/ep_flux/math-doc/document/img70.png +0 -0
- data/doc/ep_flux/math-doc/document/img71.png +0 -0
- data/doc/ep_flux/math-doc/document/img72.png +0 -0
- data/doc/ep_flux/math-doc/document/img73.png +0 -0
- data/doc/ep_flux/math-doc/document/img74.png +0 -0
- data/doc/ep_flux/math-doc/document/img75.png +0 -0
- data/doc/ep_flux/math-doc/document/img76.png +0 -0
- data/doc/ep_flux/math-doc/document/img77.png +0 -0
- data/doc/ep_flux/math-doc/document/img78.png +0 -0
- data/doc/ep_flux/math-doc/document/img79.png +0 -0
- data/doc/ep_flux/math-doc/document/img8.png +0 -0
- data/doc/ep_flux/math-doc/document/img80.png +0 -0
- data/doc/ep_flux/math-doc/document/img81.png +0 -0
- data/doc/ep_flux/math-doc/document/img82.png +0 -0
- data/doc/ep_flux/math-doc/document/img83.png +0 -0
- data/doc/ep_flux/math-doc/document/img84.png +0 -0
- data/doc/ep_flux/math-doc/document/img85.png +0 -0
- data/doc/ep_flux/math-doc/document/img86.png +0 -0
- data/doc/ep_flux/math-doc/document/img87.png +0 -0
- data/doc/ep_flux/math-doc/document/img88.png +0 -0
- data/doc/ep_flux/math-doc/document/img89.png +0 -0
- data/doc/ep_flux/math-doc/document/img9.png +0 -0
- data/doc/ep_flux/math-doc/document/img90.png +0 -0
- data/doc/ep_flux/math-doc/document/img91.png +0 -0
- data/doc/ep_flux/math-doc/document/img92.png +0 -0
- data/doc/ep_flux/math-doc/document/img93.png +0 -0
- data/doc/ep_flux/math-doc/document/img94.png +0 -0
- data/doc/ep_flux/math-doc/document/img95.png +0 -0
- data/doc/ep_flux/math-doc/document/img96.png +0 -0
- data/doc/ep_flux/math-doc/document/img97.png +0 -0
- data/doc/ep_flux/math-doc/document/img98.png +0 -0
- data/doc/ep_flux/math-doc/document/img99.png +0 -0
- data/doc/ep_flux/math-doc/document/index.html +101 -0
- data/doc/ep_flux/math-doc/document/internals.pl +258 -0
- data/doc/ep_flux/math-doc/document/labels.pl +265 -0
- data/doc/ep_flux/math-doc/document/next.png +0 -0
- data/doc/ep_flux/math-doc/document/next_g.png +0 -0
- data/doc/ep_flux/math-doc/document/node1.html +104 -0
- data/doc/ep_flux/math-doc/document/node10.html +164 -0
- data/doc/ep_flux/math-doc/document/node11.html +86 -0
- data/doc/ep_flux/math-doc/document/node12.html +166 -0
- data/doc/ep_flux/math-doc/document/node13.html +897 -0
- data/doc/ep_flux/math-doc/document/node14.html +1065 -0
- data/doc/ep_flux/math-doc/document/node15.html +72 -0
- data/doc/ep_flux/math-doc/document/node16.html +81 -0
- data/doc/ep_flux/math-doc/document/node2.html +82 -0
- data/doc/ep_flux/math-doc/document/node3.html +91 -0
- data/doc/ep_flux/math-doc/document/node4.html +149 -0
- data/doc/ep_flux/math-doc/document/node5.html +330 -0
- data/doc/ep_flux/math-doc/document/node6.html +99 -0
- data/doc/ep_flux/math-doc/document/node7.html +98 -0
- data/doc/ep_flux/math-doc/document/node8.html +83 -0
- data/doc/ep_flux/math-doc/document/node9.html +140 -0
- data/doc/ep_flux/math-doc/document/prev.png +0 -0
- data/doc/ep_flux/math-doc/document/prev_g.png +0 -0
- data/doc/ep_flux/math-doc/document/up.png +0 -0
- data/doc/ep_flux/math-doc/document/up_g.png +0 -0
- data/doc/ep_flux/math-doc/document.pdf +0 -0
- data/doc/ep_flux/math-doc/document.tex +2018 -0
- data/doc/gdir.html +412 -0
- data/doc/gdir_client.html +16 -0
- data/doc/gdir_connect_ftp-like.html +61 -0
- data/doc/gdir_server.html +45 -0
- data/doc/ggraph.html +1615 -0
- data/doc/gpcat.html +44 -0
- data/doc/gpcut.html +41 -0
- data/doc/gphys.html +532 -0
- data/doc/gphys_fft.html +324 -0
- data/doc/gphys_grads_io.html +69 -0
- data/doc/gphys_grib_io.html +82 -0
- data/doc/gphys_io.html +120 -0
- data/doc/gphys_io_common.html +18 -0
- data/doc/gphys_netcdf_io.html +283 -0
- data/doc/gplist.html +24 -0
- data/doc/gpmath.html +51 -0
- data/doc/gpmaxmin.html +31 -0
- data/doc/gpprint.html +34 -0
- data/doc/gpview.html +270 -0
- data/doc/grads2nc_with_gphys.html +21 -0
- data/doc/grads_gridded.html +307 -0
- data/doc/grib.html +144 -0
- data/doc/grid.html +212 -0
- data/doc/index.html +133 -0
- data/doc/index.rd +127 -0
- data/doc/netcdf_convention.html +136 -0
- data/doc/unumeric.html +176 -0
- data/doc/update +64 -0
- data/doc/varray.html +299 -0
- data/doc/varraycomposite.html +67 -0
- data/ext_coord.c +209 -0
- data/ext_init.c +7 -0
- data/extconf.rb +42 -0
- data/install.rb +130 -0
- data/interpo.c +497 -0
- data/lib/numru/dcl_mouse.rb +71 -0
- data/lib/numru/dclext_datetime_ax.rb +220 -0
- data/lib/numru/derivative.rb +348 -0
- data/lib/numru/ganalysis/covariance.rb +154 -0
- data/lib/numru/ganalysis/eof.rb +298 -0
- data/lib/numru/ganalysis/histogram.rb +252 -0
- data/lib/numru/ganalysis/met.rb +317 -0
- data/lib/numru/ganalysis/planet.rb +182 -0
- data/lib/numru/ganalysis.rb +7 -0
- data/lib/numru/gdir.rb +1038 -0
- data/lib/numru/gdir_connect_ftp-like.rb +149 -0
- data/lib/numru/ggraph.rb +5838 -0
- data/lib/numru/ggraph_on_merdional_section.rb +178 -0
- data/lib/numru/gphys/assoccoords.rb +359 -0
- data/lib/numru/gphys/attribute.rb +129 -0
- data/lib/numru/gphys/attributenetcdf.rb +80 -0
- data/lib/numru/gphys/axis.rb +963 -0
- data/lib/numru/gphys/coordmapping.rb +286 -0
- data/lib/numru/gphys/coordtransform.rb +209 -0
- data/lib/numru/gphys/derivative.rb +314 -0
- data/lib/numru/gphys/ep_flux.rb +868 -0
- data/lib/numru/gphys/gpcommon.rb +52 -0
- data/lib/numru/gphys/gphys.rb +1207 -0
- data/lib/numru/gphys/gphys_fft.rb +886 -0
- data/lib/numru/gphys/gphys_grads_io.rb +212 -0
- data/lib/numru/gphys/gphys_grib_io.rb +214 -0
- data/lib/numru/gphys/gphys_gtool3_io.rb +162 -0
- data/lib/numru/gphys/gphys_hdfeos5_io.rb +672 -0
- data/lib/numru/gphys/gphys_io.rb +452 -0
- data/lib/numru/gphys/gphys_io_common.rb +126 -0
- data/lib/numru/gphys/gphys_netcdf_io.rb +800 -0
- data/lib/numru/gphys/gphys_nusdas_io.rb +132 -0
- data/lib/numru/gphys/grads_gridded.rb +1638 -0
- data/lib/numru/gphys/grib.rb +2049 -0
- data/lib/numru/gphys/grib_params.rb +1465 -0
- data/lib/numru/gphys/grid.rb +723 -0
- data/lib/numru/gphys/gtool3.rb +771 -0
- data/lib/numru/gphys/interpolate.rb +854 -0
- data/lib/numru/gphys/narray_ext.rb +34 -0
- data/lib/numru/gphys/netcdf_convention.rb +406 -0
- data/lib/numru/gphys/subsetmapping.rb +332 -0
- data/lib/numru/gphys/unumeric.rb +522 -0
- data/lib/numru/gphys/varray.rb +1109 -0
- data/lib/numru/gphys/varraycomposite.rb +415 -0
- data/lib/numru/gphys/varraygrads.rb +225 -0
- data/lib/numru/gphys/varraygrib.rb +177 -0
- data/lib/numru/gphys/varraygtool3.rb +226 -0
- data/lib/numru/gphys/varrayhdfeos5.rb +451 -0
- data/lib/numru/gphys/varraynetcdf.rb +350 -0
- data/lib/numru/gphys/varraynusdas.rb +59 -0
- data/lib/numru/gphys.rb +9 -0
- data/lib/numru/htdir.rb +170 -0
- data/multibitIO.c +567 -0
- data/sample/cira86_to_nc.rb +122 -0
- data/sample/druby_cli1.rb +21 -0
- data/sample/druby_cli2.rb +34 -0
- data/sample/druby_serv1.rb +30 -0
- data/sample/druby_serv2.rb +64 -0
- data/sample/ep_flux/demo_NCEP_1.rb +48 -0
- data/sample/ep_flux/demo_NCEP_2.rb +57 -0
- data/sample/ep_flux/demo_NCEP_3.rb +81 -0
- data/sample/ggraph_latlon_labelling_dr002690.rb +159 -0
- data/sample/ggraph_mapfit-axes_dr002687.rb +131 -0
- data/sample/map_projection.rb +121 -0
- data/sample/ncep_theta_coord.rb +79 -0
- data/test/eof_slp.rb +28 -0
- data/test/mltbit.dat +0 -0
- data/test/test_ep_flux.rb +533 -0
- data/test/test_multibitIO.rb +19 -0
- data/testdata/T.jan.ctl +12 -0
- data/testdata/T.jan.dat +0 -0
- data/testdata/T.jan.grib +0 -0
- data/testdata/T.jan.nc +0 -0
- data/testdata/T.jan.packed.withmiss.nc +0 -0
- data/testdata/UV.jan.nc +0 -0
- data/testdata/assoc_crds.nc +0 -0
- data/testdata/cira86.dat +1332 -0
- metadata +621 -0
@@ -0,0 +1,178 @@
|
|
1
|
+
require 'numru/ggraph'
|
2
|
+
require 'numru/gphys/ep_flux'
|
3
|
+
|
4
|
+
############################################################
|
5
|
+
|
6
|
+
=begin
|
7
|
+
=module NumRu::GGraph in vector_on_merdional_section.rb
|
8
|
+
|
9
|
+
This file defines additional method of NumRu::GGraph. This method is for
|
10
|
+
drawing vector on merdional sections.
|
11
|
+
|
12
|
+
==Index
|
13
|
+
* ((<module NumRu::GGraph>))
|
14
|
+
* ((<vector_on_merdional_section>))
|
15
|
+
Draw vector by selecting the first 2 dimensions
|
16
|
+
(with GPhys#first2D) if (({gphys})) is more than 3D.
|
17
|
+
|
18
|
+
==Module Functions
|
19
|
+
|
20
|
+
---vector_on_merdional_section(fx, fy, newframe=true, options=nil)
|
21
|
+
Draw vector by selecting the first 2 dimensions
|
22
|
+
(with GPhys#first2D) if (({gphys})) is more than 3D.
|
23
|
+
|
24
|
+
ARGUMENTS
|
25
|
+
* fx (GPhys) : a GPhys whose data is plotted x-componet.
|
26
|
+
* fy (GPhys) : a GPhys whose data is plotted y-componet.
|
27
|
+
* newframe (true/false) : if true, calls ((<fig>)), ((<axes>)),
|
28
|
+
((<title>)), and ((<annotate>)) internally; if false, only
|
29
|
+
the poly-line is drawn (overlaid to the exiting figure).
|
30
|
+
* options (Hash) : options to change the default behavior if specified.
|
31
|
+
It is a Hash with option names (String) as keys and their values.
|
32
|
+
Options are interpreted by a NumRu::Misc::KeywordOptAutoHelp,
|
33
|
+
so you can shorten the keys (by omitting tails) as long as it is
|
34
|
+
unambiguous.
|
35
|
+
option name default value # description:
|
36
|
+
"title" nil # Title of the figure(if nil, internally
|
37
|
+
# determined)
|
38
|
+
"annotate" true # if false, do not put texts on the right
|
39
|
+
# margin even when newframe==true
|
40
|
+
"transpose" false # if true, exchange x and y axes
|
41
|
+
"flow_vect" true # If true, use DCLExt::flow_vect to draw
|
42
|
+
# vectors; otherwise, DCL::ugvect is used
|
43
|
+
"xintv" 1 # (Effective only if flow_vect) interval
|
44
|
+
# sampling in x of data
|
45
|
+
"yintv" 1 # (Effective only if flow_vect) interval
|
46
|
+
# of data sampling in y
|
47
|
+
"factor" 1.0 # (Effective only if flow_vect) scaling
|
48
|
+
# factor to strech/reduce the arrow
|
49
|
+
# lengths.
|
50
|
+
"use_before_scale" #
|
51
|
+
false #(Effective only unless flow_vect) If true,
|
52
|
+
# use scale factor before vector.
|
53
|
+
"unit_vect" false # Show the unit vector
|
54
|
+
"max_unit_vect" false # (Effective only if flow_vect &&
|
55
|
+
# unit_vect) If true, use the maximum
|
56
|
+
# arrows to scale the unit vector;
|
57
|
+
# otherwise, normalize in V coordinate.
|
58
|
+
|
59
|
+
RETURN VALUE
|
60
|
+
* nil
|
61
|
+
|
62
|
+
=end
|
63
|
+
|
64
|
+
############################################################
|
65
|
+
|
66
|
+
module NumRu
|
67
|
+
|
68
|
+
module GGraph
|
69
|
+
|
70
|
+
module_function
|
71
|
+
|
72
|
+
def vector_on_merdional_section(fx, fy, newframe=true, options=nil)
|
73
|
+
if ! defined?(@@vector_on_merdional_section_options)
|
74
|
+
@@vector_on_merdional_section_options = Misc::KeywordOptAutoHelp.new(
|
75
|
+
['newfig', true, 'if false, do not cleared before figure setting.'],
|
76
|
+
['title', nil, 'Title of the figure(if nil, internally determined)'],
|
77
|
+
['annotate', true, 'if false, do not put texts on the right margin even when newframe==true'],
|
78
|
+
['transpose', false, 'if true, exchange x and y axes'],
|
79
|
+
['flow_vect', true, 'If true, use DCLExt::flow_vect to draw vectors; otherwise, DCL::ugvect is used.'],
|
80
|
+
['xintv', 1, '(Effective only if flow_vect) interval of data sampling in x'],
|
81
|
+
['yintv', 1, '(Effective only if flow_vect) interval of data sampling in y'],
|
82
|
+
['factor', 1.0, '(Effective only if flow_vect) scaling factor to strech/reduce the arrow lengths'],
|
83
|
+
['unit_vect', false, 'Show the unit vector'],
|
84
|
+
['use_before_scale', false, '(Effective only unless flow_vect) If true, use scale factor before vector.'],
|
85
|
+
['max_unit_vect', false, '(Effective only if flow_vect && unit_vect)
|
86
|
+
If true, use the maximum arrows to scale the unit vector; otherwise, normalize in V coordinate.']
|
87
|
+
)
|
88
|
+
end
|
89
|
+
opts = @@vector_on_merdional_section_options.interpret(options)
|
90
|
+
fx = fx.first2D.copy
|
91
|
+
fy = fy.first2D.copy
|
92
|
+
sh = fx.shape
|
93
|
+
if sh != fy.shape
|
94
|
+
raise ArgumentError, "shapes of fx and fy do not agree with each other"
|
95
|
+
end
|
96
|
+
fx = fx.transpose(1,0) if opts['transpose']
|
97
|
+
fy = fy.transpose(1,0) if opts['transpose']
|
98
|
+
if ((xi=opts['xintv']) >= 2)
|
99
|
+
idx = NArray.int(sh[0]/xi).indgen!*xi # [0,xi,2*xi,..]
|
100
|
+
fx = fx[idx, true]
|
101
|
+
fy = fy[idx, true]
|
102
|
+
end
|
103
|
+
if ((yi=opts['xintv']) >= 2)
|
104
|
+
idx = NArray.int(sh[1]/yi).indgen!*yi # [0,yi,2*yi,..]
|
105
|
+
fx = fx[true, idx]
|
106
|
+
fy = fy[true, idx]
|
107
|
+
end
|
108
|
+
xax = fx.coord(0)
|
109
|
+
yax = fy.coord(1)
|
110
|
+
aphi_ax, z_ax, was_proportional_to_p = \
|
111
|
+
GPhys::EP_Flux::preparate_for_vector_on_merdional_section(xax, yax)
|
112
|
+
if was_proportional_to_p
|
113
|
+
itr = 2
|
114
|
+
else
|
115
|
+
itr = 1
|
116
|
+
end
|
117
|
+
if newframe
|
118
|
+
nextfig = @@next_fig.dup if ( @@next_fig != nil ) # backup next_fig
|
119
|
+
fig(xax, yax, {'itr'=>itr})
|
120
|
+
axes(xax, yax)
|
121
|
+
if opts['title']
|
122
|
+
ttl = opts['title']
|
123
|
+
else
|
124
|
+
fxnm = fx.data.get_att('long_name') || fx.name
|
125
|
+
fynm = fy.data.get_att('long_name') || fy.name
|
126
|
+
ttl = '('+fxnm+','+fynm+')'
|
127
|
+
end
|
128
|
+
title( ttl )
|
129
|
+
annotate(fx.lost_axes) if opts['annotate']
|
130
|
+
@@next_fig = nextfig if ( @@next_fig != nil )
|
131
|
+
end
|
132
|
+
fig(aphi_ax, z_ax, {'new_frame'=>false, 'itr'=>1, 'yreverse'=>false}) \
|
133
|
+
if (opts['newfig'])
|
134
|
+
DCL.uwsgxa(aphi_ax.val)
|
135
|
+
DCL.uwsgya(z_ax.val)
|
136
|
+
if opts['flow_vect']
|
137
|
+
if opts['use_before_scale']
|
138
|
+
vxfxratio = @@uninfo[0]; vxfyratio = @@uninfo[1]
|
139
|
+
before=DCLExt.ug_set_params( {'LNRMAL'=>false, 'LMSG'=>false,
|
140
|
+
'XFACT1'=>1.0, 'YFACT1'=>1.0} )
|
141
|
+
DCL.ugvect(vxfxratio*fx.val, vxfyratio*fy.val)
|
142
|
+
DCLExt.ug_set_params(before)
|
143
|
+
if opts['unit_vect']
|
144
|
+
if opts['max_unit_vect']
|
145
|
+
DCLExt.unit_vect(*@@uninfo)
|
146
|
+
else
|
147
|
+
DCLExt.unit_vect(*@@uninfo[0..1])
|
148
|
+
end
|
149
|
+
end
|
150
|
+
else
|
151
|
+
@@uninfo = DCLExt.flow_vect(fx.val, fy.val, opts['factor'] )
|
152
|
+
if opts['unit_vect']
|
153
|
+
if opts['max_unit_vect']
|
154
|
+
DCLExt.unit_vect(*@@uninfo)
|
155
|
+
else
|
156
|
+
DCLExt.unit_vect(*@@uninfo[0..1])
|
157
|
+
end
|
158
|
+
end
|
159
|
+
end
|
160
|
+
else
|
161
|
+
if opts['use_before_scale']
|
162
|
+
vxfxratio = @@uninfo[0]; vxfyratio = @@uninfo[1]
|
163
|
+
before1=DCLExt.ug_set_params({'lunit'=>true}) if opts['unit_vect']
|
164
|
+
before2=DCLExt.ug_set_params( {'LNRMAL'=>false, 'LMSG'=>false,
|
165
|
+
'XFACT1'=>1.0, 'YFACT1'=>1.0} )
|
166
|
+
DCL.ugvect(vxfxratio*fx.val, vxfyratio*fy.val)
|
167
|
+
DCLExt.ug_set_params(before1) if opts['unit_vect']
|
168
|
+
DCLExt.ug_set_params(before2)
|
169
|
+
else
|
170
|
+
before=DCLExt.ug_set_params({'lunit'=>true}) if opts['unit_vect']
|
171
|
+
DCL.ugvect(fx.val, fy.val)
|
172
|
+
DCLExt.ug_set_params(before) if opts['unit_vect']
|
173
|
+
end
|
174
|
+
nil
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
end
|
@@ -0,0 +1,359 @@
|
|
1
|
+
require "narray"
|
2
|
+
#require "numru/gphys_ext"
|
3
|
+
|
4
|
+
module NumRu
|
5
|
+
|
6
|
+
# = Associated coordinates
|
7
|
+
#
|
8
|
+
# To use in a Grid in order to support non-rectangular coordnate systems
|
9
|
+
#
|
10
|
+
class AssocCoords
|
11
|
+
|
12
|
+
# * assoc_crds : Array of GPhys
|
13
|
+
# * axnames : Array of axis names of the original Grid
|
14
|
+
#
|
15
|
+
def initialize(assoc_crds, axnames)
|
16
|
+
|
17
|
+
# < argument check >
|
18
|
+
if assoc_crds.uniq.length != assoc_crds.length
|
19
|
+
raise ArgumentError, "Names are not uniq: #{assoc_crds.inspect}."
|
20
|
+
end
|
21
|
+
assoc_crds.each do |gp|
|
22
|
+
raise(ArgumentError,"Non-GPhys included") if !gp.is_a?(GPhys)
|
23
|
+
if axnames.include?(gp.name)
|
24
|
+
raise ArgumentError,
|
25
|
+
"'#{gp.name}' overwraps an axis name #{axnames.inspect}."
|
26
|
+
end
|
27
|
+
end
|
28
|
+
|
29
|
+
# < some internal variables >
|
30
|
+
|
31
|
+
@assoc_crds = Hash.new
|
32
|
+
assoc_crds.each{|gp| @assoc_crds[gp.name] = gp}
|
33
|
+
@axnames = axnames.dup
|
34
|
+
@lost_assoc_crds = nil
|
35
|
+
|
36
|
+
# < lengths of original axes >
|
37
|
+
|
38
|
+
@axlens = Hash.new
|
39
|
+
@axnames.each do |nm|
|
40
|
+
len = nil
|
41
|
+
lens = nil
|
42
|
+
assoc_crds.each do |gp|
|
43
|
+
if gp.axnames.include?(nm)
|
44
|
+
len = gp.axis(nm).length
|
45
|
+
if lens && len!=lens
|
46
|
+
raise("Inconsistency in assoc coord length for ax #{nm}: #{len} (#{gp.name}) vs #{lens}")
|
47
|
+
end
|
48
|
+
lens = len
|
49
|
+
end
|
50
|
+
end
|
51
|
+
@axlens[nm] = len # can be nil
|
52
|
+
end
|
53
|
+
|
54
|
+
# < grouping in terms of original-dimension sharing >
|
55
|
+
@groups = Hash.new # axnames => assoc coord names
|
56
|
+
assoc_crds.each do |gp|
|
57
|
+
pushed = false
|
58
|
+
@groups.each do | axnames, acnames |
|
59
|
+
a = gp.axnames
|
60
|
+
if (axnames - a).length < axnames.length # included?
|
61
|
+
axnames.concat(a).uniq!
|
62
|
+
acnames.push(gp.name)
|
63
|
+
pushed = true
|
64
|
+
break
|
65
|
+
end
|
66
|
+
end
|
67
|
+
@groups[ gp.axnames ] = [gp.name] if !pushed # new group
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
71
|
+
|
72
|
+
attr_reader :assoc_crds, :axnames, :axlens
|
73
|
+
protected :assoc_crds, :axnames
|
74
|
+
|
75
|
+
def merge(other)
|
76
|
+
if other.nil?
|
77
|
+
self
|
78
|
+
else
|
79
|
+
ac = self.assoc_crds.merge(other.assoc_crds)
|
80
|
+
an = (self.axnames + other.axnames).uniq
|
81
|
+
self.class.new(ac,an)
|
82
|
+
end
|
83
|
+
end
|
84
|
+
|
85
|
+
def inspect
|
86
|
+
"<AssocCoords #{@assoc_crds.collect{|nm,gp| gp.data.inspect}.join("\n\t")}\n\t#{@groups.inspect}>"
|
87
|
+
end
|
88
|
+
|
89
|
+
def copy
|
90
|
+
self.class.new( @assoc_crds.values.collect{|gp| gp.copy}, @axnames )
|
91
|
+
end
|
92
|
+
|
93
|
+
def coord(name)
|
94
|
+
@assoc_crds[name].data # return a VArray
|
95
|
+
end
|
96
|
+
|
97
|
+
def coord_gphys(name)
|
98
|
+
@assoc_crds[name] # return a GPhys
|
99
|
+
end
|
100
|
+
|
101
|
+
def has_coord?(name)
|
102
|
+
@assoc_crds.has_key?(name)
|
103
|
+
end
|
104
|
+
|
105
|
+
def coordnames
|
106
|
+
@assoc_crds.keys
|
107
|
+
end
|
108
|
+
|
109
|
+
# assoc_crds �Ɋւ�����W�l�x�[�X�̐�o�� : ������ Hash �̂�
|
110
|
+
def cut(hash)
|
111
|
+
cutaxnms = hash.keys
|
112
|
+
newcrds = Array.new
|
113
|
+
slicer_hash = Hash.new
|
114
|
+
@groups.each do |orgaxnms, group|
|
115
|
+
ca2 = cutaxnms - group
|
116
|
+
if ca2.length < cutaxnms.length
|
117
|
+
# Some of cutaxnms are included in group
|
118
|
+
# --> Do cutting regarding this group
|
119
|
+
crds = Array.new
|
120
|
+
crdnms = Array.new
|
121
|
+
crdaxexist = Array.new
|
122
|
+
masks = Array.new # for NArrayMiss
|
123
|
+
cuts = Array.new
|
124
|
+
group.each do |nm|
|
125
|
+
cutter = hash[nm]
|
126
|
+
if !cutter.nil? && cutter!=true && cutter!=(0..-1)
|
127
|
+
crdnms.push( nm )
|
128
|
+
cuts.push( hash[nm] )
|
129
|
+
anms = @assoc_crds[nm].axnames
|
130
|
+
crdaxexist.push( NArray.to_na(
|
131
|
+
orgaxnms.collect{|a| anms.include?(a) ? 1 : 0} ) )
|
132
|
+
v = @assoc_crds[nm].val # ���W�l (NArray or NArrayMiss)
|
133
|
+
if v.is_a?(NArrayMiss)
|
134
|
+
crds.push(v.to_na)
|
135
|
+
masks.push(v.get_mask)
|
136
|
+
else
|
137
|
+
crds.push(v)
|
138
|
+
masks.push(nil)
|
139
|
+
end
|
140
|
+
end
|
141
|
+
end
|
142
|
+
cuttype = cuts.collect{|x| x.class}.uniq
|
143
|
+
if cuttype.length == 1
|
144
|
+
orgaxlens = @axlens.values_at(*orgaxnms)
|
145
|
+
if cuttype[0] == Range
|
146
|
+
vmins = Array.new
|
147
|
+
vmaxs = Array.new
|
148
|
+
cuts.each do |range|
|
149
|
+
a = range.first
|
150
|
+
b = range.last
|
151
|
+
if (b<a)
|
152
|
+
vmins.push(b)
|
153
|
+
vmaxs.push(a)
|
154
|
+
else
|
155
|
+
vmins.push(a)
|
156
|
+
vmaxs.push(b)
|
157
|
+
end
|
158
|
+
end
|
159
|
+
idxs = cut_range(vmins,vmaxs,crds,masks,crdaxexist,orgaxlens)
|
160
|
+
elsif cuttype[0] == Numeric
|
161
|
+
raise "SORRY! cut_nearest is yet to be implemented."
|
162
|
+
idxs = cut_nearest() # YET TO BE IMPLEMENT
|
163
|
+
else
|
164
|
+
raise ArgumentError, "Not allowed cutting type (#{cuttype[0]})"
|
165
|
+
end
|
166
|
+
ncrds = group.collect{ |nm|
|
167
|
+
gp = @assoc_crds[nm]
|
168
|
+
sl = gp.axnames.collect{|anm| idxs[orgaxnms.index(anm)]}
|
169
|
+
gp[ *sl ]
|
170
|
+
}
|
171
|
+
newcrds.concat( ncrds )
|
172
|
+
orgaxnms.each_with_index{|nm,i| slicer_hash[nm] = idxs[i]}
|
173
|
+
else
|
174
|
+
raise "Cutting specification for a group of assoc coords (here, #{group.inspect}) must be uniformly set to either by range or by point -- Cannot mix."
|
175
|
+
end
|
176
|
+
else
|
177
|
+
# None of cutaxnms are included in group --> just copy
|
178
|
+
ncrds = group.collect{ |nm| @assoc_crds[nm] }
|
179
|
+
newcrds.concat( ncrds )
|
180
|
+
end
|
181
|
+
cutaxnms = ca2
|
182
|
+
break if cutaxnms.length == 0 # cutting finished
|
183
|
+
end
|
184
|
+
new_assocoords = self.class.new( newcrds, @axnames )
|
185
|
+
[ new_assocoords, slicer_hash ]
|
186
|
+
end
|
187
|
+
|
188
|
+
# slicing in terms of the original axes
|
189
|
+
#
|
190
|
+
def [](*args)
|
191
|
+
return self.dup if args.length == 0
|
192
|
+
|
193
|
+
args = __rubber_expansion( args )
|
194
|
+
slicer = Hash.new
|
195
|
+
@axnames.each_with_index{|nm,i| slicer[nm] = args[i]}
|
196
|
+
|
197
|
+
new_assoc_crds = Array.new
|
198
|
+
lost_assoc_crds = Array.new
|
199
|
+
@assoc_crds.each do |dummy, gp|
|
200
|
+
sub = gp[ *( gp.axnames.collect{|nm| slicer[nm] || true} ) ]
|
201
|
+
if sub.rank > 0
|
202
|
+
new_assoc_crds.push( sub )
|
203
|
+
else
|
204
|
+
lost_assoc_crds.push( "#{sub.name}=#{sub.val}" )
|
205
|
+
end
|
206
|
+
end
|
207
|
+
|
208
|
+
ret = self.class.new( new_assoc_crds, @axnames )
|
209
|
+
ret.set_lost_coords( lost_assoc_crds ) if !lost_assoc_crds.empty?
|
210
|
+
ret
|
211
|
+
end
|
212
|
+
|
213
|
+
# make a subset with assoc coords related only to axnames
|
214
|
+
def subset_having_axnames( axnames )
|
215
|
+
acnms = Array.new
|
216
|
+
@groups.each do |ks,vs|
|
217
|
+
acnms.concat(vs) if ( (ks-axnames).length == 0 ) # all of ks present
|
218
|
+
end
|
219
|
+
assoc_crds = acnms.collect{|nm| @assoc_crds[nm]}
|
220
|
+
self.class.new(assoc_crds, axnames)
|
221
|
+
end
|
222
|
+
|
223
|
+
def set_lost_coords( lost_assoc_crds )
|
224
|
+
@lost_assoc_crds = lost_assoc_crds # Array of String
|
225
|
+
self
|
226
|
+
end
|
227
|
+
|
228
|
+
def lost_coords
|
229
|
+
@lost_assoc_crds.dup
|
230
|
+
end
|
231
|
+
|
232
|
+
def __rubber_expansion( args )
|
233
|
+
if (id = args.index(false)) # substitution into id
|
234
|
+
# false is incuded
|
235
|
+
rank = @axnames.length
|
236
|
+
alen = args.length
|
237
|
+
if args.rindex(false) != id
|
238
|
+
raise ArguemntError,"only one rubber dimension is permitted"
|
239
|
+
elsif alen > rank+1
|
240
|
+
raise ArgumentError, "too many args"
|
241
|
+
end
|
242
|
+
ar = ( id!=0 ? args[0..id-1] : [] )
|
243
|
+
args = ar + [true]*(rank-alen+1) + args[id+1..-1]
|
244
|
+
end
|
245
|
+
args
|
246
|
+
end
|
247
|
+
private :__rubber_expansion
|
248
|
+
|
249
|
+
end
|
250
|
+
|
251
|
+
end
|
252
|
+
|
253
|
+
|
254
|
+
|
255
|
+
#######################################
|
256
|
+
## < test >
|
257
|
+
if $0 == __FILE__
|
258
|
+
require "numru/gphys"
|
259
|
+
include NumRu
|
260
|
+
include NMath
|
261
|
+
nx = 10
|
262
|
+
ny = 7
|
263
|
+
nz = 2
|
264
|
+
x = (NArray.sfloat(nx).indgen! + 0.5) * (2*PI/nx)
|
265
|
+
y = NArray.sfloat(ny).indgen! * (2*PI/(ny-1))
|
266
|
+
z = NArray.sfloat(nz).indgen!
|
267
|
+
vx = VArray.new( x ).rename("x")
|
268
|
+
vy = VArray.new( y ).rename("y")
|
269
|
+
vz = VArray.new( z ).rename("z")
|
270
|
+
xax = Axis.new().set_pos(vx)
|
271
|
+
yax = Axis.new().set_pos(vy)
|
272
|
+
zax = Axis.new().set_pos(vz)
|
273
|
+
xygrid = Grid.new(xax, yax)
|
274
|
+
xyzgrid = Grid.new(xax, yax, zax)
|
275
|
+
p xygrid, xyzgrid
|
276
|
+
|
277
|
+
sqrt2 = sqrt(2.0)
|
278
|
+
|
279
|
+
p = NArray.sfloat(nx,ny)
|
280
|
+
q = NArray.sfloat(nx,ny)
|
281
|
+
for j in 0...ny
|
282
|
+
p[true,j] = NArray.sfloat(nx).indgen!(2*j,1)*sqrt2
|
283
|
+
q[true,j] = NArray.sfloat(nx).indgen!(2*j,-1)*sqrt2
|
284
|
+
end
|
285
|
+
vp = VArray.new( p ).rename("p")
|
286
|
+
vq = VArray.new( q ).rename("q")
|
287
|
+
gp = GPhys.new(xygrid, vp)
|
288
|
+
gq = GPhys.new(xygrid, vq)
|
289
|
+
|
290
|
+
r = NArray.sfloat(nz).indgen! * 2
|
291
|
+
vr = VArray.new( r ).rename("r")
|
292
|
+
gr = GPhys.new( Grid.new(zax), vr )
|
293
|
+
|
294
|
+
assoc = AssocCoords.new([gp,gq], xyzgrid.axnames)
|
295
|
+
assoc2 = AssocCoords.new([gp,gq,gr], xyzgrid.axnames)
|
296
|
+
|
297
|
+
print "--- AssocCoord objects ---\n"
|
298
|
+
p assoc, assoc2
|
299
|
+
p assoc.coordnames
|
300
|
+
p assoc.axlens
|
301
|
+
|
302
|
+
print "\n----- Subsetting by [] -----\n"
|
303
|
+
|
304
|
+
sa = assoc[0..3,{0..4=>2}]
|
305
|
+
p sa.coord('p').val, sa.coord('q').val
|
306
|
+
p sa.copy
|
307
|
+
|
308
|
+
p assoc[1,2].lost_coords
|
309
|
+
|
310
|
+
print "\n----- Subsetting by cut -----\n"
|
311
|
+
|
312
|
+
ac,sl = assoc.cut('p'=>4.0..10.0)
|
313
|
+
p ac.copy,sl
|
314
|
+
ac2,sl = assoc2.cut('p'=>4.0..10.0)
|
315
|
+
p ac2.copy,sl
|
316
|
+
|
317
|
+
print "\n----- GPhys making -----\n"
|
318
|
+
|
319
|
+
d = sin(x.newdim(1,1)) * cos(y.newdim(0,1)) + z.newdim(0,0)
|
320
|
+
vd = VArray.new( d ).rename("d")
|
321
|
+
gd = GPhys.new(xyzgrid, vd)
|
322
|
+
gd.set_assoc_coords([gp,gq,gr])
|
323
|
+
print "GPhys with associated coordinates:\n"
|
324
|
+
p gd
|
325
|
+
|
326
|
+
print "Coordiantes:\n"
|
327
|
+
p gd.axnames
|
328
|
+
p gd.coordnames
|
329
|
+
p gd.coord("p")
|
330
|
+
|
331
|
+
print "\n--- GPhys Subsetting ---\n"
|
332
|
+
p gd[1..2,0,0].copy
|
333
|
+
p gd[0,false].first2D
|
334
|
+
|
335
|
+
p gd.cut('p'=>4.0..10.0, 'z'=>0).copy
|
336
|
+
|
337
|
+
=begin
|
338
|
+
print "\n--- writing in a NetCDF file ---\n"
|
339
|
+
file = NetCDF.create("tmp.nc")
|
340
|
+
GPhys::IO.write(file,gd)
|
341
|
+
file.close
|
342
|
+
=end
|
343
|
+
|
344
|
+
print "\n--- GPhys methods that need proper AssocCoord handling ---\n"
|
345
|
+
print "* mean(2)\n"
|
346
|
+
p gd.mean(2)
|
347
|
+
print "* stddev(0)\n"
|
348
|
+
p gd.stddev(0)
|
349
|
+
print "* integrate(0)\n"
|
350
|
+
p gd.integrate(1)
|
351
|
+
|
352
|
+
print "\n--- coord_dim ---\n"
|
353
|
+
grid = gd.grid_copy
|
354
|
+
grid.coordnames.each do |nm|
|
355
|
+
print nm, " ", grid.coord_dim_indices(nm).inspect, "\n"
|
356
|
+
end
|
357
|
+
|
358
|
+
end
|
359
|
+
|
@@ -0,0 +1,129 @@
|
|
1
|
+
require "narray"
|
2
|
+
|
3
|
+
module NumRu
|
4
|
+
=begin
|
5
|
+
=class Attribute < Hash
|
6
|
+
A Hash class compatible with NetCDF attributes.
|
7
|
+
* Values are restricted to NetCDFAttr values
|
8
|
+
* Keys must be String or Symbol (Symbol is converted into String such that
|
9
|
+
they are used interchangeably. E.g., attr[:units] == attr["units"] )
|
10
|
+
=end
|
11
|
+
class Attribute < Hash
|
12
|
+
# privatalize all so that public methods must be set explicitly
|
13
|
+
private( *((Hash.instance_methods(false) - Object.new.methods).
|
14
|
+
collect{|i| i.intern} - [:[], :default]))
|
15
|
+
#":[]" and ":default" should not be private on ruby 1.9.
|
16
|
+
#Once they become private, super does not work well.
|
17
|
+
|
18
|
+
#protected :[], :[]= # to be aliased
|
19
|
+
#-> Alias does not work well in this case on ruby 1.9 !!!
|
20
|
+
public :each, :each_key, :length, :keys, :delete, :delete_if
|
21
|
+
public :has_key?, :include?, :key?, :merge, :update
|
22
|
+
|
23
|
+
def initialize
|
24
|
+
super
|
25
|
+
end
|
26
|
+
|
27
|
+
class << self
|
28
|
+
## < class methods > ##
|
29
|
+
|
30
|
+
def [](*keyval)
|
31
|
+
attr = new
|
32
|
+
0.step(keyval.length-1,2){ |i|
|
33
|
+
key,val = keyval[i],keyval[i+1]
|
34
|
+
if key.is_a?(Symbol)
|
35
|
+
key=key.to_s
|
36
|
+
elsif ! key.is_a?(String)
|
37
|
+
raise ArgumentError,"Attribute key must be String or Symbol: #{key} -- #{key.class}."
|
38
|
+
end
|
39
|
+
attr[key]=val
|
40
|
+
}
|
41
|
+
attr
|
42
|
+
end
|
43
|
+
end
|
44
|
+
|
45
|
+
## < methods > ##
|
46
|
+
|
47
|
+
def copy(to=nil)
|
48
|
+
# deep copy (clone), or addition to "to" if given.
|
49
|
+
if to == nil
|
50
|
+
to = NumRu::Attribute.new
|
51
|
+
end
|
52
|
+
self.each{|key, val|
|
53
|
+
if(val)
|
54
|
+
to[key] = val.clone
|
55
|
+
else
|
56
|
+
to[key] = val
|
57
|
+
end
|
58
|
+
}
|
59
|
+
to
|
60
|
+
end
|
61
|
+
|
62
|
+
def [](key)
|
63
|
+
if key.is_a?(Symbol)
|
64
|
+
key = key.to_s
|
65
|
+
elsif ! key.is_a?(String)
|
66
|
+
raise ArgumentError, "Attribute key must be Symbol or String: #{key} -- #{key.class}."
|
67
|
+
end
|
68
|
+
if /^[A-Za-z_]\w*$/ !~ key
|
69
|
+
raise ArgumentError, "Attribute key must match /^[A-Za-z_]\w*$/"
|
70
|
+
end
|
71
|
+
super(key)
|
72
|
+
end
|
73
|
+
|
74
|
+
def []=(key, val)
|
75
|
+
if _val_allowed?(val)
|
76
|
+
if key.is_a?(Symbol)
|
77
|
+
key = key.to_s
|
78
|
+
elsif ! key.is_a?(String)
|
79
|
+
raise ArgumentError, "Attribute key must be Symbol or String: #{key} -- #{key.class}."
|
80
|
+
end
|
81
|
+
super(key, val)
|
82
|
+
else
|
83
|
+
raise ArgumentError, "Not allowed as an attribute value: #{val} (String or NArray/Array of numerics are required`)"
|
84
|
+
end
|
85
|
+
val
|
86
|
+
end
|
87
|
+
|
88
|
+
def rename(key_from, key_to)
|
89
|
+
v = self[key_from]
|
90
|
+
if v==nil; raise "attribute #{key_from} does not exist"; end
|
91
|
+
self[key_to]=v
|
92
|
+
self.delete(key_from)
|
93
|
+
end
|
94
|
+
|
95
|
+
## < private methods > ##
|
96
|
+
private
|
97
|
+
def _val_allowed?(val)
|
98
|
+
# to ensure the compatibility with NetCDFAttr
|
99
|
+
begin
|
100
|
+
val.is_a?(String) ||
|
101
|
+
## val.is_a?(Numeric) || # disabled 2005/03/25 by horinout
|
102
|
+
val.is_a?(NilClass) ||
|
103
|
+
( ( (val.is_a?(NArray) && val.rank==1) ||
|
104
|
+
(val.is_a?(Array) && val=NArray.to_na(val)) ) &&
|
105
|
+
val.typecode <= NArray::DFLOAT )
|
106
|
+
rescue
|
107
|
+
# for possible error in val=NArray.to_na(val)) above
|
108
|
+
false
|
109
|
+
end
|
110
|
+
end
|
111
|
+
end
|
112
|
+
end
|
113
|
+
|
114
|
+
if __FILE__ == $0
|
115
|
+
a = NumRu::Attribute.new
|
116
|
+
p a
|
117
|
+
a["name"]="takeshi"
|
118
|
+
p a
|
119
|
+
b = @attr = NumRu::Attribute[:name2,"var", :units,"m/s", :valid_range,nil]
|
120
|
+
p b[:units]
|
121
|
+
p b["units"]
|
122
|
+
p b
|
123
|
+
p b["allowd"] = [1,10]
|
124
|
+
begin
|
125
|
+
b["not_allowd"] = [1,10,'no, no']
|
126
|
+
rescue
|
127
|
+
print "(OK): exception raised as expected\n"
|
128
|
+
end
|
129
|
+
end
|