gphys 1.1.1 → 1.2.2
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.
- 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/bin/gpvect
CHANGED
@@ -13,7 +13,7 @@ The first command form is for only vector field plotting.
|
|
13
13
|
|
14
14
|
where the format of the gturl is
|
15
15
|
|
16
|
-
path
|
16
|
+
path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
|
17
17
|
|
18
18
|
The command loads two gphys variables in each time and draws
|
19
19
|
vector field whose x and y components are the first and the second argument,
|
@@ -100,6 +100,9 @@ gturl_x gturl_y.
|
|
100
100
|
:--mean <dim>:
|
101
101
|
mean along axis <dim>.
|
102
102
|
|
103
|
+
:--eddy <dim>:
|
104
|
+
deviation from mean along axis <dim>.
|
105
|
+
|
103
106
|
:--m, --map <map_type>:
|
104
107
|
plot map. itr number must be set. this option is neglect if itr
|
105
108
|
number is 1-4. abailable map type is coast_world, border_world,
|
@@ -150,6 +153,9 @@ gturl_x gturl_y.
|
|
150
153
|
:--patterns:
|
151
154
|
set each patterns for tone plot.
|
152
155
|
|
156
|
+
:--tonf:
|
157
|
+
use tonf instead of tone.
|
158
|
+
|
153
159
|
:--nocolorbar:
|
154
160
|
do not draw color bar
|
155
161
|
|
@@ -178,7 +184,7 @@ gturl_x gturl_y.
|
|
178
184
|
|
179
185
|
:--max_unit_vect:
|
180
186
|
(Effective only if flow_vect && unit_vect) use the maximum arrows to
|
181
|
-
scale the unit vector
|
187
|
+
s scale the unit vector
|
182
188
|
|
183
189
|
==EXAMPLES
|
184
190
|
|
@@ -203,6 +209,8 @@ For the second command format,
|
|
203
209
|
2010/03/10 Y SASAKI (change help block into RD format)
|
204
210
|
2010/07/16 Y SASAKI (option --clrmap implemented)
|
205
211
|
2011/07/29 S Takehiro (option --clrmap fixed)
|
212
|
+
2012/02/19 S Takehiro (description for gturl format updated)
|
213
|
+
|
206
214
|
=end
|
207
215
|
#################################################
|
208
216
|
require "getoptlong" # for option_parse
|
@@ -215,7 +223,7 @@ include NumRu
|
|
215
223
|
## Default param.
|
216
224
|
|
217
225
|
VIEWPORT = [0.15,0.85,0.2,0.55]
|
218
|
-
URLfmt = "path
|
226
|
+
URLfmt = "path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]"
|
219
227
|
|
220
228
|
#####################################################
|
221
229
|
def GGraph::annotate(str_ary)
|
@@ -397,7 +405,8 @@ def draw(gp, gpux, gpuy, draw_flag)
|
|
397
405
|
"annotate"=>$annotate,
|
398
406
|
"transpose"=>$OPT_exch,
|
399
407
|
"levels"=>$OPT_slevels,
|
400
|
-
"patterns"=>$OPT_patterns
|
408
|
+
"patterns"=>$OPT_patterns,
|
409
|
+
"tonf"=>$OPT_tonf
|
401
410
|
)
|
402
411
|
GGraph.contour(gp,
|
403
412
|
false,
|
@@ -414,7 +423,8 @@ def draw(gp, gpux, gpuy, draw_flag)
|
|
414
423
|
"annotate"=>$annotate,
|
415
424
|
"transpose"=>$OPT_exch,
|
416
425
|
"levels"=>$OPT_slevels,
|
417
|
-
"patterns"=>$OPT_patterns
|
426
|
+
"patterns"=>$OPT_patterns,
|
427
|
+
"tonf"=>$OPT_tonf
|
418
428
|
)
|
419
429
|
vnewframe = false
|
420
430
|
|
@@ -555,6 +565,7 @@ parser.set_options(
|
|
555
565
|
['--reverse', GetoptLong::NO_ARGUMENT],
|
556
566
|
['--Gr', GetoptLong::NO_ARGUMENT],
|
557
567
|
['--mean', GetoptLong::REQUIRED_ARGUMENT],
|
568
|
+
['--eddy', GetoptLong::REQUIRED_ARGUMENT],
|
558
569
|
['--map', GetoptLong::REQUIRED_ARGUMENT],
|
559
570
|
['--m', GetoptLong::NO_ARGUMENT],
|
560
571
|
['--scalar', GetoptLong::NO_ARGUMENT],
|
@@ -572,6 +583,7 @@ parser.set_options(
|
|
572
583
|
['--clevels', GetoptLong::REQUIRED_ARGUMENT],
|
573
584
|
['--slevels', GetoptLong::REQUIRED_ARGUMENT],
|
574
585
|
['--patterns', GetoptLong::REQUIRED_ARGUMENT],
|
586
|
+
['--tonf', GetoptLong::NO_ARGUMENT],
|
575
587
|
['--nocolorbar', GetoptLong::NO_ARGUMENT],
|
576
588
|
['--nozero', GetoptLong::NO_ARGUMENT],
|
577
589
|
### vector option ###
|
@@ -677,6 +689,17 @@ while ARGV[0] do
|
|
677
689
|
}
|
678
690
|
end
|
679
691
|
|
692
|
+
## deviation from mean along any axis
|
693
|
+
if ($OPT_eddy)
|
694
|
+
dims = ($OPT_eddy).split(/\s*,\s*/)
|
695
|
+
dims.each{|dim|
|
696
|
+
dim = dim.to_i if dim.to_i.to_s == dim
|
697
|
+
gp = gp.eddy(dim)
|
698
|
+
gpux = gpux.eddy(dim)
|
699
|
+
gpuy = gpuy.eddy(dim)
|
700
|
+
}
|
701
|
+
end
|
702
|
+
|
680
703
|
# set title
|
681
704
|
if !$OPT_title && $OPT_scalar
|
682
705
|
gpnm = gp.data.get_att('long_name') || gp.name
|
data/bin/gpview
CHANGED
@@ -19,7 +19,7 @@ The first command form is
|
|
19
19
|
|
20
20
|
where the format of the gturl is
|
21
21
|
|
22
|
-
path
|
22
|
+
path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]
|
23
23
|
|
24
24
|
The second commnad form is
|
25
25
|
|
@@ -77,7 +77,6 @@ if you want to know more description, please read
|
|
77
77
|
|
78
78
|
:--animate/anim <dim>:
|
79
79
|
plot animation along <dim>. <dim> must be name of dimension.
|
80
|
-
|
81
80
|
|
82
81
|
:--alternate, --Ga:
|
83
82
|
enable to backing store.
|
@@ -97,6 +96,9 @@ if you want to know more description, please read
|
|
97
96
|
:--mean <dim>:
|
98
97
|
mean along axis <dim>.
|
99
98
|
|
99
|
+
:--eddy <dim>:
|
100
|
+
deviation from mean along axis <dim>.
|
101
|
+
|
100
102
|
:--m, --map <map_type>:
|
101
103
|
plot map. itr number must be set. this option is neglect if itr
|
102
104
|
number is 1-4. abailable map type is coast_world, border_world,
|
@@ -107,6 +109,15 @@ if you want to know more description, please read
|
|
107
109
|
<math_func> should be a math function with one argument
|
108
110
|
such as log10, sqrt, sin, etc.
|
109
111
|
|
112
|
+
:--time_ax [nil|false|h|ymd]:
|
113
|
+
specify type of calendar-type time axis:
|
114
|
+
nil (=> auto slection)
|
115
|
+
false (=> do not use the time axis even if
|
116
|
+
the units of the axis is a time one with since field)
|
117
|
+
"h" (=> like nil, but always use the hour-resolving datetime_ax method
|
118
|
+
in dclext_datetime_ax.rb)
|
119
|
+
"ymd" (=> like "h" but for y-m-d type using DCL.uc[xy]acl)
|
120
|
+
|
110
121
|
|
111
122
|
== LINE/MARK OPTIONS
|
112
123
|
|
@@ -172,6 +183,9 @@ if you want to know more description, please read
|
|
172
183
|
:--patterns:
|
173
184
|
set each patterns for tone plot.
|
174
185
|
|
186
|
+
:--tonf:
|
187
|
+
use tonf instead of tone.
|
188
|
+
|
175
189
|
:--nocolorbar:
|
176
190
|
do not draw color bar
|
177
191
|
|
@@ -195,6 +209,7 @@ For a single GPhys variable,
|
|
195
209
|
% gpview --overplot=3 --anim t data.nc@temp,lon=0
|
196
210
|
% gpview --mark data.nc@temp,lon=0,lat=0
|
197
211
|
% gpview --operation log10 data.nc@temp,lon=0
|
212
|
+
% gpview --time_ax false data.nc@temp,lon=0,lat=0
|
198
213
|
|
199
214
|
For multiple GPhys variables,
|
200
215
|
% gpview data1.nc@temp data2.nc@temp
|
@@ -238,6 +253,9 @@ For multiple GPhys variables,
|
|
238
253
|
2008/12/14 S Takehiro (option --mark implemented)
|
239
254
|
2010/03/10 Y SASAKI (change help block into RD format)
|
240
255
|
2011/01/14 T Tanigawa && S Takehiro (option --operation implemented)
|
256
|
+
2011/11/04 S Takehiro (option --time_ax implemented)
|
257
|
+
2011/11/20 S Takehiro (option --eddy implemented)
|
258
|
+
2012/02/19 S Takehiro (description for gturl format updated)
|
241
259
|
|
242
260
|
=end
|
243
261
|
#################################################
|
@@ -251,7 +269,7 @@ include NumRu
|
|
251
269
|
## Default param.
|
252
270
|
|
253
271
|
VIEWPORT = [0.15,0.85,0.2,0.55]
|
254
|
-
URLfmt = "path
|
272
|
+
URLfmt = "path[@|/]varname[,dimname=pos1[:pos2[:thinning_intv]][,dimname=...]]"
|
255
273
|
|
256
274
|
#####################################################
|
257
275
|
def GGraph::annotate(str_ary)
|
@@ -389,6 +407,12 @@ def draw_setup(gp)
|
|
389
407
|
GGraph::set_map(map_type=>true)
|
390
408
|
end
|
391
409
|
|
410
|
+
# time axis
|
411
|
+
if ($OPT_time_ax)
|
412
|
+
$OPT_time_ax = false if $OPT_time_ax == "false"
|
413
|
+
GGraph.set_axes('time_ax'=>$OPT_time_ax)
|
414
|
+
end
|
415
|
+
|
392
416
|
return draw_flag
|
393
417
|
|
394
418
|
end
|
@@ -464,7 +488,8 @@ def draw(gp, draw_flag)
|
|
464
488
|
"annotate"=>$annotate,
|
465
489
|
"transpose"=>$OPT_exch,
|
466
490
|
"levels"=>$OPT_slevels,
|
467
|
-
"patterns"=>$OPT_patterns
|
491
|
+
"patterns"=>$OPT_patterns,
|
492
|
+
"tonf"=>$OPT_tonf
|
468
493
|
)
|
469
494
|
GGraph.contour(gp,
|
470
495
|
false,
|
@@ -479,7 +504,8 @@ def draw(gp, draw_flag)
|
|
479
504
|
"annotate"=>$annotate,
|
480
505
|
"transpose"=>$OPT_exch,
|
481
506
|
"levels"=>$OPT_slevels,
|
482
|
-
"patterns"=>$OPT_patterns
|
507
|
+
"patterns"=>$OPT_patterns,
|
508
|
+
"tonf"=>$OPT_tonf
|
483
509
|
)
|
484
510
|
when "noshade"
|
485
511
|
mj = DCL.udpget('indxmj')
|
@@ -587,9 +613,11 @@ parser.set_options(
|
|
587
613
|
['--reverse', GetoptLong::NO_ARGUMENT],
|
588
614
|
['--Gr', GetoptLong::NO_ARGUMENT],
|
589
615
|
['--mean', GetoptLong::REQUIRED_ARGUMENT],
|
616
|
+
['--eddy', GetoptLong::REQUIRED_ARGUMENT],
|
590
617
|
['--map', GetoptLong::REQUIRED_ARGUMENT],
|
591
618
|
['--m', GetoptLong::NO_ARGUMENT],
|
592
619
|
['--operation', GetoptLong::REQUIRED_ARGUMENT],
|
620
|
+
['--time_ax', GetoptLong::REQUIRED_ARGUMENT],
|
593
621
|
### line/mark option ###
|
594
622
|
['--line', GetoptLong::NO_ARGUMENT],
|
595
623
|
['--mark', GetoptLong::NO_ARGUMENT],
|
@@ -610,6 +638,7 @@ parser.set_options(
|
|
610
638
|
['--clevels', GetoptLong::REQUIRED_ARGUMENT],
|
611
639
|
['--slevels', GetoptLong::REQUIRED_ARGUMENT],
|
612
640
|
['--patterns', GetoptLong::REQUIRED_ARGUMENT],
|
641
|
+
['--tonf', GetoptLong::NO_ARGUMENT],
|
613
642
|
['--nocolorbar', GetoptLong::NO_ARGUMENT],
|
614
643
|
['--nozero', GetoptLong::NO_ARGUMENT],
|
615
644
|
['--help', GetoptLong::NO_ARGUMENT]
|
@@ -683,6 +712,15 @@ while ARGV[0] do
|
|
683
712
|
}
|
684
713
|
end
|
685
714
|
|
715
|
+
## deviation from mean along any axis
|
716
|
+
if ($OPT_eddy)
|
717
|
+
dims = ($OPT_eddy).split(/\s*,\s*/)
|
718
|
+
dims.each{|dim|
|
719
|
+
dim = dim.to_i if dim.to_i.to_s == dim
|
720
|
+
gp = gp.eddy(dim)
|
721
|
+
}
|
722
|
+
end
|
723
|
+
|
686
724
|
## operation of a mathematical function
|
687
725
|
if ($OPT_operation)
|
688
726
|
eval "gp = gp.#{$OPT_operation}"
|
data/extconf.rb
CHANGED
@@ -8,11 +8,10 @@ def install_dirs
|
|
8
8
|
end
|
9
9
|
|
10
10
|
#dir_config('narray',$sitearchdir,$sitearchdir)
|
11
|
-
|
12
|
-
|
13
|
-
|
14
|
-
|
15
|
-
narray_lib = "#{narray_installpath}/gems/#{narray_fullname}/"
|
11
|
+
gem_home=(`gem environment GEM_HOME`).chomp
|
12
|
+
narray_dir = Dir.glob("#{gem_home}/gems/narray-*").sort[-1]
|
13
|
+
narray_include = narray_dir
|
14
|
+
narray_lib = narray_dir
|
16
15
|
dir_config('narray',narray_include,narray_lib)
|
17
16
|
|
18
17
|
if ( ! ( have_header("narray.h") && have_header("narray_config.h") ) ) then
|
@@ -39,4 +38,4 @@ if /cygwin|mingw/ =~ RUBY_PLATFORM
|
|
39
38
|
end
|
40
39
|
end
|
41
40
|
|
42
|
-
create_makefile("
|
41
|
+
create_makefile("gphys_ext")
|
data/gphys.gemspec
ADDED
@@ -0,0 +1,34 @@
|
|
1
|
+
# -*- encoding: utf-8 -*-
|
2
|
+
lib = File.expand_path('../lib', __FILE__)
|
3
|
+
$LOAD_PATH.unshift(lib) unless $LOAD_PATH.include?(lib)
|
4
|
+
require 'version'
|
5
|
+
|
6
|
+
Gem::Specification.new do |gem|
|
7
|
+
gem.name = "gphys"
|
8
|
+
gem.version = GPhys::VERSION
|
9
|
+
gem.authors = ["Takeshi Horinouchi", "Ryo Mizuta",\
|
10
|
+
"Daisuke Tsukahara", "Seiya Nishizawa", "Shin-ichi Takehiro"]
|
11
|
+
gem.email = ["eriko@gfd-dennou.org"]
|
12
|
+
gem.description = %q{comprehensive library for self-descriptive gridded physical data (in NetCDF, GrADS, or on memory) with graphicsgraphicsgraphicsgraphics.}
|
13
|
+
gem.summary = %q{a multi-purpose class to handle Gridded Physical quantities}
|
14
|
+
gem.homepage = 'http://www.gfd-dennou.org/arch/ruby/products/gphys/'
|
15
|
+
|
16
|
+
gem.files = `git ls-files`.split($/)
|
17
|
+
gem.executables = gem.files.grep(%r{^bin/}).map{ |f| File.basename(f) }
|
18
|
+
gem.test_files = gem.files.grep(%r{^(test|spec|features)/})
|
19
|
+
gem.require_paths = ["lib"]
|
20
|
+
gem.extensions << "extconf.rb"
|
21
|
+
|
22
|
+
gem.required_ruby_version = Gem::Requirement.new(">= 1.8")
|
23
|
+
|
24
|
+
gem.add_runtime_dependency(%q<narray>, [">= 0.5.7"])
|
25
|
+
gem.add_runtime_dependency(%q<numru-misc>, [">= 0.1.0"])
|
26
|
+
gem.add_runtime_dependency(%q<numru-units>, [">= 1.7"])
|
27
|
+
gem.add_runtime_dependency(%q<narray_miss>, [">= 1.2.4"])
|
28
|
+
gem.add_runtime_dependency(%q<ruby-netcdf>, [">= 0.6.6"])
|
29
|
+
gem.add_runtime_dependency(%q<ruby-dcl>, [">= 1.6.1"])
|
30
|
+
gem.add_runtime_dependency(%q<ruby-fftw3>, [">= 0.3"])
|
31
|
+
gem.add_runtime_dependency(%q<gsl>, [">= 1.14"])
|
32
|
+
gem.add_runtime_dependency(%q<ruby-lapack>, [">= 1.5"])
|
33
|
+
gem.add_runtime_dependency(%q<rb-grib>, [">= 0.2.0"])
|
34
|
+
end
|
data/interpo.c
CHANGED
@@ -14,12 +14,13 @@
|
|
14
14
|
#endif
|
15
15
|
|
16
16
|
static VALUE
|
17
|
-
interpo_do(obj, shape_to, idxmap, val_from, missval)
|
17
|
+
interpo_do(obj, shape_to, idxmap, val_from, missval, extrapo)
|
18
18
|
VALUE obj;
|
19
19
|
VALUE shape_to; // [Array] shape of the new grid
|
20
20
|
VALUE idxmap; // [Array] index mapping
|
21
21
|
VALUE val_from; // [NArray] values to be interpolated
|
22
22
|
VALUE missval; // [nil or Float] missing value if Float
|
23
|
+
VALUE extrapo; // [false/true] whether to extrapolate
|
23
24
|
{
|
24
25
|
VALUE val_to;
|
25
26
|
VALUE chk , ary;
|
@@ -33,12 +34,13 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
33
34
|
double *pt, *pf;
|
34
35
|
int nomiss;
|
35
36
|
double vmiss;
|
37
|
+
int extr;
|
36
38
|
size_t i, it, kf, j, k, l;
|
37
39
|
int *mtyp;
|
38
40
|
size_t *dm, *dm2, *dm2f, *dm3, *dm3f, *dm4, *dm4f;
|
39
41
|
int **di, nid, nic;
|
40
42
|
double **df, *f, a;
|
41
|
-
|
43
|
+
int *idf, idfc, *idt;
|
42
44
|
|
43
45
|
// check arguments
|
44
46
|
|
@@ -76,7 +78,10 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
76
78
|
nomiss = (missval == Qnil);
|
77
79
|
if (!nomiss){
|
78
80
|
vmiss = NUM2DBL(missval);
|
81
|
+
} else {
|
82
|
+
vmiss = -999.0; // dummy to avoid compiler warning (not used)
|
79
83
|
}
|
84
|
+
extr = (extrapo != Qfalse); // false -> 0(false); else -> true
|
80
85
|
|
81
86
|
// read argument (idxmap)
|
82
87
|
|
@@ -139,8 +144,8 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
139
144
|
|
140
145
|
// do interpolation
|
141
146
|
|
142
|
-
idt = ALLOCA_N(
|
143
|
-
idf = ALLOCA_N(
|
147
|
+
idt = ALLOCA_N(int, rankt);
|
148
|
+
idf = ALLOCA_N(int, rankf);
|
144
149
|
|
145
150
|
for(it=0; it<lent; it++){
|
146
151
|
l = it;
|
@@ -193,6 +198,10 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
193
198
|
k = 0;
|
194
199
|
for(j=0; j<rankf; j++){
|
195
200
|
idfc = idf[j];
|
201
|
+
if(!extr && idfc<0){
|
202
|
+
pt[it] = vmiss;
|
203
|
+
break;
|
204
|
+
}
|
196
205
|
if(mtyp[j]>0){
|
197
206
|
if ( (l>>k)%2 && idfc<shf[j]-1 ){
|
198
207
|
idfc += 1;
|
@@ -202,13 +211,16 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
202
211
|
kf += idfc*cshf;
|
203
212
|
cshf *= shf[j];
|
204
213
|
}
|
214
|
+
if (!nomiss && pt[it] == vmiss) {break;}
|
205
215
|
if (nomiss || pf[kf] != vmiss){
|
206
216
|
pt[it] += a*pf[kf];
|
207
217
|
} else {
|
208
218
|
pt[it] = vmiss;
|
209
219
|
break;
|
210
220
|
}
|
221
|
+
//printf("$$$$ %d %f %f\n",it, a, pf[kf]);
|
211
222
|
}
|
223
|
+
//printf("//// %d %f\n",it, pt[it]);
|
212
224
|
}
|
213
225
|
|
214
226
|
// finish
|
@@ -217,32 +229,39 @@ interpo_do(obj, shape_to, idxmap, val_from, missval)
|
|
217
229
|
}
|
218
230
|
|
219
231
|
static void
|
220
|
-
__interpo_find_loc_1D(N, P, n, p, ids, f)
|
232
|
+
__interpo_find_loc_1D(N, P, n, p, vmiss, extr, ids, f)
|
221
233
|
double *P, *p; // INPUT
|
222
234
|
size_t N, n; // INPUT
|
235
|
+
double vmiss; // INPUT
|
236
|
+
int extr; // INPUT
|
223
237
|
int *ids; // OUTPUT
|
224
238
|
double *f; // OUTPUT
|
225
239
|
{
|
226
|
-
size_t
|
240
|
+
size_t j;
|
241
|
+
int i, il, ir;
|
227
242
|
int down;
|
228
243
|
|
229
244
|
// first time finding : use a simple looping
|
230
245
|
j = 0;
|
231
246
|
for(i=0; i<n-1; i++){
|
232
|
-
if (
|
247
|
+
if ( p[i] != vmiss && p[i+1] != vmiss &&
|
248
|
+
(p[i]-P[j])*(P[j]-p[i+1]) >= 0 ){
|
233
249
|
break;
|
234
250
|
}
|
235
251
|
}
|
236
252
|
if (i<n-1){
|
237
253
|
// found
|
238
254
|
ids[j] = i;
|
239
|
-
} else {
|
255
|
+
} else if (extr) {
|
240
256
|
// not found --> to be extrapolated
|
241
257
|
if ( (P[j]-p[0])*(p[0]-p[n-1]) >= 0 ){
|
242
258
|
ids[j] = i = 0;
|
243
259
|
} else {
|
244
260
|
ids[j] = i = n-2;
|
245
261
|
}
|
262
|
+
} else {
|
263
|
+
ids[j] = -999999; // a negative value
|
264
|
+
i = 0;
|
246
265
|
}
|
247
266
|
f[j] = (p[i]-P[j])/(p[i]-p[i+1]);
|
248
267
|
|
@@ -254,41 +273,50 @@ __interpo_find_loc_1D(N, P, n, p, ids, f)
|
|
254
273
|
if ( (p[i]-P[j])*(P[j]-p[i+1]) >= 0 ) {
|
255
274
|
break;
|
256
275
|
} else {
|
257
|
-
if ( il>0 && ( down || ir==n-
|
276
|
+
if ( il>0 && ( down || ir==n-2 ) ){
|
258
277
|
il--;
|
259
278
|
i = il;
|
260
279
|
down = 0; // false
|
261
|
-
} else if ( ir<n-
|
280
|
+
} else if ( ir<n-2 && ( !down || il==0 ) ){
|
262
281
|
ir++;
|
263
282
|
i = ir;
|
264
283
|
down = 1; // true
|
265
284
|
} else {
|
266
|
-
// not found
|
267
|
-
|
268
|
-
|
269
|
-
|
270
|
-
|
285
|
+
// not found
|
286
|
+
if (extr) {
|
287
|
+
// to be extrapolated
|
288
|
+
if ( (P[j]-p[0])*(p[0]-p[n-1]) >= 0 ){
|
289
|
+
i = 0;
|
290
|
+
} else {
|
291
|
+
i = n-2;
|
292
|
+
}
|
293
|
+
} else {
|
294
|
+
i = -999999; // a negative value (changed to 0 below)
|
271
295
|
}
|
272
296
|
break;
|
273
297
|
}
|
274
298
|
}
|
275
299
|
}
|
276
300
|
ids[j] = i;
|
301
|
+
if(i<0){i = 0; down = 0;}
|
277
302
|
f[j] = (p[i]-P[j])/(p[i]-p[i+1]);
|
278
303
|
}
|
279
304
|
}
|
280
305
|
|
281
306
|
static VALUE
|
282
|
-
interpo_find_loc_1D(obj, X, x)
|
307
|
+
interpo_find_loc_1D(obj, X, x, missval, extrapo)
|
283
308
|
VALUE obj;
|
284
309
|
VALUE X; // [NArray(1D)] coordinate values onto which interpolation is made
|
285
310
|
VALUE x; // [NArray(1D)] coordinate values of original data
|
311
|
+
VALUE missval; // [Float] missing value in x
|
312
|
+
VALUE extrapo; // [false/true] whether to extrapolate
|
286
313
|
{
|
287
314
|
VALUE na_ids, na_f;
|
288
315
|
VALUE chk;
|
289
316
|
size_t N, n;
|
290
317
|
struct NARRAY *na;
|
291
|
-
double *P, *p;
|
318
|
+
double *P, *p, vmiss;
|
319
|
+
int extr;
|
292
320
|
int *ids;
|
293
321
|
double *f;
|
294
322
|
int shape[1]; // could be size_t if NArray is changed
|
@@ -311,6 +339,10 @@ interpo_find_loc_1D(obj, X, x)
|
|
311
339
|
n = na->total;
|
312
340
|
p = (double *)NA_PTR(na, 0);
|
313
341
|
|
342
|
+
vmiss = NUM2DBL(missval);
|
343
|
+
|
344
|
+
extr = (extrapo != Qfalse); // false -> 0(false); else -> true
|
345
|
+
|
314
346
|
// prepare output NArrays
|
315
347
|
|
316
348
|
shape[0] = N;
|
@@ -323,7 +355,7 @@ interpo_find_loc_1D(obj, X, x)
|
|
323
355
|
|
324
356
|
// Do the job
|
325
357
|
|
326
|
-
__interpo_find_loc_1D(N, P, n, p, ids, f);
|
358
|
+
__interpo_find_loc_1D(N, P, n, p, vmiss, extr, ids, f);
|
327
359
|
|
328
360
|
// Return
|
329
361
|
|
@@ -333,17 +365,20 @@ interpo_find_loc_1D(obj, X, x)
|
|
333
365
|
/* To apply interpo_find_loc_1D multi-dimensionally
|
334
366
|
*/
|
335
367
|
static VALUE
|
336
|
-
interpo_find_loc_1D_MD(obj, X, x, dimc)
|
368
|
+
interpo_find_loc_1D_MD(obj, X, x, dimc, missval, extrapo)
|
337
369
|
VALUE obj;
|
338
370
|
VALUE X; // [NArray(1D)] coordinate values onto which interpolation is made
|
339
371
|
VALUE x; // [NArray(multi-D)] coordinate values of original data
|
340
372
|
VALUE dimc; // [Integer] the dimension in x except which mapping has been set
|
373
|
+
VALUE missval; // [Float] missing value in x
|
374
|
+
VALUE extrapo; // [false/true] whether to extrapolate
|
341
375
|
{
|
342
376
|
VALUE na_ids, na_f;
|
343
377
|
VALUE chk;
|
344
378
|
size_t N, n1;
|
345
379
|
struct NARRAY *na;
|
346
|
-
double *P, *p, *p1;
|
380
|
+
double *P, *p, *p1, vmiss;
|
381
|
+
int extr;
|
347
382
|
int *ids, *ids1;
|
348
383
|
double *f, *f1;
|
349
384
|
int *shr; // shape of the result (could be size_t if NArray is changed)
|
@@ -370,6 +405,10 @@ interpo_find_loc_1D_MD(obj, X, x, dimc)
|
|
370
405
|
|
371
406
|
dmc = NUM2INT( dimc );
|
372
407
|
|
408
|
+
vmiss = NUM2DBL(missval);
|
409
|
+
|
410
|
+
extr = (extrapo != Qfalse); // false -> 0(false); else -> true
|
411
|
+
|
373
412
|
x = na_cast_object(x, NA_DFLOAT);
|
374
413
|
GetNArray(x, na);
|
375
414
|
p = (double *)NA_PTR(na, 0);
|
@@ -458,7 +497,7 @@ interpo_find_loc_1D_MD(obj, X, x, dimc)
|
|
458
497
|
|
459
498
|
// find loc in 1D
|
460
499
|
|
461
|
-
__interpo_find_loc_1D(N, P, n1, p1, ids1, f1);
|
500
|
+
__interpo_find_loc_1D(N, P, n1, p1, vmiss, extr, ids1, f1);
|
462
501
|
|
463
502
|
// substitute ids1 and f1 (1D) into ids and f (multi-D)
|
464
503
|
|
@@ -486,10 +525,10 @@ init_gphys_interpo()
|
|
486
525
|
// rb_require("narray"); // it does not work
|
487
526
|
mNumRu = rb_define_module("NumRu");
|
488
527
|
cGPhys = rb_define_class_under(mNumRu, "GPhys", rb_cObject);
|
489
|
-
rb_define_private_method(cGPhys, "c_interpo_find_loc_1D", interpo_find_loc_1D,
|
490
|
-
rb_define_private_method(cGPhys, "c_interpo_find_loc_1D_MD", interpo_find_loc_1D_MD,
|
528
|
+
rb_define_private_method(cGPhys, "c_interpo_find_loc_1D", interpo_find_loc_1D, 4);
|
529
|
+
rb_define_private_method(cGPhys, "c_interpo_find_loc_1D_MD", interpo_find_loc_1D_MD, 5);
|
491
530
|
|
492
|
-
rb_define_private_method(cGPhys, "c_interpo_do", interpo_do,
|
531
|
+
rb_define_private_method(cGPhys, "c_interpo_do", interpo_do, 5);
|
493
532
|
|
494
533
|
// to make "find loc" methods available outside GPhys as class methods
|
495
534
|
rb_define_singleton_method(cGPhys, "interpo_find_loc_1D", interpo_find_loc_1D, 2);
|
data/lib/gphys.rb
ADDED