#!/usr/bin/perl -w { # makeodv.pl Aug 08 $version = "makeodv.pl version 1.1a 25 Apr 2009"; # 25 Apr 09. WJS v 1.1a # Fix typo. Might have goofed up time data # 16 Apr 09. WJS v 1.1 # Tighten up format, etc checking on time variable (there were # warnings that got through to the error log from an object w/o # time info ... so we don't know what user gave makeodv as time var) # 24 Oct 08. WJS v 1.1 # Remove hardcoded /jg/makeodv # 24 Oct 08. WJS v 1.0b # Refer to time splitter # 4 Sep 08. WJS v 1.0a # Avoid "only used one time" diagnostic # 15 Aug 08. WJS v 1.0 # This software based on ODV User's Guide Version 3.4.0 found at # http://odv.awi.de" require ("cgi-lib.pl"); require "wjs_web_perl_utilities.pl"; # Set up environment. Assume .pl routine is in our directory $build_opt_env = "./build-opt-env.pl"; &check_r_access($build_opt_env); require $build_opt_env; # Define form action routine as this file. Undefined SCRIPT_NAME code # to allow possibility that this program is not being run in web environment ($form_action_routine = $ENV{"SCRIPT_NAME"}) || ($form_action_routine = &get_this_file_as_url($0)); # Check that build-opt-env set up things as expected $topdir = &check_build_opt_env_var('OPTHOME',$build_opt_env); $tempdir = &check_build_opt_env_var('USETEMPDIR',$build_opt_env); $tempdir = &abs_filespec($tempdir,"Env var USETEMPDIR"); $bindir = &abs_filespec($topdir,"Env var OPTHOME") . "/bin"; $listvar = "$bindir/listvar"; $list = "$bindir/list"; # ODV info from doc source cited in comments at top # ODV required fields # hash key is our form variable name (and our name for the "concept") # hash value is ODV column name/JGOFS thesaurus name(s) # Thesaurus names are in preferred order (= Bob said depth is better than # depth_w if both) If no var matches, will look for var whose initial # string matches the first thesaurus name provided. All this just # guesses - user gets full varlist to choose from $odv_req_varnames{"cruise"} = "Cruise"; $odv_req_varnames{"station"} = "Station"; $odv_req_varnames{"year"} = "year"; $odv_req_varnames{"month"} = "month"; $odv_req_varnames{"day"} = "day"; $odv_req_varnames{"time"} = "hhmm"; $odv_req_varnames{"lat"} = "Latitude"; $odv_req_varnames{"lon"} = "Longitude"; $odv_req_varnames{"depth"} = "Bot. Depth"; $odv_req_varnames{"station_type"} = "Type"; $max_num_ODV_variables = 50; $max_len_ODV_varname = 60; $max_len_ODV_cruise_datum = 20; $max_len_ODV_station_datum = 20; $ODV_missing_indicator = ""; $ODV_missing_depth_indicator = "0"; $ODV_comment_string_prefix = "//"; $let_ODV_choose_type_field_indicator = "*"; # If next character is changed, code must be added to test to # see if a JGOFS datum contains the character. Tab is as guaranteed # NOT to be in a JGOFS datum as we can get $ODV_col_separator = "\t"; $JGOFS_varname_guess{"cruise"} = "cruiseid"; $JGOFS_varname_guess{"station"} = "station"; $JGOFS_varname_guess{"year"} = "year"; $JGOFS_varname_guess{"month"} = "month"; $JGOFS_varname_guess{"day"} = "day"; $JGOFS_varname_guess{"time"} = "time"; $JGOFS_varname_guess{"lat"} = "lat"; $JGOFS_varname_guess{"lon"} = "lon"; $JGOFS_varname_guess{"depth"} = "depth,depth_w"; $JGOFS_comment_string_prefix = "#"; $JGOFS_missing_indicator = "nd"; # If next character changed, code must be added to check for # that character embedded in a JGOFS datum. Easiest way is # to test the # of data after splitting the record vs the # of variables. $JGOFS_col_separator = "\t"; $task_form_var_name = "Task_to_be_performed"; $data_generation_form_value = "Generate_ODV_data"; $refresh_cache_form_value = "Refresh_varlist_cache"; $object_form_var_name = "object_defn"; $job_id_form_var_name = "unique"; $include_missings_form_var_name = "include_missings"; &ReadParse(*form_info); $task = &get_form_var($task_form_var_name,"OPT"); if (($task eq "") || ($task eq $refresh_cache_form_value)) { &print_form; }elsif ($task eq $data_generation_form_value) { &process_form; } else { &quit ("Bad value for form var $task_form_var_name; namely,",$task); } # Avoid "used one time" diagnostic undef %form_info; exit; } sub print_form { &printheader(); print "\n"; $title = 'ODV download page'; print "