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,672 @@
|
|
1
|
+
require "numru/gphys/gphys"
|
2
|
+
require "numru/gphys/varrayhdfeos5"
|
3
|
+
|
4
|
+
module NumRu
|
5
|
+
|
6
|
+
class GPhys
|
7
|
+
|
8
|
+
module HE5_IO
|
9
|
+
|
10
|
+
module_function
|
11
|
+
|
12
|
+
PredefCoordNames = ["Time","Longitude","Latitude","Colatitude"]
|
13
|
+
# ^ In the order of precedence
|
14
|
+
|
15
|
+
@@predef_gdcoords = [/^altitude$/i, /^altitude/i, /^pressure$/i, /^wavelength$/i, /^wavelength/i,/^wavenumber$/i, /^wavenumber/i, /^time$/i,/time$/i]
|
16
|
+
# ^ In the order of precedence
|
17
|
+
|
18
|
+
@@predef_zacoords = [/^latitude$/i, /^latitude/i, /^altitude$/i, /^altitude/i, /^pressure$/i, /^wavelength$/i, /^wavelength/i,/^wavenumber$/i, /^wavenumber/i, /^time$/i, /time$/i, /^solarzenithangle$/i, /^solarzenithangle/i]
|
19
|
+
# ^ In the order of precedence
|
20
|
+
|
21
|
+
def self.add_predef_gdcoords(regexp)
|
22
|
+
raise ArgumentError, "arg must be a regexp" unless regexp.is_a?(Regexp)
|
23
|
+
@@predef_gdcoords.push(regexp)
|
24
|
+
end
|
25
|
+
|
26
|
+
def self.predef_gdcoords
|
27
|
+
@@predef_gdcoords
|
28
|
+
end
|
29
|
+
|
30
|
+
def self.add_predef_zacoords(regexp)
|
31
|
+
raise ArgumentError, "arg must be a regexp" unless regexp.is_a?(Regexp)
|
32
|
+
@@predef_gdcoords.push(regexp)
|
33
|
+
end
|
34
|
+
|
35
|
+
def self.predef_zacoords
|
36
|
+
@@predef_gdcoords
|
37
|
+
end
|
38
|
+
|
39
|
+
def is_a_HE5?(filename)
|
40
|
+
file = nil
|
41
|
+
begin
|
42
|
+
file = File.open(filename,"rb")
|
43
|
+
str = file.read(4)
|
44
|
+
ensure
|
45
|
+
file.close if file
|
46
|
+
end
|
47
|
+
return str=="\211HDF"
|
48
|
+
end
|
49
|
+
|
50
|
+
def open(files, varname)
|
51
|
+
files, var0, varname, gridtype = __interpret_files( files, varname )
|
52
|
+
case gridtype
|
53
|
+
when "swath"
|
54
|
+
_sw_open(var0, varname)
|
55
|
+
when "grid"
|
56
|
+
_gd_open(var0, varname)
|
57
|
+
when "za"
|
58
|
+
_za_open(var0, varname)
|
59
|
+
else
|
60
|
+
raise "Sorry. Currently, only the Swath type is supported"
|
61
|
+
end
|
62
|
+
end
|
63
|
+
|
64
|
+
def _sw_open(var0, varname)
|
65
|
+
swath = var0.swath
|
66
|
+
data = __files2varray( swath, varname )
|
67
|
+
rank = data.rank
|
68
|
+
dim_names = var0.dim_names
|
69
|
+
|
70
|
+
#< coordiante varables >
|
71
|
+
|
72
|
+
geo_names = swath.geo_names # geolocation varables
|
73
|
+
coords = Array.new(rank)
|
74
|
+
assoccoords = Array.new
|
75
|
+
|
76
|
+
proc = Proc.new{|nm|
|
77
|
+
vdns = swath.var(nm).dim_names
|
78
|
+
if vdns.length==1 && (dim=dim_names.index(vdns[0])) && !coords[dim]
|
79
|
+
coords[dim] = __files2varray( swath, nm)
|
80
|
+
elsif ( (vdns - dim_names).length==0 ) # all dims are covered
|
81
|
+
dimids = vdns.collect{|s| dim_names.index(s)}
|
82
|
+
assoccoords.push( [dimids, __files2varray( swath, nm)] )
|
83
|
+
end
|
84
|
+
}
|
85
|
+
|
86
|
+
# (first precedence) Predefined coordinate variable names
|
87
|
+
PredefCoordNames.each do |nm|
|
88
|
+
proc.call(nm) if geo_names.delete(nm) # if included, delete and call
|
89
|
+
end
|
90
|
+
|
91
|
+
# (second precedence) Variables having the same name as a dimension
|
92
|
+
dim_names.each do |nm|
|
93
|
+
proc.call(nm) if geo_names.delete(nm) # if included, delete and call
|
94
|
+
end
|
95
|
+
|
96
|
+
# (else)
|
97
|
+
geo_names.each do |nm|
|
98
|
+
proc.call(nm) if swath.geo(nm).ntype != "char"
|
99
|
+
end
|
100
|
+
|
101
|
+
=begin
|
102
|
+
# if no geolocation variable was found for a dim, search variables too
|
103
|
+
if coords.include?(nil)
|
104
|
+
swath.var_names.each do |nm|
|
105
|
+
vdns = swath.var(nm).dim_names
|
106
|
+
if vdns.length==1 && (dim=dim_names.index(vdns[0])) && !coords[dim]
|
107
|
+
coords[dim] = __files2varray( swath, nm)
|
108
|
+
end
|
109
|
+
break if !coords.include?(nil)
|
110
|
+
end
|
111
|
+
end
|
112
|
+
=end
|
113
|
+
|
114
|
+
#< make axes >
|
115
|
+
axes = Array.new
|
116
|
+
coords.each_with_index do |crd, dim|
|
117
|
+
if crd
|
118
|
+
axis = Axis.new
|
119
|
+
axis.set_pos( crd )
|
120
|
+
else
|
121
|
+
axis = Axis.new(false, true)
|
122
|
+
dimnm = dim_names[dim]
|
123
|
+
len = data.shape_current[dim]
|
124
|
+
axis.set_pos( VArray.new(NArray.float(len).indgen!).rename(dimnm) )
|
125
|
+
end
|
126
|
+
axes.push( axis )
|
127
|
+
end
|
128
|
+
|
129
|
+
#< make grid >
|
130
|
+
grid = Grid.new( *axes )
|
131
|
+
|
132
|
+
if assoccoords.length > 0
|
133
|
+
assoccoords.collect! do |dimids, vary|
|
134
|
+
acgrid = Grid.new( *(dimids.collect{|dim| axes[dim]}) )
|
135
|
+
gphys = GPhys.new(acgrid, vary)
|
136
|
+
end
|
137
|
+
grid.set_assoc_coords( assoccoords )
|
138
|
+
end
|
139
|
+
|
140
|
+
#< make gphys >
|
141
|
+
GPhys.new(grid,data)
|
142
|
+
end
|
143
|
+
private :_sw_open
|
144
|
+
|
145
|
+
def _gd_open(var0, varname)
|
146
|
+
#< make axes >
|
147
|
+
grid = var0.grid
|
148
|
+
data = __files2varray( grid, varname )
|
149
|
+
axes = __make_gd_axes(var0, grid, data)
|
150
|
+
|
151
|
+
#< make grid >
|
152
|
+
new_grid = Grid.new( *axes )
|
153
|
+
|
154
|
+
#< make gphys >
|
155
|
+
GPhys.new(new_grid,data)
|
156
|
+
end
|
157
|
+
private :_gd_open
|
158
|
+
|
159
|
+
def _za_open(var0, varname)
|
160
|
+
#< make axes >
|
161
|
+
za = var0.za
|
162
|
+
|
163
|
+
data = __files2varray( za, varname )
|
164
|
+
axes = __make_za_axes(var0, za, data)
|
165
|
+
|
166
|
+
#< make grid >
|
167
|
+
new_za = Grid.new( *axes )
|
168
|
+
|
169
|
+
#< make gphys >
|
170
|
+
GPhys.new(new_za,data)
|
171
|
+
end
|
172
|
+
private :_za_open
|
173
|
+
|
174
|
+
def write(file, gphys, name=nil)
|
175
|
+
name = gphys.name if name.nil?
|
176
|
+
dims = Array.new
|
177
|
+
gphys.rank.times{|n|
|
178
|
+
dims[n] = gphys.coord(n)
|
179
|
+
}
|
180
|
+
|
181
|
+
case file
|
182
|
+
when HE5Sw
|
183
|
+
VArrayHE5SwField.write(file,gphys.data,name,dims)
|
184
|
+
when HE5Gd
|
185
|
+
VArrayHE5GdField.write(file,gphys.data,name,dims)
|
186
|
+
when HE5Za
|
187
|
+
else
|
188
|
+
raise ArgumentError, "arg must be a HE5Sw, a HE5Gd or a HE5Za"
|
189
|
+
end
|
190
|
+
|
191
|
+
nil
|
192
|
+
end
|
193
|
+
|
194
|
+
def var_names(files)
|
195
|
+
case files
|
196
|
+
when HE5
|
197
|
+
file = files
|
198
|
+
opened = true
|
199
|
+
when String
|
200
|
+
file = HE5.open(files)
|
201
|
+
opened = false
|
202
|
+
else
|
203
|
+
raise ArgumentError, "arg must be a HDF-EOS5 or a file name"
|
204
|
+
end
|
205
|
+
raise "file must be a HDF-EOS5 swath filed" if !file.has_swath?()
|
206
|
+
swathlist=file.swath_names()
|
207
|
+
varnames=[]
|
208
|
+
for i in 0..swathlist.size-1
|
209
|
+
sfile=file.swath(swathlist[i])
|
210
|
+
sfile.var_names.each{|name|
|
211
|
+
f, var, varname, gridtype = __interpret_files( sfile, name )
|
212
|
+
if var.rank>1 || var.name!=var.dim_names[0]
|
213
|
+
varnames.push(swathlist[i]+"/"+name)
|
214
|
+
end
|
215
|
+
}
|
216
|
+
sfile.closed # close Swath field
|
217
|
+
end
|
218
|
+
file.close unless opened # close Swath field & close HDF-EOS5 file
|
219
|
+
return varnames
|
220
|
+
end
|
221
|
+
|
222
|
+
def var_names_except_coordinates(files)
|
223
|
+
var_names(files)
|
224
|
+
end
|
225
|
+
|
226
|
+
############################################################
|
227
|
+
def __convertTime( axisname )
|
228
|
+
# Convert Geo Location Field "Time" or "LocalTime"
|
229
|
+
# if axisname.name == "Time" || axisname.name == "LocalTime"
|
230
|
+
# axisname.val.each{|ax|
|
231
|
+
# stun = axisname.units.to_s
|
232
|
+
# since = DateTime.parse("1993-01-01 00:00:00+00:00")
|
233
|
+
# tun = Units[stun]
|
234
|
+
# sec = tun.convert( ax, Units['seconds'] ).round + 1e-1
|
235
|
+
# datetime = since + (sec/86400.0)
|
236
|
+
# ax =datetime.strftime("%Y-%m-%d %H:%M:%S")
|
237
|
+
# }
|
238
|
+
#p axisname[0].val
|
239
|
+
# end
|
240
|
+
end
|
241
|
+
|
242
|
+
def __files2varray( files, varname, dim=nil, gd_flag=nil, ntype=nil )
|
243
|
+
if files.is_a?(HE5Sw)
|
244
|
+
# Single file. Returns a VArrayHE5SwField. dim is ignored.
|
245
|
+
file = files
|
246
|
+
var = file.var(varname)
|
247
|
+
raise "variable '#{varname}' not found in #{file}" if !var
|
248
|
+
if ntype != nil && gd_flag == 1
|
249
|
+
VArrayHE5SwField.new2( var , varname, ntype, dim)
|
250
|
+
elsif ntype != nil && gd_flag == 0
|
251
|
+
VArrayHE5SwField.new3( file, varname, ntype, dim)
|
252
|
+
else
|
253
|
+
VArrayHE5SwField.new( var )
|
254
|
+
end
|
255
|
+
elsif files.is_a?(HE5Gd)
|
256
|
+
# Single file. Returns a VArrayHE5GdField. dim is ignored.
|
257
|
+
file = files
|
258
|
+
var = file.var(varname)
|
259
|
+
raise "variable '#{varname}' not found in #{file}" if !var
|
260
|
+
if ntype != nil && gd_flag == 1
|
261
|
+
VArrayHE5GdField.new2( var , varname, ntype, dim)
|
262
|
+
else
|
263
|
+
VArrayHE5GdField.new( var )
|
264
|
+
end
|
265
|
+
elsif files.is_a?(HE5Za)
|
266
|
+
# Single file. Returns a VArrayHE5ZaField. dim is ignored.
|
267
|
+
file = files
|
268
|
+
var = file.var(varname)
|
269
|
+
raise "variable '#{varname}' not found in #{file}" if !var
|
270
|
+
if ntype != nil && gd_flag == 1
|
271
|
+
VArrayHE5ZaField.new2( var , varname, ntype, dim)
|
272
|
+
else
|
273
|
+
VArrayHE5ZaField.new( var )
|
274
|
+
end
|
275
|
+
elsif files.is_a?(NArray)
|
276
|
+
# Suppose that files is a NArray of HDF-EOS5. Returns a VArrayCompsite.
|
277
|
+
if dim.is_a?(Integer) && dim>=0 && dim<files.rank
|
278
|
+
files = files[ *([0]*dim+[true]+[0]*(files.rank-dim-1)) ]
|
279
|
+
end
|
280
|
+
varys = NArray.object( *files.shape )
|
281
|
+
for i in 0...files.length
|
282
|
+
var = files[i].var( varname )
|
283
|
+
ntype = var.ntype
|
284
|
+
ntype = var.dim
|
285
|
+
raise "variable '#{varname}' not found in #{files[i].path}" if !var
|
286
|
+
if ntype != nil && gd_flag == 1 # For Data Field
|
287
|
+
varys[i] = VArrayHE5SwField.new2( var , varname, ntype, dim)
|
288
|
+
elsif ntype != nil && gd_flag == 0 # For Geo Location Field
|
289
|
+
varys[i] = VArrayHE5SwField.new3( file, varname, ntype, dim)
|
290
|
+
else
|
291
|
+
varys[i] = VArrayHE5SwField.new( var )
|
292
|
+
end
|
293
|
+
end
|
294
|
+
if files.length != 1
|
295
|
+
VArrayComposite.new( varys )
|
296
|
+
else
|
297
|
+
varys[0]
|
298
|
+
end
|
299
|
+
else
|
300
|
+
raise TypeError, "not a HDF-EOS5 or NArray"
|
301
|
+
end
|
302
|
+
end
|
303
|
+
|
304
|
+
def __interpret_files( files, varname )
|
305
|
+
gridtype = nil # --> "swath", "grid", "za", ....
|
306
|
+
case files
|
307
|
+
when HE5, String
|
308
|
+
files = HE5.open(files) if files.is_a?(String)
|
309
|
+
dirname, varname, = varname.split(/\//)
|
310
|
+
|
311
|
+
if files.has_swath?
|
312
|
+
swath = files.swath(dirname) or raise("Can't find a swath named #{dirname}")
|
313
|
+
he5var0 = swath.var( varname )
|
314
|
+
gridtype = 'swath'
|
315
|
+
elsif files.has_grid?
|
316
|
+
grid = files.grid(dirname) or raise("Can't find a grid named #{dirname}")
|
317
|
+
he5var0 = grid.var( varname )
|
318
|
+
gridtype = 'grid'
|
319
|
+
elsif files.has_za?
|
320
|
+
za = files.zonal(dirname) or raise("Can't find a zonal average named #{dirname}")
|
321
|
+
he5var0 = za.var( varname )
|
322
|
+
gridtype = 'za'
|
323
|
+
else
|
324
|
+
raise "Sorry. Currenly, only the Swath type is supported"
|
325
|
+
end
|
326
|
+
when HE5Sw
|
327
|
+
he5var0 = files.var( varname )
|
328
|
+
gridtype = 'swath'
|
329
|
+
when HE5Gd
|
330
|
+
he5var0 = files.var( varname )
|
331
|
+
gridtype = 'grid'
|
332
|
+
# when Regexp
|
333
|
+
else
|
334
|
+
raise TypeError, "argument files: not a HDF-EOS5, String, NArray, or Array"
|
335
|
+
end
|
336
|
+
[files, he5var0, varname, gridtype]
|
337
|
+
end
|
338
|
+
|
339
|
+
def __make_gd_axes(var0, grid, data)
|
340
|
+
dim_names = var0.dim_names # �����̖��O
|
341
|
+
unlocated_dim_names = var0.dim_names # �܂����̌��܂��Ă��Ȃ������̖��O
|
342
|
+
unused_var_names = grid.var_names
|
343
|
+
axes = Array.new
|
344
|
+
|
345
|
+
# (#1) HDF-EOS5 standard rule.
|
346
|
+
["Longitude", "Latitude"].each do |provided_varname|
|
347
|
+
unlocated_dim_names.each do |dim_nm|
|
348
|
+
if (vary = __make_field_one_dimension(grid.var(provided_varname), dim_names.index(dim_nm)))
|
349
|
+
axes.push(Axis.new().set_pos(vary))
|
350
|
+
unlocated_dim_names.delete(dim_nm)
|
351
|
+
unused_var_names.delete(provided_varname)
|
352
|
+
break
|
353
|
+
end
|
354
|
+
end
|
355
|
+
end
|
356
|
+
if unused_var_names.include?("Longitude") || unused_var_names.include?("Latitude")
|
357
|
+
raise("Sorry. Truely multidimensional longitudes/latitudes are yet to be supported. (2-dimensional lon/lat data that are actually one dimensional are supported.)")
|
358
|
+
end
|
359
|
+
|
360
|
+
# (#2) Empirical rule (from EOS-AURA, MLS, etc)
|
361
|
+
# (#2-1) �������m��̎����ɑ��A�������ƈ�v���閼�O������1�����ϐ������W�ϐ��Ƃ��č̗p����
|
362
|
+
unlocated_dim_names.each do |dim_nm|
|
363
|
+
if unused_var_names.include?(dim_nm)
|
364
|
+
vary = __files2varray( grid, dim_nm)
|
365
|
+
if vary.rank == 1
|
366
|
+
axes.push(Axis.new().set_pos(vary))
|
367
|
+
unlocated_dim_names.delete(dim_nm)
|
368
|
+
unused_var_names.delete(dim_nm)
|
369
|
+
end
|
370
|
+
end
|
371
|
+
end
|
372
|
+
|
373
|
+
# (#2-2) �������m��̎����ɑ��A���̎������g���Ē�`����Ă���1�����ϐ������W�ϐ��Ƃ��č̗p����
|
374
|
+
# (a) select variables match to Regexp.
|
375
|
+
@@predef_gdcoords.each do |reg_exp|
|
376
|
+
unlocated_dim_names.each do |dim_nm|
|
377
|
+
# get candidates
|
378
|
+
candidate_var_names = Array.new
|
379
|
+
unused_var_names.each do |var_nm|
|
380
|
+
var = grid.var(var_nm)
|
381
|
+
if reg_exp =~ var_nm && var.dim_names.include?(dim_nm)
|
382
|
+
candidate_var_names.push(var_nm)
|
383
|
+
end
|
384
|
+
end
|
385
|
+
|
386
|
+
# permute the candidates in order of length.
|
387
|
+
candidate_var_names = candidate_var_names.sort {|a, b| a.length <=> b.length}
|
388
|
+
candidate_var_names.each do |candidate|
|
389
|
+
vary = __files2varray(grid, candidate)
|
390
|
+
if vary.rank == 1
|
391
|
+
axes.push(Axis.new().set_pos(vary))
|
392
|
+
unlocated_dim_names.delete(dim_nm)
|
393
|
+
unused_var_names.delete(candidate)
|
394
|
+
end
|
395
|
+
break if unlocated_dim_names.length == 0
|
396
|
+
end
|
397
|
+
end
|
398
|
+
end
|
399
|
+
|
400
|
+
# (#2-3) ���W�ϐ��̓t�@�C�����ɂȂ����̂Ƃ݂Ȃ��C
|
401
|
+
# �_�~�[�Ƃ��� 0,1,2,... �����蓖�Ă���悤�ɂ���D
|
402
|
+
unlocated_dim_names.each do |dim_nm|
|
403
|
+
nary_length = data.shape_current[dim_names.index(dim_nm)]
|
404
|
+
nary = NArray[0...nary_length]
|
405
|
+
vary = VArray.new(nary).rename(dim_nm + "_dummy")
|
406
|
+
axis = Axis.new(false, true)
|
407
|
+
axis.set_pos(vary)
|
408
|
+
axes.push(axis)
|
409
|
+
end
|
410
|
+
|
411
|
+
return axes
|
412
|
+
end
|
413
|
+
private :__make_gd_axes
|
414
|
+
|
415
|
+
def __make_za_axes(var0, za, data)
|
416
|
+
dim_names = var0.dim_names # �����̖��O
|
417
|
+
unlocated_dim_names = var0.dim_names # �܂����̌��܂��Ă��Ȃ������̖��O
|
418
|
+
unused_var_names = za.var_names
|
419
|
+
axes = Array.new
|
420
|
+
|
421
|
+
# (#1) HDF-EOS5 standard rule is none.
|
422
|
+
# (#2) Empirical rule (from EOS-AURA, MLS, etc)
|
423
|
+
# (#2-1) �������ƈ�v���閼�O������1�����ϐ������W�ϐ��Ƃ��č̗p����
|
424
|
+
unlocated_dim_names.each do |dim_nm|
|
425
|
+
if unused_var_names.include?(dim_nm)
|
426
|
+
vary = __files2varray( za, dim_nm)
|
427
|
+
if vary.rank == 1
|
428
|
+
axes.push(Axis.new().set_pos(vary))
|
429
|
+
unlocated_dim_names.delete(dim_nm)
|
430
|
+
unused_var_names.delete(dim_nm)
|
431
|
+
end
|
432
|
+
end
|
433
|
+
end
|
434
|
+
|
435
|
+
# (#2-2) �������m��̎����ɑ��A���̎������g���Ē�`����Ă���1�����ϐ������W�ϐ��Ƃ��č̗p����
|
436
|
+
# (a) select variables match to Regexp.
|
437
|
+
@@predef_zacoords.each do |reg_exp|
|
438
|
+
unlocated_dim_names.each do |dim_nm|
|
439
|
+
# get candidates
|
440
|
+
candidate_var_names = Array.new
|
441
|
+
unused_var_names.each do |var_nm|
|
442
|
+
var = za.var(var_nm)
|
443
|
+
if reg_exp =~ var_nm && var.dim_names.include?(dim_nm)
|
444
|
+
candidate_var_names.push(var_nm)
|
445
|
+
end
|
446
|
+
end
|
447
|
+
|
448
|
+
# permute the candidates in order of length.
|
449
|
+
candidate_var_names = candidate_var_names.sort {|a, b| a.length <=> b.length}
|
450
|
+
candidate_var_names.each do |candidate|
|
451
|
+
vary = __files2varray(za, candidate)
|
452
|
+
if vary.rank == 1
|
453
|
+
axes.push(Axis.new().set_pos(vary))
|
454
|
+
unlocated_dim_names.delete(dim_nm)
|
455
|
+
unused_var_names.delete(candidate)
|
456
|
+
end
|
457
|
+
break if unlocated_dim_names.length == 0
|
458
|
+
end
|
459
|
+
end
|
460
|
+
end
|
461
|
+
|
462
|
+
# (#2-3) ���W�ϐ��̓t�@�C�����ɂȂ����̂Ƃ݂Ȃ��C
|
463
|
+
# �_�~�[�Ƃ��� 0,1,2,... �����蓖�Ă���悤�ɂ���D
|
464
|
+
unlocated_dim_names.each do |dim_nm|
|
465
|
+
nary_length = data.shape_current[dim_names.index(dim_nm)]
|
466
|
+
nary = NArray[0...nary_length]
|
467
|
+
vary = VArray.new(nary).rename(dim_nm + "_dummy")
|
468
|
+
axis = Axis.new(false, true)
|
469
|
+
axis.set_pos(vary)
|
470
|
+
axes.push(axis)
|
471
|
+
end
|
472
|
+
|
473
|
+
return axes
|
474
|
+
end
|
475
|
+
private :__make_za_axes
|
476
|
+
|
477
|
+
# dim_index �Ɋւ��Ď���1�����̕ϐ��Ȃ�� VArray ��Ԃ��B�����łȂ���� nil ��Ԃ��B
|
478
|
+
def __make_field_one_dimension(aHE5GdField, dim_index)
|
479
|
+
rank = aHE5GdField.rank
|
480
|
+
indexes = Array.new
|
481
|
+
seps = (2**(-23).to_f) * 10
|
482
|
+
deps = Float::EPSILON * 10 # (2**(-52).to_f) * 10
|
483
|
+
permissible_diff = case aHE5GdField.simple_get.typecode
|
484
|
+
when NArray::SFLOAT, NArray::SCOMPLEX then seps
|
485
|
+
when NArray::DFLOAT, NArray::DCOMPLEX then deps
|
486
|
+
else 0
|
487
|
+
end
|
488
|
+
|
489
|
+
for i in 0...rank do
|
490
|
+
indexes.push(i) unless i == dim_index
|
491
|
+
end
|
492
|
+
mn = aHE5GdField.simple_get.min(*indexes)
|
493
|
+
mx = aHE5GdField.simple_get.max(*indexes)
|
494
|
+
maxdiff = (mx - mn).max
|
495
|
+
maxval = ((mx1=mx.max)>(mx2=-mn.min)) ? mx1 : mx2
|
496
|
+
|
497
|
+
is_zero = (maxdiff/maxval <= permissible_diff)
|
498
|
+
|
499
|
+
unless is_zero
|
500
|
+
return nil
|
501
|
+
else
|
502
|
+
ary = Array.new
|
503
|
+
for j in 0...rank do
|
504
|
+
if j == dim_index
|
505
|
+
ary.push(true)
|
506
|
+
else
|
507
|
+
ary.push(0)
|
508
|
+
end
|
509
|
+
end
|
510
|
+
return VArrayHE5GdField.new(aHE5GdField).[](*ary)
|
511
|
+
end
|
512
|
+
end
|
513
|
+
private :__make_field_one_dimension
|
514
|
+
|
515
|
+
end
|
516
|
+
end
|
517
|
+
end
|
518
|
+
######################################################
|
519
|
+
if $0 == __FILE__
|
520
|
+
include NumRu
|
521
|
+
require "numru/hdfeos5"
|
522
|
+
require "numru/gphys/varray"
|
523
|
+
|
524
|
+
##### Read test #####
|
525
|
+
# Swath
|
526
|
+
#filename1, varname1 = "../../../testdata/MLS-Aura_L2GP-O3_v02-21-c01_2007d059.he5", "O3/L2gpValue"
|
527
|
+
# Grid
|
528
|
+
#filename1, varname1 = "../../../testdata/OMI-Aura_L3-OMAEROe_2008m0101_v003-2009m0114t114202.he5", "ColumnAmountAerosol/AerosolModelMW"
|
529
|
+
# Zonal Average
|
530
|
+
filename1, varname1 = "../../../testdata/test_za.he5", "za1/Temperature"
|
531
|
+
|
532
|
+
print "filename1 = \"#{filename1}\", varname1 = \"#{varname1}\"\n"
|
533
|
+
file = HE5.open(filename1)
|
534
|
+
print "zonal_names = "
|
535
|
+
p file.zonal_names
|
536
|
+
|
537
|
+
temp = GPhys::HE5_IO.open(file, varname1)
|
538
|
+
|
539
|
+
print "temp = "
|
540
|
+
p temp
|
541
|
+
exit
|
542
|
+
|
543
|
+
######
|
544
|
+
|
545
|
+
|
546
|
+
|
547
|
+
# p temp.name, temp.shape_current
|
548
|
+
# p temp.val.class
|
549
|
+
temp2 = temp[true, 2]
|
550
|
+
# p temp2.name, temp2.shape_current
|
551
|
+
temp_xmean = temp#.average(0)
|
552
|
+
# p temp.val
|
553
|
+
temp_edy = ( temp - temp_xmean )
|
554
|
+
# p '###',temp_edy.name,temp_edy.val[0,true]
|
555
|
+
# p '@@@',temp
|
556
|
+
# p '///',temp.copy
|
557
|
+
# p '+++',temp2
|
558
|
+
puts "\n** test write (tmp.he5) **"
|
559
|
+
p v = temp_edy.axis(0).pos.copy.rename('lonlon')
|
560
|
+
temp_edy.axis(0).set_aux('test',v)
|
561
|
+
temp_edy.axis(0).set_aux('test2',(v/2).rename('lonlon2'))
|
562
|
+
temp_edy.axis(0).set_aux('test2',(v/2).rename('lonlon3'))
|
563
|
+
|
564
|
+
print "========== temp ===========\n"
|
565
|
+
pp temp
|
566
|
+
print "=====================\n"
|
567
|
+
pp temp_edy
|
568
|
+
print "========== temp_edy ==========\n"
|
569
|
+
|
570
|
+
#### grid write test ####
|
571
|
+
file2 = HE5.create('tmp.he5')
|
572
|
+
gd = HE5Gd.create( file2, 'grid1', 1440, 720, [90.0, 180.0], [-90.0, -180.0])
|
573
|
+
|
574
|
+
print "gd = "
|
575
|
+
pp gd
|
576
|
+
print "gd.gridinfo = "
|
577
|
+
pp gd.gridinfo
|
578
|
+
|
579
|
+
GPhys::HE5_IO.write(gd,temp_edy)
|
580
|
+
file2.close
|
581
|
+
exit
|
582
|
+
|
583
|
+
|
584
|
+
|
585
|
+
#### swath write test ####
|
586
|
+
file2 = HE5.create('tmp.he5')
|
587
|
+
sw = HE5Sw.create( file2, 'swath1')
|
588
|
+
|
589
|
+
print "sw = "
|
590
|
+
pp sw
|
591
|
+
|
592
|
+
GPhys::HE5_IO.write(sw,temp_edy)
|
593
|
+
file2.close
|
594
|
+
|
595
|
+
sw = HE5Sw.create(file3 = HE5.create('tmp2.he5'),'swath1')
|
596
|
+
GPhys::HE5_IO.write(sw,temp_xmean)
|
597
|
+
file3.close
|
598
|
+
|
599
|
+
p '** test composite **'
|
600
|
+
|
601
|
+
temp = GPhys::HE5_IO.open(file,"O3/L2gpValue")
|
602
|
+
sw = HE5Sw.create( f=HE5.create('tmp00.he5'), "swath3" )
|
603
|
+
GPhys::HE5_IO.write( sw, temp[0..5,true] )
|
604
|
+
# GPhys::HE5_IO.write( sw, temp[6..9,true] )
|
605
|
+
# GPhys::HE5_IO.write( sw, temp[10..15,true] )
|
606
|
+
f.close
|
607
|
+
|
608
|
+
=begin
|
609
|
+
###### Regexp test. ######
|
610
|
+
files = /tmp(\d)(\d).he5/
|
611
|
+
p gpcompo = GPhys::HE5_IO.open( files, "O3/L2gpValue")
|
612
|
+
p gpcompo.coord(0).val
|
613
|
+
p gpcompo[false,0].val
|
614
|
+
=end
|
615
|
+
|
616
|
+
p '** test each_along_dims* **'
|
617
|
+
|
618
|
+
f=HE5.create('tmpE1.he5')
|
619
|
+
GPhys::HE5_IO.each_along_dims_write( temp, f, 1, 2 ){|sub|
|
620
|
+
[sub.mean(0)]
|
621
|
+
}
|
622
|
+
f.close
|
623
|
+
f=HE5.create('tmpE0.he5')
|
624
|
+
GPhys::HE5_IO.write( f, temp.mean(0) )
|
625
|
+
f.close
|
626
|
+
|
627
|
+
print `he5dump tmpE0.he5 > tmpE0; he5dump tmpE1.he5 > tmpE1 ; diff -u tmpE[01]`
|
628
|
+
|
629
|
+
f=HE5.create('tmpE2.he5')
|
630
|
+
GPhys::HE5_IO.each_along_dims_write([temp,temp_edy], f, "level"){|s1,s2|
|
631
|
+
[s1.mean(0),s2.mean(1).rename('T_edy')]
|
632
|
+
}
|
633
|
+
f.close
|
634
|
+
|
635
|
+
f=HE5.create('tmpE3.he5')
|
636
|
+
GPhys::HE5_IO.each_along_dims_write([temp,temp_xmean], f, "level"){|s1,s2|
|
637
|
+
[s1.mean(1),s2.rename('T_x_mean'),s2.mean(0).rename('T_xy_mean')]
|
638
|
+
}
|
639
|
+
f.close
|
640
|
+
|
641
|
+
print "\n\n** PACKED DATA TREATMENT **\n\n"
|
642
|
+
|
643
|
+
file = HE5.open("../../../testdata/T.jan.packed.withmiss.he5")
|
644
|
+
temp = GPhys::HE5_IO.open(file,"T")
|
645
|
+
temp.att_names.each{|nm| p nm,temp.get_att(nm) if /(scale|offs)/ =~ nm}
|
646
|
+
p( mls=temp.copy.att_names )
|
647
|
+
p( (temp*10).att_names - mls )
|
648
|
+
p( temp[0,false].copy.att_names - mls )
|
649
|
+
|
650
|
+
|
651
|
+
print "\n\n** copying with write_grid **\n\n"
|
652
|
+
f=HE5.create('tmpE4.he5')
|
653
|
+
grid = GPhys::HE5_IO.write_grid(f,temp)
|
654
|
+
p grid,grid.axis(0).pos.val
|
655
|
+
f.close
|
656
|
+
|
657
|
+
print "\n\n** axis conventions **\n\n"
|
658
|
+
x = temp.axis(0).copy.to_gphys
|
659
|
+
x.coord(0).set_att('topology','circular')
|
660
|
+
x.coord(0).set_att('modulo',[360.0])
|
661
|
+
p x
|
662
|
+
f=HE5.create('tmpE5.he5')
|
663
|
+
GPhys::HE5_IO.write_grid(f,x)
|
664
|
+
f.close
|
665
|
+
f=HE5.open('tmpE5.he5')
|
666
|
+
x=GPhys::HE5_IO.open(f,'lon')
|
667
|
+
p x.coord(0).axis_cyclic?
|
668
|
+
p x.coord(0).axis_modulo
|
669
|
+
|
670
|
+
|
671
|
+
|
672
|
+
end
|