gfdnavi 1.3.0.0
Sign up to get free protection for your applications and to get access to all the features.
- data/ChangeLog +10949 -0
- data/LICENCE.txt +57 -0
- data/Makefile +18 -0
- data/TODO +132 -0
- data/app/controllers/analysis_controller.rb +700 -0
- data/app/controllers/application.rb +41 -0
- data/app/controllers/draw_method_controller.rb +172 -0
- data/app/controllers/explorer_controller.rb +197 -0
- data/app/controllers/finder_controller.rb +331 -0
- data/app/controllers/function_controller.rb +204 -0
- data/app/controllers/group_controller.rb +115 -0
- data/app/controllers/keyword_attributes_controller.rb +52 -0
- data/app/controllers/knowledge_controller.rb +928 -0
- data/app/controllers/nodes_controller.rb +515 -0
- data/app/controllers/search_controller.rb +341 -0
- data/app/controllers/user_controller.rb +337 -0
- data/app/helpers/analysis_helper.rb +2 -0
- data/app/helpers/application_helper.rb +105 -0
- data/app/helpers/description_helper.rb +2 -0
- data/app/helpers/function_helper.rb +2 -0
- data/app/helpers/group_helper.rb +2 -0
- data/app/helpers/search_helper.rb +3 -0
- data/app/helpers/user_helper.rb +2 -0
- data/app/helpers/work_flow_helper.rb +92 -0
- data/app/models/actual_file.rb +3 -0
- data/app/models/analysis.rb +715 -0
- data/app/models/analysis_history.rb +42 -0
- data/app/models/cross_array.rb +22 -0
- data/app/models/cross_result.rb +254 -0
- data/app/models/derived_spatial_attribute.rb +3 -0
- data/app/models/diagram_cache.rb +16 -0
- data/app/models/diagram_cache_datum.rb +4 -0
- data/app/models/diagram_cache_session.rb +8 -0
- data/app/models/directory.rb +21 -0
- data/app/models/draw_method.rb +48 -0
- data/app/models/draw_method_attribute.rb +8 -0
- data/app/models/draw_parameter.rb +12 -0
- data/app/models/explorer_query.rb +354 -0
- data/app/models/explorer_result.rb +312 -0
- data/app/models/function.rb +75 -0
- data/app/models/function_argument.rb +6 -0
- data/app/models/function_output.rb +4 -0
- data/app/models/group.rb +153 -0
- data/app/models/image.rb +20 -0
- data/app/models/keyword_attribute.rb +179 -0
- data/app/models/knowledge.rb +94 -0
- data/app/models/knowledge_backup.rb +32 -0
- data/app/models/knowledge_figure.rb +16 -0
- data/app/models/knowledge_figure_backup.rb +16 -0
- data/app/models/knowledge_parser.rb +392 -0
- data/app/models/node.rb +605 -0
- data/app/models/node_entity_abstract.rb +112 -0
- data/app/models/node_lineage.rb +6 -0
- data/app/models/node_relation.rb +4 -0
- data/app/models/path_node.rb +60 -0
- data/app/models/query.rb +193 -0
- data/app/models/query_history.rb +12 -0
- data/app/models/results.rb +48 -0
- data/app/models/sign_up_user.rb +25 -0
- data/app/models/spatial_and_time_attribute.rb +11 -0
- data/app/models/user.rb +115 -0
- data/app/models/user_mailer.rb +48 -0
- data/app/models/value_type.rb +3 -0
- data/app/models/variable.rb +70 -0
- data/app/models/virtual_node.rb +457 -0
- data/app/views/analysis/__help_analysis_tab.en.html +57 -0
- data/app/views/analysis/__help_draw_share.en.html +12 -0
- data/app/views/analysis/__help_draw_tab.en.html +6 -0
- data/app/views/analysis/_analysis_function_settings.rhtml +61 -0
- data/app/views/analysis/_analysis_settings.rhtml +28 -0
- data/app/views/analysis/_diagram.rhtml +70 -0
- data/app/views/analysis/_dimension_option.rhtml +59 -0
- data/app/views/analysis/_draw_general_settings.rhtml +217 -0
- data/app/views/analysis/_draw_settings.rhtml +73 -0
- data/app/views/analysis/_history.rhtml +19 -0
- data/app/views/analysis/_popular_diagrams.rhtml +42 -0
- data/app/views/analysis/_save_form.rhtml +44 -0
- data/app/views/analysis/_variables.rhtml +66 -0
- data/app/views/analysis/_variables_order.rhtml +56 -0
- data/app/views/analysis/index.rhtml +195 -0
- data/app/views/analysis/preview.rhtml +3 -0
- data/app/views/analysis/save.rhtml +73 -0
- data/app/views/analysis/show_diagram.rhtml +42 -0
- data/app/views/cross/_display_map.rhtml +201 -0
- data/app/views/cross/_result.rhtml +205 -0
- data/app/views/cross/_show_result_tree.rhtml +40 -0
- data/app/views/cross/_show_results.rhtml +80 -0
- data/app/views/cross/_style.rhtml +21 -0
- data/app/views/cross/index.rhtml +271 -0
- data/app/views/draw_method/_edit_form.rhtml +110 -0
- data/app/views/draw_method/create.rhtml +8 -0
- data/app/views/draw_method/details.rhtml +113 -0
- data/app/views/draw_method/edit.rhtml +8 -0
- data/app/views/draw_method/list.rhtml +80 -0
- data/app/views/explorer/_display_map.rhtml +199 -0
- data/app/views/explorer/_show_result_tree.rhtml +40 -0
- data/app/views/explorer/_show_results.rhtml +101 -0
- data/app/views/explorer/_style.rhtml +21 -0
- data/app/views/explorer/index.rhtml +214 -0
- data/app/views/finder/_children.html.erb +84 -0
- data/app/views/finder/_children_details.html.erb +74 -0
- data/app/views/finder/_children_details_tr.html.erb +196 -0
- data/app/views/finder/create_tree.html.erb +15 -0
- data/app/views/finder/flex.html.erb +52 -0
- data/app/views/finder/index.html.erb +47 -0
- data/app/views/finder/show_details.html.erb +3 -0
- data/app/views/finder/show_images.html.erb +3 -0
- data/app/views/function/_edit_form.rhtml +106 -0
- data/app/views/function/create.rhtml +8 -0
- data/app/views/function/details.rhtml +96 -0
- data/app/views/function/edit.rhtml +8 -0
- data/app/views/function/list.rhtml +80 -0
- data/app/views/group/add_member.rhtml +13 -0
- data/app/views/group/change_owner.rhtml +15 -0
- data/app/views/group/create.rhtml +11 -0
- data/app/views/group/delete_member.rhtml +14 -0
- data/app/views/group/list.rhtml +63 -0
- data/app/views/knowledge/_backup.rhtml +135 -0
- data/app/views/knowledge/_category.rhtml +58 -0
- data/app/views/knowledge/_category_list.rhtml +34 -0
- data/app/views/knowledge/_category_table.rhtml +23 -0
- data/app/views/knowledge/_comment.rhtml +64 -0
- data/app/views/knowledge/_comment_input_form.rhtml +19 -0
- data/app/views/knowledge/_comments.rhtml +84 -0
- data/app/views/knowledge/_form.rhtml +139 -0
- data/app/views/knowledge/_group_figure_form.rhtml +187 -0
- data/app/views/knowledge/_layout_figure.rhtml +61 -0
- data/app/views/knowledge/_layout_figures_in_a_row_above_text.rhtml +42 -0
- data/app/views/knowledge/_layout_figures_under_text.rhtml +45 -0
- data/app/views/knowledge/_layout_one_figure_above_text.rhtml +28 -0
- data/app/views/knowledge/_summary.rhtml +21 -0
- data/app/views/knowledge/edit.rhtml +37 -0
- data/app/views/knowledge/list.rhtml +287 -0
- data/app/views/knowledge/new.rhtml +23 -0
- data/app/views/knowledge/new_from_analysis.rhtml +21 -0
- data/app/views/knowledge/show.rhtml +196 -0
- data/app/views/layouts/gfdnavi.rhtml +105 -0
- data/app/views/nodes/_ancestors.html.erb +89 -0
- data/app/views/nodes/_description_methods_table.html.erb +75 -0
- data/app/views/nodes/_mode.html.erb +16 -0
- data/app/views/nodes/description.html.erb +181 -0
- data/app/views/nodes/description_methods.html.erb +1 -0
- data/app/views/nodes/edit.html.erb +73 -0
- data/app/views/nodes/index.html.erb +25 -0
- data/app/views/nodes/show.html.erb +20 -0
- data/app/views/search/_children_details_mapsearch.rhtml +68 -0
- data/app/views/search/_children_details_tr.rhtml +205 -0
- data/app/views/search/_show_grouplist.rhtml +74 -0
- data/app/views/search/_show_results.rhtml +43 -0
- data/app/views/search/_show_results_global.rhtml +36 -0
- data/app/views/search/_show_results_partial.rhtml +39 -0
- data/app/views/search/_show_results_partial_groupbyfile.rhtml +50 -0
- data/app/views/search/_show_variablelist.rhtml +28 -0
- data/app/views/search/mapsearch.rhtml +176 -0
- data/app/views/search/remapsearch.rjs +18 -0
- data/app/views/search/show_details.rhtml +3 -0
- data/app/views/user/add_user.rhtml +30 -0
- data/app/views/user/change_password.rhtml +25 -0
- data/app/views/user/edit.html.erb +50 -0
- data/app/views/user/index.rhtml +162 -0
- data/app/views/user/login.rhtml +41 -0
- data/app/views/user/logout.rhtml +4 -0
- data/app/views/user/signup.rhtml +36 -0
- data/app/views/user/signup_succeeded.rhtml +36 -0
- data/app/views/user_mailer/authorization_inform.rhtml +15 -0
- data/app/views/user_mailer/signup_accepted.rhtml +12 -0
- data/app/views/user_mailer/signup_confirm.rhtml +14 -0
- data/app/views/user_mailer/signup_inform.rhtml +13 -0
- data/app/views/user_mailer/signup_rejected.rhtml +11 -0
- data/app/views/work_flow/_push_wsdls.rhtml +55 -0
- data/app/views/work_flow/index.rhtml +46 -0
- data/config/database.yml.example +35 -0
- data/config/environment.rb +68 -0
- data/config/gfdnavi.yml.example +95 -0
- data/config/load_config.rb +151 -0
- data/config/routes.rb +35 -0
- data/consistency_checker.rb +129 -0
- data/data/gfdnavi_docs/how_to_draw_multiple_images.knlge +68 -0
- data/data/gfdnavi_docs/how_to_knowledge.knlge +138 -0
- data/data/gfdnavi_docs/how_to_write_document_about_Gfdnavi.knlge +30 -0
- data/data/samples/jmadata.SIGEN +8 -0
- data/data/samples/jmadata.yml +6 -0
- data/data/samples/jmadata/MSM-P/2006.nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006.yml +17 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0101.nc.yml +13 -0
- data/data/samples/jmadata/MSM-P/2006/0102.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0103.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0104.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/0105.nc +0 -0
- data/data/samples/jmadata/MSM-P/2006/010[1-3].nc.yml +2 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.rb +96 -0
- data/data/samples/jmadata/MSM-P/2006/skip_data.sh +6 -0
- data/data/samples/reanalysis.SIGEN +8 -0
- data/data/samples/reanalysis/era40.SIGEN +8 -0
- data/data/samples/reanalysis/era40.yml +2 -0
- data/data/samples/reanalysis/era40/t.jan.nc +0 -0
- data/data/samples/reanalysis/era40/t.jan.nc.yml +1 -0
- data/data/samples/reanalysis/ncep.SIGEN +9 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png +0 -0
- data/data/samples/reanalysis/ncep/T.jan.100hPa.png.yml +43 -0
- data/data/samples/reanalysis/ncep/T.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan.zonal_mean.nc.yml +8 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc +0 -0
- data/data/samples/reanalysis/ncep/T.jan_only_root.nc.yml +4 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc +0 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml +10 -0
- data/data/samples/reanalysis/ncep/UV.jan.nc.yml.ja +11 -0
- data/data/samples/sonde_operational.yml +5 -0
- data/data/samples/sonde_operational/std_plev.yml +12 -0
- data/data/samples/sonde_operational/std_plev/41256.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/42410.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43333.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/43346.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/48698.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/61641.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/63741.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/67083.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/72261.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/76805.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/82193.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91165.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91610.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/91948.spl.nc +0 -0
- data/data/samples/sonde_operational/std_plev/94294.spl.nc +0 -0
- data/db/NetCDFparser.rb +406 -0
- data/db/create_derived_spatial_attributes.sql +12 -0
- data/db/draw_methods/line.yml +6 -0
- data/db/draw_methods/scatter.yml +38 -0
- data/db/draw_methods/tone.yml +64 -0
- data/db/draw_methods/vector.yml +19 -0
- data/db/dump_db.rb +43 -0
- data/db/functions/additions.yml +10 -0
- data/db/functions/cut.yml +10 -0
- data/db/functions/division.yml +10 -0
- data/db/functions/mean.yml +28 -0
- data/db/functions/multiplication.yml +10 -0
- data/db/functions/stddev.yml +28 -0
- data/db/functions/subtraction.yml +10 -0
- data/db/migrate/001_initial_scheme.rb +289 -0
- data/db/migrate/002_add_open_id_authentication_tables.rb +20 -0
- data/db/register_directory_tree.rb +760 -0
- data/db/restore_db.rb +60 -0
- data/gfdnavi-install +828 -0
- data/install.rb +828 -0
- data/lib/activerecord_gfdnavi.rb +31 -0
- data/lib/basic_authorization.rb +50 -0
- data/lib/create_activeresources.rb +108 -0
- data/lib/execute_analysis.rb +472 -0
- data/lib/file_gfdnavi.rb +38 -0
- data/lib/gphys_gfdnavi.rb +81 -0
- data/lib/localdir.rb +110 -0
- data/lib/login_system.rb +110 -0
- data/lib/multibytes.rb +20 -0
- data/lib/narray_yaml.rb +58 -0
- data/lib/no_rdb_base.rb +40 -0
- data/lib/opendapdir.rb +171 -0
- data/lib/tar.rb +127 -0
- data/lib/tasks/clean.rake +65 -0
- data/lib/tasks/setup.rake +316 -0
- data/lib/tasks/update.rake +62 -0
- data/lib/vizshot_gfdnavi.rb +224 -0
- data/public/crossdomain.xml +4 -0
- data/public/flex/NodeTreeDescriptor.as +55 -0
- data/public/flex/TreeNode.as +253 -0
- data/public/flex/finder.mxml +304 -0
- data/public/flex/finder.swf +0 -0
- data/public/flex/gfdnavi.mxml +52 -0
- data/public/flex/gfdnavi.swf +0 -0
- data/public/images/Help_S-shots/dir_tree_with_add.jpg +0 -0
- data/public/images/analyze.gif +0 -0
- data/public/images/circle.gif +0 -0
- data/public/images/create_from_analysis_button.png +0 -0
- data/public/images/delete.png +0 -0
- data/public/images/down.png +0 -0
- data/public/images/drawbutton.gif +0 -0
- data/public/images/gfdnavi_home_logo.png +0 -0
- data/public/images/gfdnavi_logo_big.png +0 -0
- data/public/images/gfdnavi_logo_med.png +0 -0
- data/public/images/gfdnavi_logo_mini.png +0 -0
- data/public/images/gfdnavi_logo_nobg_big.png +0 -0
- data/public/images/gfdnavi_logo_nobg_med.png +0 -0
- data/public/images/gfdnavi_logo_nobg_small.png +0 -0
- data/public/images/gfdnavi_logo_small.png +0 -0
- data/public/images/gfdnavi_logo_xsmall.png +0 -0
- data/public/images/hbar.png +0 -0
- data/public/images/helpmark16.png +0 -0
- data/public/images/helpmark18.png +0 -0
- data/public/images/kikyu_g.gif +0 -0
- data/public/images/kikyu_r.gif +0 -0
- data/public/images/map_icon_g.gif +0 -0
- data/public/images/map_icon_r.gif +0 -0
- data/public/images/new_knowledge.png +0 -0
- data/public/images/openid.png +0 -0
- data/public/images/read_in_the_form.png +0 -0
- data/public/images/slider_f.gif +0 -0
- data/public/images/slider_f_red.gif +0 -0
- data/public/images/star1.gif +0 -0
- data/public/images/star2.gif +0 -0
- data/public/images/startanim.gif +0 -0
- data/public/images/stopanim.gif +0 -0
- data/public/images/tree/DL.png +0 -0
- data/public/images/tree/anal_viz.png +0 -0
- data/public/images/tree/analyze_visualize_checked_items.png +0 -0
- data/public/images/tree/binary.png +0 -0
- data/public/images/tree/details.png +0 -0
- data/public/images/tree/download_checked_items.png +0 -0
- data/public/images/tree/folder.png +0 -0
- data/public/images/tree/folder_close.gif +0 -0
- data/public/images/tree/image2.png +0 -0
- data/public/images/tree/knowledge.png +0 -0
- data/public/images/tree/knowledges.png +0 -0
- data/public/images/tree/last.gif +0 -0
- data/public/images/tree/last.png +0 -0
- data/public/images/tree/minus.gif +0 -0
- data/public/images/tree/minus_simple.gif +0 -0
- data/public/images/tree/none.gif +0 -0
- data/public/images/tree/none.png +0 -0
- data/public/images/tree/plus.gif +0 -0
- data/public/images/tree/plus_simple.gif +0 -0
- data/public/images/tree/show.png +0 -0
- data/public/images/tree/show_checked_items.png +0 -0
- data/public/images/tree/t.gif +0 -0
- data/public/images/tree/t.png +0 -0
- data/public/images/tree/tate.gif +0 -0
- data/public/images/tree/tate.png +0 -0
- data/public/images/up.png +0 -0
- data/public/images/vbar.png +0 -0
- data/public/images/white.bmp +0 -0
- data/public/images/x.gif +0 -0
- data/public/index.html +100 -0
- data/public/javascripts/AC_OETags.js +269 -0
- data/public/javascripts/analysis.js +751 -0
- data/public/javascripts/application.js +29 -0
- data/public/javascripts/directory_tree.js +102 -0
- data/public/javascripts/draw_method.js +83 -0
- data/public/javascripts/excanvas.js +704 -0
- data/public/javascripts/function.js +107 -0
- data/public/javascripts/gfdnavi.js +175 -0
- data/public/javascripts/knowledge.js +384 -0
- data/public/javascripts/mapsearch.js +313 -0
- data/public/javascripts/progress.js +42 -0
- data/public/javascripts/resizable_box.js +164 -0
- data/public/javascripts/slider.js +260 -0
- data/public/javascripts/tab.js +17 -0
- data/public/javascripts/work_flow.js +452 -0
- data/public/stylesheets/analysis.css +111 -0
- data/public/stylesheets/description.css +71 -0
- data/public/stylesheets/gfdnavi.css +141 -0
- data/public/stylesheets/knowledge.css +218 -0
- data/public/stylesheets/search.css +184 -0
- data/public/stylesheets/tree.css +45 -0
- data/public/stylesheets/tree_for_ie.css +3 -0
- data/public/stylesheets/work_flow.css +78 -0
- data/script/cleaner +11 -0
- data/script/server_ssl +131 -0
- data/test/fixtures/diagram_cache_data.yml +5 -0
- data/test/fixtures/diagram_cache_sessions.yml +6 -0
- data/test/fixtures/diagram_caches.yml +6 -0
- data/test/fixtures/directories.yml +57 -0
- data/test/fixtures/draw_parameters.yml +6 -0
- data/test/fixtures/function_arguments.yml +15 -0
- data/test/fixtures/function_outputs.yml +15 -0
- data/test/fixtures/functions.yml +29 -0
- data/test/fixtures/group_members.yml +33 -0
- data/test/fixtures/groups.yml +25 -0
- data/test/fixtures/images.yml +12 -0
- data/test/fixtures/keyword_attributes.yml +73 -0
- data/test/fixtures/knowledges.yml +10 -0
- data/test/fixtures/node_relations.yml +11 -0
- data/test/fixtures/nodes.yml +298 -0
- data/test/fixtures/sign_up_users.yml +8 -0
- data/test/fixtures/spatial_and_time_attributes.yml +29 -0
- data/test/fixtures/user_mailer/authorization_inform +11 -0
- data/test/fixtures/user_mailer/signup_accepted +10 -0
- data/test/fixtures/user_mailer/signup_confirm +17 -0
- data/test/fixtures/user_mailer/signup_inform +10 -0
- data/test/fixtures/user_mailer/signup_rejected +9 -0
- data/test/fixtures/users.yml +31 -0
- data/test/fixtures/value_types.yml +10 -0
- data/test/fixtures/variables.yml +17 -0
- data/test/functional/analysis_controller_test.rb +169 -0
- data/test/functional/description_controller_test.rb +18 -0
- data/test/functional/function_controller_test.rb +18 -0
- data/test/functional/group_controller_test.rb +18 -0
- data/test/functional/search_controller_test.rb +83 -0
- data/test/functional/user_controller_test.rb +77 -0
- data/test/functional/webservice_analysis_api_test.rb +12 -0
- data/test/functional/work_flow_controller_test.rb +18 -0
- data/test/test_helper.rb +28 -0
- data/test/unit/diagram_cache_datum_test.rb +10 -0
- data/test/unit/diagram_cache_session_test.rb +10 -0
- data/test/unit/diagram_cache_test.rb +10 -0
- data/test/unit/directory_test.rb +49 -0
- data/test/unit/draw_parameter_test.rb +10 -0
- data/test/unit/function_argument_test.rb +10 -0
- data/test/unit/function_output_test.rb +10 -0
- data/test/unit/function_test.rb +10 -0
- data/test/unit/group_test.rb +48 -0
- data/test/unit/image_test.rb +13 -0
- data/test/unit/keyword_attribute_test.rb +33 -0
- data/test/unit/knowledge_test.rb +13 -0
- data/test/unit/node_relation_test.rb +20 -0
- data/test/unit/node_test.rb +85 -0
- data/test/unit/sign_up_user_test.rb +20 -0
- data/test/unit/spatial_and_time_attribute_test.rb +29 -0
- data/test/unit/user_mailer_test.rb +101 -0
- data/test/unit/user_test.rb +134 -0
- data/test/unit/value_type_test.rb +10 -0
- data/test/unit/variable_test.rb +35 -0
- data/vendor/plugins/acts_as_list/README +23 -0
- data/vendor/plugins/acts_as_list/init.rb +3 -0
- data/vendor/plugins/acts_as_list/lib/active_record/acts/list.rb +256 -0
- data/vendor/plugins/acts_as_list/test/list_test.rb +332 -0
- data/vendor/plugins/acts_as_tree/README +26 -0
- data/vendor/plugins/acts_as_tree/Rakefile +22 -0
- data/vendor/plugins/acts_as_tree/init.rb +1 -0
- data/vendor/plugins/acts_as_tree/lib/active_record/acts/tree.rb +96 -0
- data/vendor/plugins/acts_as_tree/test/abstract_unit.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/acts_as_tree_test.rb +219 -0
- data/vendor/plugins/acts_as_tree/test/database.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixin.rb +0 -0
- data/vendor/plugins/acts_as_tree/test/fixtures/mixins.yml +0 -0
- data/vendor/plugins/acts_as_tree/test/schema.rb +0 -0
- data/vendor/plugins/will_paginate/CHANGELOG +92 -0
- data/vendor/plugins/will_paginate/LICENSE +18 -0
- data/vendor/plugins/will_paginate/README.rdoc +131 -0
- data/vendor/plugins/will_paginate/Rakefile +62 -0
- data/vendor/plugins/will_paginate/examples/apple-circle.gif +0 -0
- data/vendor/plugins/will_paginate/examples/index.haml +69 -0
- data/vendor/plugins/will_paginate/examples/index.html +92 -0
- data/vendor/plugins/will_paginate/examples/pagination.css +90 -0
- data/vendor/plugins/will_paginate/examples/pagination.sass +91 -0
- data/vendor/plugins/will_paginate/init.rb +1 -0
- data/vendor/plugins/will_paginate/lib/will_paginate.rb +86 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/array.rb +16 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/collection.rb +145 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/core_ext.rb +32 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/finder.rb +247 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope.rb +132 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/named_scope_patch.rb +39 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/version.rb +9 -0
- data/vendor/plugins/will_paginate/lib/will_paginate/view_helpers.rb +373 -0
- data/vendor/plugins/will_paginate/will_paginate.gemspec +21 -0
- metadata +586 -0
data/app/models/user.rb
ADDED
@@ -0,0 +1,115 @@
|
|
1
|
+
require 'digest/sha1'
|
2
|
+
|
3
|
+
# this model expects a certain database layout and its based on the name/login pattern.
|
4
|
+
class User < ActiveRecord::Base
|
5
|
+
attr_protected :super_user
|
6
|
+
has_many :own_groups, :class_name => "Group", :foreign_key => "owner_id", :dependent => :destroy
|
7
|
+
#has_many :belonging_groups, :through => :group_members, :source => :group, :order => :name
|
8
|
+
|
9
|
+
before_create :crypt_password
|
10
|
+
after_save :save_file
|
11
|
+
after_destroy :save_file_destroy
|
12
|
+
|
13
|
+
def self.authenticate(login, pass)
|
14
|
+
find(:first,
|
15
|
+
:conditions => ["login = ? AND password = ?", login, sha1(pass)])
|
16
|
+
end
|
17
|
+
|
18
|
+
def self.super_user?(user)
|
19
|
+
user.super_user?
|
20
|
+
end
|
21
|
+
|
22
|
+
def super_user?
|
23
|
+
super_user == true
|
24
|
+
end
|
25
|
+
|
26
|
+
def change_password(pass, pass_confirm)
|
27
|
+
unless pass == pass_confirm
|
28
|
+
return false
|
29
|
+
end
|
30
|
+
self.password = User.sha1(pass)
|
31
|
+
self.save
|
32
|
+
end
|
33
|
+
|
34
|
+
def belonging_groups
|
35
|
+
Group.find_by_bit_flag(groups)
|
36
|
+
end
|
37
|
+
|
38
|
+
protected
|
39
|
+
|
40
|
+
def self.sha1(pass)
|
41
|
+
Digest::SHA1.hexdigest("#{GFDNAVI_PASSPHRASE}--#{pass}--")
|
42
|
+
end
|
43
|
+
|
44
|
+
def crypt_password
|
45
|
+
write_attribute("password", self.class.sha1(password))
|
46
|
+
end
|
47
|
+
|
48
|
+
=begin
|
49
|
+
def after_create
|
50
|
+
group = self.own_groups.create(:name => self.login)
|
51
|
+
group.members = [self]
|
52
|
+
end
|
53
|
+
=end
|
54
|
+
|
55
|
+
def save_file
|
56
|
+
fname = File.join(RAILS_ROOT,"db","user.yml")
|
57
|
+
if File.exist?(fname)
|
58
|
+
yml = YAML.load(File.read(fname))
|
59
|
+
unless Hash === yml
|
60
|
+
raise "data is invalid"
|
61
|
+
end
|
62
|
+
backup = fname + "~"
|
63
|
+
File.rename(fname, backup)
|
64
|
+
else
|
65
|
+
yml = Hash.new
|
66
|
+
end
|
67
|
+
hash = Hash.new
|
68
|
+
self.class.column_names.each{|name|
|
69
|
+
hash[name] = self[name]
|
70
|
+
}
|
71
|
+
yml[self.login] = hash
|
72
|
+
File.open(fname,"w"){|file| file.print yml.to_yaml}
|
73
|
+
end
|
74
|
+
|
75
|
+
def save_file_destroy
|
76
|
+
fname = File.join(RAILS_ROOT,"db","user.yml")
|
77
|
+
if File.exist?(fname)
|
78
|
+
yml = YAML.load(File.read(fname))
|
79
|
+
unless Hash === yml
|
80
|
+
raise "data is invalid"
|
81
|
+
end
|
82
|
+
backup = "#{fname}.#{Time.now.strftime('%Y%m%d%H%M%S')}"
|
83
|
+
raise("backup file already exists") if File.exist?(backup)
|
84
|
+
File.rename(fname, backup)
|
85
|
+
else
|
86
|
+
yml = Hash.new
|
87
|
+
end
|
88
|
+
yml.delete(self.login)
|
89
|
+
File.open(fname,"w"){|file| file.print yml.to_yaml}
|
90
|
+
end
|
91
|
+
|
92
|
+
|
93
|
+
validates_length_of :login , :within => 3..100
|
94
|
+
validates_length_of :password, :within => 5..40
|
95
|
+
validates_presence_of :login, :password, :full_name, :email_address, :affiliation
|
96
|
+
validates_presence_of :password_confirmation, :on => :create
|
97
|
+
validates_confirmation_of :password, :on => :create
|
98
|
+
validates_uniqueness_of :login
|
99
|
+
validates_format_of :email_address, :with => /^(\w|-)+@(\w|-)+\.(\w|-)+/, :message => "email address is invalid"
|
100
|
+
|
101
|
+
|
102
|
+
#<< class methods >>
|
103
|
+
class << self
|
104
|
+
# == OpenID�̐��K�����s��
|
105
|
+
def normalization(openid_url)
|
106
|
+
openid_url = openid_url[6..-1] if /^xri\:\/\// =~ openid_url
|
107
|
+
return openid_url if /^[=@!\+\$\(]/ =~ openid_url
|
108
|
+
return openid_url if /^https\:\/\// =~ openid_url
|
109
|
+
openid_url = "http://" + openid_url unless /^http\:\/\// =~ openid_url
|
110
|
+
openid_url += "/" unless /^http\:\/\/.+?\/.*?$/ =~ openid_url
|
111
|
+
|
112
|
+
return openid_url
|
113
|
+
end
|
114
|
+
end
|
115
|
+
end
|
@@ -0,0 +1,48 @@
|
|
1
|
+
class UserMailer < ActionMailer::Base
|
2
|
+
|
3
|
+
def signup_confirm(user, url)
|
4
|
+
@subject = '[gfdnavi] sign up confirmation'
|
5
|
+
@body = {:user => user, :url => url}
|
6
|
+
@recipients = "#{user.full_name} <#{user.email_address}>"
|
7
|
+
@from = "#{GFDNAVI_ADMIN_NAME} <#{GFDNAVI_ADMIN_EMAIL}>"
|
8
|
+
@sent_on = Time.now
|
9
|
+
@headers = {}
|
10
|
+
end
|
11
|
+
|
12
|
+
def signup_inform(user, url)
|
13
|
+
@subject = '[gfdnavi] sign up information'
|
14
|
+
@body = {:user => user, :url => url}
|
15
|
+
@recipients = User.find(:all, :conditions => ["super_user=?", true]).collect{|u| u.email_address}
|
16
|
+
@from = "#{GFDNAVI_ADMIN_NAME} <#{GFDNAVI_ADMIN_EMAIL}>"
|
17
|
+
@sent_on = Time.now
|
18
|
+
@headers = {}
|
19
|
+
end
|
20
|
+
|
21
|
+
def signup_accepted(user, url)
|
22
|
+
@subject = '[gfdnavi] Your signup request was accepted'
|
23
|
+
@body = {:user => user, :url => url}
|
24
|
+
@recipients = "#{user.full_name} <#{user.email_address}>"
|
25
|
+
@from = "#{GFDNAVI_ADMIN_NAME} <#{GFDNAVI_ADMIN_EMAIL}>"
|
26
|
+
@sent_on = Time.now
|
27
|
+
@headers = {}
|
28
|
+
end
|
29
|
+
|
30
|
+
def signup_rejected(user, url)
|
31
|
+
@subject = '[gfdnavi] Your signup request was rejected'
|
32
|
+
@body = {:user => user, :url => url}
|
33
|
+
@recipients = "#{user.full_name} <#{user.email_address}>"
|
34
|
+
@from = "#{GFDNAVI_ADMIN_NAME} <#{GFDNAVI_ADMIN_EMAIL}>"
|
35
|
+
@sent_on = Time.now
|
36
|
+
@headers = {}
|
37
|
+
end
|
38
|
+
|
39
|
+
def authorization_inform(user, url, suser, result)
|
40
|
+
@subject = '[gfdnavi] authorization information'
|
41
|
+
@body = {:user => user, :url => url, :suser => suser, :result => result}
|
42
|
+
@recipients = User.find(:all, :conditions => ["super_user=?", true]).collect{|u| u.email_address}
|
43
|
+
@from = "#{GFDNAVI_ADMIN_NAME} <#{GFDNAVI_ADMIN_EMAIL}>"
|
44
|
+
@sent_on = Time.now
|
45
|
+
@headers = {}
|
46
|
+
end
|
47
|
+
|
48
|
+
end
|
@@ -0,0 +1,70 @@
|
|
1
|
+
require "narray_yaml"
|
2
|
+
require "numru/gphys"
|
3
|
+
require "numru/netcdf"
|
4
|
+
|
5
|
+
class Variable < NodeEntityAbstract
|
6
|
+
|
7
|
+
has_many :diagram_caches, :through => :diagram_cache_data, :source => :diagram_cache
|
8
|
+
has_many :diagram_cache_data, :dependent => :destroy
|
9
|
+
has_many :actual_files, :dependent => :destroy
|
10
|
+
has_many :knowledge_figures
|
11
|
+
|
12
|
+
after_create :save_references
|
13
|
+
|
14
|
+
|
15
|
+
def vname
|
16
|
+
if vn = node.file
|
17
|
+
return node.path.sub(/#{vn}\//,"")
|
18
|
+
else
|
19
|
+
return name
|
20
|
+
end
|
21
|
+
end
|
22
|
+
|
23
|
+
def fname
|
24
|
+
if node.file
|
25
|
+
node.add_prefix(node.file)
|
26
|
+
elsif (acs = actual_files).length > 0
|
27
|
+
acs.collect{|ac| node.add_prefix(ac.path) }
|
28
|
+
else
|
29
|
+
raise "[BUG]"
|
30
|
+
end
|
31
|
+
end
|
32
|
+
|
33
|
+
def gphys
|
34
|
+
NumRu::GPhys::IO.open(fname, vname)
|
35
|
+
end
|
36
|
+
|
37
|
+
def references_tmp
|
38
|
+
unless @new_record
|
39
|
+
raise "Cannot #call references_tmp for saved data. Use references instead"
|
40
|
+
end
|
41
|
+
@references_tmp ||= Array.new
|
42
|
+
end
|
43
|
+
|
44
|
+
def downloadable?
|
45
|
+
if parent
|
46
|
+
return parent.entity.downloadable?
|
47
|
+
else
|
48
|
+
da = true
|
49
|
+
references_tmp.each{|v|
|
50
|
+
unless v.downloadable?
|
51
|
+
da = false
|
52
|
+
break
|
53
|
+
end
|
54
|
+
}
|
55
|
+
return da
|
56
|
+
end
|
57
|
+
end
|
58
|
+
|
59
|
+
|
60
|
+
protected
|
61
|
+
def save_references
|
62
|
+
if @references_tmp
|
63
|
+
@references_tmp.each{|v|
|
64
|
+
v = v.node unless Node === v
|
65
|
+
NodeRelation.new(:name=>"analysis", :reference=>v, :referenced_by=>self.node).save!
|
66
|
+
}
|
67
|
+
end
|
68
|
+
end
|
69
|
+
|
70
|
+
end
|
@@ -0,0 +1,457 @@
|
|
1
|
+
require "vizshot_gfdnavi"
|
2
|
+
require "file_gfdnavi"
|
3
|
+
|
4
|
+
class VirtualNode
|
5
|
+
|
6
|
+
DRAW_PROJECTION = {1 => "rectangular uniform coordinate",
|
7
|
+
2 => "semi-logarithmic coordinate (y axis)",
|
8
|
+
3 => "semi-logarithmic coordinate (x axis)",
|
9
|
+
4 => "logarithmic coordinate",
|
10
|
+
5 => "polar coordinate",
|
11
|
+
6 => "bipolar coordinate",
|
12
|
+
# 7 => "elliptic coordinate",
|
13
|
+
10 => "equidistant cylindrical projection",
|
14
|
+
11 => "Mercator's projection",
|
15
|
+
12 => "Mollweide's projection",
|
16
|
+
13 => "Hammer's projection",
|
17
|
+
14 => "Eckert VI projection",
|
18
|
+
15 => "Kitada's elliptic projection",
|
19
|
+
20 => "equidistant conical projection",
|
20
|
+
21 => "Lambert's equal-area conical projection",
|
21
|
+
22 => "Lambert's conformal conical projection",
|
22
|
+
23 => "Bonne's projection",
|
23
|
+
30 => "orthographic projection",
|
24
|
+
31 => "polar stereo projection",
|
25
|
+
32 => "azimuthal equidistant projection",
|
26
|
+
33 => "Lambert's azimuthal equal-area projection"
|
27
|
+
}
|
28
|
+
|
29
|
+
DRAW_SIZE = [[700,700], [550,550], [400,400], [250,250]]
|
30
|
+
|
31
|
+
@@draw_options = {
|
32
|
+
"x_axis" => {:type => "string"},
|
33
|
+
"y_axis" => {:type => "string"},
|
34
|
+
"projection" => {:default => 1, :type => "int"},
|
35
|
+
"region" => {:default => {}, :type => "hash"},
|
36
|
+
"pileup" => {:default => false, :type => "boolean"},
|
37
|
+
"size" => {:default => [400,400], :type => "array_int"},
|
38
|
+
"anim" => {:default => false, :type => "boolean", :optional => true},
|
39
|
+
"anim_dim" => {:type => "string", :optional => true},
|
40
|
+
"viewport" => {:default => [0.2, 0.8, 0.2, 0.8], :type => "array_float", :optional => true},
|
41
|
+
"map" => {:default => false, :type => "boolean", :optional => true}
|
42
|
+
}
|
43
|
+
|
44
|
+
|
45
|
+
|
46
|
+
attr_accessor :original_nodes, :functions, :draw_method
|
47
|
+
|
48
|
+
def initialize(nodes)
|
49
|
+
nodes = [nodes] unless Array === nodes
|
50
|
+
nodes.each{|node|
|
51
|
+
if Node === node
|
52
|
+
unless node.variable?
|
53
|
+
raise "node must be variable"
|
54
|
+
end
|
55
|
+
elsif ! VirtialNode === node
|
56
|
+
raise "node is invalid"
|
57
|
+
end
|
58
|
+
}
|
59
|
+
@original_nodes = nodes
|
60
|
+
@num_vars = nodes.length
|
61
|
+
@functions = Array.new
|
62
|
+
@draw_method = nil
|
63
|
+
end
|
64
|
+
|
65
|
+
def function(func,args=nil)
|
66
|
+
unless Function === func
|
67
|
+
return [false, "function is invalid"]
|
68
|
+
end
|
69
|
+
if @draw_method
|
70
|
+
return [false, "cannot apply function after drawing"]
|
71
|
+
end
|
72
|
+
unless @num_vars%func.nvars == 0
|
73
|
+
return [false, "wrong number of variables (#{@num_vars}%#{func.nvars} != 0)"]
|
74
|
+
end
|
75
|
+
if args && args.length > (al = func.function_arguments.length)
|
76
|
+
return [false, "wrong number of arguments (#{args.length} for #{al})"]
|
77
|
+
end
|
78
|
+
@functions.push( {:type => :func, :func => func, :args => args} )
|
79
|
+
@num_vars = func.function_outputs.length * (@num_vars/func.nvars)
|
80
|
+
return true
|
81
|
+
end
|
82
|
+
|
83
|
+
def [](*ind)
|
84
|
+
if ind.length == 0
|
85
|
+
return [false, "index is invalid"]
|
86
|
+
end
|
87
|
+
ind.each{|i|
|
88
|
+
unless Integer === i
|
89
|
+
return [false, "indices must be integer"]
|
90
|
+
end
|
91
|
+
}
|
92
|
+
if ind.max >= @num_vars
|
93
|
+
return [false, "index out of range"]
|
94
|
+
end
|
95
|
+
@functions.push( {:type => :index, :index => ind} )
|
96
|
+
@num_vars = ind.length
|
97
|
+
return true
|
98
|
+
end
|
99
|
+
|
100
|
+
def cut!(*val)
|
101
|
+
if val.length == 0
|
102
|
+
return [false, "value is invalid"]
|
103
|
+
end
|
104
|
+
val.each{|i|
|
105
|
+
unless Numeric === i || Range === i || TrueClass === i || FalseClass === i
|
106
|
+
return [false, "value is invalid"]
|
107
|
+
end
|
108
|
+
}
|
109
|
+
@functions.push( {:type => :cut, :value => val} )
|
110
|
+
return true
|
111
|
+
end
|
112
|
+
|
113
|
+
def draw(dm,opts=nil)
|
114
|
+
unless DrawMethod === dm
|
115
|
+
raise "draw method is invalid"
|
116
|
+
end
|
117
|
+
unless @num_vars%dm.nvars == 0
|
118
|
+
return [false, "wrong number of variables (#{@num_vars}%#{dm.nvars}!=0)"]
|
119
|
+
end
|
120
|
+
opts_new = Hash.new
|
121
|
+
dm.draw_method_attributes.each{|dma|
|
122
|
+
on = dma.name
|
123
|
+
if ( val = opts.delete(on) )
|
124
|
+
opts_new[on] = val
|
125
|
+
end
|
126
|
+
}
|
127
|
+
@@draw_options.each{|on,v|
|
128
|
+
if ( val = opts.delete(on) )
|
129
|
+
opts_new[on] = val
|
130
|
+
end
|
131
|
+
}
|
132
|
+
unless opts.empty?
|
133
|
+
return [false, "wrong options were specified: #{opts.keys.join(", ")}"]
|
134
|
+
end
|
135
|
+
@draw_method = [dm,opts_new]
|
136
|
+
return true
|
137
|
+
end
|
138
|
+
|
139
|
+
|
140
|
+
def type
|
141
|
+
@draw_method ? "draw" : "analysis"
|
142
|
+
end
|
143
|
+
|
144
|
+
def get(path)
|
145
|
+
fname = File.temp_name(path,"_001.png")
|
146
|
+
dirname = File.dirname(fname)
|
147
|
+
basename = File.basename(fname,"_001.png")
|
148
|
+
res,code = get_code(basename)
|
149
|
+
if res
|
150
|
+
# File.open(File.join(dirname,basename)+".rb","w"){|file| file.print code} # for debug
|
151
|
+
msg = execute(code,dirname)
|
152
|
+
else
|
153
|
+
msg = code
|
154
|
+
end
|
155
|
+
if msg
|
156
|
+
files = nil
|
157
|
+
else
|
158
|
+
files = Dir[File.join(dirname,basename)+"_*.png"].sort
|
159
|
+
end
|
160
|
+
return [files, msg]
|
161
|
+
end
|
162
|
+
|
163
|
+
def path
|
164
|
+
str = @original_nodes.collect{|on| on.path}.join(",")
|
165
|
+
@functions.each{|f|
|
166
|
+
case f[:type]
|
167
|
+
when :func
|
168
|
+
str += "/analysis"
|
169
|
+
str += f[:func].path
|
170
|
+
hash = Hash.new
|
171
|
+
if ( args = f[:args] )
|
172
|
+
args.each_with_index{|arg,i|
|
173
|
+
hash["argv[#{i}]"] = arg
|
174
|
+
}
|
175
|
+
str += options_to_str(hash).gsub(/\?/,"%3F")
|
176
|
+
end
|
177
|
+
when :index
|
178
|
+
str += "/[#{f[:index].join(',')}]"
|
179
|
+
when :cut
|
180
|
+
str += "/#{f[:value].join(',')}"
|
181
|
+
else
|
182
|
+
raise "invalid type"
|
183
|
+
end
|
184
|
+
}
|
185
|
+
if @draw_method
|
186
|
+
str += "/draw"
|
187
|
+
str += @draw_method[0].path
|
188
|
+
str += options_to_str(@draw_method[1])
|
189
|
+
end
|
190
|
+
return str
|
191
|
+
end
|
192
|
+
|
193
|
+
def options_to_str(opts)
|
194
|
+
unless opts && Hash === opts && !opts.empty?
|
195
|
+
return ""
|
196
|
+
end
|
197
|
+
ary = Array.new
|
198
|
+
opts.sort.each{|k,v|
|
199
|
+
case v
|
200
|
+
when String, Numric
|
201
|
+
ary.push "#{k.to_s}=#{v}"
|
202
|
+
when Array
|
203
|
+
ary.push "#{k.to_s}=#{v.join(',')}"
|
204
|
+
else
|
205
|
+
raise "not supported type"
|
206
|
+
end
|
207
|
+
}
|
208
|
+
return "?" + ary.join("&")
|
209
|
+
end
|
210
|
+
|
211
|
+
def to_xml(arg={})
|
212
|
+
uri_prefix = arg.delete(:uri_prefix)
|
213
|
+
nodes = Array.new
|
214
|
+
@original_nodes.each{|on|
|
215
|
+
case on
|
216
|
+
when Node
|
217
|
+
path = on.path
|
218
|
+
nodes.push( {"path" => path, "uri" => File.join(uri_prefix, "data", path+".xml")} )
|
219
|
+
when VirtualNode
|
220
|
+
nodes.push node
|
221
|
+
end
|
222
|
+
}
|
223
|
+
funcs = Array.new
|
224
|
+
@functions.each{|func|
|
225
|
+
case func[:type]
|
226
|
+
when :func
|
227
|
+
path = func[:func].path
|
228
|
+
hash = {"path" => path, "uri" => File.join(uri_prefix, "data", path+".xml")}
|
229
|
+
hash["arguments"] = func[:args] if func[:args]
|
230
|
+
funcs.push hash
|
231
|
+
when :index
|
232
|
+
funcs.push( {"indices" => func[:index]} )
|
233
|
+
when :cut
|
234
|
+
funcs.push( {"cut" => func[:value]} )
|
235
|
+
end
|
236
|
+
}
|
237
|
+
hash = {"nodes" => nodes, "functions" => funcs}
|
238
|
+
if @draw_method
|
239
|
+
path = @draw_method[0].path
|
240
|
+
hash["draw_method"] = {"path" => @draw_method[0].path, "uri" => File.join(uri_prefix, "data", path+".xml")}
|
241
|
+
hash["draw_method"]["options"] = @draw_method[1] if @draw_method[1]
|
242
|
+
end
|
243
|
+
return hash.to_xml(*arg)
|
244
|
+
end
|
245
|
+
|
246
|
+
|
247
|
+
protected
|
248
|
+
def get_code(basename)
|
249
|
+
if @draw_method
|
250
|
+
dm, opts = @draw_method
|
251
|
+
vars = Array.new
|
252
|
+
script = gen_code(dm.nvars,vars)
|
253
|
+
plot = Hash.new
|
254
|
+
plot[:method] = dm.vizshot_method.to_sym
|
255
|
+
|
256
|
+
size = opts["size"]
|
257
|
+
if size
|
258
|
+
size = size.split(",").collect{|c| c.to_i}
|
259
|
+
unless size.length == 2
|
260
|
+
return [false, "option size must be array of length 2"]
|
261
|
+
end
|
262
|
+
else
|
263
|
+
size = @@draw_options["size"][:default]
|
264
|
+
end
|
265
|
+
projection = opts["projection"]
|
266
|
+
if projection
|
267
|
+
projection = projection.to_i
|
268
|
+
unless DRAW_PROJECTION.has_key?(projection)
|
269
|
+
return [false, "option projection number is invalid"]
|
270
|
+
end
|
271
|
+
else
|
272
|
+
projection = @@draw_options["projection"][:default]
|
273
|
+
end
|
274
|
+
viewport = opts["viewport"]
|
275
|
+
if viewport
|
276
|
+
viewport = viewport.split(",").collect{|c| c.to_f}
|
277
|
+
if viewport.min < 0 || viewport.max > 1 || viewport[0] >= viewport[1] || viewport[2] >= viewport[3]
|
278
|
+
return [false, "option viewport is invalid"]
|
279
|
+
end
|
280
|
+
else
|
281
|
+
viewport = @@draw_options["viewport"][:default]
|
282
|
+
end
|
283
|
+
|
284
|
+
code = ""
|
285
|
+
(@num_vars/dm.nvars).times{|i|
|
286
|
+
viz = NumRu::VizShot.new(:iwidth => size[0], :iheight => size[1], :basename => basename)
|
287
|
+
viz.set_fig("itr" => projection, "viewport" => viewport)
|
288
|
+
viz.set_tone("tonf" => true) unless projection == 5
|
289
|
+
plot[:variables] = vars[i].collect{|var| var.path}
|
290
|
+
plot[:script] = script
|
291
|
+
viz.plot(plot.dup)
|
292
|
+
code += viz.gen_code(false, {:image_dump => true}, false)
|
293
|
+
}
|
294
|
+
else
|
295
|
+
vars = Array.new
|
296
|
+
script = self.gen_code(nil, vars)
|
297
|
+
code = <<"EOF"
|
298
|
+
$SAFE = 3
|
299
|
+
|
300
|
+
NumRu::GPhys::read_size_limit_2 = #{GPHYS_READ_SIZE_LIMIT_2.inspect}
|
301
|
+
NumRu::GPhys::read_size_limit_1 = #{GPHYS_READ_SIZE_LIMIT_1.inspect}
|
302
|
+
|
303
|
+
gphyses = Array.new
|
304
|
+
EOF
|
305
|
+
vars.each_with_index{|var,i|
|
306
|
+
code += "gphyses[#{i}] = NumRu::GPhys::IO.open('#{var.fname}','#{var.vname}')\n"
|
307
|
+
}
|
308
|
+
code += <<"EOF"
|
309
|
+
#{script}
|
310
|
+
|
311
|
+
ofname = ARGV.shift || "output.nc"
|
312
|
+
file = NumRu::NetCDF.create(ofname)
|
313
|
+
begin
|
314
|
+
$SAFE=1
|
315
|
+
gphyses.each{|gphys|
|
316
|
+
NumRu::GPhys::IO.write(file,gphys)
|
317
|
+
}
|
318
|
+
ensure
|
319
|
+
file.close
|
320
|
+
end
|
321
|
+
|
322
|
+
EOF
|
323
|
+
end
|
324
|
+
|
325
|
+
return true, code
|
326
|
+
|
327
|
+
end
|
328
|
+
|
329
|
+
|
330
|
+
def gen_code(nvars,vars,id=0)
|
331
|
+
if id == 0 && nvars
|
332
|
+
vars_org = vars
|
333
|
+
vars = Array.new
|
334
|
+
end
|
335
|
+
script = "gphyses#{id} = Array.new\n"
|
336
|
+
@original_nodes.each_with_index{|node,i|
|
337
|
+
case node
|
338
|
+
when Node
|
339
|
+
script += "gphyses#{id}.push gphyses[#{vars.length}]\n"
|
340
|
+
vars.push node.entity
|
341
|
+
when VirtualNode
|
342
|
+
id2 = id*10+i
|
343
|
+
script += node.gen_code(var,id2)
|
344
|
+
script += "gphyses#{id} += proc#{id2}.call\n"
|
345
|
+
else
|
346
|
+
raise "[BUG] node is invalid"
|
347
|
+
end
|
348
|
+
if id == 0
|
349
|
+
if nvars
|
350
|
+
if vars.length == nvars
|
351
|
+
vars_org.push vars
|
352
|
+
vars = Array.new
|
353
|
+
elsif vars.length > nvars
|
354
|
+
raise "[BUG} vars.length is invalid"
|
355
|
+
end
|
356
|
+
end
|
357
|
+
end
|
358
|
+
}
|
359
|
+
script += "proc#{id} = Proc.new{\n"
|
360
|
+
@functions.each{|func|
|
361
|
+
case func[:type]
|
362
|
+
when :func
|
363
|
+
argv = func[:args] || Array.new
|
364
|
+
func = func[:func]
|
365
|
+
nvars = func.nvars
|
366
|
+
fargs = func.function_arguments
|
367
|
+
ary = Array.new
|
368
|
+
nvars.times{|i| ary << "gphys#{i}"}
|
369
|
+
args ||= Array.new
|
370
|
+
fargs.each_with_index{|fa,i|
|
371
|
+
ary << "arg#{i}"
|
372
|
+
args[i] = (argv[i] || YAML.load(fa.default)).inspect
|
373
|
+
}
|
374
|
+
script +=<<"EOF"
|
375
|
+
new_gphyses = Array.new
|
376
|
+
proc = Proc.new{|#{ary.join(",")}|
|
377
|
+
#{func.script}
|
378
|
+
}
|
379
|
+
(gphyses#{id}.length/#{nvars}).times{|i|
|
380
|
+
new_gphyses += proc.call(#{s=Array.new;nvars.times{|i|s.push("gphyses"+id.to_s+"["+(i*nvars).to_s+"+i]")};args.each{|arg|s.push arg};s.join(",")})
|
381
|
+
}
|
382
|
+
gphyses#{id} = new_gphyses
|
383
|
+
EOF
|
384
|
+
when :index
|
385
|
+
script += "gphyses#{id} = gphyes#{id}[#{func[:index].join(",")}]\n"
|
386
|
+
when :cut
|
387
|
+
script += "gphyses#{id}.collect!{|gphys| gphys.cut(#{func[:value].join(",")})}\n"
|
388
|
+
end
|
389
|
+
}
|
390
|
+
script +=<<"EOF"
|
391
|
+
return gphyses#{id}
|
392
|
+
}
|
393
|
+
EOF
|
394
|
+
if id==0
|
395
|
+
script += "gphyses = proc#{id}.call\n"
|
396
|
+
end
|
397
|
+
return script
|
398
|
+
end
|
399
|
+
|
400
|
+
|
401
|
+
def execute(code,dir=nil,nice=19)
|
402
|
+
pipe = /linux/ =~ Config::CONFIG["arch"]
|
403
|
+
if pipe
|
404
|
+
rr,rw = IO.pipe
|
405
|
+
er,ew = IO.pipe
|
406
|
+
end
|
407
|
+
pid = fork {
|
408
|
+
if pipe
|
409
|
+
rr.close
|
410
|
+
er.close
|
411
|
+
STDERR.reopen(ew)
|
412
|
+
end
|
413
|
+
begin
|
414
|
+
Process.setpriority(Process::PRIO_PROCESS, 0, nice)
|
415
|
+
rescue Errno::EACCES
|
416
|
+
end
|
417
|
+
Dir.chdir(dir) if dir
|
418
|
+
eval code
|
419
|
+
if pipe
|
420
|
+
rw.close
|
421
|
+
ew.close
|
422
|
+
end
|
423
|
+
}
|
424
|
+
if pipe
|
425
|
+
rw.close
|
426
|
+
ew.close
|
427
|
+
end
|
428
|
+
pid, status = Process.wait2(pid)
|
429
|
+
case
|
430
|
+
when status.signaled?
|
431
|
+
msg = ["Killed by signal #{status.termsig}\n"]
|
432
|
+
when status.exited?
|
433
|
+
if (es = status.exitstatus) == 0
|
434
|
+
msg = nil
|
435
|
+
else
|
436
|
+
msg = ["error occured with status #{es}\n"]
|
437
|
+
end
|
438
|
+
else
|
439
|
+
msg = ["stoped with unknown status (#{status.to_i})\n"]
|
440
|
+
end
|
441
|
+
if pipe
|
442
|
+
els = er.readlines
|
443
|
+
rr.close
|
444
|
+
er.close
|
445
|
+
$stderr.print els.join("") if els.length > 0
|
446
|
+
if msg
|
447
|
+
msg += els
|
448
|
+
msg = msg.delete_if{|line| /^\s*from / =~ line}.collect{|line| line.sub(/[\/\w\.]*\.rb:\d*:in /, "") }
|
449
|
+
end
|
450
|
+
end
|
451
|
+
msg = msg.join("") if msg
|
452
|
+
return msg
|
453
|
+
end
|
454
|
+
|
455
|
+
|
456
|
+
end
|
457
|
+
|