gphys 1.2.2.1 → 1.4.3
Sign up to get free protection for your applications and to get access to all the features.
- checksums.yaml +7 -0
- data/.gitignore +8 -17
- data/.rspec +2 -0
- data/.travis.yml +3 -0
- data/ChangeLog +5762 -753
- data/LICENSE.txt +30 -18
- data/Rakefile +1 -0
- data/bin/console +14 -0
- data/bin/gpcat +43 -2
- data/bin/gpcut +16 -0
- data/bin/gpvect +167 -15
- data/bin/gpview +254 -51
- data/bin/setup +7 -0
- data/dim_op.c +1220 -0
- data/doc/attribute.html +19 -0
- data/doc/attributenetcdf.html +15 -0
- data/doc/axis.html +387 -0
- data/doc/coordmapping.html +111 -0
- data/doc/coordtransform.html +36 -0
- data/doc/dclext.html +821 -0
- data/doc/derivative/gphys-derivative.html +100 -0
- data/doc/derivative/index.html +21 -0
- data/doc/derivative/index.rd +14 -0
- data/doc/derivative/math-doc/document.pdf +0 -0
- data/doc/derivative/math-doc/document.tex +158 -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/numru-derivative.html +158 -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.pdf +0 -0
- data/doc/ep_flux/math-doc/document.tex +2018 -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/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 +1119 -0
- data/doc/gpcat.html +45 -0
- data/doc/gpcut.html +47 -0
- data/doc/gphys.html +624 -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 +183 -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 +52 -0
- data/doc/gpmaxmin.html +32 -0
- data/doc/gpprint.html +35 -0
- data/doc/gpview.html +349 -0
- data/doc/grads2nc_with_gphys.html +21 -0
- data/doc/grads_gridded.html +307 -0
- data/doc/grib.html +149 -0
- data/doc/grid.html +224 -0
- data/doc/index.html +145 -0
- data/doc/index.rd +138 -0
- data/doc/netcdf_convention.html +136 -0
- data/doc/unumeric.html +176 -0
- data/doc/update +69 -0
- data/doc/update_rdoc +8 -0
- data/doc/varray.html +299 -0
- data/doc/varraycomposite.html +67 -0
- data/ext_init.c +1 -0
- data/extconf.rb +16 -6
- data/gphys.gemspec +33 -26
- data/interpo.c +1 -1
- data/lib/numru/dclext.rb +718 -546
- data/lib/numru/derivative.rb +2 -0
- data/lib/numru/ganalysis.rb +38 -0
- data/lib/numru/ganalysis/beta_plane.rb +103 -0
- data/lib/numru/ganalysis/eof.rb +3 -2
- data/lib/numru/ganalysis/fitting.rb +559 -0
- data/lib/numru/ganalysis/histogram.rb +36 -19
- data/lib/numru/ganalysis/log_p.rb +130 -0
- data/lib/numru/ganalysis/met.rb +396 -2
- data/lib/numru/ganalysis/met_z.rb +300 -0
- data/lib/numru/ganalysis/planet.rb +17 -7
- data/lib/numru/ganalysis/qg.rb +685 -0
- data/lib/numru/ganalysis/sigma_coord.rb +90 -0
- data/lib/numru/gdir.rb +2 -1
- data/lib/numru/ggraph.rb +204 -60
- data/lib/numru/ggraph_on_merdional_section.rb +1 -1
- data/lib/numru/gphys.rb +6 -0
- data/lib/numru/gphys/assoccoords.rb +18 -3
- data/lib/numru/gphys/axis.rb +209 -8
- data/lib/numru/gphys/derivative.rb +11 -0
- data/lib/numru/gphys/gphys.rb +539 -48
- data/lib/numru/gphys/gphys_dim_op.rb +331 -0
- data/lib/numru/gphys/gphys_fft.rb +48 -2
- data/lib/numru/gphys/gphys_io.rb +241 -13
- data/lib/numru/gphys/gphys_netcdf_io.rb +77 -39
- data/lib/numru/gphys/gphys_nusdas_io.rb +3 -0
- data/lib/numru/gphys/grib.rb +133 -54
- data/lib/numru/gphys/grib_params.rb +26 -3
- data/lib/numru/gphys/grid.rb +75 -34
- data/lib/numru/gphys/interpolate.rb +24 -10
- data/lib/numru/gphys/mdstorage.rb +160 -0
- data/lib/numru/gphys/netcdf_convention.rb +4 -2
- data/lib/numru/gphys/subsetmapping.rb +0 -1
- data/lib/numru/gphys/unumeric.rb +50 -5
- data/lib/numru/gphys/varray.rb +15 -30
- data/lib/numru/gphys/varraycomposite.rb +107 -24
- data/lib/numru/gphys/varraynetcdf.rb +9 -3
- data/lib/numru/gphys/version.rb +5 -0
- data/sample/druby_cli1.rb +2 -0
- data/sample/druby_cli2.rb +0 -6
- data/sample/druby_serv2.rb +0 -13
- data/spec/gphys_spec.rb +11 -0
- data/spec/spec_helper.rb +2 -0
- data/test/test_assoccoords.rb +102 -0
- data/test/test_axis.rb +61 -0
- data/test/test_fitting.rb +116 -0
- data/test/test_gphys.rb +20 -0
- data/test/test_met_z.rb +96 -0
- data/test/test_sigma_coord.rb +50 -0
- data/{test → test_old}/eof_slp.rb +0 -0
- data/{test → test_old}/mltbit.dat +0 -0
- data/{test → test_old}/test_ep_flux.rb +0 -0
- data/{test → test_old}/test_multibitIO.rb +0 -0
- metadata +530 -191
- data/README.md +0 -29
- data/lib/gphys.rb +0 -2
- data/lib/numru/dclext_datetime_ax.rb +0 -220
- data/lib/version.rb +0 -3
data/spec/gphys_spec.rb
ADDED
data/spec/spec_helper.rb
ADDED
@@ -0,0 +1,102 @@
|
|
1
|
+
$LOAD_PATH.unshift("../lib/")
|
2
|
+
require "numru/gphys/gphys.rb"
|
3
|
+
require "test/unit"
|
4
|
+
include NumRu
|
5
|
+
include NMath
|
6
|
+
|
7
|
+
class AssocCoordsTest < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
#@nx = 10
|
10
|
+
#@ny = 7
|
11
|
+
@nx = 5
|
12
|
+
@ny = 3
|
13
|
+
@nz = 2
|
14
|
+
@nt = 2
|
15
|
+
x = (NArray.sfloat(@nx).indgen! + 0.5) * (2*PI/@nx)
|
16
|
+
y = NArray.sfloat(@ny).indgen! * (2*PI/(@ny-1))
|
17
|
+
z = NArray.sfloat(@nz).indgen!
|
18
|
+
t = NArray.sfloat(@nt).indgen!
|
19
|
+
vx = VArray.new( x ).rename("x")
|
20
|
+
vy = VArray.new( y ).rename("y")
|
21
|
+
vz = VArray.new( z ).rename("z")
|
22
|
+
vt = VArray.new( t ).rename("t")
|
23
|
+
xax = Axis.new().set_pos(vx)
|
24
|
+
yax = Axis.new().set_pos(vy)
|
25
|
+
zax = Axis.new().set_pos(vz)
|
26
|
+
tax = Axis.new().set_pos(vt)
|
27
|
+
xygrid = Grid.new(xax, yax)
|
28
|
+
xyzgrid = Grid.new(xax, yax, zax)
|
29
|
+
xyztgrid = Grid.new(xax, yax, zax, tax)
|
30
|
+
|
31
|
+
sqrt2 = sqrt(2.0)
|
32
|
+
p = NArray.sfloat(@nx,@ny)
|
33
|
+
q = NArray.sfloat(@nx,@ny)
|
34
|
+
for j in 0...@ny
|
35
|
+
p[true,j] = NArray.sfloat(@nx).indgen!(2*j,1)*sqrt2
|
36
|
+
q[true,j] = NArray.sfloat(@nx).indgen!(2*j,-1)*sqrt2
|
37
|
+
end
|
38
|
+
vp = VArray.new( p ).rename("p")
|
39
|
+
vq = VArray.new( q ).rename("q")
|
40
|
+
gp = GPhys.new(xygrid, vp)
|
41
|
+
gq = GPhys.new(xygrid, vq)
|
42
|
+
r = NArray.sfloat(@nz).indgen! * 2
|
43
|
+
vr = VArray.new( r ).rename("r")
|
44
|
+
gr = GPhys.new( Grid.new(zax), vr )
|
45
|
+
|
46
|
+
d = sin(x.newdim(1,1)) * cos(y.newdim(0,1)) + z.newdim(0,0)
|
47
|
+
vd = VArray.new( d ).rename("d")
|
48
|
+
@gd = GPhys.new(xyzgrid, vd)
|
49
|
+
@gd.set_assoc_coords([gp,gq,gr])
|
50
|
+
|
51
|
+
s = p + r.reshape(1,1,@nz)
|
52
|
+
vs = VArray.new( s ).rename("s")
|
53
|
+
gs = GPhys.new( Grid.new(xax,yax,zax), vs )
|
54
|
+
u = NArray.sfloat(@ny).indgen!
|
55
|
+
vu = VArray.new( u ).rename("u")
|
56
|
+
gu = GPhys.new( Grid.new(yax), vu )
|
57
|
+
d2 = d * NArray.sfloat(1,1,1,@nt).indgen
|
58
|
+
vd2 = VArray.new( d2 ).rename("d2")
|
59
|
+
@gd2 = GPhys.new( xyztgrid, vd2 )
|
60
|
+
@gd2.set_assoc_coords([gp,gq,gs,gu])
|
61
|
+
|
62
|
+
#p @gd
|
63
|
+
end
|
64
|
+
|
65
|
+
def test_gd
|
66
|
+
# make sure @gd has proper associated coordinates.
|
67
|
+
assert_equal( @gd.coord("p").rank, 2 )
|
68
|
+
assert_equal( @gd.coord("p").shape, [@nx,@ny] )
|
69
|
+
assert_equal( @gd.coord("q").rank, 2 )
|
70
|
+
assert_equal( @gd.coord("r").rank, 1 )
|
71
|
+
end
|
72
|
+
|
73
|
+
def test_divide_and_join
|
74
|
+
# make sure to divide a GPhys into chunks and joining them
|
75
|
+
# restores the original assoccoords.
|
76
|
+
chunks = Array.new
|
77
|
+
[0..@nx/2,@nx/2+1..-1].each do |ix|
|
78
|
+
[0..@ny/2,@ny/2+1..-1].each do |iy|
|
79
|
+
chunks.push( @gd[ix,iy,true].copy )
|
80
|
+
end
|
81
|
+
end
|
82
|
+
gd2 = GPhys.join(chunks)
|
83
|
+
assert_equal( gd2.coord("p").shape, [@nx,@ny] )
|
84
|
+
assert_equal( gd2.coord("p").val, @gd.coord("p").val )
|
85
|
+
end
|
86
|
+
|
87
|
+
def test_cut_twice
|
88
|
+
c = @gd2[true,0,true,true] #=> [@nx,@nz,@nt]
|
89
|
+
c2 = c[true,true,0] #=> [@nx,@nz]
|
90
|
+
assert_equal( c2.coord("p").shape, [@nx] )
|
91
|
+
assert_equal( c2.coord("q").shape, [@nx] )
|
92
|
+
assert_equal( c2.coord("s").shape, [@nx,@nz] )
|
93
|
+
end
|
94
|
+
|
95
|
+
def test_mean
|
96
|
+
c = @gd2.mean("y") #=> [@nx,@nz,@nt]
|
97
|
+
assert_equal( c.coord("p").shape, [@nx] )
|
98
|
+
assert_equal( c.coord("q").shape, [@nx] )
|
99
|
+
assert_equal( c.coord("s").shape, [@nx,@nz] )
|
100
|
+
end
|
101
|
+
|
102
|
+
end
|
data/test/test_axis.rb
ADDED
@@ -0,0 +1,61 @@
|
|
1
|
+
##$LOAD_PATH.clear
|
2
|
+
##$LOAD_PATH.push("/usr/lib/ruby/1.8")
|
3
|
+
##$LOAD_PATH.push("/usr/lib/ruby/1.8/i686-linux")
|
4
|
+
$LOAD_PATH.unshift("../lib/")
|
5
|
+
require "numru/gphys/axis.rb"
|
6
|
+
require "test/unit"
|
7
|
+
include NumRu
|
8
|
+
|
9
|
+
class AxisTest < Test::Unit::TestCase
|
10
|
+
def setup
|
11
|
+
@len = 10
|
12
|
+
xc = VArray.new( NArray.float(@len).indgen! + 0.5 ).rename("x")
|
13
|
+
xb = VArray.new( NArray.float(@len+1).indgen! ).rename("xb")
|
14
|
+
@axpt = Axis.new().set_pos(xc)
|
15
|
+
axcel = Axis.new(true).set_cell(xc,xb)
|
16
|
+
@axcel_c = axcel.dup.set_pos_to_center
|
17
|
+
@axcel_b = axcel.dup.set_pos_to_bounds
|
18
|
+
#axcel2 = Axis.new(true).set_cell_guess_bounds(xc)
|
19
|
+
|
20
|
+
xcc = xc.copy
|
21
|
+
xcc.set_att("modulo", [@len.to_f])
|
22
|
+
@axcyc = Axis.new().set_pos(xcc)
|
23
|
+
end
|
24
|
+
|
25
|
+
def test_cell
|
26
|
+
assert_equal(@axcel_c.cell_center?, true)
|
27
|
+
assert_equal(@axcel_b.cell_bounds?, true)
|
28
|
+
end
|
29
|
+
|
30
|
+
def test_length
|
31
|
+
assert_equal(@axpt.length, @len)
|
32
|
+
assert_equal(@axcel_c.length, @len)
|
33
|
+
assert_equal(@axcel_b.length, @len+1)
|
34
|
+
end
|
35
|
+
|
36
|
+
def test_cyclic
|
37
|
+
assert_equal(@axcyc.cyclic?, true)
|
38
|
+
assert_equal(@axcyc.cyclic_extendible?, true)
|
39
|
+
assert( @axcyc.cut(14.9)[0].is_a?(String) ) # cut by scalar
|
40
|
+
ax, sl = @axcyc.cut([5.6, 13.1, 14.9]) # cut by Array
|
41
|
+
assert_equal( ax.pos.val.to_a, [5.5, 13.5, 14.5] )
|
42
|
+
assert_equal( sl, [5, 3, 4] )
|
43
|
+
ax, sl = @axcyc.cut(-3..3)
|
44
|
+
assert_equal( ax.pos.val.to_a, [-2.5, -1.5, -0.5, 0.5, 1.5, 2.5] )
|
45
|
+
assert_equal( sl, [7,8,9,0,1,2] )
|
46
|
+
ax, sl = @axcyc.cut(-3..13)
|
47
|
+
assert_equal( ax.length, 16 )
|
48
|
+
assert_equal( sl.length, 16 )
|
49
|
+
p "###", ax.pos.val.to_a,sl.to_a
|
50
|
+
##p "###", @axcyc.cut(0.1..0.2)
|
51
|
+
end
|
52
|
+
|
53
|
+
def test_add
|
54
|
+
assert_equal( @axpt.add(3.0).pos.val[0], @axpt.pos.val[0]+3.0 )
|
55
|
+
axcel_b2 = @axcel_b.add( NArray.float(@axcel_b.length).indgen! )
|
56
|
+
len = axcel_b2.length
|
57
|
+
assert_equal( @axcel_b.pos[-1].val + (len-1), axcel_b2.pos[-1].val )
|
58
|
+
assert_not_equal( @axcel_b.cell_center.val, axcel_b2.cell_center.val )
|
59
|
+
assert_nothing_raised{@axcel_c.add(NArray.float(@axcel_c.length).indgen!)}
|
60
|
+
end
|
61
|
+
end
|
@@ -0,0 +1,116 @@
|
|
1
|
+
$LOAD_PATH.unshift( File.expand_path("../lib") )
|
2
|
+
require "narray"
|
3
|
+
require "numru/ganalysis/fitting"
|
4
|
+
require "test/unit"
|
5
|
+
include NumRu
|
6
|
+
|
7
|
+
class FittingTest < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
nx = 7
|
10
|
+
ny = 5
|
11
|
+
@x = NArray.float(nx).indgen! - nx/2
|
12
|
+
@y = NArray.float(ny).indgen! - ny/2
|
13
|
+
|
14
|
+
x = @x.newdim(-1)
|
15
|
+
y = @y.newdim(0)
|
16
|
+
@data = x + 2*y + 10 # then the coefficients will be [1, 2, 10]
|
17
|
+
dist = (x*x)*(y*y)*1e-1
|
18
|
+
dist -= dist.mean
|
19
|
+
@data += dist # disturbance that does not change the fitting result
|
20
|
+
|
21
|
+
@data2 = NArray.float(nx,2,ny)
|
22
|
+
@data2[true,0,true] = @data - 1
|
23
|
+
@data2[true,1,true] = @data + 1
|
24
|
+
|
25
|
+
@data3 = 2*NMath.cos(x) + 3*NMath.sin(y)
|
26
|
+
|
27
|
+
@f_cosx = proc {|x,y| NMath.cos(x).newdim!(-1)}
|
28
|
+
@f_sinx = proc {|x,y| NMath.sin(x).newdim!(-1)}
|
29
|
+
@f_cosy = proc {|x,y| NMath.cos(y).newdim!(0)}
|
30
|
+
@f_siny = proc {|x,y| NMath.sin(y).newdim!(0)}
|
31
|
+
|
32
|
+
d = NArray.float(nx,2,ny)
|
33
|
+
d[true,0,true] = x + 2*y + 10 - 1
|
34
|
+
d[true,1,true] = x + 2*y + 10 + 1
|
35
|
+
mask = NArray.byte( *d.shape )
|
36
|
+
mask[0..3,true,0..3] = mask[-3..-1,true,true] = 1
|
37
|
+
mask[0,0,0] = 0 # this is the source of a small descrepancy
|
38
|
+
@data2m = NArrayMiss.to_nam( d, mask )
|
39
|
+
|
40
|
+
@data4 = NArray.float(nx,2,ny,2)
|
41
|
+
@data4[false,0] = d - 0.1
|
42
|
+
@data4[false,1] = d + 0.1
|
43
|
+
end
|
44
|
+
|
45
|
+
def test_least_square_fit_1
|
46
|
+
f_x = GAnalysis::Fitting::X
|
47
|
+
f_y = GAnalysis::Fitting::Y
|
48
|
+
|
49
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data, [@x,@y], [f_x, f_y])
|
50
|
+
err = (c - NArray[1.0, 2.0, 10.0]).abs.max
|
51
|
+
assert( err < 1e-5 )
|
52
|
+
|
53
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data2, [@x,@y],
|
54
|
+
[f_x,f_y], [1])
|
55
|
+
err = (c - NArray[1.0, 2.0, 10.0]).abs.max
|
56
|
+
assert( err < 1e-5 )
|
57
|
+
end
|
58
|
+
|
59
|
+
def test_least_square_fit_2
|
60
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data3, [@x,@y],
|
61
|
+
[@f_cosx, @f_sinx, @f_cosy, @f_siny])
|
62
|
+
err = (c - NArray[2.0, 0, 0, 3, 0]).abs.max
|
63
|
+
assert( err < 1e-10 )
|
64
|
+
assert( dif < 1e-10 )
|
65
|
+
end
|
66
|
+
|
67
|
+
def test_least_square_fit_3
|
68
|
+
f_x = GAnalysis::Fitting::X
|
69
|
+
f_y = GAnalysis::Fitting::Y
|
70
|
+
|
71
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data2m, [@x,@y],
|
72
|
+
[f_x,f_y],[1])
|
73
|
+
err = (c - NArray[1.0, 2.0, 10.0]).abs.max
|
74
|
+
assert( err < 3e-2 )
|
75
|
+
end
|
76
|
+
|
77
|
+
def test_least_square_fit_4
|
78
|
+
f_x = GAnalysis::Fitting::X
|
79
|
+
f_y = GAnalysis::Fitting::Y
|
80
|
+
|
81
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data4, [@x,@y], [f_x,f_y],
|
82
|
+
nil, [1,3])
|
83
|
+
assert_equal( c.rank, 3 )
|
84
|
+
assert( dif < 1e-10 ) # should be a perfect fit (except round-off)
|
85
|
+
|
86
|
+
|
87
|
+
c, bf, dif = GAnalysis::Fitting.least_square_fit(@data4, [@x,@y], [f_x,f_y],
|
88
|
+
[3], [1])
|
89
|
+
assert_equal( c.rank, 2 )
|
90
|
+
assert_equal( bf.rank, 4 )
|
91
|
+
assert_equal( bf.shape[3], 1 )
|
92
|
+
end
|
93
|
+
|
94
|
+
def test_least_square_fit_5
|
95
|
+
va = VArray.new(@data4,{"long_name"=>"data4","units"=>""},"data4")
|
96
|
+
xax = Axis.new().set_pos( VArray.new(@x,{"units"=>""},"x") )
|
97
|
+
yax = Axis.new().set_pos( VArray.new(@y,{"units"=>""},"y") )
|
98
|
+
v1 = NArray.float(@data4.shape[1]).indgen!
|
99
|
+
ax1 = Axis.new().set_pos( VArray.new(v1,nil,"d1") )
|
100
|
+
v3 = NArray.float(@data4.shape[3]).indgen!
|
101
|
+
ax3 = Axis.new().set_pos( VArray.new(v3,nil,"d3") )
|
102
|
+
grid = Grid.new(xax, ax1, yax, ax3)
|
103
|
+
gphys = GPhys.new(grid, va)
|
104
|
+
|
105
|
+
f_x = GAnalysis::Fitting::X
|
106
|
+
f_y = GAnalysis::Fitting::Y
|
107
|
+
|
108
|
+
c, bf, dif = gphys.least_square_fit([f_x,f_y], [3], [1])
|
109
|
+
assert_equal( c.rank, 2 )
|
110
|
+
assert_equal( bf.class, NumRu::GPhys )
|
111
|
+
assert_equal( bf.rank, 3 ) # rank reduced <-- ensemble_dims are deleted
|
112
|
+
assert_equal( bf.shape, [7,2,5] ) # [nx, len of indep_dim, ny ]
|
113
|
+
end
|
114
|
+
|
115
|
+
end
|
116
|
+
|
data/test/test_gphys.rb
ADDED
@@ -0,0 +1,20 @@
|
|
1
|
+
$LOAD_PATH.unshift("../lib/")
|
2
|
+
require "numru/gphys/gphys.rb"
|
3
|
+
require "numru/gphys/gphys_io.rb"
|
4
|
+
require "test/unit"
|
5
|
+
include NumRu
|
6
|
+
|
7
|
+
class GPhysTest < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
@T = GPhys::IO.open("../testdata/T.jan.nc","T") # NetCDF data
|
10
|
+
@Tgd = GPhys::IO.open("../testdata/T.jan.ctl","T") # GrADS data
|
11
|
+
end
|
12
|
+
|
13
|
+
def test_cyclic_ext
|
14
|
+
te = @T.cyclic_ext(0)
|
15
|
+
assert_equal( te.shape[0], @T.shape[0]+1 ) # to make sure it is extened
|
16
|
+
assert_equal( te.axis(0).pos.max.to_f, 360.0 ) # to make sure it is extened
|
17
|
+
te = @Tgd.cyclic_ext(0)
|
18
|
+
assert_equal( te.axis(0).pos.max.to_f, 360.0 ) # to make sure it is extened
|
19
|
+
end
|
20
|
+
end
|
data/test/test_met_z.rb
ADDED
@@ -0,0 +1,96 @@
|
|
1
|
+
$LOAD_PATH.unshift( File.expand_path("../lib") )
|
2
|
+
require "narray"
|
3
|
+
require "../gphys_ext" # extention library is currently at the top directory
|
4
|
+
require "numru/gphys"
|
5
|
+
require "numru/ganalysis/met_z"
|
6
|
+
require "numru/ganalysis/sigma_coord"
|
7
|
+
require "test/unit"
|
8
|
+
include NumRu
|
9
|
+
|
10
|
+
|
11
|
+
class MetZTest < Test::Unit::TestCase
|
12
|
+
def setup
|
13
|
+
nx = 6
|
14
|
+
x = NArray.float(nx).indgen!*60
|
15
|
+
lam = ( x * (Math::PI/180) ).newdim(-1)
|
16
|
+
ny = 5
|
17
|
+
y = NArray.float(ny).indgen!*30 - 60.0
|
18
|
+
phi = ( y * (Math::PI/180) ).newdim(0)
|
19
|
+
ns = 5
|
20
|
+
s = 1.0 - NArray.float(ns).indgen / ns
|
21
|
+
vx = VArray.new(x,{"units"=>"degrees_east", "long_name"=>"longitude"},"lon")
|
22
|
+
vy = VArray.new(y,{"units"=>"degrees_north","long_name"=>"latitude"},"lat")
|
23
|
+
vs = VArray.new(s,{"units"=>"1","long_name"=>"sigma"},"sig")
|
24
|
+
ax = Axis.new().set_pos(vx)
|
25
|
+
ay = Axis.new().set_pos(vy)
|
26
|
+
as = Axis.new().set_pos(vs)
|
27
|
+
grid_xy = Grid.new(ax, ay)
|
28
|
+
grid_xys = Grid.new(ax, ay, as)
|
29
|
+
|
30
|
+
p = s * 1000.0
|
31
|
+
vp = VArray.new(p,{"units"=>"hPa","long_name"=>"pressure"},"p")
|
32
|
+
ap = Axis.new().set_pos(vp)
|
33
|
+
grid_xyp = Grid.new(ax, ay, ap)
|
34
|
+
|
35
|
+
ps = NArray.float(nx,ny).fill!(1000) + NMath.cos(lam)*NMath.cos(phi)*50
|
36
|
+
ps[1,1] = 750
|
37
|
+
ps[2,1] = 500
|
38
|
+
ps[3,1] = 700
|
39
|
+
|
40
|
+
#< for test_mass_strm_p_* and test_mass_strm_* >
|
41
|
+
|
42
|
+
@ps = GPhys.new( grid_xy, VArray.new(ps, {"units"=>"hPa"}, "ps") )
|
43
|
+
|
44
|
+
#v = NArray.float(nx,ny,ns) + (NMath.cos(lam)*NMath.sin(2*phi)*10).newdim(-1)
|
45
|
+
v = NArray.float(nx,ny,ns).fill!(1.0)
|
46
|
+
|
47
|
+
@v_on_sig = GPhys.new( grid_xys, VArray.new(v, {"units"=>"m.s-1"}, "v") )
|
48
|
+
@v_on_p = GPhys.new( grid_xyp, VArray.new(v, {"units"=>"m.s-1"}, "v") )
|
49
|
+
|
50
|
+
#v2 = v.clone
|
51
|
+
#(0...ns).each{|k| v2[false,k]=ns-k}
|
52
|
+
#v2[2,0,false]=300
|
53
|
+
#@v_on_p2 = GPhys.new( grid_xyp, VArray.new(v2, {"units"=>"m.s-1"}, "v") )
|
54
|
+
|
55
|
+
@ans1 = NArray[ 5.41667e+07, 6.5e+09, 1.3e+10, 1.95e+10, 2.57292e+10 ]
|
56
|
+
|
57
|
+
#< additionally for test_mass_strm_* >
|
58
|
+
|
59
|
+
@p_on_sig = GAnalysis::SigmaCoord.sig_ps2p(@ps, s, 2)
|
60
|
+
|
61
|
+
@pcoord = vs * 1000
|
62
|
+
@pcoord.units = "hPa"
|
63
|
+
@pcoord.name = "p"
|
64
|
+
@pcoord.long_name = "pressure"
|
65
|
+
@pcoord.put_att("standard_name","air_pressure")
|
66
|
+
@pcoord.put_att("positive","down")
|
67
|
+
|
68
|
+
end
|
69
|
+
|
70
|
+
def test_mass_strm_p_1
|
71
|
+
mstr = GAnalysis::MetZ.mass_strm_p(@v_on_sig, @ps)
|
72
|
+
v = mstr[0,true].val / (2 * Math::PI)
|
73
|
+
eps = (v-@ans1).abs.max / v.abs.max
|
74
|
+
assert( eps < 1e-5 )
|
75
|
+
end
|
76
|
+
|
77
|
+
#def test_mass_strm_p_2
|
78
|
+
# mstr = GAnalysis::MetZ.mass_strm_p(@v_on_p2, @ps)
|
79
|
+
#end
|
80
|
+
|
81
|
+
def test_mass_strm_p_3
|
82
|
+
mstr = GAnalysis::MetZ.mass_strm_p(@v_on_p, @ps)
|
83
|
+
v = mstr[0,true].val / (2 * Math::PI)
|
84
|
+
ans = NArray[ 0, 6.5e+09, 1.3e+10, 1.95e+10, 2.57292e+10 ]
|
85
|
+
eps = (v-ans).abs.max / v.abs.max
|
86
|
+
assert( eps < 1e-5 )
|
87
|
+
end
|
88
|
+
|
89
|
+
def test_mass_strm_any_1
|
90
|
+
mstr = GAnalysis::MetZ.mass_strm_any(@v_on_sig, @ps, @p_on_sig/10, @pcoord/10)
|
91
|
+
v = mstr[0,true].val / (2 * Math::PI)
|
92
|
+
eps = (v - @ans1).abs.max / v.abs.max
|
93
|
+
assert( eps < 1e-5 )
|
94
|
+
end
|
95
|
+
|
96
|
+
end
|
@@ -0,0 +1,50 @@
|
|
1
|
+
$LOAD_PATH.unshift( File.expand_path("../lib") )
|
2
|
+
require "numru/gphys"
|
3
|
+
require "numru/ganalysis/sigma_coord"
|
4
|
+
require "test/unit"
|
5
|
+
include NumRu
|
6
|
+
|
7
|
+
class SigmaCoordTest < Test::Unit::TestCase
|
8
|
+
def setup
|
9
|
+
nx = 6
|
10
|
+
x = NArray.float(nx).indgen!*60
|
11
|
+
lam = ( x * (Math::PI/180) ).newdim(-1)
|
12
|
+
ny = 5
|
13
|
+
y = NArray.float(ny).indgen!*30 - 60.0
|
14
|
+
phi = ( y * (Math::PI/180) ).newdim(0)
|
15
|
+
ns = 4
|
16
|
+
s = 1.0 - NArray.float(ns).indgen / ns
|
17
|
+
vx = VArray.new(x,{"units"=>"degrees_east", "long_name"=>"longitude"},"lon")
|
18
|
+
vy = VArray.new(y,{"units"=>"degrees_north","long_name"=>"latitude"},"lat")
|
19
|
+
vs = VArray.new(s,{"units"=>"1","long_name"=>"sigma"},"sig")
|
20
|
+
ax = Axis.new().set_pos(vx)
|
21
|
+
ay = Axis.new().set_pos(vy)
|
22
|
+
as = Axis.new().set_pos(vs)
|
23
|
+
grid_xy = Grid.new(ax, ay)
|
24
|
+
grid_xys = Grid.new(ax, ay, as)
|
25
|
+
|
26
|
+
ps = NArray.float(nx,ny).fill!(1000) + NMath.cos(lam)*NMath.cos(phi)*10
|
27
|
+
@ps = GPhys.new( grid_xy, VArray.new(ps, {"units"=>"hPa"}, "ps") )
|
28
|
+
|
29
|
+
u = NArray.float(nx,ny,ns) + (NMath.cos(lam)*NMath.sin(2*phi)*10).newdim(-1)
|
30
|
+
@u = GPhys.new( grid_xys, VArray.new(u, {"units"=>"m.s-1"}, "u") )
|
31
|
+
end
|
32
|
+
|
33
|
+
def test_find_sigma_d
|
34
|
+
assert_equal( GAnalysis::SigmaCoord.find_sigma_d(@u), 2 )
|
35
|
+
end
|
36
|
+
|
37
|
+
def test_sig_ps2p
|
38
|
+
sig = @u.coord(2)
|
39
|
+
sigval = sig.val
|
40
|
+
p1 = GAnalysis::SigmaCoord.sig_ps2p(@ps.val, sigval, 2 )
|
41
|
+
assert( p1.is_a?(NArray) )
|
42
|
+
assert_equal( p1.shape, @u.shape )
|
43
|
+
|
44
|
+
p2 = GAnalysis::SigmaCoord.sig_ps2p(@ps, sig, 2 )
|
45
|
+
assert( p2.is_a?(GPhys) )
|
46
|
+
assert_equal( p2.shape, @u.shape )
|
47
|
+
assert_equal( p2.val, p1 )
|
48
|
+
end
|
49
|
+
|
50
|
+
end
|