gphys 1.2.2.1 → 1.4.3
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- 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
|
@@ -34,14 +34,21 @@ module NumRu
|
|
|
34
34
|
nbins = 10 if nbins < 10
|
|
35
35
|
min = opts["min"] || gphys0.min.val
|
|
36
36
|
max = opts["max"] || gphys0.max.val
|
|
37
|
+
if log_bins = (opts["log_bins"] && (min > 0))
|
|
38
|
+
min = Math.log10(min)
|
|
39
|
+
max = Math.log10(max)
|
|
40
|
+
end
|
|
37
41
|
hist = GSL::Histogram.alloc(nbins,[min,max])
|
|
38
42
|
end
|
|
39
43
|
val = gphys0.val
|
|
40
44
|
val = val.get_array![val.get_mask!] if NArrayMiss === val
|
|
45
|
+
val = NMath.log10(val) if log_bins
|
|
41
46
|
hist.increment(val)
|
|
42
47
|
|
|
43
48
|
bounds = hist.range.to_na
|
|
49
|
+
bounds = 10 ** bounds if log_bins
|
|
44
50
|
center = (bounds[0..-2]+bounds[1..-1])/2
|
|
51
|
+
cell_width = (bounds[1..-1] - bounds[0..-2]) / 2
|
|
45
52
|
name = gphys0.name
|
|
46
53
|
attr = gphys0.data.attr_copy
|
|
47
54
|
bounds = VArray.new(bounds, attr, name)
|
|
@@ -51,8 +58,9 @@ module NumRu
|
|
|
51
58
|
axis.set_pos_to_center
|
|
52
59
|
|
|
53
60
|
bin = hist.bin.to_na
|
|
61
|
+
bin /= cell_width if opts["log_bins"]
|
|
54
62
|
bin = VArray.new(bin,
|
|
55
|
-
{"long_name"=>"number in bins", "units"=>"1"},
|
|
63
|
+
{"long_name" => (log_bins ? "number per unit bin width" : "number in bins"), "units"=>"1"},
|
|
56
64
|
"bin")
|
|
57
65
|
new_gphys = GPhys.new(Grid.new(axis), bin)
|
|
58
66
|
new_gphys.set_att("mean",[hist.mean])
|
|
@@ -157,7 +165,8 @@ module NumRu
|
|
|
157
165
|
['window', [nil,nil,nil,nil], "window bounds"],
|
|
158
166
|
['title', "histogram", "window title"],
|
|
159
167
|
['exchange', false, "exchange x and y"],
|
|
160
|
-
['fill', false, "fill bars"]
|
|
168
|
+
['fill', false, "fill bars"],
|
|
169
|
+
['fill_pattern', nil, "fill pattern"]
|
|
161
170
|
)
|
|
162
171
|
def histogram(gphys, newframe=true, options=nil)
|
|
163
172
|
gropn_1_if_not_yet
|
|
@@ -173,7 +182,10 @@ module NumRu
|
|
|
173
182
|
# if window is specified via GGraph#fig or GGraph#set_fig, use it.
|
|
174
183
|
opts = @@histogram_options.interpret(options)
|
|
175
184
|
exchange = opts["exchange"]
|
|
176
|
-
window
|
|
185
|
+
raise "Option 'window' must be an Array of length == 4" unless opts["window"].is_a?(Array) && opts["window"].length == 4
|
|
186
|
+
window = opts["window"].dup
|
|
187
|
+
4.times{|i| window[i] ||= @@fig['window'][i]} if @@fig['window']
|
|
188
|
+
4.times{|i| window[i] ||= DCL::sgqwnd[i]} unless newframe
|
|
177
189
|
unless exchange
|
|
178
190
|
x = gphys.axis(0).cell_bounds
|
|
179
191
|
y = gphys
|
|
@@ -201,7 +213,9 @@ module NumRu
|
|
|
201
213
|
tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
|
|
202
214
|
end
|
|
203
215
|
y.replace_val(tmp)
|
|
204
|
-
window[2]
|
|
216
|
+
if(window[2].nil? || window[2] == 0)
|
|
217
|
+
window[2] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
|
|
218
|
+
end
|
|
205
219
|
end
|
|
206
220
|
if (itr==3 || itr==4)
|
|
207
221
|
tmp = x.val
|
|
@@ -220,38 +234,35 @@ module NumRu
|
|
|
220
234
|
tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
|
|
221
235
|
end
|
|
222
236
|
x.replace_val(tmp)
|
|
223
|
-
window[0]
|
|
237
|
+
if(window[0].nil? || window[0] == 0)
|
|
238
|
+
window[0] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
|
|
239
|
+
end
|
|
224
240
|
end
|
|
225
241
|
opts["window"] = window
|
|
226
242
|
|
|
227
|
-
if newframe
|
|
228
|
-
fig(x, y, "window"=>opts["window"])
|
|
229
|
-
axes(x, y, "title"=>opts["title"])
|
|
230
|
-
end
|
|
243
|
+
fig(x, y, "window" => window) if newframe
|
|
231
244
|
lmiss = DCL::gllget("lmiss")
|
|
232
245
|
DCL::gllset("lmiss", true)
|
|
246
|
+
if opts["fill"]
|
|
247
|
+
itps = DCL::uuqarp
|
|
248
|
+
itps[0] = itps[1] = opts["fill_pattern"] if opts["fill_pattern"]
|
|
249
|
+
DCL::uusarp(*itps)
|
|
250
|
+
end
|
|
233
251
|
unless exchange
|
|
234
252
|
if opts["fill"]
|
|
235
253
|
DCL::uvbxa(x.val, [window[2]] * y.length, y.val)
|
|
236
254
|
end
|
|
237
|
-
|
|
238
|
-
bottom = [y.val.min] * y.length
|
|
239
|
-
else
|
|
240
|
-
bottom = [window[2]] * y.length
|
|
241
|
-
end
|
|
255
|
+
bottom = [window[2]] * y.length
|
|
242
256
|
DCL::uvbxf(x.val, bottom, y.val)
|
|
243
257
|
else
|
|
244
258
|
if opts["fill"]
|
|
245
259
|
DCL::uhbxa([window[0]] * x.length, x.val, y.val)
|
|
246
260
|
end
|
|
247
|
-
|
|
248
|
-
bottom = [x.val.min] * x.length
|
|
249
|
-
else
|
|
250
|
-
bottom = [window[0]] * x.length
|
|
251
|
-
end
|
|
261
|
+
bottom = [window[0]] * x.length
|
|
252
262
|
DCL::uhbxf(bottom, x.val, y.val)
|
|
253
263
|
end
|
|
254
264
|
DCL::gllset("lmiss", lmiss)
|
|
265
|
+
axes(x, y, "title" => opts["title"]) if newframe
|
|
255
266
|
return nil
|
|
256
267
|
end
|
|
257
268
|
alias :histogram1D :histogram
|
|
@@ -308,10 +319,16 @@ if $0 == __FILE__
|
|
|
308
319
|
GGraph.set_fig("itr"=>4)
|
|
309
320
|
GGraph.histogram(hist)
|
|
310
321
|
|
|
322
|
+
GGraph.set_fig("itr"=>1)
|
|
323
|
+
GGraph.histogram(hist, true, "fill" => true, "fill_pattern" => 15999)
|
|
324
|
+
|
|
311
325
|
GGraph.set_fig("itr"=>1)
|
|
312
326
|
hist = gphys1D.histogram("nbins"=>10)
|
|
313
327
|
GGraph.histogram(hist, true, "title"=>"histogram 1D")
|
|
314
328
|
|
|
329
|
+
hist = GAnalysis.histogram(gphys1D, 'log_bins' => true)
|
|
330
|
+
GGraph.histogram(hist)
|
|
331
|
+
|
|
315
332
|
hist = GAnalysis.histogram2D(gphys2D_0, gphys2D_1, "nbins0"=>50)
|
|
316
333
|
GGraph.tone(hist, true, "tonc"=>true)
|
|
317
334
|
|
|
@@ -0,0 +1,130 @@
|
|
|
1
|
+
require "numru/gphys"
|
|
2
|
+
require 'numru/gphys/derivative'
|
|
3
|
+
require "numru/ganalysis/met"
|
|
4
|
+
|
|
5
|
+
module NumRu
|
|
6
|
+
module GAnalysis
|
|
7
|
+
|
|
8
|
+
# module LogP : log-pressure coordinate support
|
|
9
|
+
#
|
|
10
|
+
module LogP
|
|
11
|
+
module_function
|
|
12
|
+
|
|
13
|
+
# P00 = 1e5 Pa (1000 hPa)
|
|
14
|
+
P00 = UNumeric[1e5,"Pa"]
|
|
15
|
+
|
|
16
|
+
@@H = UNumeric[7e3,"m"]
|
|
17
|
+
|
|
18
|
+
# set the constant log-p scale height (default 7e3 m)
|
|
19
|
+
#
|
|
20
|
+
# Argument
|
|
21
|
+
# * h [Unumeric]
|
|
22
|
+
def set_h(h)
|
|
23
|
+
@@H = h
|
|
24
|
+
end
|
|
25
|
+
|
|
26
|
+
# returns the current value of the log-p scale height (in UNumeric)
|
|
27
|
+
def h
|
|
28
|
+
@@H.clone
|
|
29
|
+
end
|
|
30
|
+
|
|
31
|
+
# convert pressure to log-p height
|
|
32
|
+
def p2z(p)
|
|
33
|
+
z = (p/P00).convert_units("1").log * (-@@H)
|
|
34
|
+
z.name = "z"
|
|
35
|
+
z.long_name = "log-p z"
|
|
36
|
+
z.del_att("positive")
|
|
37
|
+
z
|
|
38
|
+
end
|
|
39
|
+
|
|
40
|
+
# del/delz applied to data with the p coordinate
|
|
41
|
+
def pcdata_dz(gphys, pdim=nil)
|
|
42
|
+
pdim = Met.find_prs_d(gphys) if !pdim
|
|
43
|
+
p = gphys.axis(pdim).to_gphys
|
|
44
|
+
z = p2z(p.data)
|
|
45
|
+
bc = Derivative::LINEAR_EXT
|
|
46
|
+
delz = gphys.threepoint_O2nd_deriv(pdim, bc, z)
|
|
47
|
+
delz.name = gphys.name+"_z"
|
|
48
|
+
delz.long_name = "del/delz (#{gphys.long_name})"
|
|
49
|
+
delz
|
|
50
|
+
end
|
|
51
|
+
|
|
52
|
+
# del2/del2z applied to data with the p coordinate
|
|
53
|
+
def pcdata_dz2(gphys, pdim=nil)
|
|
54
|
+
pdim = Met.find_prs_d(gphys) if !pdim
|
|
55
|
+
p = gphys.axis(pdim).to_gphys
|
|
56
|
+
z = p2z(p.data)
|
|
57
|
+
bc = Derivative::LINEAR_EXT
|
|
58
|
+
delz = gphys.deriv2nd(pdim, bc, z)
|
|
59
|
+
delz.name = gphys.name+"_zz"
|
|
60
|
+
delz.long_name = "del2/del2z (#{gphys.long_name})"
|
|
61
|
+
delz
|
|
62
|
+
end
|
|
63
|
+
|
|
64
|
+
# p^{-1} del_z ( p del_z self )
|
|
65
|
+
# where del_z = del/del z
|
|
66
|
+
def pcdata_pi_dz_p_dz(gphys, pdim=nil)
|
|
67
|
+
pdim = Met.find_prs_d(gphys) if !pdim
|
|
68
|
+
p = gphys.axis(pdim).to_gphys
|
|
69
|
+
z = p2z(p.data)
|
|
70
|
+
bc = Derivative::LINEAR_EXT
|
|
71
|
+
p_dz = gphys.threepoint_O2nd_deriv(pdim, bc, z) * p
|
|
72
|
+
pi_dz_p_p_dz = p_dz.threepoint_O2nd_deriv(pdim, bc, z) / p
|
|
73
|
+
pi_dz_p_p_dz.long_name = "1/p del_z (p del_z #{gphys.name})"
|
|
74
|
+
pi_dz_p_p_dz
|
|
75
|
+
end
|
|
76
|
+
|
|
77
|
+
end
|
|
78
|
+
end
|
|
79
|
+
|
|
80
|
+
class GPhys
|
|
81
|
+
# Convert the pressure coordinate in self to log-pressure height (after duplicating self)
|
|
82
|
+
#
|
|
83
|
+
# Return value: a GPhys
|
|
84
|
+
def logp_coord_p2z(pdim=nil)
|
|
85
|
+
pdim = GAnalysis::Met.find_prs_d(self) if !pdim
|
|
86
|
+
p = self.coord(pdim)
|
|
87
|
+
z = GAnalysis::LogP.p2z(p)
|
|
88
|
+
ax = self.axis(pdim).copy
|
|
89
|
+
ax.set_pos(z)
|
|
90
|
+
ax.name = z.name
|
|
91
|
+
grid = self.grid.copy.set_axis(pdim, ax)
|
|
92
|
+
GPhys.new(grid,self.data)
|
|
93
|
+
end
|
|
94
|
+
|
|
95
|
+
end
|
|
96
|
+
end
|
|
97
|
+
|
|
98
|
+
|
|
99
|
+
########################################
|
|
100
|
+
##### test part ######
|
|
101
|
+
if $0 == __FILE__
|
|
102
|
+
require "numru/ggraph"
|
|
103
|
+
include NumRu
|
|
104
|
+
u = GPhys::IO.open("../../../testdata/UV.jan.nc","U")
|
|
105
|
+
u2 = u.logp_coord_p2z
|
|
106
|
+
p u2.axnames
|
|
107
|
+
puts u2.coord(2).units
|
|
108
|
+
DCL.swpset('iwidth',1000)
|
|
109
|
+
DCL.swpset('iheight',500)
|
|
110
|
+
DCL.gropn(4)
|
|
111
|
+
DCL.sldiv('y',2,1)
|
|
112
|
+
DCL.sgpset('isub', 96) # control character of subscription: '_' --> '`'
|
|
113
|
+
DCL.glpset('lmiss',true)
|
|
114
|
+
GGraph.contour u2[0,false]
|
|
115
|
+
u_zz = GAnalysis::LogP.pcdata_pi_dz_p_dz(u[0,false])
|
|
116
|
+
GGraph.tone u_zz
|
|
117
|
+
GGraph.contour u[0,false], false
|
|
118
|
+
GGraph.color_bar
|
|
119
|
+
puts u2.units, u_zz.units
|
|
120
|
+
|
|
121
|
+
#sig = (u.axis(2).to_gphys / GAnalysis::LogP::P00).convert_units("1")
|
|
122
|
+
z = GAnalysis::LogP.p2z(u.axis(2).to_gphys)
|
|
123
|
+
p z.val
|
|
124
|
+
y = u[0,false] * 0 - z
|
|
125
|
+
y_zz = GAnalysis::LogP.pcdata_pi_dz_p_dz(y)
|
|
126
|
+
GGraph.line y_zz[0,false], true, "exchange"=>true
|
|
127
|
+
GGraph.color_bar
|
|
128
|
+
|
|
129
|
+
DCL.grcls
|
|
130
|
+
end
|
data/lib/numru/ganalysis/met.rb
CHANGED
|
@@ -5,6 +5,16 @@ require 'numru/ganalysis/planet'
|
|
|
5
5
|
|
|
6
6
|
module NumRu
|
|
7
7
|
|
|
8
|
+
class GPhys
|
|
9
|
+
for f in %w!temp2theta interpolate_onto_theta z2geostrophic_wind q2r r2q r2e e2r q2e e2q lat e_sat rh2e theta_e theta_es!
|
|
10
|
+
eval <<-EOS
|
|
11
|
+
def #{f}(*args)
|
|
12
|
+
GAnalysis::Met.#{f}(self,*args)
|
|
13
|
+
end
|
|
14
|
+
EOS
|
|
15
|
+
end
|
|
16
|
+
end
|
|
17
|
+
|
|
8
18
|
module GAnalysis
|
|
9
19
|
|
|
10
20
|
# Meteorological analysis
|
|
@@ -133,7 +143,7 @@ module NumRu
|
|
|
133
143
|
# potential temperature values (Kelvin) on which PV is derived.
|
|
134
144
|
#
|
|
135
145
|
# RETURN VALUE
|
|
136
|
-
# * potential
|
|
146
|
+
# * potential voticity [GPhys] on a theta coordinate, where
|
|
137
147
|
# levels are set to theta_levs
|
|
138
148
|
def pv_on_theta(u, v, theta, theta_levs)
|
|
139
149
|
sigi = GAnalysis::Met.sigma_inv(theta)
|
|
@@ -147,6 +157,40 @@ module NumRu
|
|
|
147
157
|
pv
|
|
148
158
|
end
|
|
149
159
|
|
|
160
|
+
# Derive Ertel's potential vorticity on the pressure
|
|
161
|
+
# coordinate
|
|
162
|
+
#
|
|
163
|
+
#
|
|
164
|
+
# ARGUMENTS
|
|
165
|
+
# * u [GPhys] : zonal wind on pressure coordinate
|
|
166
|
+
# (u, v, and theta must share same coordinates)
|
|
167
|
+
# * v [GPhys] : meridional wind on pressure coordinate
|
|
168
|
+
# * theta [GPhys] : potential temperature on pressure coordinate
|
|
169
|
+
#
|
|
170
|
+
# RETURN VALUE
|
|
171
|
+
# * potential vorticity [GPhys] on the same grid as the inputs
|
|
172
|
+
#
|
|
173
|
+
def pv_on_p(u, v, theta)
|
|
174
|
+
up,vp,thp = del_ngp(u,v,theta) # -g del/del p
|
|
175
|
+
pv = Planet.absvor_s(u, v) * thp \
|
|
176
|
+
- vp * Planet.grad_sx(theta) \
|
|
177
|
+
+ up * Planet.grad_sy(theta)
|
|
178
|
+
pv.long_name = "potential vorticity"
|
|
179
|
+
pv.name = "PV"
|
|
180
|
+
pv.units = pv.units.reduce5 # express in the MKS fundamental units
|
|
181
|
+
pv
|
|
182
|
+
end
|
|
183
|
+
|
|
184
|
+
# -g del/del p
|
|
185
|
+
def del_ngp(*gps) # gps: array of GPhys objects having the same grid
|
|
186
|
+
d = find_prs_d(gps[0])
|
|
187
|
+
prs = gps[0].coord(d).convert_units(Units["Pa"])
|
|
188
|
+
dngps = gps.collect{|gp|
|
|
189
|
+
gp.threepoint_O2nd_deriv(d,Derivative::LINEAR_EXT,prs) * (-@@g)
|
|
190
|
+
}
|
|
191
|
+
end
|
|
192
|
+
private :del_ngp
|
|
193
|
+
|
|
150
194
|
# Derive geostrophic wind from geopotential hight (spherical but fixed f)
|
|
151
195
|
#
|
|
152
196
|
# ARGUMENTS
|
|
@@ -194,7 +238,7 @@ module NumRu
|
|
|
194
238
|
# Here, the 2nd line (vertical advection) is optional;
|
|
195
239
|
# [vx, vy] = gradH v; [thetax, thetay] = gradH theta;
|
|
196
240
|
# [ux, uy] = cos_phi * gradH (u/cos_phi)
|
|
197
|
-
# va = v
|
|
241
|
+
# va = v*tan_phi/a (a=radius).
|
|
198
242
|
# z and w is the vertical coordinate and the lagrangian
|
|
199
243
|
# "velocity" in that coordinate --- Typically they are
|
|
200
244
|
# p and omega, or log-p height and log-p w.
|
|
@@ -405,6 +449,327 @@ module NumRu
|
|
|
405
449
|
dfdz / x
|
|
406
450
|
end
|
|
407
451
|
|
|
452
|
+
##### moist thermodynamics ###
|
|
453
|
+
|
|
454
|
+
@@consider_ice = true
|
|
455
|
+
@@ice_thres = T0 # Celcius
|
|
456
|
+
|
|
457
|
+
# whether or not ice is considered in the water phase change
|
|
458
|
+
def consider_ice
|
|
459
|
+
@@consider_ice
|
|
460
|
+
end
|
|
461
|
+
|
|
462
|
+
# set whether or not ice is considered in the water phase change
|
|
463
|
+
def consider_ice=(t_or_f)
|
|
464
|
+
@@consider_ice=t_or_f
|
|
465
|
+
end
|
|
466
|
+
|
|
467
|
+
# the threshold temperature for liquid/ice-phase treatment
|
|
468
|
+
def ice_thres
|
|
469
|
+
@@ice_thres
|
|
470
|
+
end
|
|
471
|
+
|
|
472
|
+
# set the threshold temperature for liquid/ice-phase treatment (default: O degC)
|
|
473
|
+
def ice_thres=(temp)
|
|
474
|
+
@@ice_thres=temp
|
|
475
|
+
end
|
|
476
|
+
|
|
477
|
+
# specific humidity -> mixing ratio
|
|
478
|
+
#
|
|
479
|
+
# ARGUMENTS
|
|
480
|
+
# * q: specific humidty
|
|
481
|
+
#
|
|
482
|
+
# RETURN VALUE
|
|
483
|
+
# * r: mixing ratio
|
|
484
|
+
def q2r(q)
|
|
485
|
+
r = q/(1.0-q)
|
|
486
|
+
r.name = "r"
|
|
487
|
+
r.long_name = "mixing ratio"
|
|
488
|
+
r
|
|
489
|
+
end
|
|
490
|
+
|
|
491
|
+
# mixing ratio -> specific humidity
|
|
492
|
+
#
|
|
493
|
+
# ARGUMENTS
|
|
494
|
+
# * r: mixing ratio
|
|
495
|
+
#
|
|
496
|
+
# RETURN VALUE
|
|
497
|
+
# * q: specific humidty
|
|
498
|
+
def r2q(r)
|
|
499
|
+
q = r/(1.0+r)
|
|
500
|
+
q.name = "q"
|
|
501
|
+
q.long_name = "specific humidity"
|
|
502
|
+
q
|
|
503
|
+
end
|
|
504
|
+
|
|
505
|
+
# water vapor mixing ratio -> water vapor pressure
|
|
506
|
+
#
|
|
507
|
+
# ARGUMENTS
|
|
508
|
+
# * r: water vapor mixing ratio
|
|
509
|
+
# * prs: pressure
|
|
510
|
+
#
|
|
511
|
+
# RETURN VALUE
|
|
512
|
+
# * e: water vapor pressure
|
|
513
|
+
def r2e(r,prs=nil)
|
|
514
|
+
prs = get_prs(r) if !prs
|
|
515
|
+
prs = convert_units2Pa(prs)
|
|
516
|
+
rratio = R / Rv
|
|
517
|
+
e = prs*r/(rratio+r) # water vapor pertial pressure
|
|
518
|
+
e.name = "e"
|
|
519
|
+
e.long_name = "water vapor pressure"
|
|
520
|
+
e
|
|
521
|
+
end
|
|
522
|
+
|
|
523
|
+
# water vapor pressure -> mixing ratio
|
|
524
|
+
#
|
|
525
|
+
# ARGUMENTS
|
|
526
|
+
# * e: water vapor pressure
|
|
527
|
+
# * prs: pressure
|
|
528
|
+
#
|
|
529
|
+
# RETURN VALUE
|
|
530
|
+
# * r: mixing ratio
|
|
531
|
+
def e2r(e,prs=nil)
|
|
532
|
+
prs = get_prs(e) if !prs
|
|
533
|
+
prs = convert_units(prs,e.units)
|
|
534
|
+
rratio = R / Rv
|
|
535
|
+
r = rratio * e / (prs-e)
|
|
536
|
+
r.name = "r"
|
|
537
|
+
r.long_name = "mixing ratio"
|
|
538
|
+
r
|
|
539
|
+
end
|
|
540
|
+
|
|
541
|
+
# specific humidity -> water vapor pressure
|
|
542
|
+
#
|
|
543
|
+
# ARGUMENTS
|
|
544
|
+
# * q: specific humidity[g/g]
|
|
545
|
+
# * prs: pressure[hPa]
|
|
546
|
+
#
|
|
547
|
+
# RETURN VALUE
|
|
548
|
+
# * e: water vapor pressure
|
|
549
|
+
def q2e(q,prs=nil)
|
|
550
|
+
prs = get_prs(q) if !prs
|
|
551
|
+
prs = convert_units2Pa(prs)
|
|
552
|
+
rratio = R / Rv
|
|
553
|
+
e = prs*q/(rratio+(1-rratio)*q) # water vapor pertial pressure
|
|
554
|
+
e.name = "e"
|
|
555
|
+
e.long_name = "water vapor pressure"
|
|
556
|
+
e
|
|
557
|
+
end
|
|
558
|
+
|
|
559
|
+
# water vapor pressure -> specific humidity
|
|
560
|
+
#
|
|
561
|
+
# ARGUMENTS
|
|
562
|
+
# * e: water vapor pressure
|
|
563
|
+
# * prs: pressure
|
|
564
|
+
#
|
|
565
|
+
# RETURN VALUE
|
|
566
|
+
# * q: specific humidity
|
|
567
|
+
def e2q(e,prs=nil)
|
|
568
|
+
prs = get_prs(e) if !prs
|
|
569
|
+
prs = convert_units(prs,e.units)
|
|
570
|
+
rratio = R / Rv
|
|
571
|
+
q = rratio * e / (prs-(1-rratio)*e)
|
|
572
|
+
q.name = "q"
|
|
573
|
+
q.long_name = "specific humidity"
|
|
574
|
+
q
|
|
575
|
+
end
|
|
576
|
+
|
|
577
|
+
# temperature --> latent heat [J.kg-1]
|
|
578
|
+
#
|
|
579
|
+
# good for -100<T<50
|
|
580
|
+
#
|
|
581
|
+
# ARGUMENTS
|
|
582
|
+
# * temp: temperature
|
|
583
|
+
#
|
|
584
|
+
# RETURN VALUE
|
|
585
|
+
# * lat: latent heat
|
|
586
|
+
def lat(temp)
|
|
587
|
+
tempK = temp.convert_units("K")
|
|
588
|
+
lat = Lat0*(T0/tempK)**(0.167+tempK.val*3.67E-4)
|
|
589
|
+
lat.name = "L"
|
|
590
|
+
lat.long_name = "Latent heat"
|
|
591
|
+
lat
|
|
592
|
+
end
|
|
593
|
+
|
|
594
|
+
# Bolton formula for saturation water vapor pressure against water
|
|
595
|
+
#
|
|
596
|
+
# ARGUMENTS
|
|
597
|
+
# * temp: temperature
|
|
598
|
+
#
|
|
599
|
+
# RETURN VALUE
|
|
600
|
+
# * es: saturation water vapor pressure [Pa]
|
|
601
|
+
def e_sat_bolton(temp)
|
|
602
|
+
tempC = temp.convert_units("degC")
|
|
603
|
+
es = UNumeric[6.112e2,"Pa"] *
|
|
604
|
+
Misc::EMath.exp( 17.67 * tempC / (tempC + UNumeric[243.5,"degC"] ) )
|
|
605
|
+
es.name = "e_sat"
|
|
606
|
+
es.long_name = "e_sat_water bolton"
|
|
607
|
+
es
|
|
608
|
+
end
|
|
609
|
+
|
|
610
|
+
# saturation water vapor pressure against ice.
|
|
611
|
+
#
|
|
612
|
+
# Emanuel (1994) eq.(4.4.15)
|
|
613
|
+
#
|
|
614
|
+
# ARGUMENTS
|
|
615
|
+
# * temp: temperature
|
|
616
|
+
#
|
|
617
|
+
# RETURN VALUE
|
|
618
|
+
# * es: saturation water vapor pressure [Pa]
|
|
619
|
+
def e_sat_emanuel_water(temp, mask=nil)
|
|
620
|
+
es = temp.copy
|
|
621
|
+
tempK = temp.convert_units("K").val # units removed
|
|
622
|
+
tempK = tempK[mask] if mask
|
|
623
|
+
e = 53.67957 - 6743.769/tempK \
|
|
624
|
+
- 4.8451 * Misc::EMath.log(tempK)
|
|
625
|
+
if !mask
|
|
626
|
+
es.replace_val( Misc::EMath.exp(e) * 100.0 )
|
|
627
|
+
else
|
|
628
|
+
es[false] = 0
|
|
629
|
+
es[mask] = Misc::EMath.exp(e) * 100.0
|
|
630
|
+
end
|
|
631
|
+
es.units = "Pa"
|
|
632
|
+
es.name = "e_sat_ice"
|
|
633
|
+
es.long_name = "e_sat_ice emanuel"
|
|
634
|
+
es
|
|
635
|
+
end
|
|
636
|
+
|
|
637
|
+
# Saturation water vapor pressure against ice.
|
|
638
|
+
#
|
|
639
|
+
# Emanuel (1994) eq.(4.4.15)
|
|
640
|
+
#
|
|
641
|
+
# ARGUMENTS
|
|
642
|
+
# * temp: temperature
|
|
643
|
+
#
|
|
644
|
+
# RETURN VALUE
|
|
645
|
+
# * es: saturation water vapor pressure [Pa]
|
|
646
|
+
def e_sat_emanuel_ice(temp, mask=nil)
|
|
647
|
+
es = temp.copy
|
|
648
|
+
tempK = temp.convert_units("K").val # units removed
|
|
649
|
+
tempK = tempK[mask] if mask
|
|
650
|
+
e = 23.33086 - 6111.72784/tempK \
|
|
651
|
+
+ 0.15215 * Misc::EMath.log(tempK)
|
|
652
|
+
if !mask
|
|
653
|
+
es.replace_val( Misc::EMath.exp(e) * 100.0 )
|
|
654
|
+
else
|
|
655
|
+
es[false] = 0
|
|
656
|
+
es[mask] = Misc::EMath.exp(e) * 100.0
|
|
657
|
+
end
|
|
658
|
+
es.units = "Pa"
|
|
659
|
+
es.name = "e_sat_ice"
|
|
660
|
+
es.long_name = "e_sat_ice emanuel"
|
|
661
|
+
es
|
|
662
|
+
end
|
|
663
|
+
|
|
664
|
+
# Selector of the formulat to compute saturation water vapor pressure against water (default: Bolton)
|
|
665
|
+
#
|
|
666
|
+
# ARGUMENTS
|
|
667
|
+
# * formula: nil(default), "bolton", "emanuel"
|
|
668
|
+
#
|
|
669
|
+
# RETURN VALUE
|
|
670
|
+
# * nil
|
|
671
|
+
def set_e_sat_water(formula=nil)
|
|
672
|
+
case formula
|
|
673
|
+
when nil,"bolton"
|
|
674
|
+
alias :e_sat_water :e_sat_bolton
|
|
675
|
+
when "emanuel"
|
|
676
|
+
alias :e_sat_water :e_sat_emanuel_water
|
|
677
|
+
module_function :e_sat_water
|
|
678
|
+
end
|
|
679
|
+
nil
|
|
680
|
+
end
|
|
681
|
+
set_e_sat_water
|
|
682
|
+
module_function :e_sat_water
|
|
683
|
+
|
|
684
|
+
# currently, only a single formula is avilable for ice
|
|
685
|
+
alias :e_sat_ice :e_sat_emanuel_ice
|
|
686
|
+
module_function :e_sat_ice
|
|
687
|
+
|
|
688
|
+
# Calculates saturation water vapor pressure using enhanced
|
|
689
|
+
#
|
|
690
|
+
# ARGUMENTS
|
|
691
|
+
# * temp: temperature
|
|
692
|
+
#
|
|
693
|
+
# RETURN VALUE
|
|
694
|
+
# * es: saturation water vapor pressure
|
|
695
|
+
def e_sat(temp)
|
|
696
|
+
|
|
697
|
+
ice = @@consider_ice && ( temp.lt(@@ice_thres) )
|
|
698
|
+
#ice = ice.to_na
|
|
699
|
+
water = !@@consider_ice || ( (ice==true||ice==false) ? !ice : ice.not)
|
|
700
|
+
|
|
701
|
+
if water
|
|
702
|
+
es = e_sat_water(temp)
|
|
703
|
+
end
|
|
704
|
+
|
|
705
|
+
case ice
|
|
706
|
+
when true
|
|
707
|
+
es = e_sat_ice(temp)
|
|
708
|
+
when NArray, NArrayMiss
|
|
709
|
+
es[ice] = e_sat_ice(temp,ice).val[ice]
|
|
710
|
+
end
|
|
711
|
+
es.name = "e_sat"
|
|
712
|
+
es.long_name = "e_sat"
|
|
713
|
+
es
|
|
714
|
+
end
|
|
715
|
+
|
|
716
|
+
# relative humidity -> water vapor pressure
|
|
717
|
+
#
|
|
718
|
+
# ARGUMENTS
|
|
719
|
+
# * rh: relative humidity
|
|
720
|
+
# * temp: temperature
|
|
721
|
+
#
|
|
722
|
+
# RETURN VALUE
|
|
723
|
+
# * e: water vapor pressure
|
|
724
|
+
def rh2e(rh,temp)
|
|
725
|
+
es = e_sat(temp)
|
|
726
|
+
rh = rh.convert_units("1")
|
|
727
|
+
e = es * rh
|
|
728
|
+
e.name = "e"
|
|
729
|
+
e.long_name = "water vapor pressure"
|
|
730
|
+
e
|
|
731
|
+
end
|
|
732
|
+
|
|
733
|
+
# Derive equivalent potential temperature
|
|
734
|
+
#
|
|
735
|
+
# ARGUMENTS
|
|
736
|
+
# * temp [GPhys] : temperature (ok whether degC or K)
|
|
737
|
+
# * q [GPhys] : specific humidity
|
|
738
|
+
# * prs [GPhys or VArray] : the pressure values.
|
|
739
|
+
# If nil, searched from coordinates (for data on
|
|
740
|
+
# the pressure coordinate)
|
|
741
|
+
#
|
|
742
|
+
# RETURN VALUE
|
|
743
|
+
# * theta_e: equivalent potential temperature
|
|
744
|
+
def theta_e(temp,q,prs=nil)
|
|
745
|
+
tempK = temp.convert_units("K")
|
|
746
|
+
theta = temp2theta(tempK, prs)
|
|
747
|
+
theta_e = theta * Misc::EMath.exp( lat(tempK)*q/(Cp*tempK) )
|
|
748
|
+
theta_e.name = "theta_e"
|
|
749
|
+
theta_e.long_name = "equivalent potential temperature"
|
|
750
|
+
theta_e
|
|
751
|
+
end
|
|
752
|
+
|
|
753
|
+
# Derive the saturation equivalent potential temperature
|
|
754
|
+
#
|
|
755
|
+
# ARGUMENTS
|
|
756
|
+
# * temp [GPhys] : temperature (ok whether degC or K)
|
|
757
|
+
# * prs [GPhys or VArray] : the pressure values.
|
|
758
|
+
# If nil, searched from coordinates (for data on
|
|
759
|
+
# the pressure coordinate)
|
|
760
|
+
#
|
|
761
|
+
# RETURN VALUE
|
|
762
|
+
# * theta_es: saturation equivalent potential temperature
|
|
763
|
+
def theta_es(temp,prs=nil)
|
|
764
|
+
tempK = temp.convert_units("K")
|
|
765
|
+
theta = temp2theta(tempK, prs)
|
|
766
|
+
q = e_sat(temp).e2q(prs)
|
|
767
|
+
theta_e = theta * Misc::EMath.exp( lat(tempK)*q/(Cp*tempK) )
|
|
768
|
+
theta_e.name = "theta_es"
|
|
769
|
+
theta_e.long_name = "theta_e sat"
|
|
770
|
+
theta_e
|
|
771
|
+
end
|
|
772
|
+
|
|
408
773
|
end
|
|
409
774
|
end
|
|
410
775
|
end
|
|
@@ -473,6 +838,35 @@ if $0 == __FILE__
|
|
|
473
838
|
GGraph::tone pv.cut("theta"=>320),true,"nlev"=>20,"color_bar"=>true
|
|
474
839
|
GGraph::tone pv.cut("theta"=>600),true,"nlev"=>20,"color_bar"=>true
|
|
475
840
|
|
|
841
|
+
|
|
842
|
+
#< moist thermo >
|
|
843
|
+
DCL.grfrm
|
|
844
|
+
|
|
845
|
+
GGraph::set_fig "itr"=>2
|
|
846
|
+
|
|
847
|
+
sel = [0,true,0..-4]
|
|
848
|
+
|
|
849
|
+
es = temp[*sel].e_sat
|
|
850
|
+
# es = GAnalysis::Met.e_sat(temp[*sel]) # same as temp[*sel].e_sat
|
|
851
|
+
GGraph::tone es,true,"int"=>2e2,"max"=>4e3,"min"=>0,"tonf"=>true
|
|
852
|
+
GGraph::contour temp[*sel],false
|
|
853
|
+
GGraph.color_bar
|
|
854
|
+
|
|
855
|
+
GAnalysis::Met.consider_ice=false
|
|
856
|
+
es2 = temp[*sel].e_sat
|
|
857
|
+
GGraph::tone( (es2-es)/es,true )
|
|
858
|
+
GGraph.color_bar
|
|
859
|
+
|
|
860
|
+
# GAnalysis::Met.set_e_sat_water("emanuel")
|
|
861
|
+
# es3 = GAnalysis::Met.e_sat(temp[*sel])
|
|
862
|
+
# GGraph::tone (es2-es3)/es3,true,"tonf"=>true
|
|
863
|
+
# GGraph.color_bar
|
|
864
|
+
|
|
865
|
+
qs = es.e2r
|
|
866
|
+
GGraph::tone qs,true,"nlev"=>20
|
|
867
|
+
GGraph.color_bar
|
|
868
|
+
|
|
476
869
|
#< finish >
|
|
477
870
|
DCL.grcls
|
|
871
|
+
|
|
478
872
|
end
|