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,212 @@
|
|
1
|
+
require "numru/gphys/gphys"
|
2
|
+
require "numru/gphys/varraygrads"
|
3
|
+
|
4
|
+
=begin
|
5
|
+
=module NumRu::GPhys::GrADS_IO
|
6
|
+
|
7
|
+
helps read/write GrADS-formatted data
|
8
|
+
|
9
|
+
==Module functions
|
10
|
+
---is_a_GrADS?(filename)
|
11
|
+
test whether the file is a GrADS control file.
|
12
|
+
|
13
|
+
ARGUMENTS
|
14
|
+
* filename (String): filename to test.
|
15
|
+
|
16
|
+
RETURN VALUE
|
17
|
+
* true/false
|
18
|
+
|
19
|
+
---open(file, varname)
|
20
|
+
GPhys constructor from GrADS.
|
21
|
+
|
22
|
+
ARGUMENTS
|
23
|
+
* file (GrADS_Gridded or String): file to read. If string,
|
24
|
+
it must be the name (path) of a GrADS control file.
|
25
|
+
* varname (String): name of the varible in the file, for which
|
26
|
+
a GPhys object is constructed.
|
27
|
+
|
28
|
+
RETURN VALUE
|
29
|
+
* a GPhys
|
30
|
+
|
31
|
+
EXAMPLE
|
32
|
+
* Suppose that you have a file T.jan.ctl in the currentdirectly,
|
33
|
+
and it contains a variable "T". The following creates a GPhys
|
34
|
+
object representing the variable in the file.
|
35
|
+
|
36
|
+
require "numru/gphys"
|
37
|
+
include GPhys
|
38
|
+
temp = GPhys::GrADS_IO.open("T.jan.ctl","T")
|
39
|
+
|
40
|
+
---write(file, gphys, name=nil)
|
41
|
+
|
42
|
+
writes a GPhys object into a GrADS file. -- !!only 4D data is supported!!
|
43
|
+
|
44
|
+
---var_names(file)
|
45
|
+
ARGUMENTS
|
46
|
+
* file (GrADS_Gridded or String): if string,
|
47
|
+
it must be the name (path) of a GrADS control file.
|
48
|
+
|
49
|
+
RETURN VALUE
|
50
|
+
* names of variables (Array): this return the names of variables
|
51
|
+
which the file has.
|
52
|
+
|
53
|
+
---var_names_except_coordinates(file)
|
54
|
+
same as var_names
|
55
|
+
|
56
|
+
=end
|
57
|
+
|
58
|
+
module NumRu
|
59
|
+
class GPhys
|
60
|
+
|
61
|
+
module GrADS_IO
|
62
|
+
|
63
|
+
module_function
|
64
|
+
|
65
|
+
def is_a_GrADS?(filename)
|
66
|
+
file = nil
|
67
|
+
begin
|
68
|
+
file = File.open(filename)
|
69
|
+
str = file.read(4)
|
70
|
+
ensure
|
71
|
+
file.close if file
|
72
|
+
end
|
73
|
+
return str=="DSET"
|
74
|
+
end
|
75
|
+
|
76
|
+
def open(file, varname)
|
77
|
+
if file.is_a?(String)
|
78
|
+
file = GrADS_Gridded.open(file)
|
79
|
+
elsif ! file.is_a?(GrADS_Gridded)
|
80
|
+
raise ArgumentError, "1st arg must be a GrADS_Gridded or a file name"
|
81
|
+
end
|
82
|
+
|
83
|
+
grvar = file.var(varname)
|
84
|
+
data = VArrayGrADS.new(grvar)
|
85
|
+
|
86
|
+
# axposnames = [ "lon", "lat", "lev", "time" ]
|
87
|
+
axposnames = [ "x", "y", "z", "t" ]
|
88
|
+
rank = 4
|
89
|
+
bare_index = [ false ] * rank # will be true if coord var is not found
|
90
|
+
|
91
|
+
axes = Array.new
|
92
|
+
for i in 0...rank
|
93
|
+
axpos = VArrayGrADS.new( file.var(axposnames[i]) )[0...data.shape_current[i]]
|
94
|
+
|
95
|
+
cell_center = true
|
96
|
+
cell = false
|
97
|
+
|
98
|
+
axis = Axis.new(cell,bare_index[i])
|
99
|
+
if !cell
|
100
|
+
axis.set_pos( axpos )
|
101
|
+
else
|
102
|
+
if cell_center
|
103
|
+
if varray_cell_bounds
|
104
|
+
axis.set_cell(axpos, varray_cell_bounds).set_pos_to_center
|
105
|
+
else
|
106
|
+
p "cell bounds are guessed"
|
107
|
+
axis.set_cell_guess_bounds(axpos).set_pos_to_center
|
108
|
+
end
|
109
|
+
else # then it is cell_bounds
|
110
|
+
if varray_cell_center
|
111
|
+
axis.set_cell(varray_cell_center, axpos).set_pos_to_bounds
|
112
|
+
else
|
113
|
+
p "cell center is guessed"
|
114
|
+
axis.set_cell_guess_center(axpos).set_pos_to_bounds
|
115
|
+
end
|
116
|
+
end
|
117
|
+
end
|
118
|
+
|
119
|
+
#p "yet-to-be-defined: method to define aux coord vars"
|
120
|
+
|
121
|
+
axes[i] = axis
|
122
|
+
end
|
123
|
+
|
124
|
+
grid = Grid.new( *axes )
|
125
|
+
|
126
|
+
GPhys.new(grid,data)
|
127
|
+
end
|
128
|
+
|
129
|
+
def write(file, gphys, name=nil)
|
130
|
+
if file.is_a?(String)
|
131
|
+
file = GrADS_Gridded.open(file,"w")
|
132
|
+
elsif ! file.is_a?(GrADS_Gridded)
|
133
|
+
raise ArgumentError, "1st arg must be a GrADS_Gridded or a file name"
|
134
|
+
end
|
135
|
+
if( ! file.dset )
|
136
|
+
bfname = file.path.gsub(/\.ctl/,"")+".dat"
|
137
|
+
while( File.exist?(bfname) )
|
138
|
+
bfname = bfname + "_"
|
139
|
+
end
|
140
|
+
file.dset = bfname
|
141
|
+
end
|
142
|
+
VArrayGrADS.write_control(file, gphys)
|
143
|
+
VArrayGrADS.write_binary(file, gphys.data)
|
144
|
+
end
|
145
|
+
|
146
|
+
def var_names(file)
|
147
|
+
opened = false
|
148
|
+
case file
|
149
|
+
when String
|
150
|
+
file = GrADS_Gridded.open(file,"r")
|
151
|
+
when GrADS_Gridded
|
152
|
+
opened = true
|
153
|
+
else
|
154
|
+
raise ArgumentError, "arg must be a GrADS_Gridded or a file name"
|
155
|
+
end
|
156
|
+
var_names = file.var_names
|
157
|
+
file.close unless opened
|
158
|
+
return var_names
|
159
|
+
end
|
160
|
+
def var_names_except_coordinates(file)
|
161
|
+
var_names(file)
|
162
|
+
end
|
163
|
+
|
164
|
+
end
|
165
|
+
end
|
166
|
+
end
|
167
|
+
|
168
|
+
######################################################
|
169
|
+
if $0 == __FILE__
|
170
|
+
include NumRu
|
171
|
+
|
172
|
+
begin
|
173
|
+
file = GrADS_Gridded.open("../../testdata/T.jan.ctl")
|
174
|
+
rescue
|
175
|
+
file = GrADS_Gridded.open("../../../testdata/T.jan.ctl")
|
176
|
+
end
|
177
|
+
temp = GPhys::GrADS_IO.open(file,"T")
|
178
|
+
p temp.name, temp.shape_current
|
179
|
+
temp2 = temp[true,true,2,0]
|
180
|
+
p temp2.name, temp2.shape_current
|
181
|
+
|
182
|
+
temp_xmean = temp.average(0)
|
183
|
+
p temp.val
|
184
|
+
|
185
|
+
temp_edy = ( temp - temp_xmean )
|
186
|
+
p '$$$',temp_edy.name,temp_edy.val[0,true,true,0]
|
187
|
+
p '@@@',temp
|
188
|
+
p '///',temp.copy
|
189
|
+
p '+++',temp2
|
190
|
+
|
191
|
+
puts "\n** test write (tmp.nc) **"
|
192
|
+
require "numru/gphys/gphys_netcdf_io"
|
193
|
+
file2 = NetCDF.create('tmp.nc')
|
194
|
+
p v = temp_edy.axis(0).pos[0..-2].copy.rename('lonlon')
|
195
|
+
temp_edy.axis(0).set_aux('test',v)
|
196
|
+
temp_edy.axis(0).set_aux('test2',(v/2).rename('lonlon2'))
|
197
|
+
temp_edy.axis(0).set_aux('test2',(v/2).rename('lonlon3')[0..-2])
|
198
|
+
GPhys::NetCDF_IO.write(file2,temp_edy)
|
199
|
+
file2.close
|
200
|
+
file3 = NetCDF.create('tmp2.nc')
|
201
|
+
GPhys::NetCDF_IO.write(file3,temp_xmean)
|
202
|
+
file3.close
|
203
|
+
|
204
|
+
puts "\n** test write (tmp.ctl) **"
|
205
|
+
file1 = GrADS_Gridded.create("tmp.ctl")
|
206
|
+
file1.put_att("big_endian",true)
|
207
|
+
file1.put_att("dset","tmp.dr")
|
208
|
+
file1.put_att("title","test control file")
|
209
|
+
file1.put_att("undef",-999.0)
|
210
|
+
GPhys::GrADS_IO.write(file1,temp_edy)
|
211
|
+
|
212
|
+
end
|
@@ -0,0 +1,214 @@
|
|
1
|
+
require "numru/gphys/gphys"
|
2
|
+
require "numru/gphys/varraygrib"
|
3
|
+
|
4
|
+
=begin
|
5
|
+
=module NumRu::GPhys::Grib_IO
|
6
|
+
|
7
|
+
helps read Grib-formatted data
|
8
|
+
|
9
|
+
==Module functions
|
10
|
+
---is_a_Grib? filename)
|
11
|
+
test whether the file is a Grib file.
|
12
|
+
|
13
|
+
ARGUMENTS
|
14
|
+
* filename (String): filename to test.
|
15
|
+
|
16
|
+
RETURN VALUE
|
17
|
+
* true/false
|
18
|
+
|
19
|
+
---open(file, varname)
|
20
|
+
GPhys constructor from Grib.
|
21
|
+
|
22
|
+
ARGUMENTS
|
23
|
+
* file (Grib or String): file to read. If string,
|
24
|
+
it must be the name (path) of a Grib file.
|
25
|
+
* varname (String): name of the varible in the file, for which
|
26
|
+
a GPhys object is constructed.
|
27
|
+
|
28
|
+
RETURN VALUE
|
29
|
+
* a GPhys
|
30
|
+
|
31
|
+
EXAMPLE
|
32
|
+
* Suppose that you have a file temp in the currentdirectly,
|
33
|
+
and it contains a variable "T". The following creates a GPhys
|
34
|
+
object representing the variable in the file.
|
35
|
+
|
36
|
+
require "numru/gphys"
|
37
|
+
include GPhys
|
38
|
+
temp = GPhys::Grib_IO.open("temp","T")
|
39
|
+
|
40
|
+
---write(file, gphys, name_dummy=nil)
|
41
|
+
|
42
|
+
Write a GPhys into a Grib file. The whole data under the GPhys
|
43
|
+
(such as coordinate vars) are written self-descriptively.
|
44
|
+
|
45
|
+
ARGUMENTS
|
46
|
+
* file (Grib): the Grib file to write in. Must be writable of course.
|
47
|
+
* gphys (GPhys): the GPhys to write.
|
48
|
+
* name_dummy (nil) : Unused in this module; Just for consistency with others.
|
49
|
+
|
50
|
+
RETURN VALUE
|
51
|
+
* nil
|
52
|
+
|
53
|
+
---var_names(file)
|
54
|
+
ARGUMENTS
|
55
|
+
* file (Grib or String): if string,
|
56
|
+
it must be the name (path) of a Grib file.
|
57
|
+
|
58
|
+
RETURN VALUE
|
59
|
+
* names of variables (Array): this return the names of variables
|
60
|
+
which the file has.
|
61
|
+
|
62
|
+
---var_names_except_coordinates(file)
|
63
|
+
* same as var_names
|
64
|
+
|
65
|
+
=end
|
66
|
+
|
67
|
+
module NumRu
|
68
|
+
class GPhys
|
69
|
+
|
70
|
+
module Grib_IO
|
71
|
+
|
72
|
+
module_function
|
73
|
+
|
74
|
+
def is_a_Grib?(filename)
|
75
|
+
Grib.is_a_Grib?(filename)
|
76
|
+
end
|
77
|
+
|
78
|
+
def open(file, varname)
|
79
|
+
if file.is_a?(String)
|
80
|
+
file = Grib.open(file)
|
81
|
+
elsif ! Grib===file
|
82
|
+
raise ArgumentError, "1st arg must be a Grib or a file name"
|
83
|
+
end
|
84
|
+
|
85
|
+
var = file.var(varname)
|
86
|
+
var.nil? && raise("variable '#{varname}' not found in '#{file.path}'")
|
87
|
+
data = VArrayGrib.new(var)
|
88
|
+
|
89
|
+
rank = data.rank
|
90
|
+
bare_index = [ false ] * rank # will be true if coord var is not found
|
91
|
+
|
92
|
+
|
93
|
+
axes = Array.new
|
94
|
+
var_names = file.var_names
|
95
|
+
for i in 0...rank
|
96
|
+
dim = var.dim(i)
|
97
|
+
val = dim.get
|
98
|
+
if Array===val && val.length!=1
|
99
|
+
bare_index[i] = true
|
100
|
+
end
|
101
|
+
axpos = VArrayGrib.new( dim )
|
102
|
+
cell_center = true
|
103
|
+
cell = false
|
104
|
+
|
105
|
+
axis = Axis.new(cell,bare_index[i])
|
106
|
+
if !cell
|
107
|
+
axis.set_pos( axpos )
|
108
|
+
else
|
109
|
+
if cell_center
|
110
|
+
if varray_cell_bounds
|
111
|
+
axis.set_cell(axpos, varray_cell_bounds).set_pos_to_center
|
112
|
+
else
|
113
|
+
p "cell bounds are guessed"
|
114
|
+
axis.set_cell_guess_bounds(axpos).set_pos_to_center
|
115
|
+
end
|
116
|
+
else # then it is cell_bounds
|
117
|
+
if varray_cell_center
|
118
|
+
axis.set_cell(varray_cell_center, axpos).set_pos_to_bounds
|
119
|
+
else
|
120
|
+
p "cell center is guessed"
|
121
|
+
axis.set_cell_guess_center(axpos).set_pos_to_bounds
|
122
|
+
end
|
123
|
+
end
|
124
|
+
end
|
125
|
+
if Array===val && val.length!=1
|
126
|
+
val[1..-1].each{|hash|
|
127
|
+
va =
|
128
|
+
va = VArray.new(hash["value"],nil,hash["name"])
|
129
|
+
hash.each{|k,v|
|
130
|
+
next if k=="value"||k=="name"
|
131
|
+
va.put_att(k,v)
|
132
|
+
}
|
133
|
+
axis.set_aux(hash["name"],va)
|
134
|
+
}
|
135
|
+
end
|
136
|
+
|
137
|
+
#p "yet-to-be-defined: method to define aux coord vars"
|
138
|
+
|
139
|
+
axes[i] = axis
|
140
|
+
end
|
141
|
+
|
142
|
+
grid = Grid.new( *axes )
|
143
|
+
|
144
|
+
GPhys.new(grid,data)
|
145
|
+
end
|
146
|
+
|
147
|
+
def write(file, gphys, name_dummy=nil)
|
148
|
+
dims = Array.new
|
149
|
+
gphys.rank.times{|n|
|
150
|
+
dims[n] = gphys.coord(n)
|
151
|
+
}
|
152
|
+
VArrayGrib.write(file,gphys.data,dims)
|
153
|
+
nil
|
154
|
+
end
|
155
|
+
|
156
|
+
def var_names(file)
|
157
|
+
opened = false
|
158
|
+
case file
|
159
|
+
when String
|
160
|
+
file = Grib.open(file)
|
161
|
+
when Grib
|
162
|
+
opened = true
|
163
|
+
else
|
164
|
+
raise ArgumentError, "arg must be a Grib or a file name"
|
165
|
+
end
|
166
|
+
var_names = file.var_names
|
167
|
+
file.close unless opened
|
168
|
+
return var_names
|
169
|
+
end
|
170
|
+
def var_names_except_coordinates(file)
|
171
|
+
var_names(file)
|
172
|
+
end
|
173
|
+
|
174
|
+
|
175
|
+
end
|
176
|
+
end
|
177
|
+
end
|
178
|
+
|
179
|
+
######################################################
|
180
|
+
if $0 == __FILE__
|
181
|
+
include NumRu
|
182
|
+
require "numru/gphys/gphys_netcdf_io"
|
183
|
+
|
184
|
+
temp = GPhys::Grib_IO.open("../../../testdata/T.jan.grib","TMP")
|
185
|
+
p temp.name, temp.shape_current
|
186
|
+
temp2 = temp[true,true,2]
|
187
|
+
p temp2.name, temp2.shape_current
|
188
|
+
|
189
|
+
temp_xmean = temp.average(0)
|
190
|
+
p temp.val
|
191
|
+
|
192
|
+
temp_edy = ( temp - temp_xmean )
|
193
|
+
p '$$$',temp_edy.name,temp_edy.val[0,true,true]
|
194
|
+
p '@@@',temp
|
195
|
+
p '///',temp.copy
|
196
|
+
p '+++',temp2
|
197
|
+
|
198
|
+
puts "\n** test convert (T.jan.nc to tmp.grib) **"
|
199
|
+
temp3 = GPhys::NetCDF_IO.open("../../../testdata/T.jan.nc","T")
|
200
|
+
file = Grib.create("tmp.grib")
|
201
|
+
GPhys::Grib_IO.write(file,temp3)
|
202
|
+
file.close
|
203
|
+
|
204
|
+
puts "\n** test compare (T.jan.nc and tmp.grib) **"
|
205
|
+
temp4 = GPhys::Grib_IO.open("tmp.grib","TMP")
|
206
|
+
p temp3.val
|
207
|
+
p temp4.val
|
208
|
+
print "max => #{temp3.max}, and #{temp4.max}\n"
|
209
|
+
print "min => #{temp3.min}, and #{temp4.min}\n"
|
210
|
+
print "mean => #{temp3.mean}, and #{temp4.mean}\n"
|
211
|
+
print "stddev => #{temp3.stddev}, and #{temp4.stddev}\n"
|
212
|
+
|
213
|
+
|
214
|
+
end
|
@@ -0,0 +1,162 @@
|
|
1
|
+
require "numru/gphys/gphys"
|
2
|
+
require "numru/gphys/varraygtool3"
|
3
|
+
|
4
|
+
=begin
|
5
|
+
=module NumRu::GPhys::Gtool3_IO
|
6
|
+
|
7
|
+
helps read/write Gtool3-formatted data
|
8
|
+
|
9
|
+
==Module functions
|
10
|
+
---is_a_Gtool3?(filename)
|
11
|
+
test whether the file is a Gtool3 control file.
|
12
|
+
|
13
|
+
ARGUMENTS
|
14
|
+
* filename (String): filename to test.
|
15
|
+
|
16
|
+
RETURN VALUE
|
17
|
+
* true/false
|
18
|
+
|
19
|
+
---open(file, varname)
|
20
|
+
GPhys constructor from Gtool3.
|
21
|
+
|
22
|
+
ARGUMENTS
|
23
|
+
* file (Gtool3 or String): file to read. If string,
|
24
|
+
it must be the name (path) of a Gtool3 control file.
|
25
|
+
* varname (String): name of the varible in the file, for which
|
26
|
+
a GPhys object is constructed.
|
27
|
+
|
28
|
+
RETURN VALUE
|
29
|
+
* a GPhys
|
30
|
+
|
31
|
+
EXAMPLE
|
32
|
+
* Suppose that you have a file T.jan.ctl in the currentdirectly,
|
33
|
+
and it contains a variable "T". The following creates a GPhys
|
34
|
+
object representing the variable in the file.
|
35
|
+
|
36
|
+
require "numru/gphys"
|
37
|
+
include GPhys
|
38
|
+
temp = GPhys::Gtool3_IO.open("T.jan.ctl","T")
|
39
|
+
|
40
|
+
#---write(file, gphys, name=nil)
|
41
|
+
#
|
42
|
+
# writes a GPhys object into a Gtool3 file. -- !!only 4D data is supported!!
|
43
|
+
|
44
|
+
---var_names(file)
|
45
|
+
ARGUMENTS
|
46
|
+
* file (Gtool3 or String): if string,
|
47
|
+
it must be the name (path) of a Gtool3 control file.
|
48
|
+
|
49
|
+
RETURN VALUE
|
50
|
+
* names of variables (Array): this return the names of variables
|
51
|
+
which the file has.
|
52
|
+
|
53
|
+
---var_names_except_coordinates(file)
|
54
|
+
same as var_names
|
55
|
+
|
56
|
+
=end
|
57
|
+
|
58
|
+
module NumRu
|
59
|
+
class GPhys
|
60
|
+
|
61
|
+
module Gtool3_IO
|
62
|
+
|
63
|
+
module_function
|
64
|
+
|
65
|
+
@@default_calendar = nil # e.g., "360_day"
|
66
|
+
def default_calendar=(cal)
|
67
|
+
@@default_calendar = cal
|
68
|
+
end
|
69
|
+
def default_calendar
|
70
|
+
@@default_calendar
|
71
|
+
end
|
72
|
+
|
73
|
+
def is_a_Gtool3?(filename)
|
74
|
+
Gtool3.is_a_Gtool3?(filename)
|
75
|
+
end
|
76
|
+
|
77
|
+
def open(file, varname)
|
78
|
+
if file.is_a?(String)
|
79
|
+
file = Gtool3.open(file)
|
80
|
+
elsif ! file.is_a?(Gtool3)
|
81
|
+
raise ArgumentError, "1st arg must be a Gtool3 or a file name"
|
82
|
+
end
|
83
|
+
|
84
|
+
var = file.var(varname)
|
85
|
+
data = VArrayGtool3.new(var)
|
86
|
+
|
87
|
+
axes = Array.new
|
88
|
+
for i in 0...var.rank
|
89
|
+
gax = var.axis(i)
|
90
|
+
gloc = gax["LOC"]
|
91
|
+
if gloc["ITEM"]=="time"
|
92
|
+
loc = VArrayGtool3Time.new(gloc, @@default_calendar)
|
93
|
+
else
|
94
|
+
loc = VArrayGtool3.make_coord(gloc)
|
95
|
+
end
|
96
|
+
# if (gwgt = gax("WGT"))
|
97
|
+
# wgt = VArray.new(gwgt.delete(:val), gwgt, gwgt.delete("ITEM"))
|
98
|
+
# cell_center = true
|
99
|
+
# cell = true
|
100
|
+
# else
|
101
|
+
cell = false
|
102
|
+
# end
|
103
|
+
|
104
|
+
axis = Axis.new(cell,false)
|
105
|
+
if !cell
|
106
|
+
axis.set_pos( loc )
|
107
|
+
end
|
108
|
+
|
109
|
+
axes[i] = axis
|
110
|
+
end
|
111
|
+
|
112
|
+
grid = Grid.new( *axes )
|
113
|
+
|
114
|
+
GPhys.new(grid,data)
|
115
|
+
end
|
116
|
+
|
117
|
+
# def write(file, gphys, name=nil)
|
118
|
+
# end
|
119
|
+
|
120
|
+
def var_names(file)
|
121
|
+
opened = false
|
122
|
+
case file
|
123
|
+
when String
|
124
|
+
file = Gtool3.open(file,"r")
|
125
|
+
when Gtool3
|
126
|
+
opened = true
|
127
|
+
else
|
128
|
+
raise ArgumentError, "arg must be a Gtool3 or a file name"
|
129
|
+
end
|
130
|
+
var_names = file.var_names
|
131
|
+
file.close unless opened
|
132
|
+
return var_names
|
133
|
+
end
|
134
|
+
def var_names_except_coordinates(file)
|
135
|
+
var_names(file)
|
136
|
+
end
|
137
|
+
|
138
|
+
end
|
139
|
+
end
|
140
|
+
end
|
141
|
+
|
142
|
+
######################################################
|
143
|
+
if $0 == __FILE__
|
144
|
+
include NumRu
|
145
|
+
Gtool3.gtaxdir = File.expand_path("~/dennou/GTAXDIR")
|
146
|
+
file = ARGV[0]
|
147
|
+
varname = ARGV[1] or raise("Need two args")
|
148
|
+
|
149
|
+
gp = GPhys::Gtool3_IO.open(file,varname)
|
150
|
+
GPhys::Gtool3_IO.default_calendar = "360_day"
|
151
|
+
|
152
|
+
p gp
|
153
|
+
p gp[false,0].val
|
154
|
+
p gp[false,0,0].copy
|
155
|
+
print "\n****\n"
|
156
|
+
gp.att_names.each{|k| print k," ",gp.get_att(k),"\n"}
|
157
|
+
print "\n******\n"
|
158
|
+
p gp.coord(0).name
|
159
|
+
gp.coord(0).att_names.each{|k| print k," ",gp.get_att(k),"\n"}
|
160
|
+
p gp.coord(-1).name
|
161
|
+
gp.coord(-1).att_names.each{|k| print k," ",gp.get_att(k),"\n"}
|
162
|
+
end
|