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,415 @@
|
|
1
|
+
require "numru/gphys/varray"
|
2
|
+
|
3
|
+
=begin
|
4
|
+
=class NumRu::VArrayComposite < NumRu::VArray
|
5
|
+
|
6
|
+
a VArray that consists of multiple VArrays tiled regularly
|
7
|
+
(possibly in multi-dimension). Except for the constructer
|
8
|
+
"new" and ((<attr_update>)), the usage of this class is the same as VArray.
|
9
|
+
|
10
|
+
Note that the name and the attributes of a VArrayComposite is
|
11
|
+
borrowed form one of the VArrays contained (actually, the first one
|
12
|
+
is used). Currently, no check is made
|
13
|
+
regarding whether the names and attributes are the same among the
|
14
|
+
VArrays contained. If you rename a VArrayComposite, the change will
|
15
|
+
be made with all the VArrays contained. However, currently,
|
16
|
+
change of the attributes are only reflected only in the first
|
17
|
+
VArray. You have to call ((<attr_update>)) separately.
|
18
|
+
|
19
|
+
==Class methods
|
20
|
+
---VArrayComposite.new(varrays)
|
21
|
+
Constructor
|
22
|
+
|
23
|
+
ARGUMENTS
|
24
|
+
* varrays (NArray of VArray) : VArrays to be included, gridded
|
25
|
+
regularly in a NArray.
|
26
|
+
|
27
|
+
RETURN VALUE
|
28
|
+
* a VArrayComposite
|
29
|
+
|
30
|
+
EXAMPLES
|
31
|
+
* Suppose that you have VArrays va00, va01, va10, va00,
|
32
|
+
with va00 and va10 having a same 0th dimension length,
|
33
|
+
va01 and va11 having a same 0th dimension length,
|
34
|
+
and va00 and va01 having a same 1st dimention length.
|
35
|
+
|
36
|
+
varrays = NArray[ [ va00, va01 ],
|
37
|
+
[ va10, va11 ] ]
|
38
|
+
vac = VArrayComposite.new(varrays)
|
39
|
+
|
40
|
+
This will create a composite VArray tiled two-dimensionally.
|
41
|
+
|
42
|
+
* You can create a VArray that lacks one or more VArrays as
|
43
|
+
long as the shape is unambiguous:
|
44
|
+
|
45
|
+
vac = VArrayComposite.new( NArray[ [ va00, va01 ],
|
46
|
+
[ va10, nil ] ] )
|
47
|
+
is allowed, but
|
48
|
+
vac = VArrayComposite.new( NArray[ [ va00, nil ],
|
49
|
+
[ va10, nil ] ] )
|
50
|
+
is prohibited.
|
51
|
+
|
52
|
+
NOTICE: At this moment, handling of such nil-contianing
|
53
|
+
VArrayComposite is very limited, and many methods do not work.
|
54
|
+
|
55
|
+
* Suppose that you have 3D VArrays va0, va1, va2, va3,
|
56
|
+
and you want to concatenate them with the 3rd dimension.
|
57
|
+
|
58
|
+
varrays = NArray[ va0,va1,va2,va3 ].newdim(0,0)
|
59
|
+
|
60
|
+
This will create a 3D NArray with a shape of [1,1,4].
|
61
|
+
Then you can make the composite as follows:
|
62
|
+
|
63
|
+
vac = VArrayComposite.new(varrays)
|
64
|
+
|
65
|
+
Usage of all the other class methods are the same as in VArray.
|
66
|
+
|
67
|
+
=end
|
68
|
+
|
69
|
+
module NumRu
|
70
|
+
class VArrayComposite < VArray
|
71
|
+
|
72
|
+
def initialize( varrays )
|
73
|
+
|
74
|
+
if !varrays.is_a?(NArray) || varrays.typecode != NArray::OBJECT
|
75
|
+
raise ArgumentError, "argument must be a NArray of VArray (or nil)"
|
76
|
+
end
|
77
|
+
|
78
|
+
nvas = varrays.shape
|
79
|
+
vrank = nvas.length
|
80
|
+
rank=0
|
81
|
+
varrays.each{|va|
|
82
|
+
if va.is_a?(VArray)
|
83
|
+
@first_vary = va
|
84
|
+
@attr = @first_vary.attr
|
85
|
+
@name = @first_vary.name
|
86
|
+
@rank = va.rank
|
87
|
+
break
|
88
|
+
end
|
89
|
+
}
|
90
|
+
if vrank > @rank
|
91
|
+
raise ArgumentError, "rank of varrays > rank of the VArray"
|
92
|
+
elsif vrank < @rank
|
93
|
+
(@rank - vrank).times{
|
94
|
+
varrays = varrays.newdim(vrank)
|
95
|
+
nvas.push(1)
|
96
|
+
}
|
97
|
+
vrank = @rank
|
98
|
+
end
|
99
|
+
|
100
|
+
@bound_idx = Array.new # will be Array of Array
|
101
|
+
for dim in 0...vrank
|
102
|
+
@bound_idx[dim] = [0] # the frst element is always 0
|
103
|
+
for i in 0...nvas[dim]
|
104
|
+
idx = [true]*dim + [i..i,false]
|
105
|
+
set=false
|
106
|
+
len=0
|
107
|
+
varrays[*idx].each{|va|
|
108
|
+
if !set && va
|
109
|
+
if !va.is_a?(VArray)
|
110
|
+
raise ArgumentError,"Not a VArray: #{va.inspect}"
|
111
|
+
end
|
112
|
+
len = va.shape_current[dim]
|
113
|
+
@bound_idx[dim][i+1] = @bound_idx[dim][i] + len
|
114
|
+
set=true
|
115
|
+
elsif va
|
116
|
+
if va.shape_current[dim] != len
|
117
|
+
raise ArgumentError,"Non-uniformity in the #{i}th element"+
|
118
|
+
" of the #{dim}th dimension (#{va.shape_current[dim]} for #{len})"
|
119
|
+
end
|
120
|
+
end
|
121
|
+
}
|
122
|
+
if !set
|
123
|
+
raise "No VArray is found in the #{i}th elem of the #{dim}th dim"
|
124
|
+
end
|
125
|
+
end
|
126
|
+
end
|
127
|
+
#< finish >
|
128
|
+
@varrays = varrays.dup
|
129
|
+
@shape = @bound_idx.collect{|a| a[-1]}
|
130
|
+
@length = 1
|
131
|
+
@shape.each{|l| @length *= l}
|
132
|
+
# p @bound_idx, @varrays
|
133
|
+
end
|
134
|
+
|
135
|
+
undef initialize_mapping
|
136
|
+
|
137
|
+
def set_att(name,val)
|
138
|
+
@varrays.each{|va|
|
139
|
+
va.set_att(name,val)
|
140
|
+
}
|
141
|
+
self
|
142
|
+
end
|
143
|
+
|
144
|
+
undef :mapping, :varray, :ary
|
145
|
+
|
146
|
+
def inspect
|
147
|
+
"<#{self.class.to_s} shape=#{shape.inspect} #_of_tiles=#{@bound_idx.collect{|b| b.length-1}.inspect}>"
|
148
|
+
# "bounds=#{@bound_idx.collect{|b| b[1..-2]}.inspect}"
|
149
|
+
end
|
150
|
+
|
151
|
+
def shape
|
152
|
+
@shape
|
153
|
+
end
|
154
|
+
alias shape_current shape
|
155
|
+
def rank
|
156
|
+
@rank
|
157
|
+
end
|
158
|
+
def length
|
159
|
+
@length
|
160
|
+
end
|
161
|
+
alias total length
|
162
|
+
|
163
|
+
def val
|
164
|
+
val = nil
|
165
|
+
loop_multi_dim_index( @varrays.shape ){|index|
|
166
|
+
vidx = Array.new
|
167
|
+
for d in 0...@rank
|
168
|
+
vidx[d] = (@bound_idx[d][index[d]])..(@bound_idx[d][index[d]+1]-1)
|
169
|
+
end
|
170
|
+
v = @varrays[*index].val
|
171
|
+
if !val
|
172
|
+
if NArray===v
|
173
|
+
val = NArray.new(v.typecode,*@shape)
|
174
|
+
elsif NArrayMiss===v
|
175
|
+
val = NArrayMiss.new(v.typecode,*@shape)
|
176
|
+
else
|
177
|
+
raise TypeError, "Unexpected type #{v.class}"
|
178
|
+
end
|
179
|
+
end
|
180
|
+
val[*vidx] = @varrays[*index].val
|
181
|
+
}
|
182
|
+
val
|
183
|
+
end
|
184
|
+
|
185
|
+
def val=(narray)
|
186
|
+
loop_multi_dim_index( @varrays.shape ){|index|
|
187
|
+
if narray.is_a?(Numeric)
|
188
|
+
sub = narray
|
189
|
+
else
|
190
|
+
__check_ary_class(narray)
|
191
|
+
vidx = Array.new
|
192
|
+
for d in 0...@rank
|
193
|
+
vidx[d] = (@bound_idx[d][index[d]])..(@bound_idx[d][index[d]+1]-1)
|
194
|
+
end
|
195
|
+
sub=narray[*vidx]
|
196
|
+
end
|
197
|
+
@varrays[*index].val = sub
|
198
|
+
}
|
199
|
+
narray
|
200
|
+
end
|
201
|
+
|
202
|
+
def [](*slicer)
|
203
|
+
slicer = __rubber_expansion(slicer)
|
204
|
+
varrays = _div_idx(*slicer)
|
205
|
+
if varrays.length == 1
|
206
|
+
varrays[0]
|
207
|
+
else
|
208
|
+
VArrayComposite.new( varrays )
|
209
|
+
end
|
210
|
+
end
|
211
|
+
|
212
|
+
def []=(*args)
|
213
|
+
args = __rubber_expansion(args)
|
214
|
+
val = args.pop
|
215
|
+
slicer = args
|
216
|
+
slicer.collect!{|i| (i.is_a?(Numeric)) ? i..i : i }
|
217
|
+
subva = self[*slicer]
|
218
|
+
val = val.val if val.is_a?(VArray)
|
219
|
+
subva.val= val
|
220
|
+
val
|
221
|
+
end
|
222
|
+
|
223
|
+
# def ntype
|
224
|
+
# @first_vary.ntype
|
225
|
+
# end
|
226
|
+
def ntype
|
227
|
+
__ntype(typecode)
|
228
|
+
end
|
229
|
+
|
230
|
+
def typecode
|
231
|
+
@first_vary.typecode
|
232
|
+
end
|
233
|
+
|
234
|
+
def file
|
235
|
+
@varrays.collect{|va| va.file}
|
236
|
+
end
|
237
|
+
|
238
|
+
def name=(nm)
|
239
|
+
raise ArgumentError, "name should be a String" if ! nm.is_a?(String)
|
240
|
+
@name = nm
|
241
|
+
@varrays.each{|va| va.name=nm}
|
242
|
+
nm
|
243
|
+
end
|
244
|
+
def rename(nm)
|
245
|
+
raise "method rename is not vailable. (But rename! and name= are available)"
|
246
|
+
## self.dup.set_name_shallow(nm)
|
247
|
+
end
|
248
|
+
|
249
|
+
# def set_name_shallow(nm)
|
250
|
+
# raise ArgumentError, "name should be a String" if ! nm.is_a?(String)
|
251
|
+
# @name = nm
|
252
|
+
# self
|
253
|
+
# end
|
254
|
+
# protected set_name_shallow
|
255
|
+
|
256
|
+
#def reshape!( *shape )
|
257
|
+
# raise "cannot reshape a #{class}. Use copy first to make it a VArray with NArray"
|
258
|
+
#end
|
259
|
+
undef reshape!
|
260
|
+
|
261
|
+
## Not needed, so far:
|
262
|
+
#def convention
|
263
|
+
# @first_vary.convention
|
264
|
+
#end
|
265
|
+
|
266
|
+
################# private #####################
|
267
|
+
private
|
268
|
+
|
269
|
+
def loop_multi_dim_index(shape)
|
270
|
+
cumshape=[1]
|
271
|
+
rank = shape.length
|
272
|
+
(1..rank).each{|i| cumshape[i] = shape[i-1]*cumshape[i-1]}
|
273
|
+
len = cumshape[-1]
|
274
|
+
for i in 0...len
|
275
|
+
index = (0...rank).collect{|d| (i/cumshape[d])%shape[d]}
|
276
|
+
yield(index)
|
277
|
+
end
|
278
|
+
end
|
279
|
+
|
280
|
+
def _div_idx(*idx)
|
281
|
+
if idx.length != @rank
|
282
|
+
raise ArgumentError, "length of args != rank"
|
283
|
+
end
|
284
|
+
imask = Array.new
|
285
|
+
isub = Array.new
|
286
|
+
idx.each_with_index{ |ix, dim|
|
287
|
+
size = @bound_idx[dim][-1]
|
288
|
+
imask[dim] = Array.new
|
289
|
+
isub[dim] = Array.new
|
290
|
+
for j in 0...(@bound_idx[dim].length)
|
291
|
+
match, isb = _imatch( size, ix, @bound_idx[dim][j..j+1] )
|
292
|
+
if match
|
293
|
+
imask[dim].push(j)
|
294
|
+
isub[dim].push(isb)
|
295
|
+
end
|
296
|
+
end
|
297
|
+
}
|
298
|
+
varrays = @varrays[ *imask ]
|
299
|
+
loop_multi_dim_index( varrays.shape ){ |index|
|
300
|
+
slice = Array.new
|
301
|
+
isub.each_with_index{|is, d| slice[d]=is[index[d]]}
|
302
|
+
varrays[*index] = varrays[*index][*slice]
|
303
|
+
}
|
304
|
+
shape = varrays.shape
|
305
|
+
(idx.length-1).downto(0){ |d|
|
306
|
+
if idx[d].is_a?(Integer)
|
307
|
+
shape.delete_at(d)
|
308
|
+
end
|
309
|
+
}
|
310
|
+
varrays.reshape!(*shape)
|
311
|
+
varrays
|
312
|
+
end
|
313
|
+
|
314
|
+
def _imatch( size, index, bounds )
|
315
|
+
first = bounds[0]
|
316
|
+
last = bounds[-1]-1
|
317
|
+
case index
|
318
|
+
when Integer
|
319
|
+
index += size if index < 0
|
320
|
+
if first <= index && index <= last
|
321
|
+
return [true, index-first ]
|
322
|
+
else
|
323
|
+
return [false, nil]
|
324
|
+
end
|
325
|
+
when Range, Hash, true
|
326
|
+
if true === index
|
327
|
+
fst,lst = 0,size-1
|
328
|
+
stp = 1
|
329
|
+
elsif Range === index
|
330
|
+
fst = index.first
|
331
|
+
fst += size if fst < 0
|
332
|
+
lst = index.exclude_end? ? index.last-1 : index.last
|
333
|
+
lst += size if lst < 0
|
334
|
+
stp = 1
|
335
|
+
else # Hash
|
336
|
+
range, stp = index.to_a[0]
|
337
|
+
range = 0..-1 if range==true
|
338
|
+
fst = range.first
|
339
|
+
fst += size if fst < 0
|
340
|
+
lst = range.last
|
341
|
+
lst += size if lst < 0
|
342
|
+
if range.exclude_end?
|
343
|
+
stp>=0 ? lst-=1 : lst+=1
|
344
|
+
end
|
345
|
+
end
|
346
|
+
if fst <= last && lst >= first
|
347
|
+
a = ( (fst >= first) ? fst-first : (fst - first).modulo(stp) )
|
348
|
+
b = ( (lst <= last) ? lst-first : last-first )
|
349
|
+
if stp==1
|
350
|
+
return [true, a..b ]
|
351
|
+
else
|
352
|
+
return [true, {(a..b) => stp} ]
|
353
|
+
end
|
354
|
+
else
|
355
|
+
return [false, nil]
|
356
|
+
end
|
357
|
+
else
|
358
|
+
raise "Unsupported type for indexing: #{index.class}"
|
359
|
+
end
|
360
|
+
end
|
361
|
+
|
362
|
+
def __rubber_expansion( args )
|
363
|
+
if (id = args.index(false)) # substitution into id
|
364
|
+
# false is incuded
|
365
|
+
alen = args.length
|
366
|
+
if args.rindex(false) != id
|
367
|
+
raise ArguemntError,"only one rubber dimension is permitted"
|
368
|
+
elsif alen > rank+1
|
369
|
+
raise ArgumentError, "too many args"
|
370
|
+
end
|
371
|
+
ar = ( id!=0 ? args[0..id-1] : [] )
|
372
|
+
args = ar + [true]*(rank-alen+1) + args[id+1..-1]
|
373
|
+
end
|
374
|
+
args
|
375
|
+
end
|
376
|
+
|
377
|
+
end
|
378
|
+
end
|
379
|
+
|
380
|
+
###############################################
|
381
|
+
|
382
|
+
if __FILE__ == $0
|
383
|
+
include NumRu
|
384
|
+
va00 = VArray.new( NArray.float(2,3,2).indgen!, nil, 'TEST' )
|
385
|
+
va01 = VArray.new( NArray.float(2,4,2).indgen!+100 )
|
386
|
+
va10 = VArray.new( NArray.float(5,3,2).indgen!+200 )
|
387
|
+
va11 = VArray.new( NArray.float(5,4,2).indgen!+300 )
|
388
|
+
varrays = NArray[ [ va00, va10 ],
|
389
|
+
[ va01, va11 ] ]
|
390
|
+
p vac = VArrayComposite.new(varrays)
|
391
|
+
varrays = NArray[ [ va00.copy, nil ],
|
392
|
+
[ va01.copy, va11.copy ] ]
|
393
|
+
p vac2 = VArrayComposite.new(varrays)
|
394
|
+
p vac.ntype, vac.typecode
|
395
|
+
p vac.val
|
396
|
+
vacs = vac[1..3,0..3,true]
|
397
|
+
p vacs.val
|
398
|
+
p vac[false,1]
|
399
|
+
vacs.val *= -1
|
400
|
+
p vac.val
|
401
|
+
vacs.val = 999.0
|
402
|
+
p vac.val
|
403
|
+
vac[-1, 0..1, true] = 0.0
|
404
|
+
p vac.val
|
405
|
+
p( (vac*100.0).val, vac.sin.val )
|
406
|
+
vac2[0, 0..1, true] = 1000.0
|
407
|
+
p vac2[0..1, 0..1, true].val
|
408
|
+
p vac.name
|
409
|
+
p vac.name='test'
|
410
|
+
p va01.name
|
411
|
+
vac.set_att('long_name', 'test data')
|
412
|
+
p vac.get_att('long_name')
|
413
|
+
p va01.get_att('long_name')
|
414
|
+
p vac.typecode,vac.ntype
|
415
|
+
end
|
@@ -0,0 +1,225 @@
|
|
1
|
+
=begin
|
2
|
+
=ToDo list
|
3
|
+
* Support a temporay attribute (@tmp_attr = Attribute.new)
|
4
|
+
=end
|
5
|
+
|
6
|
+
require "numru/gphys/grads_gridded"
|
7
|
+
require "numru/gphys/varray"
|
8
|
+
|
9
|
+
module NumRu
|
10
|
+
|
11
|
+
class VArrayGrADS < VArray
|
12
|
+
|
13
|
+
## < initialization redefined > ##
|
14
|
+
|
15
|
+
def initialize(aGrADSVar)
|
16
|
+
@name = aGrADSVar.name
|
17
|
+
@mapping = nil
|
18
|
+
@varray = nil
|
19
|
+
raise ArgumentError,"Not a GrADSVar" if ! aGrADSVar.is_a?(GrADSVar)
|
20
|
+
@ary = aGrADSVar
|
21
|
+
@attr = aGrADSVar.attr
|
22
|
+
end
|
23
|
+
|
24
|
+
def inspect
|
25
|
+
# "<'#{@name}' in '#{@ary.file.path}' #{@ary.ntype}#{shape_current.inspect}>"
|
26
|
+
"<'#{@name}' #{shape_current.inspect}>"
|
27
|
+
end
|
28
|
+
|
29
|
+
class << self
|
30
|
+
## < redefined class methods > ##
|
31
|
+
|
32
|
+
def new2(file, name, ntype, dimensions, attr=nil)
|
33
|
+
va = new( file.def_var(name, ntype, dimensions) )
|
34
|
+
if attr; attr.each{|key,val| va.attr[key]=val}; end
|
35
|
+
va
|
36
|
+
end
|
37
|
+
|
38
|
+
## < additional class methods > ##
|
39
|
+
|
40
|
+
def write_control(file, gphys)
|
41
|
+
raise ArgumentError, "1st arg: not a GrADS_Gridded" if !file.is_a?(GrADS_Gridded)
|
42
|
+
rank = gphys.data.rank
|
43
|
+
raise ArgumentError, "only 4D data is supported" if rank != 4
|
44
|
+
|
45
|
+
for i in 0..2 # lon, lat, lev
|
46
|
+
c = ""
|
47
|
+
if ( i==1 && (gphys.coord(i).length > 1) &&
|
48
|
+
(gphys.coord(i).val[1]-gphys.coord(i).val[0] < 0) )
|
49
|
+
file.put_att("yrev",true)
|
50
|
+
gphys.axis(i).pos.val[-1..0].each{|j| c += (j.to_s + " ")}
|
51
|
+
elsif( i==2 && (gphys.coord(i).length > 1) &&
|
52
|
+
(gphys.coord(i)[1].val-gphys.coord(i)[0].val > 0) )
|
53
|
+
file.put_att("zrev",true)
|
54
|
+
gphys.axis(i).pos.val[-1..0].each{|j| c += (j.to_s + " ")}
|
55
|
+
else
|
56
|
+
gphys.axis(i).pos.val.each{|j| c += (j.to_s + " ")}
|
57
|
+
end
|
58
|
+
file.dimensions[i] = {
|
59
|
+
:len=>gphys.axis(i).pos.length,
|
60
|
+
:flag=> "LEVELS",
|
61
|
+
:spec=> c.gsub(/(-*\d+\.\d+ ){5,5}/,'\0'+"\n ")
|
62
|
+
}
|
63
|
+
end
|
64
|
+
|
65
|
+
i = 3 # time
|
66
|
+
sunits = gphys.coord(i).get_att("units")
|
67
|
+
/(.*) *since *(.*)/ =~ sunits
|
68
|
+
if (!$1 or !$2)
|
69
|
+
raise("Units mismatch. Requires time units that includes 'since'")
|
70
|
+
end
|
71
|
+
increment_units = $1
|
72
|
+
startdatetime = DateTime.parse($2)
|
73
|
+
|
74
|
+
if( gphys.coord(i).length > 1 )
|
75
|
+
increment = gphys.coord(i)[1].val - gphys.coord(i)[0].val
|
76
|
+
else
|
77
|
+
increment = 1.0 # anything is possible
|
78
|
+
end
|
79
|
+
|
80
|
+
file.dimensions[i] = {
|
81
|
+
:len=>gphys.axis(i).pos.length,
|
82
|
+
:flag=> "LINEAR",
|
83
|
+
:startdatetime=>startdatetime,
|
84
|
+
:increment=>increment,
|
85
|
+
:increment_units=>increment_units
|
86
|
+
}
|
87
|
+
|
88
|
+
nlev1 = gphys.coord(2).length
|
89
|
+
if( nlev = gphys.data.get_att("nlev") )
|
90
|
+
nlev = nlev.to_i
|
91
|
+
if( (nlev1 != nlev) && !(nlev1==1 && nlev==0) )
|
92
|
+
raise "inconsistent attribute nlev (#{nlev} and #{nlev1})"
|
93
|
+
end
|
94
|
+
else
|
95
|
+
nlev = nlev1
|
96
|
+
end
|
97
|
+
file.def_var(gphys.name, nlev, 99, gphys.data.get_att("long_name") )
|
98
|
+
|
99
|
+
ctlfile = File.open(file.path,"w")
|
100
|
+
ctlfile << file.to_ctl
|
101
|
+
ctlfile.close
|
102
|
+
|
103
|
+
end
|
104
|
+
|
105
|
+
|
106
|
+
def write_binary(file, vary, rename=nil, dimnames=nil)
|
107
|
+
raise ArgumentError, "1st arg: not a GrADS_Gridded" if !file.is_a?(GrADS_Gridded)
|
108
|
+
raise ArgumentError, "2nd arg: not a VArray" if !vary.is_a?(VArray)
|
109
|
+
rank=vary.rank
|
110
|
+
raise ArgumentError, "only 4D data is supported" if rank != 4
|
111
|
+
|
112
|
+
file.put(vary.val)
|
113
|
+
end
|
114
|
+
end
|
115
|
+
|
116
|
+
## < redefined instance methods > ##
|
117
|
+
|
118
|
+
def val
|
119
|
+
# mode_switched = @ary.file.enddef
|
120
|
+
v = @ary.get
|
121
|
+
# if mode_switched; @ary.file.redef; end
|
122
|
+
# v
|
123
|
+
end
|
124
|
+
|
125
|
+
def val=(narray)
|
126
|
+
@ary.put( __check_ary_class2(narray) )
|
127
|
+
narray
|
128
|
+
end
|
129
|
+
|
130
|
+
# It is safer not to have the method "shape" to avoid misconfusion of
|
131
|
+
# shape_ul0 and shape_current:
|
132
|
+
def shape
|
133
|
+
raise "The shape method is not available. Use shape_ul0 or shape_current instead."
|
134
|
+
end
|
135
|
+
|
136
|
+
def name=(nm)
|
137
|
+
@ary.name = nm
|
138
|
+
@name = nm
|
139
|
+
end
|
140
|
+
def rename!(nm)
|
141
|
+
@ary.name = nm
|
142
|
+
@name = nm
|
143
|
+
self
|
144
|
+
end
|
145
|
+
def rename_no_file_change(nm)
|
146
|
+
@name = nm
|
147
|
+
self
|
148
|
+
end
|
149
|
+
def rename(nm)
|
150
|
+
self.dup.rename_no_file_change(nm)
|
151
|
+
end
|
152
|
+
|
153
|
+
def ntype
|
154
|
+
@ary.ntype
|
155
|
+
end
|
156
|
+
|
157
|
+
def total
|
158
|
+
len = 1
|
159
|
+
@ary.shape_current.each{|i| len *= i}
|
160
|
+
len
|
161
|
+
end
|
162
|
+
alias length total
|
163
|
+
|
164
|
+
def rank
|
165
|
+
shape_current.length
|
166
|
+
end
|
167
|
+
|
168
|
+
# def reshape!( *args )
|
169
|
+
# raise "cannot reshape a #{class}. Use copy first to make it a VArray with NArray"
|
170
|
+
# end
|
171
|
+
undef reshape!
|
172
|
+
|
173
|
+
|
174
|
+
## < additional instance methods > ##
|
175
|
+
|
176
|
+
def dim_names
|
177
|
+
@ary.dim_names
|
178
|
+
end
|
179
|
+
def shape_ul0
|
180
|
+
@ary.shape_ul0
|
181
|
+
end
|
182
|
+
def shape_current
|
183
|
+
@ary.shape_current
|
184
|
+
end
|
185
|
+
def file
|
186
|
+
@ary.file
|
187
|
+
end
|
188
|
+
|
189
|
+
end
|
190
|
+
end
|
191
|
+
|
192
|
+
###########################################################
|
193
|
+
### < test >
|
194
|
+
|
195
|
+
if $0 == __FILE__
|
196
|
+
# $DEBUG = true
|
197
|
+
include NumRu
|
198
|
+
|
199
|
+
begin
|
200
|
+
grvar = GrADSVar.new("../../testdata/T.jan.ctl","T")
|
201
|
+
rescue
|
202
|
+
grvar = GrADSVar.new("../../../testdata/T.jan.ctl","T")
|
203
|
+
end
|
204
|
+
va = VArrayGrADS.new(grvar)
|
205
|
+
|
206
|
+
p va.dim_names
|
207
|
+
p va.shape_ul0
|
208
|
+
p va.val
|
209
|
+
|
210
|
+
p va.att_names
|
211
|
+
p va.get_att("long_name")
|
212
|
+
|
213
|
+
va2 = va[3..9,5..15,0,0]
|
214
|
+
p va2.shape
|
215
|
+
p va2.val
|
216
|
+
|
217
|
+
p va2.get_att("long_name")
|
218
|
+
# va2.get_att("units")
|
219
|
+
# va2[3,true,true,true] = 5.0
|
220
|
+
# va2.val
|
221
|
+
|
222
|
+
va3 = (va2*3).val
|
223
|
+
p va3
|
224
|
+
|
225
|
+
end
|