gphys 1.1.1 → 1.2.2
Sign up to get free protection for your applications and to get access to all the features.
- data/.gitignore +17 -0
- data/ChangeLog +221 -0
- data/Gemfile +4 -0
- data/LICENSE.txt +18 -30
- data/README +23 -26
- data/README.md +29 -0
- data/Rakefile +1 -56
- data/bin/gpaop +2 -1
- data/bin/gpcut +3 -2
- data/bin/gpedit +6 -2
- data/bin/gpmath +3 -2
- data/bin/gpmaxmin +3 -2
- data/bin/gpprint +2 -1
- data/bin/gpvect +28 -5
- data/bin/gpview +43 -5
- data/extconf.rb +5 -6
- data/gphys.gemspec +34 -0
- data/interpo.c +63 -24
- data/lib/gphys.rb +2 -0
- data/lib/numru/dclext.rb +2636 -0
- data/lib/numru/derivative.rb +53 -12
- data/lib/numru/ganalysis/eof.rb +4 -0
- data/lib/numru/ganalysis/histogram.rb +73 -5
- data/lib/numru/ganalysis/met.rb +163 -2
- data/lib/numru/ganalysis/planet.rb +230 -20
- data/lib/numru/ggraph.rb +147 -2247
- data/lib/numru/gphys/assoccoords.rb +19 -3
- data/lib/numru/gphys/axis.rb +1 -1
- data/lib/numru/gphys/coordmapping.rb +2 -2
- data/lib/numru/gphys/derivative.rb +56 -13
- data/lib/numru/gphys/gphys.rb +17 -1
- data/lib/numru/gphys/gphys_grads_io.rb +6 -5
- data/lib/numru/gphys/gphys_grib_io.rb +6 -6
- data/lib/numru/gphys/gphys_io.rb +25 -6
- data/lib/numru/gphys/grads_gridded.rb +31 -29
- data/lib/numru/gphys/grib.rb +13 -9
- data/lib/numru/gphys/interpolate.rb +153 -29
- data/lib/numru/gphys/unumeric.rb +29 -6
- data/lib/numru/gphys/varray.rb +9 -0
- data/lib/numru/gphys/varraygrib.rb +70 -8
- data/lib/version.rb +3 -0
- metadata +247 -531
- data/doc/attribute.html +0 -19
- data/doc/attributenetcdf.html +0 -15
- data/doc/axis.html +0 -376
- data/doc/coordmapping.html +0 -111
- data/doc/coordtransform.html +0 -36
- data/doc/derivative/gphys-derivative.html +0 -80
- data/doc/derivative/index.html +0 -21
- data/doc/derivative/index.rd +0 -14
- data/doc/derivative/math-doc/document/document.css +0 -30
- data/doc/derivative/math-doc/document/document.html +0 -57
- data/doc/derivative/math-doc/document/images.aux +0 -1
- data/doc/derivative/math-doc/document/images.log +0 -385
- data/doc/derivative/math-doc/document/images.pl +0 -186
- data/doc/derivative/math-doc/document/images.tex +0 -364
- 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 +0 -57
- data/doc/derivative/math-doc/document/labels.pl +0 -13
- 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 +0 -238
- data/doc/derivative/math-doc/document/node2.html +0 -75
- 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 +0 -158
- data/doc/derivative/numru-derivative.html +0 -129
- data/doc/ep_flux/ep_flux.html +0 -469
- data/doc/ep_flux/ggraph_on_merdional_section.html +0 -71
- data/doc/ep_flux/index.html +0 -31
- data/doc/ep_flux/index.rd +0 -24
- data/doc/ep_flux/math-doc/document/WARNINGS +0 -1
- 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 +0 -30
- data/doc/ep_flux/math-doc/document/document.html +0 -101
- data/doc/ep_flux/math-doc/document/images.aux +0 -1
- data/doc/ep_flux/math-doc/document/images.log +0 -1375
- data/doc/ep_flux/math-doc/document/images.pl +0 -1328
- data/doc/ep_flux/math-doc/document/images.tex +0 -1471
- 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 +0 -101
- data/doc/ep_flux/math-doc/document/internals.pl +0 -258
- data/doc/ep_flux/math-doc/document/labels.pl +0 -265
- 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 +0 -104
- data/doc/ep_flux/math-doc/document/node10.html +0 -164
- data/doc/ep_flux/math-doc/document/node11.html +0 -86
- data/doc/ep_flux/math-doc/document/node12.html +0 -166
- data/doc/ep_flux/math-doc/document/node13.html +0 -897
- data/doc/ep_flux/math-doc/document/node14.html +0 -1065
- data/doc/ep_flux/math-doc/document/node15.html +0 -72
- data/doc/ep_flux/math-doc/document/node16.html +0 -81
- data/doc/ep_flux/math-doc/document/node2.html +0 -82
- data/doc/ep_flux/math-doc/document/node3.html +0 -91
- data/doc/ep_flux/math-doc/document/node4.html +0 -149
- data/doc/ep_flux/math-doc/document/node5.html +0 -330
- data/doc/ep_flux/math-doc/document/node6.html +0 -99
- data/doc/ep_flux/math-doc/document/node7.html +0 -98
- data/doc/ep_flux/math-doc/document/node8.html +0 -83
- data/doc/ep_flux/math-doc/document/node9.html +0 -140
- 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 +0 -2018
- data/doc/gdir.html +0 -412
- data/doc/gdir_client.html +0 -16
- data/doc/gdir_connect_ftp-like.html +0 -61
- data/doc/gdir_server.html +0 -45
- data/doc/ggraph.html +0 -1615
- data/doc/gpcat.html +0 -44
- data/doc/gpcut.html +0 -41
- data/doc/gphys.html +0 -532
- data/doc/gphys_fft.html +0 -324
- data/doc/gphys_grads_io.html +0 -69
- data/doc/gphys_grib_io.html +0 -82
- data/doc/gphys_io.html +0 -120
- data/doc/gphys_io_common.html +0 -18
- data/doc/gphys_netcdf_io.html +0 -283
- data/doc/gplist.html +0 -24
- data/doc/gpmath.html +0 -51
- data/doc/gpmaxmin.html +0 -31
- data/doc/gpprint.html +0 -34
- data/doc/gpview.html +0 -270
- data/doc/grads2nc_with_gphys.html +0 -21
- data/doc/grads_gridded.html +0 -307
- data/doc/grib.html +0 -144
- data/doc/grid.html +0 -212
- data/doc/index.html +0 -133
- data/doc/index.rd +0 -127
- data/doc/netcdf_convention.html +0 -136
- data/doc/unumeric.html +0 -176
- data/doc/update +0 -64
- data/doc/varray.html +0 -299
- data/doc/varraycomposite.html +0 -67
data/lib/numru/derivative.rb
CHANGED
@@ -28,13 +28,12 @@ Module functions of Derivative Operater for NArray.
|
|
28
28
|
|
29
29
|
---threepoint_O2nd_deriv(z, x, dim, bc=LINEAR_EXT)
|
30
30
|
|
31
|
-
Derivate (({z})) respect to (({dim})) th
|
32
|
-
|
33
|
-
|
34
|
-
|
35
|
-
|
36
|
-
|
37
|
-
dimension of array. ).
|
31
|
+
Derivate of (({z})) with respect to (({dim})) th dim using a 2nd
|
32
|
+
order 3-point differentiation valid for non-uniform grid:
|
33
|
+
(s**2*z_{i+1} + (t**2 - s**2)*f_{i} - t**2*f_{i-1}) / (s*t*(s + t))
|
34
|
+
Here, s represents (x_{i} - x_{i-1}) ,t represents (x_{i+1} - x_{i})
|
35
|
+
and _{i} represents the suffix of {i} th element in the ((<dim>)) th
|
36
|
+
dimension of the array. ).
|
38
37
|
|
39
38
|
ARGUMENTS
|
40
39
|
* z (NArray): a NArray which you want to derivative.
|
@@ -59,11 +58,28 @@ Module functions of Derivative Operater for NArray.
|
|
59
58
|
|
60
59
|
---cderiv(z, x, dim, bc=LINEAR_EXT)
|
61
60
|
|
62
|
-
Derivate (({z})) respect to (({dim})) th
|
63
|
-
|
64
|
-
|
65
|
-
|
66
|
-
|
61
|
+
Derivate of (({z})) with respect to (({dim})) th dim using centeral
|
62
|
+
differenciation: (z_{i+1} - z_{i-1}) / (x_{i+1} - x_{i-1})
|
63
|
+
|
64
|
+
ARGUMENTS
|
65
|
+
* z (NArray): a NArray which you want to derivative.
|
66
|
+
* x (NArray): a NArray represents the dimension which derivative respect
|
67
|
+
to. z.rank must be 1.
|
68
|
+
* dim (Numeric): a Numeric represents the dimention which derivative
|
69
|
+
respect to. you can give number count backward (((<dim>))<0), but
|
70
|
+
((<z.rank ��dim>)) must be > 0.
|
71
|
+
* bc (Numeric) : a Numeric to represent boundary condition.
|
72
|
+
See ((<threepoint_O2nd_deriv>)) for supported conditions.
|
73
|
+
|
74
|
+
RETURN VALUE
|
75
|
+
* cderiv_data (NArray): (z_{i+1} - z_{i-1}) / (x_{i+1} - x_{i-1})
|
76
|
+
|
77
|
+
---deriv2nd(z, x, dim, bc=LINEAR_EXT)
|
78
|
+
|
79
|
+
2nd Derivate of (({z})) with respect to (({dim}))-th dim
|
80
|
+
covering non-uniform grids. Based on:
|
81
|
+
( (z_{i+1}-z_{i})/(x_{i+1}-x_{i}) - (z_{i}-z_{i-1})/(x_{i}-x_{i-1}) )
|
82
|
+
/ ((x_{i+1}-x_{i-1})/2)
|
67
83
|
|
68
84
|
ARGUMENTS
|
69
85
|
* z (NArray): a NArray which you want to derivative.
|
@@ -169,6 +185,31 @@ module NumRu
|
|
169
185
|
return dzdx
|
170
186
|
end
|
171
187
|
|
188
|
+
# 2nd derivative covering uniform grids
|
189
|
+
def deriv2nd(z, x, dim, bc=LINEAR_EXT)
|
190
|
+
dim += z.rank if dim<0
|
191
|
+
if dim < 0 || dim >= z.rank
|
192
|
+
raise ArgumentError,"dim value(#{dim}) must be between 0 and (#{z.rank-1}"
|
193
|
+
end
|
194
|
+
raise ArgumentError,"rank of x (#{x.rank}) must be 1" if x.rank != 1
|
195
|
+
# <<expand boundaries>>
|
196
|
+
ze = b_expand(z,dim,bc)
|
197
|
+
xe = b_expand_linear_ext(x,0) # always linear extention
|
198
|
+
# <<differenciation>>
|
199
|
+
to_rankD = [1]*dim + [true] + [1]*(ze.rank-1-dim) # to exand 1D to rank D
|
200
|
+
dx20 = xe[2..-1] - xe[0..-3] # x_{i+1} - x_{i-1} (for i=1..-2)
|
201
|
+
dx21 = xe[2..-1] - xe[1..-2] # x_{i+1} - x_{i} (for i=1..-2)
|
202
|
+
dx10 = xe[1..-2] - xe[0..-3] # x_{i} - x_{i-1} (for i=1..-2)
|
203
|
+
a2 = 2/(dx21*dx20).reshape(*to_rankD)
|
204
|
+
a1 = (-2)/(dx21*dx10).reshape(*to_rankD)
|
205
|
+
a0 = 2/(dx10*dx20).reshape(*to_rankD)
|
206
|
+
d2zdx2 = ze[ *([true]*dim+[2..-1,false]) ] * a2 \
|
207
|
+
+ ze[ *([true]*dim+[1..-2,false]) ] * a1 \
|
208
|
+
+ ze[ *([true]*dim+[0..-3,false]) ] * a0
|
209
|
+
return d2zdx2
|
210
|
+
end
|
211
|
+
|
212
|
+
|
172
213
|
def b_expand(z,dim,bc)
|
173
214
|
case bc
|
174
215
|
when LINEAR_EXT
|
data/lib/numru/ganalysis/eof.rb
CHANGED
@@ -154,7 +154,7 @@ module NumRu
|
|
154
154
|
module_function
|
155
155
|
|
156
156
|
@@histogram_options = Misc::KeywordOptAutoHelp.new(
|
157
|
-
['window', [nil,nil,
|
157
|
+
['window', [nil,nil,nil,nil], "window bounds"],
|
158
158
|
['title', "histogram", "window title"],
|
159
159
|
['exchange', false, "exchange x and y"],
|
160
160
|
['fill', false, "fill bars"]
|
@@ -170,30 +170,88 @@ module NumRu
|
|
170
170
|
unless gphys.axis(0).cell?
|
171
171
|
raise ArgumentError, "axis must be cell type"
|
172
172
|
end
|
173
|
+
# if window is specified via GGraph#fig or GGraph#set_fig, use it.
|
173
174
|
opts = @@histogram_options.interpret(options)
|
174
175
|
exchange = opts["exchange"]
|
176
|
+
window = opts["window"] || @@fig['window']
|
175
177
|
unless exchange
|
176
178
|
x = gphys.axis(0).cell_bounds
|
177
179
|
y = gphys
|
180
|
+
window[2] ||= 0
|
178
181
|
else
|
179
182
|
y = gphys.axis(0).cell_bounds
|
180
183
|
x = gphys
|
184
|
+
window[0] ||= 0
|
181
185
|
end
|
186
|
+
itr = @@fig['itr'] || DCL::sgpget("itr")
|
187
|
+
if (itr==2 || itr==4)
|
188
|
+
tmp = y.val
|
189
|
+
if tmp.min * tmp.max < 0
|
190
|
+
if tmp.min.abs < tmp.max
|
191
|
+
mask = tmp.lt(0)
|
192
|
+
else
|
193
|
+
mask = tmp.gt(0)
|
194
|
+
end
|
195
|
+
else
|
196
|
+
mask = tmp.ne(0)
|
197
|
+
end
|
198
|
+
if tmp.is_a?(NArrayMiss)
|
199
|
+
tmp.set_mask(mask * tmp.get_mask)
|
200
|
+
else
|
201
|
+
tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
|
202
|
+
end
|
203
|
+
y.replace_val(tmp)
|
204
|
+
window[2] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
|
205
|
+
end
|
206
|
+
if (itr==3 || itr==4)
|
207
|
+
tmp = x.val
|
208
|
+
if tmp.min * tmp.max < 0
|
209
|
+
if tmp.min.abs < tmp.max
|
210
|
+
mask = tmp.lt(0)
|
211
|
+
else
|
212
|
+
mask = tmp.gt(0)
|
213
|
+
end
|
214
|
+
else
|
215
|
+
mask = tmp.ne(0)
|
216
|
+
end
|
217
|
+
if tmp.is_a?(NArrayMiss)
|
218
|
+
tmp.set_mask(mask * tmp.get_mask)
|
219
|
+
else
|
220
|
+
tmp = NArrayMiss.to_nam_no_dup(tmp, mask)
|
221
|
+
end
|
222
|
+
x.replace_val(tmp)
|
223
|
+
window[0] = tmp.abs.min * (tmp.min < 0 ? -1 : 1)
|
224
|
+
end
|
225
|
+
opts["window"] = window
|
226
|
+
|
182
227
|
if newframe
|
183
228
|
fig(x, y, "window"=>opts["window"])
|
184
229
|
axes(x, y, "title"=>opts["title"])
|
185
230
|
end
|
231
|
+
lmiss = DCL::gllget("lmiss")
|
232
|
+
DCL::gllset("lmiss", true)
|
186
233
|
unless exchange
|
187
234
|
if opts["fill"]
|
188
|
-
DCL::uvbxa(x.val, [
|
235
|
+
DCL::uvbxa(x.val, [window[2]] * y.length, y.val)
|
189
236
|
end
|
190
|
-
|
237
|
+
if (itr == 2) || (itr == 4)
|
238
|
+
bottom = [y.val.min] * y.length
|
239
|
+
else
|
240
|
+
bottom = [window[2]] * y.length
|
241
|
+
end
|
242
|
+
DCL::uvbxf(x.val, bottom, y.val)
|
191
243
|
else
|
192
244
|
if opts["fill"]
|
193
|
-
DCL::uhbxa([0]*x.length, x.val, y.val)
|
245
|
+
DCL::uhbxa([window[0]] * x.length, x.val, y.val)
|
194
246
|
end
|
195
|
-
|
247
|
+
if (itr == 3) || (itr == 4)
|
248
|
+
bottom = [x.val.min] * x.length
|
249
|
+
else
|
250
|
+
bottom = [window[0]] * x.length
|
251
|
+
end
|
252
|
+
DCL::uhbxf(bottom, x.val, y.val)
|
196
253
|
end
|
254
|
+
DCL::gllset("lmiss", lmiss)
|
197
255
|
return nil
|
198
256
|
end
|
199
257
|
alias :histogram1D :histogram
|
@@ -241,6 +299,16 @@ if $0 == __FILE__
|
|
241
299
|
hist = GAnalysis.histogram(gphys1D)
|
242
300
|
GGraph.histogram(hist)
|
243
301
|
|
302
|
+
GGraph.set_fig("itr"=>2)
|
303
|
+
GGraph.histogram(hist)
|
304
|
+
|
305
|
+
GGraph.set_fig("itr"=>3)
|
306
|
+
GGraph.histogram(hist)
|
307
|
+
|
308
|
+
GGraph.set_fig("itr"=>4)
|
309
|
+
GGraph.histogram(hist)
|
310
|
+
|
311
|
+
GGraph.set_fig("itr"=>1)
|
244
312
|
hist = gphys1D.histogram("nbins"=>10)
|
245
313
|
GGraph.histogram(hist, true, "title"=>"histogram 1D")
|
246
314
|
|
data/lib/numru/ganalysis/met.rb
CHANGED
@@ -95,7 +95,8 @@ module NumRu
|
|
95
95
|
dim = find_prs_d(theta) if !dim
|
96
96
|
prs = get_prs(theta) if !prs
|
97
97
|
prs = convert_units2Pa(prs)
|
98
|
-
dtheta_dp = df_dx(theta, prs, dim)
|
98
|
+
#dtheta_dp = df_dx(theta, prs, dim)
|
99
|
+
dtheta_dp = df_dx_vialogscale(theta, prs, dim)
|
99
100
|
sig_inv = dtheta_dp * (-@@g)
|
100
101
|
if sig_inv.respond_to?(:long_name) # VArray or GPhys
|
101
102
|
sig_inv.name = "sig_inv"
|
@@ -134,7 +135,7 @@ module NumRu
|
|
134
135
|
# RETURN VALUE
|
135
136
|
# * potential temperature [GPhys] on a theta coordinate, where
|
136
137
|
# levels are set to theta_levs
|
137
|
-
|
138
|
+
def pv_on_theta(u, v, theta, theta_levs)
|
138
139
|
sigi = GAnalysis::Met.sigma_inv(theta)
|
139
140
|
uth = GAnalysis::Met.interpolate_onto_theta(u, theta, theta_levs)
|
140
141
|
vth = GAnalysis::Met.interpolate_onto_theta(v, theta, theta_levs)
|
@@ -146,6 +147,154 @@ module NumRu
|
|
146
147
|
pv
|
147
148
|
end
|
148
149
|
|
150
|
+
# Derive geostrophic wind from geopotential hight (spherical but fixed f)
|
151
|
+
#
|
152
|
+
# ARGUMENTS
|
153
|
+
# * z [GPhys] : geopotential height on the pressure (or log-pressure)
|
154
|
+
# coordinate
|
155
|
+
# * f [nil or Numeric of UNumeric] : the constant f value
|
156
|
+
# (Coriolis parameter).
|
157
|
+
# If nil, the value at the north pole is assumed.
|
158
|
+
# If Numeric, units are assumed to be "s-1".
|
159
|
+
#
|
160
|
+
def z2geostrophic_wind(z, f=nil)
|
161
|
+
if f.nil?
|
162
|
+
f = 2 * GAnalysis::Planet.omega
|
163
|
+
elsif f.is_a?(Numeric)
|
164
|
+
f = UNumeric[f,"s-1"]
|
165
|
+
end
|
166
|
+
z = z.convert_units("m")
|
167
|
+
gx, gy = GAnalysis::Planet.grad_s( z * (g/f) )
|
168
|
+
u = -gy
|
169
|
+
v = gx
|
170
|
+
u.name = "u"
|
171
|
+
u.long_name = "geostrophic U"
|
172
|
+
u.put_att("assumed_f",f.to_s)
|
173
|
+
v.name = "v"
|
174
|
+
v.long_name = "geostrophic V"
|
175
|
+
v.put_att("assumed_f",f.to_s)
|
176
|
+
[u, v]
|
177
|
+
end
|
178
|
+
|
179
|
+
# Adiabatic frontogenesis function over the sphere. --
|
180
|
+
# D/Dt(|gradH theta|) or D/Dt(|gradH theta|^2), where gradH express
|
181
|
+
# the horizontal component of gradient.
|
182
|
+
#
|
183
|
+
# if full_adv is true (default),
|
184
|
+
# D/Dt(|gradH theta|) =
|
185
|
+
# [ -(ux-va)*thetax^2 - (vx+uy)*thetax*thetay - vy*thetay^2
|
186
|
+
# - (wx*thetax + wy*thetay)*theta_z ]
|
187
|
+
# / |gradH theta|
|
188
|
+
# or else,
|
189
|
+
# (\del/\del t + u gradx + v grady )(|gradH theta|) =
|
190
|
+
# [ -(ux-va)*thetax^2 - (vx+uy)*thetax*thetay - vy*thetay^2
|
191
|
+
# - (w*theta_z)_x*thetax - (w*theta_z)_y*thetay ]
|
192
|
+
# / |gradH theta|
|
193
|
+
#
|
194
|
+
# Here, the 2nd line (vertical advection) is optional;
|
195
|
+
# [vx, vy] = gradH v; [thetax, thetay] = gradH theta;
|
196
|
+
# [ux, uy] = cos_phi * gradH (u/cos_phi)
|
197
|
+
# va = v/tan_phi/a (a=radius).
|
198
|
+
# z and w is the vertical coordinate and the lagrangian
|
199
|
+
# "velocity" in that coordinate --- Typically they are
|
200
|
+
# p and omega, or log-p height and log-p w.
|
201
|
+
#
|
202
|
+
# This formulation is adiabatic; the diabatic heating effect
|
203
|
+
# can be easily included if needed.
|
204
|
+
#
|
205
|
+
# ARGUMENTS
|
206
|
+
# * theta [GPhys] : potential temperature
|
207
|
+
# * u [GPhys] : zonal wind
|
208
|
+
# * v [GPhys] : meridional wind
|
209
|
+
# * w [nil (default) or GPhys] : (optional) "vertical wind", which must
|
210
|
+
# be dimensionally consistent with the vertical coordiante
|
211
|
+
# (e.g., omega for the pressure coordinate).
|
212
|
+
# If w is given, the vertical cooridnate is assumed to be
|
213
|
+
# the 3rd one (dim=2).
|
214
|
+
# * fstodr [true (default) or false] (optional) if true
|
215
|
+
# D/Dt(|\NablaH theta|) returned; if false D/Dt(|\NablaH theta|^2)
|
216
|
+
# is returned.
|
217
|
+
# * full_adv [true (default) or false] : whether to calculate
|
218
|
+
# full lagrangian tendency or lagragian tendency only in
|
219
|
+
# horizontal direction
|
220
|
+
#
|
221
|
+
# RETURN VALUE
|
222
|
+
# * frontogenesis function [GPhys]
|
223
|
+
#
|
224
|
+
def frontogenesis_func(theta, u, v, w=nil, fstodr=true, full_adv = true)
|
225
|
+
thx, thy = GAnalysis::Planet.grad_s( theta )
|
226
|
+
ux = GAnalysis::Planet.grad_sx( u )
|
227
|
+
uy = GAnalysis::Planet.grad_sy_cosphifact( u, -1 )
|
228
|
+
vx, vy = GAnalysis::Planet.grad_s( v )
|
229
|
+
va = GAnalysis::Planet.weight_tanphi( v, 1, -1 )
|
230
|
+
frgf = - (ux-va)*thx*thx - (vx+uy)*thx*thy - vy*thy*thy
|
231
|
+
frgf.name = "frgen"
|
232
|
+
frgf.long_name = "frontogenesis function"
|
233
|
+
if w
|
234
|
+
zdim = 2
|
235
|
+
if (wun=w.units) !~ (ztun = theta.coord(zdim).units * Units["s-1"])
|
236
|
+
raise "w in #{wun} is inconsistent with the vertical coordinate of theta in #{ztun}"
|
237
|
+
else
|
238
|
+
w = w.convert_units(ztun) # For example, Pa/s -> hPa/s
|
239
|
+
end
|
240
|
+
z = theta.axis(zdim).to_gphys
|
241
|
+
if z.units =~ Units["Pa"]
|
242
|
+
thz = df_dx_vialogscale(theta, z, zdim)
|
243
|
+
else
|
244
|
+
thz = df_dx(theta, z, zdim)
|
245
|
+
end
|
246
|
+
if full_adv
|
247
|
+
# full lagragian tendency of theta-gradient strength
|
248
|
+
wx, wy = GAnalysis::Planet.grad_s( w )
|
249
|
+
frgf -= (wx*thx + wy*thy)*thz
|
250
|
+
else
|
251
|
+
# lagragian tendency only in horizontal direction
|
252
|
+
wthzx, wthzy = GAnalysis::Planet.grad_s( w*thz )
|
253
|
+
frgf -= wthzx*thx + wthzy*thy
|
254
|
+
end
|
255
|
+
end
|
256
|
+
if fstodr
|
257
|
+
frgf /= (thx**2 + thy**2).sqrt
|
258
|
+
else
|
259
|
+
frgf *= 2
|
260
|
+
end
|
261
|
+
frgf
|
262
|
+
end
|
263
|
+
|
264
|
+
=begin
|
265
|
+
def frontogenesis_eulerian(theta, u, v, w=nil, fstodr=true )
|
266
|
+
thx, thy = GAnalysis::Planet.grad_s( theta )
|
267
|
+
uthxx, uthxy = GAnalysis::Planet.grad_s( u*thx )
|
268
|
+
vthyx, vthyy = GAnalysis::Planet.grad_s( v*thy )
|
269
|
+
va = GAnalysis::Planet.weight_tanphi( v, 1, -1 )
|
270
|
+
frgf = - (uthxx+vthyx)*thx - (uthxy+vthyy)*thy
|
271
|
+
frgf.name = "thgrd_tend"
|
272
|
+
frgf.long_name = "Eluerian grad-theta tendency"
|
273
|
+
if w
|
274
|
+
zdim = 2
|
275
|
+
if (wun=w.units) !~ (ztun = theta.coord(zdim).units * Units["s-1"])
|
276
|
+
raise "w in #{wun} is inconsistent with the vertical coordinate of theta in #{ztun}"
|
277
|
+
else
|
278
|
+
w = w.convert_units(ztun) # For example, Pa/s -> hPa/s
|
279
|
+
end
|
280
|
+
z = theta.axis(zdim).to_gphys
|
281
|
+
if z.units =~ Units["Pa"]
|
282
|
+
thz = df_dx_vialogscale(theta, z, zdim)
|
283
|
+
else
|
284
|
+
thz = df_dx(theta, z, zdim)
|
285
|
+
end
|
286
|
+
wthzx, wthzy = GAnalysis::Planet.grad_s( w*thz )
|
287
|
+
frgf -= wthzx*thx + wthzy*thy
|
288
|
+
end
|
289
|
+
if fstodr
|
290
|
+
frgf /= (thx**2 + thy**2).sqrt
|
291
|
+
else
|
292
|
+
frgf *= 2
|
293
|
+
end
|
294
|
+
frgf
|
295
|
+
end
|
296
|
+
=end
|
297
|
+
|
149
298
|
# Find a pressure coordinate in a GPhys object
|
150
299
|
#
|
151
300
|
# ARGUMENT
|
@@ -244,6 +393,18 @@ module NumRu
|
|
244
393
|
end
|
245
394
|
private :df_dx # this method should be defined somewhere else
|
246
395
|
|
396
|
+
def df_dx_vialogscale(f, x, dim)
|
397
|
+
z = Misc::EMath.log(x)
|
398
|
+
if GPhys === f
|
399
|
+
mdl = NumRu::GPhys::Derivative
|
400
|
+
dfdz = mdl.threepoint_O2nd_deriv(f, dim, mdl::LINEAR_EXT, z)
|
401
|
+
else
|
402
|
+
mdl = NumRu::Derivative
|
403
|
+
dfdz = mdl.threepoint_O2nd_deriv(f, z, dim, mdl::LINEAR_EXT)
|
404
|
+
end
|
405
|
+
dfdz / x
|
406
|
+
end
|
407
|
+
|
247
408
|
end
|
248
409
|
end
|
249
410
|
end
|