ôŒ¢CREATE SCHEMA PUBLIC AUTHORIZATION DBA CREATE MEMORY TABLE QUEUE_SYSTEM(QUEUE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,QUEUE_NAME VARCHAR(40) NOT NULL,CONSTRAINT SYS_CT_46 UNIQUE(QUEUE_NAME)) CREATE MEMORY TABLE COMPUTER(COMPUTER_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,COMPUTER_NAME VARCHAR(40) NOT NULL,OS_NAME VARCHAR(10) DEFAULT 'linux' NOT NULL,WORKFLOW_MGR_PATH VARCHAR(255),DEFAULT_QUEUE_ID INTEGER DEFAULT 3,MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,ALIASES VARCHAR(255),TOKEN_CARD_ACCESS_YN CHAR(1) DEFAULT 'N',CONSTRAINT SYS_FK_50 FOREIGN KEY(DEFAULT_QUEUE_ID) REFERENCES QUEUE_SYSTEM(QUEUE_ID),CONSTRAINT SYS_CT_51 UNIQUE(COMPUTER_NAME)) CREATE MEMORY TABLE COMPUTER_QUEUE_SYSTEM(COMPUTER_QUEUE_SYSTEM_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,QUEUE_ID INTEGER NOT NULL,COMPUTER_ID INTEGER NOT NULL,CONSTRAINT SYS_CT_57 UNIQUE(QUEUE_ID,COMPUTER_ID),CONSTRAINT SYS_FK_58 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID),CONSTRAINT SYS_FK_59 FOREIGN KEY(QUEUE_ID) REFERENCES QUEUE_SYSTEM(QUEUE_ID)) CREATE MEMORY TABLE USER(USER_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,USERNAME VARCHAR(16) NOT NULL,IS_ADMIN CHAR(1) NOT NULL,SINGLE_MODEL CHAR(1) DEFAULT 'Y' NOT NULL,EMAIL VARCHAR(100),SHOW_HELP_ON_STARTUP_YN CHAR(1) DEFAULT 'Y',DEF_COMPUTER_ID INTEGER,LOCAL_TEMP_DIR VARCHAR(255),DEF_MODEL_TYPE VARCHAR(255),MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,CONSTRAINT SYS_CT_67 UNIQUE(USERNAME),CONSTRAINT SYS_FK_68 FOREIGN KEY(DEF_COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID)) CREATE MEMORY TABLE MODEL_TYPE(MODEL_TYPE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TYPE VARCHAR(20) NOT NULL,CONSTRAINT SYS_CT_74 UNIQUE(MODEL_TYPE)) CREATE INDEX IDXMODEL_TYPE_MODEL_TYPE ON MODEL_TYPE(MODEL_TYPE) CREATE MEMORY TABLE CONFIG_FILE(CONFIG_FILE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,CONFIG_FILE_NAME VARCHAR(40) NOT NULL,IS_NAMELIST CHAR(1) NOT NULL,MODEL_TYPE VARCHAR(20) NOT NULL,COMPUTER_ID INTEGER NOT NULL,USER_ID INTEGER,FILE_TEXT VARCHAR(200000),MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,CONSTRAINT SYS_FK_78 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID),CONSTRAINT SYS_FK_79 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID),CONSTRAINT SYS_FK_80 FOREIGN KEY(MODEL_TYPE) REFERENCES MODEL_TYPE(MODEL_TYPE)) CREATE MEMORY TABLE MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TYPE VARCHAR(20) NOT NULL,COMPUTER_ID INTEGER NOT NULL,MODEL_TASK_TYPE VARCHAR(50) NOT NULL,USER_ID INTEGER,SCRIPT_CONFIG_FILE_ID INTEGER NOT NULL,CONSTRAINT SYS_CT_89 UNIQUE(MODEL_TASK_TYPE,MODEL_TYPE,COMPUTER_ID,USER_ID),CONSTRAINT SYS_CT_90 UNIQUE(SCRIPT_CONFIG_FILE_ID),CONSTRAINT SYS_FK_91 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID),CONSTRAINT SYS_FK_92 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_93 FOREIGN KEY(SCRIPT_CONFIG_FILE_ID) REFERENCES CONFIG_FILE(CONFIG_FILE_ID),CONSTRAINT SYS_FK_94 FOREIGN KEY(MODEL_TYPE) REFERENCES MODEL_TYPE(MODEL_TYPE) ON DELETE CASCADE) CREATE INDEX IDXMODEL_TASK_TYPE_MODEL_TASK_TYPE ON MODEL_TASK_TYPE(MODEL_TASK_TYPE) CREATE MEMORY TABLE MODEL_TASK_TYPE_CONFIG_FILE(MODEL_TASK_CONFIG_FILE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_TYPE_ID INTEGER NOT NULL,CONFIG_FILE_ID INTEGER NOT NULL,CONSTRAINT SYS_FK_107 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_108 FOREIGN KEY(CONFIG_FILE_ID) REFERENCES CONFIG_FILE(CONFIG_FILE_ID),CONSTRAINT SYS_CT_109 UNIQUE(MODEL_TASK_TYPE_ID,CONFIG_FILE_ID)) CREATE MEMORY TABLE MODEL_CONFIG(MODEL_CONFIG_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,USER_ID INTEGER NOT NULL,MODEL_TYPE VARCHAR(20) NOT NULL,NAME VARCHAR(40) NOT NULL,COMPUTER_ID INTEGER NOT NULL,DATA_ROOT_DIR VARCHAR(255),MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,CONSTRAINT SYS_CT_117 UNIQUE(USER_ID,NAME,COMPUTER_ID,MODEL_TYPE),CONSTRAINT SYS_FK_118 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_119 FOREIGN KEY(MODEL_TYPE) REFERENCES MODEL_TYPE(MODEL_TYPE),CONSTRAINT SYS_FK_120 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID)) CREATE MEMORY TABLE TASK_ENVIRONMENT_VARIABLE(TASK_ENVIRONMENT_VARIABLE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(40) NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,MODEL_CONFIG_ID INTEGER NOT NULL,VALUE VARCHAR(255),CONSTRAINT SYS_FK_130 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_131 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE TASK_DEFAULT_ENVIRONMENT_VARIABLE(TASK_DEFAULT_ENVIRONMENT_VARIABLE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(40) NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,VALUE VARCHAR(255) NOT NULL,CONSTRAINT SYS_FK_138 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_CONFIG_ENVIRONMENT_VARIABLE(MODEL_CONFIG_ENVIRONMENT_VARIABLE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(40) NOT NULL,MODEL_CONFIG_ID INTEGER NOT NULL,VALUE VARCHAR(255),CONSTRAINT SYS_FK_143 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK(MODEL_TASK_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_CONFIG_ID INTEGER NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,TASK_ORDER INTEGER NOT NULL,CONSTRAINT SYS_FK_148 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_149 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_CONFIG_FILE(MODEL_CONFIG_FILE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_CONFIG_ID INTEGER NOT NULL,CONFIG_FILE_ID INTEGER NOT NULL,USER_ID INTEGER NOT NULL,ORIGINAL_FILEPATH VARCHAR(255),FILE_TEXT VARCHAR(200000),MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,CONSTRAINT SYS_FK_156 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_157 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID),CONSTRAINT SYS_FK_158 FOREIGN KEY(CONFIG_FILE_ID) REFERENCES CONFIG_FILE(CONFIG_FILE_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MCF_CONSOLIDATED(MCF_CONSOLIDATED_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_CONFIG_ID INTEGER NOT NULL,CONFIG_FILE_ID INTEGER NOT NULL,POINT_TO_CONFIG_FILE_ID INTEGER NOT NULL,CONSTRAINT SYS_FK_167 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_168 FOREIGN KEY(CONFIG_FILE_ID) REFERENCES CONFIG_FILE(CONFIG_FILE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_169 FOREIGN KEY(POINT_TO_CONFIG_FILE_ID) REFERENCES CONFIG_FILE(CONFIG_FILE_ID) ON DELETE CASCADE) CREATE MEMORY TABLE RUN_CONFIG(RUN_CONFIG_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,USER_ID INTEGER NOT NULL,MODEL_CONFIG_ID INTEGER NOT NULL,NAME VARCHAR(40),MODEL_TYPE VARCHAR(20) NOT NULL,COMPUTER_ID INTEGER NOT NULL,NOTE VARCHAR(80),DATA_ROOT_DIR VARCHAR(255),INPUT_FILES_DIR VARCHAR(255),ACCOUNT_NAME VARCHAR(40),RUN_STATUS VARCHAR(10),WORKFLOW_MGR VARCHAR(10) DEFAULT 'INTERNAL',FLOWRATE INTEGER,MODIFIED_DATE TIMESTAMP DEFAULT CURRENT_TIMESTAMP,QUEUE_ID INTEGER,ERROR_LOG VARCHAR(1048575),WORKFLOW_MGR_PID INTEGER,WORKFLOW_MGR_CMD VARCHAR(1023),CONSTRAINT SYS_CT_178 UNIQUE(USER_ID,COMPUTER_ID,MODEL_TYPE,NAME),CONSTRAINT SYS_FK_179 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_180 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_181 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_245 FOREIGN KEY(QUEUE_ID) REFERENCES QUEUE_SYSTEM(QUEUE_ID)) CREATE MEMORY TABLE RUN_CONFIG_TASKS(RUN_CONFIG_TASKS_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,RUN_CONFIG_ID INTEGER NOT NULL,MODEL_CONFIG_ID INTEGER NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,NUM_PROCESSORS INTEGER,MAX_WALLCLOCKTIME CHAR(8),QUEUE_NAME VARCHAR(40),THROTTLE INTEGER DEFAULT 3,RETRIES INTEGER DEFAULT 2,PARALLEL_ENV VARCHAR(40),METATASK_ID INTEGER,CONSTRAINT SYS_FK_191 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_192 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_193 FOREIGN KEY(RUN_CONFIG_ID) REFERENCES RUN_CONFIG(RUN_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE TASK_DEFAULT(TASK_DEFAULT_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,COMPUTER_ID INTEGER NOT NULL,MODEL_TYPE VARCHAR(20) DEFAULT 'WRF' NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,USER_ID INTEGER,NUM_PROCESSORS INTEGER,MAX_WALLCLOCKTIME CHAR(8),QUEUE_NAME VARCHAR(40),THROTTLE INTEGER DEFAULT 3,RETRIES INTEGER DEFAULT 2,PARALLEL_ENV VARCHAR(40),CONSTRAINT SYS_CT_213 UNIQUE(USER_ID,COMPUTER_ID,MODEL_TYPE,MODEL_TASK_TYPE_ID),CONSTRAINT SYS_FK_214 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID),CONSTRAINT SYS_FK_215 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID),CONSTRAINT SYS_FK_216 FOREIGN KEY(MODEL_TYPE) REFERENCES MODEL_TYPE(MODEL_TYPE),CONSTRAINT SYS_FK_217 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE ON UPDATE CASCADE) CREATE MEMORY TABLE RUN_CONFIG_DATES(RUN_CONFIG_DATES_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,RUN_CONFIG_ID INTEGER NOT NULL,RUN_DATETIME TIMESTAMP NOT NULL,RUN_STATUS VARCHAR(10) DEFAULT 'NOT_RUN',RUN_STARTED TIMESTAMP,RUN_ENDED TIMESTAMP,RUN_TIME_SEC INTEGER DEFAULT 0,LOG_FILE_PATH VARCHAR(255),LOG_FILE_SIZE INTEGER,CONSTRAINT SYS_FK_229 FOREIGN KEY(RUN_CONFIG_ID) REFERENCES RUN_CONFIG(RUN_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE TASK_RUN_STATUS(TASK_RUN_STATUS_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,RUN_CONFIG_DATES_ID INTEGER NOT NULL,RUN_CONFIG_TASKS_ID INTEGER NOT NULL,TASK_STARTED TIMESTAMP,TASK_ENDED TIMESTAMP,TASK_STATUS VARCHAR(10),TASK_STATUS_MESSAGE VARCHAR(255),QUEUE_JOB_ID INTEGER,CONSTRAINT SYS_CT_234 UNIQUE(RUN_CONFIG_DATES_ID,RUN_CONFIG_TASKS_ID),CONSTRAINT SYS_FK_235 FOREIGN KEY(RUN_CONFIG_DATES_ID) REFERENCES RUN_CONFIG_DATES(RUN_CONFIG_DATES_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_236 FOREIGN KEY(RUN_CONFIG_TASKS_ID) REFERENCES RUN_CONFIG_TASKS(RUN_CONFIG_TASKS_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_DEP_TASK(MODEL_TASK_DEP_TASK_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,DEP_UPON_MODEL_TASK_ID INTEGER NOT NULL,CONSTRAINT SYS_FK_249 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_250 FOREIGN KEY(DEP_UPON_MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_DEP_FILE(MODEL_TASK_DEP_FILE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,FILE_AGE_SEC INTEGER,FILE_PATH VARCHAR(255),CONSTRAINT SYS_FK_257 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_HANG_DEP_FILE(MODEL_TASK_HANG_DEP_FILE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,FILE_AGE_SEC INTEGER,FILE_PATH VARCHAR(255),CONSTRAINT SYS_FK_262 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_DEP_TIME(MODEL_TASK_DEP_TIME_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,YYYYMMDDHHMMSS CHAR(255) NOT NULL,CONSTRAINT SYS_FK_267 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_DEP_DEADLINE(MODEL_TASK_DEP_DEADLINE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,YYYYMMDDHHMMSS CHAR(255) NOT NULL,CONSTRAINT SYS_FK_272 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_DEP_COMPLEX(MODEL_TASK_DEP_COMPLEX_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,XML VARCHAR(10000),CONSTRAINT SYS_FK_277 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_METATASK(NAME VARCHAR(40) NOT NULL,MODEL_METATASK_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_CONFIG_ID INTEGER NOT NULL,TASK_ORDER INTEGER NOT NULL,CONSTRAINT SYS_FK_314 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID) ON DELETE CASCADE) CREATE MEMORY TABLE MODEL_TASK_METATASK(MODEL_TASK_METATASK_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,MODEL_TASK_ID INTEGER NOT NULL,MODEL_TASK_TYPE_ID INTEGER NOT NULL,MODEL_METATASK_ID INTEGER NOT NULL,MODEL_CONFIG_ID INTEGER NOT NULL,CONSTRAINT SYS_FK_319 FOREIGN KEY(MODEL_TASK_ID) REFERENCES MODEL_TASK(MODEL_TASK_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_320 FOREIGN KEY(MODEL_TASK_TYPE_ID) REFERENCES MODEL_TASK_TYPE(MODEL_TASK_TYPE_ID) ON DELETE CASCADE,CONSTRAINT SYS_FK_321 FOREIGN KEY(MODEL_METATASK_ID) REFERENCES MODEL_METATASK(MODEL_METATASK_ID),CONSTRAINT SYS_FK_322 FOREIGN KEY(MODEL_CONFIG_ID) REFERENCES MODEL_CONFIG(MODEL_CONFIG_ID),CONSTRAINT SYS_CT_323 UNIQUE(MODEL_TASK_ID,MODEL_METATASK_ID)) CREATE MEMORY TABLE MODEL_METATASK_VARIABLE(MODEL_METATASK_VARIABLE_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,NAME VARCHAR(40) NOT NULL,MODEL_METATASK_ID INTEGER NOT NULL,VALUE VARCHAR(65535),CONSTRAINT SYS_FK_335 FOREIGN KEY(MODEL_METATASK_ID) REFERENCES MODEL_METATASK(MODEL_METATASK_ID) ON DELETE CASCADE) CREATE MEMORY TABLE DATABASE_VERSION(DATABASE_VERSION_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,VERSION FLOAT NOT NULL) CREATE MEMORY TABLE USER_COMPUTER_DEFAULTS(USER_COMPUTER_DEFAULTS_ID INTEGER GENERATED BY DEFAULT AS IDENTITY(START WITH 1) NOT NULL PRIMARY KEY,COMPUTER_ID INTEGER NOT NULL,USER_ID INTEGER NOT NULL,DEF_ACCOUNT_NAME VARCHAR(40),DEF_INPUT_DATA_DIR VARCHAR(255),DEF_OUTPUT_DATA_DIR VARCHAR(255),DEF_WORKFLOW_MGR VARCHAR(10) DEFAULT 'Internal',CONSTRAINT SYS_FK_342 FOREIGN KEY(COMPUTER_ID) REFERENCES COMPUTER(COMPUTER_ID),CONSTRAINT SYS_FK_343 FOREIGN KEY(USER_ID) REFERENCES USER(USER_ID),CONSTRAINT SYS_CT_350 UNIQUE(COMPUTER_ID,USER_ID)) ALTER TABLE QUEUE_SYSTEM ALTER COLUMN QUEUE_ID RESTART WITH 6 ALTER TABLE COMPUTER ALTER COLUMN COMPUTER_ID RESTART WITH 4 ALTER TABLE COMPUTER_QUEUE_SYSTEM ALTER COLUMN COMPUTER_QUEUE_SYSTEM_ID RESTART WITH 2 ALTER TABLE USER ALTER COLUMN USER_ID RESTART WITH 2 ALTER TABLE MODEL_TYPE ALTER COLUMN MODEL_TYPE_ID RESTART WITH 3 ALTER TABLE CONFIG_FILE ALTER COLUMN CONFIG_FILE_ID RESTART WITH 93 ALTER TABLE MODEL_TASK_TYPE ALTER COLUMN MODEL_TASK_TYPE_ID RESTART WITH 45 ALTER TABLE MODEL_TASK_TYPE_CONFIG_FILE ALTER COLUMN MODEL_TASK_CONFIG_FILE_ID RESTART WITH 87 ALTER TABLE MODEL_CONFIG ALTER COLUMN MODEL_CONFIG_ID RESTART WITH 195 ALTER TABLE TASK_ENVIRONMENT_VARIABLE ALTER COLUMN TASK_ENVIRONMENT_VARIABLE_ID RESTART WITH 2637 ALTER TABLE TASK_DEFAULT_ENVIRONMENT_VARIABLE ALTER COLUMN TASK_DEFAULT_ENVIRONMENT_VARIABLE_ID RESTART WITH 109 ALTER TABLE MODEL_CONFIG_ENVIRONMENT_VARIABLE ALTER COLUMN MODEL_CONFIG_ENVIRONMENT_VARIABLE_ID RESTART WITH 1656 ALTER TABLE MODEL_TASK ALTER COLUMN MODEL_TASK_ID RESTART WITH 994 ALTER TABLE MODEL_CONFIG_FILE ALTER COLUMN MODEL_CONFIG_FILE_ID RESTART WITH 5230 ALTER TABLE MCF_CONSOLIDATED ALTER COLUMN MCF_CONSOLIDATED_ID RESTART WITH 129 ALTER TABLE RUN_CONFIG ALTER COLUMN RUN_CONFIG_ID RESTART WITH 230 ALTER TABLE RUN_CONFIG_TASKS ALTER COLUMN RUN_CONFIG_TASKS_ID RESTART WITH 5288 ALTER TABLE TASK_DEFAULT ALTER COLUMN TASK_DEFAULT_ID RESTART WITH 45 ALTER TABLE RUN_CONFIG_DATES ALTER COLUMN RUN_CONFIG_DATES_ID RESTART WITH 517 ALTER TABLE TASK_RUN_STATUS ALTER COLUMN TASK_RUN_STATUS_ID RESTART WITH 472 ALTER TABLE MODEL_TASK_DEP_TASK ALTER COLUMN MODEL_TASK_DEP_TASK_ID RESTART WITH 39 ALTER TABLE MODEL_TASK_DEP_FILE ALTER COLUMN MODEL_TASK_DEP_FILE_ID RESTART WITH 57 ALTER TABLE MODEL_TASK_HANG_DEP_FILE ALTER COLUMN MODEL_TASK_HANG_DEP_FILE_ID RESTART WITH 21 ALTER TABLE MODEL_TASK_DEP_TIME ALTER COLUMN MODEL_TASK_DEP_TIME_ID RESTART WITH 1 ALTER TABLE MODEL_TASK_DEP_DEADLINE ALTER COLUMN MODEL_TASK_DEP_DEADLINE_ID RESTART WITH 1 ALTER TABLE MODEL_TASK_DEP_COMPLEX ALTER COLUMN MODEL_TASK_DEP_COMPLEX_ID RESTART WITH 43 ALTER TABLE MODEL_METATASK ALTER COLUMN MODEL_METATASK_ID RESTART WITH 501 ALTER TABLE MODEL_TASK_METATASK ALTER COLUMN MODEL_TASK_METATASK_ID RESTART WITH 620 ALTER TABLE MODEL_METATASK_VARIABLE ALTER COLUMN MODEL_METATASK_VARIABLE_ID RESTART WITH 55 ALTER TABLE DATABASE_VERSION ALTER COLUMN DATABASE_VERSION_ID RESTART WITH 2 ALTER TABLE USER_COMPUTER_DEFAULTS ALTER COLUMN USER_COMPUTER_DEFAULTS_ID RESTART WITH 4 CREATE USER SA PASSWORD "" GRANT DBA TO SA SET WRITE_DELAY 10 SET SCHEMA PUBLIC INSERT INTO QUEUE_SYSTEM VALUES(1,'SGE') INSERT INTO QUEUE_SYSTEM VALUES(2,'LSF') INSERT INTO QUEUE_SYSTEM VALUES(3,'NONE') INSERT INTO QUEUE_SYSTEM VALUES(4,'PBS') INSERT INTO QUEUE_SYSTEM VALUES(5,'Torque') INSERT INTO COMPUTER VALUES(3,'bluefire.ucar.edu','linux','/blhome/lynge/workflowmgr.beta/workflowmgr.rb',2,'2010-06-18 15:42:09.587000000','be1105en.ucar.edu,be1005en.ucar.edu','Y') INSERT INTO USER VALUES(1,'portal','Y','Y','','N',3,'/work/01220/lynge/portal_temp','FIM','2008-03-18 15:12:30.048000000') INSERT INTO MODEL_TYPE VALUES(1,'WRF') INSERT INTO MODEL_TYPE VALUES(2,'FIM') INSERT INTO CONFIG_FILE VALUES(61,'def_ungrib.rb','N','WRF',3,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_ungrib.rb ########################\u000a#\u000a# version 1.00 (runs WRF/WPS - ungrib.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WPS\u000a#\u000a##########################################\u000aclass WPS\u000a\u000a @@format_chars={\u000a "%Y"=>4,\u000a "%y"=>2,\u000a "%j"=>3,\u000a "%m"=>2,\u000a "%d"=>2,\u000a "%H"=>2,\u000a "%M"=>2,\u000a "%F"=>4,\u000a "%f"=>2\u000a }\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wps_root,\u000a domain_home,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wps_root,:domain_home]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WPS and domain home directories\u000a @wps_root=File.expand_path(wps_root)\u000a @domain_home=File.expand_path(domain_home)\u000a\u000a # Set the paths to the WPS executables\u000a @geogrid="#{@wps_root}/geogrid.exe"\u000a @ungrib="#{@wps_root}/ungrib.exe"\u000a @metgrid="#{@wps_root}/metgrid.exe"\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wps_root,:@domain_home]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Make sure WPS executables exist and are executable\u000a args=[:@geogrid,:@ungrib,:@metgrid]\u000a args.each { |arg|\u000a exe=eval("#{arg}")\u000a if !File.exist?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: #{exe} does not exist"\u000a end\u000a if !File.executable?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{exe}"\u000a end\u000a }\u000a\u000a # Set the WPS namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_ungrib/namelist.wps")\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # run_ungrib\u000a #\u000a #####################################################\u000a def run_ungrib(vtable_home,\u000a output_root,\u000a source,\u000a source_path,\u000a format,\u000a start_time,\u000a fcst_length,\u000a fcst_interval)\u000a\u000a begin\u000a\u000a puts "def_ungrib.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:vtable_home,:output_root,:source,:source_path,:format,:start_time,:fcst_length,:fcst_interval].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate the vtable_home argument\u000a @vtable_home=File.expand_path(vtable_home) \u000a if !File.exist?(@vtable_home)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable directory, ''#{@vtable_home}'', does not exist"\u000a elsif !File.directory?(@vtable_home)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable directory, ''#{@vtable_home}'', is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @ungrib_output_root=File.expand_path(output_root)\u000a if File.exist?(@ungrib_output_root)\u000a if !File.directory?(@ungrib_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Ungrib output directory, ''#{@ungrib_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the data source name\u000a @ungrib_source=source\u000a\u000a # Validate the data source path\u000a @ungrib_source_path=File.expand_path(source_path)\u000a if !File.exist?(@ungrib_source_path)\u000a raise "#{__FILE__}:#{__LINE__}:: Source path, ''#{@ungrib_source_path}'', does not exist"\u000a elsif !File.directory?(@ungrib_source_path)\u000a raise "#{__FILE__}:#{__LINE__}:: Source path, ''#{@ungrib_source_path}'', is not a directory"\u000a end\u000a\u000a # Set the source filename format\u000a @ungrib_format=format\u000a\u000a # Set the start time, forecast length, and forecast interval\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a\u000a # Make sure the Vtable for the specified source exists and is readable\u000a @vtable="#{@vtable_home}/Vtable.#{@ungrib_source}"\u000a if !File.exist?(@vtable)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable, ''#{@vtable}'', does not exist"\u000a end\u000a if !File.readable?(@vtable)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read #{@vtable}"\u000a end\u000a\u000a # Create a filename pattern to capture each format character in @ungrib_format\u000a @ungrib_format_pattern=Hash.new\u000a @@format_chars.each {|char,length|\u000a next unless /#{char}/.match(@ungrib_format)\u000a formatstr="#{@ungrib_format.gsub(char,"(\\d{#{length},#{length}})")}"\u000a @@format_chars.each { |c,l|\u000a formatstr.gsub!(c,"\\d\{#{l},#{l}\}")\u000a }\u000a @ungrib_format_pattern[char]=Regexp.new("^#{formatstr}$")\u000a }\u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a \u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@ungrib_output_root}/work/#{@source}"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do \u000a \u000a # Create a link to the Vtable\u000a File.delete("Vtable") if File.symlink?("Vtable")\u000a File.symlink(@vtable,"Vtable")\u000a\u000a # Set the start and end time fields in the namelist\u000a @namelist.set("share","start_date",[@start_time.strftime("%Y-%m-%d_%H:%M:%S")])\u000a @namelist.set("share","end_date",[(@start_time+3600*@fcst_length).strftime("%Y-%m-%d_%H:%M:%S")])\u000a \u000a # Set the interval seconds field in the namelist\u000a @namelist.set("share","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Set the prefix field in the namelist\u000a @namelist.set("ungrib","prefix",[@ungrib_source])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.wps")\u000a\u000a # Create links to source files whose name match the pattern and are valid during the forecast\u000a id="AAA"\u000a Dir.foreach(@ungrib_source_path) { |fname|\u000a\u000a catch(:mismatch) do\u000a\u000a @ungrib_format_pattern.each { |char,pattern|\u000a match=pattern.match(fname)\u000a throw :mismatch if match.nil?\u000a val=match.captures[0].to_i\u000a case char\u000a when "%y"\u000a throw :mismatch unless val == @start_time.strftime("%y").to_i\u000a when "%Y"\u000a throw :mismatch unless val == @start_time.year\u000a when "%j"\u000a throw :mismatch unless val == @start_time.yday\u000a when "%m"\u000a throw :mismatch if val != @start_time.month\u000a when "%d"\u000a throw :mismatch if val != @start_time.day\u000a when "%H"\u000a throw :mismatch if val != @start_time.hour\u000a when "%M"\u000a throw :mismatch if val != @start_time.minute\u000a when "%f","%F"\u000a throw :mismatch if val > @fcst_length\u000a end\u000a }\u000a\u000a File.delete("GRIBFILE.#{id}") if File.symlink?("GRIBFILE.#{id}")\u000a File.symlink("#{@ungrib_source_path}/#{fname}","GRIBFILE.#{id}")\u000a id=id.succ\u000a\u000a end # catch :mismatch\u000a\u000a } # Dir.foreach\u000a\u000a # Run ungrib\u000a system(@ungrib)\u000a status=$?\u000a\u000a # Check for successful completion of ungrib\u000a if status.signaled? \u000a raise "#{__FILE__}:#{__LINE__}:: #{@ungrib} was terminated by signal #{status.termsig}"\u000a elsif status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{@ungrib} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Calculate names of expected output files\u000a output_files=Array.new\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a output_files.push("#{(@start_time+f*3600).strftime("#{@ungrib_source}:%Y-%m-%d_%H")}")\u000a }\u000a\u000a # print list of expected ungrib files\u000a puts "List of expected ungrib files (if ungrib finishes successfully):"\u000a output_files.each {|file| puts " #{file}"}\u000a puts " "\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: Ungrib output file, ''#{workdir}#{outfile}'', is missing"\u000a end\u000a }\u000a\u000a # Move the output files to the extprd directory\u000a extprd="#{@ungrib_output_root}/extprd"\u000a Dir.mkdir(extprd) unless File.exist?(extprd)\u000a output_files.each {|outfile|\u000a File.rename(outfile,"#{@ungrib_output_root}/extprd/#{outfile}")\u000a }\u000a \u000a end # Dir.chdir\u000a\u000a status=0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a status=1\u000a ensure\u000a puts "run_ungrib terminated at: #{Time.now}"\u000a return status\u000a end \u000a \u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of ungrib.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WPS_ROOT","MOAD_DATAHOME",\u000a "EXT_DATAHOME","EXT_DATAROOT",\u000a "SOURCE","UNGRIB_SOURCE_PATH","FORMAT",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000awps_root=ENV["WPS_ROOT"]\u000adomain_home=ENV["MOAD_DATAHOME"]\u000avtable_home=ENV["EXT_DATAHOME"]\u000aoutput_root=ENV["EXT_DATAROOT"]\u000asource=ENV["SOURCE"]\u000asource_path=ENV["UNGRIB_SOURCE_PATH"]\u000aformat=ENV["FORMAT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000a\u000a# Create a WPS object\u000awps=WPS.new(wps_root,domain_home,output_root)\u000a\u000a# Run ungrib\u000astatus=wps.run_ungrib(vtable_home,\u000a output_root,\u000a source,\u000a source_path,\u000a format,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval)\u000a\u000aexit status\u000a','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(62,'namelist.wps','Y','WRF',3,NULL,'Hint: click the Import button below to import namelist.wps from your domain directory','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(63,'def_metgrid.rb','N','WRF',3,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_metgrid.rb #######################\u000a#\u000a# version 1.00 (runs WRF/WPS - metgrid.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WPS\u000a#\u000a##########################################\u000aclass WPS\u000a\u000a @@format_chars={\u000a "%Y"=>4,\u000a "%y"=>2,\u000a "%j"=>3,\u000a "%m"=>2,\u000a "%d"=>2,\u000a "%H"=>2,\u000a "%M"=>2,\u000a "%F"=>4,\u000a "%f"=>2\u000a }\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wps_root,\u000a domain_home,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wps_root,:domain_home]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WPS and domain home directories\u000a @wps_root=File.expand_path(wps_root)\u000a @domain_home=File.expand_path(domain_home)\u000a\u000a # Set the paths to the WPS executables\u000a @geogrid="#{@wps_root}/geogrid.exe"\u000a @ungrib="#{@wps_root}/ungrib.exe"\u000a @metgrid="#{@wps_root}/metgrid.exe"\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wps_root,:@domain_home]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Make sure WPS executables exist and are executable\u000a args=[:@geogrid,:@ungrib,:@metgrid]\u000a args.each { |arg|\u000a exe=eval("#{arg}")\u000a if !File.exist?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: #{exe} does not exist"\u000a end\u000a if !File.executable?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{exe}"\u000a end\u000a }\u000a\u000a # Set the WPS namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_metgrid/namelist.wps")\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # run_metgrid\u000a #\u000a #####################################################\u000a def run_metgrid(output_root,\u000a sources,\u000a sources_paths,\u000a constants,\u000a constants_paths,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_metgrid.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a \u000a\u000a # Make sure the required input arguments are not nil\u000a [:output_root,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @metgrid_output_root=File.expand_path(output_root)\u000a if File.exist?(@metgrid_output_root)\u000a if !File.directory?(@metgrid_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Metgrid output directory, ''#{@metgrid_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Get the data sources\u000a if sources.nil?\u000a @metgrid_sources=@namelist.get("metgrid","fg_name")\u000a else\u000a if sources.kind_of?(Array)\u000a if sources.empty?\u000a @metgrid_sources=@namelist.get("metgrid","fg_name")\u000a else\u000a @metgrid_sources=sources\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources argument must be an array"\u000a end\u000a end\u000a\u000a # Get the data source paths\u000a if sources_paths.nil?\u000a @metgrid_sources_paths=nil\u000a else\u000a if sources_paths.kind_of?(Array)\u000a @metgrid_sources_paths=sources_paths.map {|src_path|\u000a if src_path.kind_of?(String)\u000a File.expand_path(src_path)\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources_path, ''#{src_path}'', is not a valid path"\u000a end\u000a }\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources_paths argument must be an array"\u000a end \u000a end\u000a\u000a # Get the constants\u000a if constants.nil?\u000a @metgrid_constants=@namelist.get("metgrid","constants_name")\u000a else\u000a if constants.kind_of?(Array)\u000a if constants.empty?\u000a @metgrid_constants=@namelist.get("metgrid","constants_name")\u000a else\u000a @metgrid_constants=constants\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants argument must be an array"\u000a end\u000a end\u000a\u000a # Get the constant paths\u000a if constants_paths.nil?\u000a @metgrid_constants_paths=nil\u000a else\u000a if constants_paths.kind_of?(Array)\u000a @metgrid_constants_paths=constants_paths.map {|constant_path|\u000a if constant_path.kind_of?(String)\u000a File.expand_path(constant_path)\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants_path, ''#{constant_path}'', is not a valid path"\u000a end\u000a }\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants_paths argument must be an array"\u000a end \u000a end\u000a\u000a # Get the start time, forecast length, and forecast interval\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a\u000a # Get the number of processors\u000a @nprocs=nprocs\u000a\u000a use_mpi=ENV["WPS_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure that there is a legitimate sources_path for each source\u000a unless @metgrid_sources.nil?\u000a @metgrid_sources.each_with_index {|src,index|\u000a unless src.empty?\u000a if @metgrid_sources_paths.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: Sources are specified, but sources_paths is nil"\u000a elsif @metgrid_sources_paths[index].nil?\u000a raise "#{__FILE__}:#{__LINE__}:: The source path for source, ''#{src}'', is nil"\u000a elsif !File.directory?(@metgrid_sources_paths[index])\u000a raise "#{__FILE__}:#{__LINE__}:: The source path directory, ''#{@metgrid_sources_paths[index]}'', does not exist"\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Make sure that there is a legitimate constants_path for each constant\u000a unless @metgrid_constants.nil?\u000a @metgrid_constants.each_with_index {|constant,index|\u000a unless constant.empty?\u000a if @metgrid_constants_paths.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: Constants are specified, but constants_paths is nil"\u000a elsif @metgrid_constants_paths[index].nil?\u000a raise "#{__FILE__}:#{__LINE__}:: The constant path for constant, ''#{constant}'', is nil"\u000a elsif !File.directory?(@metgrid_constants_paths[index])\u000a raise "#{__FILE__}:#{__LINE__}:: The constant path directory, ''#{@metgrid_constants_paths[index]}'', does not exist"\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Make sure nprocs is an integer\u000a if !@nprocs.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: nprocs argument is not an integer"\u000a end\u000a\u000a # Set the output filename prefix\u000a wrf_core=@namelist.get("share","wrf_core")[0]\u000a case wrf_core\u000a when /^ARW$/i\u000a prefix="met_em"\u000a when /^NMM$/i\u000a prefix="met_nmm"\u000a end\u000a\u000a # Set the output filename suffix\u000a io_form=@namelist.get("metgrid","io_form_metgrid")[0]\u000a case io_form\u000a when 2\u000a suffix=".nc"\u000a else\u000a suffix=""\u000a end\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@metgrid_output_root}/wps-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do \u000a\u000a # Create links to geogrid files\u000a Dir["#{@domain_home}/geo_*.d*.nc"].each { |geo_file|\u000a local_file="./#{File.basename(geo_file)}"\u000a File.delete(local_file) if File.symlink?(local_file)\u000a File.symlink(geo_file,local_file)\u000a }\u000a\u000a # Set the start and end time fields\u000a @namelist.set("share","start_date",[@start_time.strftime("%Y-%m-%d_%H:%M:%S")])\u000a @namelist.set("share","end_date",[(@start_time+3600*@fcst_length).strftime("%Y-%m-%d_%H:%M:%S")])\u000a \u000a # For the rest of the script, offset the start_time by the number of hours away from UTC\u000a @start_time = start_time - Time.now.gmt_offset\u000a \u000a # Set the interval seconds field\u000a @namelist.set("share","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Set the fg_name\u000a unless @metgrid_sources.nil?\u000a unless @metgrid_sources.empty?\u000a @namelist.set("metgrid","fg_name",@metgrid_sources)\u000a end\u000a end\u000a\u000a # Set the constants_name\u000a unless @metgrid_constants.nil?\u000a unless @metgrid_constants.empty?\u000a @namelist.set("metgrid","constants_name",@metgrid_constants)\u000a end\u000a end\u000a\u000a #set the metgrid output dir\u000a @namelist.set("metgrid","opt_output_from_metgrid_path", "#{workdir}")\u000a \u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.wps")\u000a\u000a # Create links to all sources\u000a unless @metgrid_sources.nil?\u000a @metgrid_sources.each_with_index {|src,index|\u000a unless src.empty?\u000a @start_time.to_i.step(@start_time.to_i+3600*@fcst_length,@fcst_interval*3600) {|bndy_time|\u000a fname="#{src}:#{Time.at(bndy_time).strftime("%Y-%m-%d_%H")}"\u000a File.delete(fname) if File.symlink?(fname)\u000a if File.exists?("#{@metgrid_sources_paths[index]}/#{fname}")\u000a File.symlink("#{@metgrid_sources_paths[index]}/#{fname}",fname)\u000a end\u000a }\u000a end\u000a }\u000a end\u000a\u000a # Create links to all constants\u000a unless @metgrid_constants.nil?\u000a @metgrid_constants.each_with_index {|constant,index|\u000a unless constant.empty?\u000a File.delete(constant) if (File.symlink?(constant) || File.exists?(constant))\u000a if File.exists?("#{@metgrid_constants_paths[index]}/#{constant}")\u000a File.symlink("#{@metgrid_constants_paths[index]}/#{constant}",constant)\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Calculate names of metgrid output files\u000a fnames=Array.new\u000a @start_time.to_i.step(@start_time.to_i+3600*@fcst_length,@fcst_interval*3600) {|bndy_time|\u000a fnames.push("#{prefix}.d01.#{Time.at(bndy_time).strftime("%Y-%m-%d_%H:%M:%S")}#{suffix}") \u000a }\u000a\u000a # print list of expected metgrid files\u000a puts "List of expected metgrid files (if metgrid finishes successfully):"\u000a fnames.each {|file| puts " #{file}"}\u000a puts " "\u000a\u000a # Remove pre-existing metgrid files\u000a fnames.each {|file| File.delete(file) if File.exists?(file)}\u000a\u000a # Run metgrid\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{@metgrid}")\u000a elsif\u000a system("#{@metgrid}")\u000a end\u000a status=$?\u000a\u000a # Check for successful completion of metgrid\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{@metgrid} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Check for existence of expected output\u000a fnames.each {|file|\u000a unless File.exist?("#{@metgrid_output_root}/wps-output/#{file}")\u000a raise "#{__FILE__}:#{__LINE__}:: output file ''#{@metgrid_output_root}/wps-output/#{file}'' is missing"\u000a end\u000a }\u000a\u000a end # Dir.chdir\u000a\u000a return 0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a return 1\u000a ensure\u000a puts "run_metgrid terminated at: #{Time.now}"\u000a end \u000a \u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000a\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of metgrid.rb\u000a#\u000a##########################################\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WPS_ROOT","MOAD_DATAHOME","MOAD_DATAROOT","SOURCE","SOURCE_PATH","WPS_USE_MPI",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","METGRID_PROC"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000awps_root=ENV["WPS_ROOT"]\u000adomain_home=ENV["MOAD_DATAHOME"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000asources=ENV["SOURCE"].nil? ? nil : ENV["SOURCE"].gsub(","," ").split(/\s+/)\u000asources_paths=ENV["SOURCE_PATH"].nil? ? nil : ENV["SOURCE_PATH"].gsub(","," ").split(/\s+/)\u000aconstants=ENV["CONSTANT"].nil? ? nil : ENV["CONSTANT"].gsub(","," ").split(/\s+/)\u000aconstants_paths=ENV["CONSTANT_PATH"].nil? ? nil : ENV["CONSTANT_PATH"].gsub(","," ").split(/\s+/)\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["METGRID_PROC"].to_i\u000a\u000a# Create a WPS object\u000awps=WPS.new(wps_root,domain_home,output_root)\u000a\u000a# Run metgrid\u000astatus=wps.run_metgrid(output_root,\u000a sources,\u000a sources_paths,\u000a constants,\u000a constants_paths,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000aexit status\u000a','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(64,'namelist.wps','Y','WRF',3,NULL,'Hint: click the Import button below to import namelist.wps from\u000ayour domain directory','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(65,'def_real.rb','N','WRF',3,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_real.rb ##########################\u000a#\u000a# version 1.00 (runs WRF - real.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WRF\u000a#\u000a##########################################\u000aclass WRF\u000a\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wrf_root,\u000a output_root,\u000a metgrid_input_dir)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wrf_root,:output_root,:metgrid_input_dir]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to param directories\u000a @wrf_root=File.expand_path(wrf_root)\u000a @output_root=File.expand_path(output_root)\u000a @metgrid_input_dir=File.expand_path(metgrid_input_dir)\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wrf_root,:@output_root,:@metgrid_input_dir]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Set the WRF namelist\u000a namelist_dir=File.dirname("#{output_root}")\u000a @namelist=Namelist.new("#{namelist_dir}/static/def_real/namelist.input")\u000a\u000a # Initialize the list of TBL and DATA files\u000a @datfiles=["#{wrf_root}/run/LANDUSE.TBL",\u000a "#{wrf_root}/run/RRTM_DATA",\u000a "#{wrf_root}/run/VEGPARM.TBL",\u000a "#{wrf_root}/run/GENPARM.TBL",\u000a "#{wrf_root}/run/SOILPARM.TBL",\u000a "#{wrf_root}/run/ETAMPNEW_DATA",\u000a "#{wrf_root}/run/tr49t85",\u000a "#{wrf_root}/run/tr49t67",\u000a "#{wrf_root}/run/tr67t85",\u000a "#{wrf_root}/run/gribmap.txt"]\u000a\u000a # Make sure datfiles exist and are readable\u000a @datfiles.each { |file|\u000a if !File.exist?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF data file, ''#{file}'', does not exist"\u000a elif !File.readable?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read WRF data file, ''#{file}''"\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # run_real\u000a #\u000a #####################################################\u000a def run_real(core,\u000a input_root,\u000a output_root,\u000a metgrid_input_dir,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_real.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:core,:input_root,:output_root,:metgrid_input_dir,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate core and set the paths to the REAL executables and set the metgrid filename prefix\u000a case core\u000a when /^arw$/i\u000a real=File.exist?("#{@wrf_root}/main/real_arw.exe") ? "#{@wrf_root}/main/real_arw.exe" : "#{@wrf_root}/main/real.exe"\u000a prefix="met_em"\u000a when /^nmm$/i\u000a real="#{@wrf_root}/main/real_nmm.exe"\u000a prefix="met_nmm"\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid WRF core, ''#{core}''"\u000a end\u000a \u000a # Make sure REAL executables exist and are executable\u000a if !File.exist?(real)\u000a raise "#{__FILE__}:#{__LINE__}:: #{real} does not exist"\u000a elsif !File.executable?(real)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{real}"\u000a end\u000a\u000a # Make sure that input_root exists, and is a directory\u000a @real_input_root=File.expand_path(input_root)\u000a if !File.exist?(@real_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real input directory, ''#{@real_input_root}'' does not exist"\u000a elsif !File.directory?(@real_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real input directory, ''#{@real_input_root}'' is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @real_output_root=File.expand_path(output_root)\u000a if File.exist?(@real_output_root)\u000a if !File.directory?(@real_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real output directory, ''#{@real_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Make sure that if metgrid_input_dir exists, it is a directory\u000a @metgrid_input_dir=File.expand_path(metgrid_input_dir)\u000a if File.exist?(@metgrid_input_dir)\u000a if !File.directory?(@metgrid_input_dir)\u000a raise "#{__FILE__}:#{__LINE__}:: Metgrid input directory, ''#{@metgrid_input_dir}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the start time, forecast length, forecast interval, and number of processors\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a @nprocs=nprocs\u000a\u000a use_mpi=ENV["WRF_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Calculate the names of the metgrid input files\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a fileglob="#{@metgrid_input_dir}/#{prefix}.d01.#{(@start_time+f*3600).strftime("%Y-%m-%d_%H:%M:%S")}*"\u000a if Dir[fileglob].empty?\u000a raise "#{__FILE__}:#{__LINE__}:: #{fileglob} does not exist"\u000a end\u000a }\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@real_output_root}/wrf-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do\u000a \u000a # Create links to realinput and realbdy if necessary\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a fileglob="#{@metgrid_input_dir}/#{prefix}.d01.#{(@start_time+f*3600).strftime("%Y-%m-%d_%H:%M:%S")}*"\u000a Dir[fileglob].each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a }\u000a\u000a # Create links to the WRF DAT files\u000a @datfiles.each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a\u000a # Compute number of days and hours for the run\u000a run_days = @fcst_length / 24 \u000a run_hours = @fcst_length % 24\u000a\u000a # Set the run_days and run_hours fields in the namelist\u000a @namelist.set("time_control","run_days",[run_days])\u000a @namelist.set("time_control","run_hours",[run_hours])\u000a\u000a # Set the start and end time fields in the namelist\u000a end_time=@start_time+3600*@fcst_length\u000a @namelist.set("time_control","start_year",[@start_time.year])\u000a @namelist.set("time_control","start_month",[@start_time.month])\u000a @namelist.set("time_control","start_day",[@start_time.day])\u000a @namelist.set("time_control","start_hour",[@start_time.hour])\u000a @namelist.set("time_control","start_minute",[@start_time.min])\u000a @namelist.set("time_control","start_second",[@start_time.sec])\u000a\u000a @namelist.set("time_control","end_year",[end_time.year])\u000a @namelist.set("time_control","end_month",[end_time.month])\u000a @namelist.set("time_control","end_day",[end_time.day])\u000a @namelist.set("time_control","end_hour",[end_time.hour])\u000a @namelist.set("time_control","end_minute",[end_time.min])\u000a @namelist.set("time_control","end_second",[end_time.sec])\u000a\u000a # Set the interval seconds field in the namelist\u000a @namelist.set("time_control","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.input")\u000a\u000a # Move existing rsl files to a subdir\u000a if File.exist?("rsl.error.0000")\u000a rsldir="#{output_root}/logs/rsl.real.#{File.mtime("rsl.error.0000").strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Get the current time\u000a runtime=Time.now\u000a\u000a # Run real\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{real}")\u000a elsif \u000a system("#{real}")\u000a end \u000a\u000a #get the return status right after system call\u000a status=$?\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Save a copy of the rsl files\u000a rsldir="#{output_root}/logs/rsl.real.#{runtime.strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end \u000a\u000a # Check return status of real\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{real} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Calculate names of expected output files\u000a output_files=["wrfinput_d01","wrfbdy_d01"]\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: Real output file, #{@real_output_root}/wrf-output/#{outfile}, is missing"\u000a end\u000a \u000a puts "Expected Real output file found: #{@real_output_root}/wrf-output/#{outfile}"\u000a }\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Look for completion messages in rsl files\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.error.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE REAL/\u000a raise "#{__FILE__}:#{__LINE__}:: REAL Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.out.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE REAL/\u000a raise "#{__FILE__}:#{__LINE__}:: REAL Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a else\u000a #need to write code to look for message \u000a #in ../logs/def_real_???.log file (where ''???'' changes)\u000a end\u000a \u000a\u000a end # Dir.chdir\u000a\u000a status=0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a status=1\u000a ensure\u000a puts "run_real terminated at: #{Time.now}"\u000a return status\u000a end \u000a \u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of real.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WRF_CORE","WRF_ROOT", "MOAD_DATAROOT","METGRID_INPUT_DIR",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","REALPROC"\u000a].each { |var|\u000a if var.nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000acore=ENV["WRF_CORE"]\u000awrf_root=ENV["WRF_ROOT"]\u000ametgrid_input_dir=ENV["METGRID_INPUT_DIR"]\u000ainput_root=ENV["MOAD_DATAROOT"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["REALPROC"].to_i\u000a\u000a# Create a WRF object\u000awrf=WRF.new(wrf_root,output_root,metgrid_input_dir)\u000a\u000a# Run real\u000astatus=wrf.run_real(core,\u000a input_root,\u000a output_root,\u000a metgrid_input_dir,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000aputs status.inspect\u000aexit status\u000a\u000a','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(66,'namelist.input','Y','WRF',3,NULL,'Hint: click the Import button below to import namelist.input from\u000ayour domain directory','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(67,'def_wrf.rb','N','WRF',3,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_wrf.rb ###########################\u000a#\u000a# version 1.00 (runs WRF - wrf.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WRF\u000a#\u000a##########################################\u000aclass WRF\u000a\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wrf_root,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wrf_root,:output_root]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WRF and domain home directories\u000a @wrf_root=File.expand_path(wrf_root)\u000a @output_root=File.expand_path(output_root)\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wrf_root,:@output_root]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Set the WRF namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_wrf/namelist.input")\u000a\u000a # Initialize the list of TBL and DATA files\u000a @datfiles=["#{wrf_root}/run/LANDUSE.TBL",\u000a "#{wrf_root}/run/RRTM_DATA",\u000a "#{wrf_root}/run/VEGPARM.TBL",\u000a "#{wrf_root}/run/GENPARM.TBL",\u000a "#{wrf_root}/run/SOILPARM.TBL",\u000a "#{wrf_root}/run/ETAMPNEW_DATA",\u000a "#{wrf_root}/run/tr49t85",\u000a "#{wrf_root}/run/tr49t67",\u000a "#{wrf_root}/run/tr67t85",\u000a "#{wrf_root}/run/gribmap.txt"]\u000a\u000a # Make sure datfiles exist and are readable\u000a @datfiles.each { |file|\u000a if !File.exist?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF data file, ''#{file}'', does not exist"\u000a elif !File.readable?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read WRF data file, ''#{file}''"\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # run_wrf\u000a #\u000a #####################################################\u000a def run_wrf(core,\u000a input_root,\u000a output_root,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_wrf.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:core,:input_root,:output_root,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate core and set the paths to the WRF executables\u000a case core\u000a when /^arw$/i\u000a wrf=File.exist?("#{@wrf_root}/main/wrf_arw.exe") ? "#{@wrf_root}/main/wrf_arw.exe" : "#{@wrf_root}/main/wrf.exe"\u000a when /^nmm$/i\u000a wrf=File.exist?("#{@wrf_root}/main/wrf_nmm.exe") ? "#{@wrf_root}/main/wrf_nmm.exe" : "#{@wrf_root}/main/wrf.exe"\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid WRF core, ''#{core}''"\u000a end\u000a \u000a # Make sure WRF executables exist and are executable\u000a if !File.exist?(wrf)\u000a raise "#{__FILE__}:#{__LINE__}:: #{wrf} does not exist"\u000a elsif !File.executable?(wrf)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{wrf}"\u000a end\u000a\u000a # Make sure that input_root exists, and is a directory\u000a @wrf_input_root=File.expand_path(input_root)\u000a if !File.exist?(@wrf_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf input directory, ''#{@wrf_input_root}'' does not exist"\u000a elsif !File.directory?(@wrf_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf input directory, ''#{@wrf_input_root}'' is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @wrf_output_root=File.expand_path(output_root)\u000a if File.exist?(@wrf_output_root)\u000a if !File.directory?(@wrf_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf output directory, ''#{@wrf_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the start time, forecast length, forecast interval, and number of processors\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a @nprocs=nprocs\u000a \u000a use_mpi=ENV["WRF_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Make sure the wrf_input and wrf_bdy input files exist\u000a if !File.exist?("#{@wrf_input_root}/wrf-output/wrfinput_d01")\u000a raise "#{__FILE__}:#{__LINE__}:: #{@wrf_input_root}/wrf-output/wrfinput_d01 does not exist"\u000a elsif !File.exist?("#{@wrf_input_root}/wrf-output/wrfbdy_d01")\u000a raise "#{__FILE__}:#{__LINE__}:: #{@wrf_input_root}/wrf-output/wrfbdy_d01 does not exist"\u000a end\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@wrf_output_root}/wrf-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do\u000a \u000a # Create links to wrfinput and wrfbdy if necessary\u000a unless @wrf_input_root==@wrf_output_root\u000a File.delete("wrfinput_d01") if File.exist?("wrfinput_d01")\u000a File.delete("wrfinput_d01") if File.symlink?("wrfinput_d01")\u000a File.symlink("#{@wrf_input_root}/wrf-output/wrfinput_d01","wrfinput_d01")\u000a File.delete("wrfbdy_d01") if File.exist?("wrfbdy_d01")\u000a File.delete("wrfbdy_d01") if File.symlink?("wrfbdy_d01")\u000a File.symlink("#{@wrf_input_root}/wrf-output/wrfbdy_d01","wrfbdy_d01")\u000a end\u000a\u000a # Create links to the WRF DAT files\u000a @datfiles.each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a\u000a # Compute number of days and hours for the run\u000a run_days = @fcst_length / 24 \u000a run_hours = @fcst_length % 24\u000a\u000a # Set the run_days and run_hours fields in the namelist\u000a @namelist.set("time_control","run_days",[run_days])\u000a @namelist.set("time_control","run_hours",[run_hours])\u000a\u000a # Set the start and end time fields in the namelist\u000a end_time=@start_time+3600*@fcst_length\u000a @namelist.set("time_control","start_year",[@start_time.year])\u000a @namelist.set("time_control","start_month",[@start_time.month])\u000a @namelist.set("time_control","start_day",[@start_time.day])\u000a @namelist.set("time_control","start_hour",[@start_time.hour])\u000a @namelist.set("time_control","start_minute",[@start_time.min])\u000a @namelist.set("time_control","start_second",[@start_time.sec])\u000a\u000a @namelist.set("time_control","end_year",[end_time.year])\u000a @namelist.set("time_control","end_month",[end_time.month])\u000a @namelist.set("time_control","end_day",[end_time.day])\u000a @namelist.set("time_control","end_hour",[end_time.hour])\u000a @namelist.set("time_control","end_minute",[end_time.min])\u000a @namelist.set("time_control","end_second",[end_time.sec])\u000a\u000a # Set the interval seconds field in the namelist\u000a @namelist.set("time_control","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.input")\u000a\u000a # Move existing rsl files to a subdir\u000a if File.exist?("rsl.error.0000")\u000a rsldir="#{output_root}/logs/rsl.wrf.#{File.mtime("rsl.error.0000").strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Get the current time\u000a runtime=Time.now\u000a\u000a # Run wrf\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{wrf}")\u000a elsif\u000a system("#{wrf}")\u000a end\u000a\u000a #get the return status right after system call\u000a status=$?\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Save a copy of the rsl files\u000a rsldir="#{output_root}/logs/rsl.wrf.#{runtime.strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Check return status of wrf\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{wrf} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Look for completion messages in rsl files\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.error.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE WRF/\u000a raise "#{__FILE__}:#{__LINE__}:: WRF Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.out.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE WRF/\u000a raise "#{__FILE__}:#{__LINE__}:: WRF Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a else\u000a #need to write code to look for message \u000a #in ../logs/def_real_???.log file (where ''???'' changes)\u000a end\u000a \u000a\u000a # Calculate names of expected output files\u000a output_files=Array.new\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a output_files.push("#{(@start_time+f*3600).strftime("wrfout_d01_%Y-%m-%d_%H:%M:%S")}")\u000a }\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF output file, ''#{outfile}'', is missing"\u000a end\u000a \u000a puts ""\u000a puts "Expected WRF output file found: #{@real_output_root}/wrf-output/#{outfile}"\u000a }\u000a\u000a end # Dir.chdir\u000a\u000a return 0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a return 1\u000a ensure\u000a puts "run_wrf terminated at: #{Time.now}"\u000a end \u000a \u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of wrf.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WRF_CORE","WRF_ROOT","MOAD_DATAROOT",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","WRFPROC"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000acore=ENV["WRF_CORE"]\u000awrf_root=ENV["WRF_ROOT"]\u000ainput_root=ENV["MOAD_DATAROOT"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["WRFPROC"].to_i\u000a\u000a# Create a WRF object\u000awrf=WRF.new(wrf_root,output_root)\u000a\u000a# Run real\u000astatus=wrf.run_wrf(core,\u000a input_root,\u000a output_root,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000aputs status.inspect\u000aexit status\u000a\u000a','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(68,'namelist.input','Y','WRF',3,NULL,'Hint: click the Import button below to import namelist.input from\u000ayour domain directory','2010-06-18 15:42:09.597000000') INSERT INTO CONFIG_FILE VALUES(69,'batch-Template-prep.ksh','Y','FIM',3,1,'#!/bin/ksh\u000a\u000a# NOTE: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/prep. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000aif [[ $WFM == "ENSEMBLE" ]]\u000athen\u000a echo "This is an ensemble run"\u000afi\u000a\u000aCONTEXT_NAME="batchTemplate-prep"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest $WFM && (. $FIM_HOME/FIMrun/errhandler.ksh || exit 1)\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ $WFM && $FIM_HOME ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ ! $batchTemplate_setup_ran ]]\u000athen\u000a script="batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a pwd\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Preserve a pre-existing WFM prep dir by renaming with a timestamp\u000aif [[ $WFM && -d $PREP ]]\u000athen\u000a ls -ld --time-style=+%Y%m%d%H%M%S $PREP | awk ''{print $6}'' | \\u000a read timestamp || fail "Cannot ls $PREP"\u000a test -z $timestamp && fail "Cannot determine timestamp for $PREP"\u000a mv $PREP $PREP.$timestamp || fail "Cannot move $PREP -> $PREP.$timestamp"\u000afi\u000a\u000a# Make the prep directory\u000amkdir $PREP || fail "Cannot make directory $PREP"\u000a\u000a# If a pre-existing prep directory was identified, link its contents\u000aif [[ -d $PREPDIR ]]\u000athen\u000a test $COMPARE_VAR_ON == "true" && \\u000a fail "cannot use PREPDIR and COMPARE_VAR together"\u000a ln -s $PREPDIR/* $PREP || fail "Cannot link $PREP -> $PREPDIR/\*"\u000aelse\u000a # Copy/link needed items\u000a cp $fimnamelist $PREP/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $PREP/$NLFILE"\u000a cp $thetacoor $PREP/theta_coor.txt || \\u000a fail "Cannot copy $thetacoor -> $PREP/theta_coor.txt"\u000a cp $dpsig $PREP/dpsig.txt || \\u000a fail "Cannot copy $dpsig -> $PREP/dpsig.txt"\u000a cp $topgrid $PREP/top_grid || \\u000a fail "Cannot copy $topgrid -> $PREP/top_grid"\u000a test -d $DATADIR || fail "$DATADIR does not exist"\u000a test -d $DATADR2 || fail "$DATADR2 does not exist"\u000a cp $DATADIR/gfsltln.dat $PREP || \\u000a fail "Cannot copy $DATADIR/gfsltln.dat -> $PREP"\u000a cp $DATADIR/global_mtnvar.t382 $PREP || \\u000a fail "Cannot copy $DATADIR/global_mtnvar.t382 -> $PREP"\u000a if [[ $WFM ]]\u000a then\u000a if [[ $WFM == "ENSEMBLE" ]]\u000a then\u000a print "Setting up symbolic links for Ensemble Run"\u000a ln -s $sanlFile $PREP/$sanlFilename || \\u000a fail "Cannot link $sanlFile -> $PREP/$sanlFilename"\u000a ln -s $sfcanlFile $PREP/$sfcanlFilename || \\u000a fail "Cannot link $sfcanlFile -> $PREP/$sanlFilename"\u000a else\u000a ln -s ../ensics/$sanlFile $PREP || \\u000a fail "Cannot link ../ensics/$sanlFile -> $PREP"\u000a ln -s ../ensics/$sfcanlFile $PREP || \\u000a fail "Cannot link ../ensics/$sfcanlFile -> $PREP"\u000a fi\u000a else\u000a cp $DATADR2/$sanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sanlFile -> $PREP"\u000a cp $DATADR2/$sfcanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sfcanlFile -> $PREP"\u000a fi\u000a\u000a # For WFM runs, set yyyymmddhhmm in the namelist file''s TIMEnamelist to the\u000a # value in WFM-exported environment variable yyyymmddhhmm.\u000a if [[ $WFM ]]\u000a then\u000a $nlh $PREP/$NLFILE TIMEnamelist yyyymmddhhmm $yyyymmddhhmm || \\u000a fail "Cannot set yyyymmddhhmm in $NLFILE"\u000a fi\u000a\u000a # Enter the prep directory\u000a cd $PREP || fail "Cannot cd to $PREP"\u000a\u000a # Link files\u000a for file in grid ginfo getlvl ssfc2icos\u000a do\u000a ln -s $BINDIR/$file || fail "Cannot link $BINDIR/$file -> $PWD"\u000a done\u000a\u000a # If COMPARE_VAR is enabled, use $prepoutfiles to list prep output files that \u000a # will be compared as a sanity check when prep is finished. \u000a test $COMPARE_VAR_ON == "true" && \\u000a prepoutfiles="$GFSFC_FILE $GLVL_FILE $INFO_FILE $GRID_FILE $LATLON_FILE"\u000a\u000a # If COMPARE_VAR is enabled, run prep twice using task counts \u000a # $COMPARE_VAR_NTASKS_1 and $COMPARE_VAR_NTASKS_2. \u000a # Otherwise run prep once using $PES for task count. \u000a for taskcount in $taskcounts\u000a do\u000a # If COMPARE_VAR is enabled, edit the namelist file to replace value of \u000a # ComputeTasks with either $COMPARE_VAR_NTASKS_1 or $COMPARE_VAR_NTASKS_2\u000a if [[ $COMPARE_VAR_ON == "true" ]]\u000a then\u000a # modify ComputeTasks in the namelist file after saving old version\u000a orignl="$NLFILE.orig"\u000a test $taskcount == $COMPARE_VAR_NTASKS_1 && prevnl=$orignl\u000a test $taskcount == $COMPARE_VAR_NTASKS_2 && prevnl="$NLFILE.$COMPARE_VAR_NTASKS_1"\u000a # save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE -> $prevnl"\u000a # set ComputeTasks = $taskcount\u000a # note that this substitution would fail if CompteTasks = ''S'' but \u000a # fortunately qsubfim disallows use of COMPARE_VAR with a serial run\u000a sed -e "s/^ *ComputeTasks *= *''*[0-9][0-9]*''*/ ComputeTasks = ''$taskcount''/g" $prevnl > $NLFILE || \\u000a fail "sed failed"\u000a fi\u000a\u000a # grid\u000a grid || fail "grid failed"\u000a [[ -f $GRID_FILE && ! -z $GRID_FILE ]] || fail "grid no file $GRID_FILE"\u000a print "grid finished"\u000a\u000a # ginfo\u000a ginfo || fail "ginfo failed"\u000a [[ -f $INFO_FILE && ! -z $INFO_FILE ]] || fail "grid no file $INFO_FILE"\u000a print "ginfo finished"\u000a\u000a # getlvl\u000a getlvl || fail "getlvl failed"\u000a [[ -f $GLVL_FILE && ! -z $GLVL_FILE ]] || fail "grid no file $GLVL_FILE"\u000a print "getlvl finished"\u000a\u000a # ssfc2icos\u000a export F_UFMTENDIAN="big:11,21"\u000a export FORT90L="-Wl,-T11,-T21"\u000a ssfc2icos || fail "ssfc2icos failed"\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a [[ -f $GFSFC_FILE && ! -z $GFSFC_FILE ]] || fail "grid no file $GFSFC_FILE"\u000a print "ssfc2icos finished"\u000a\u000a if [[ $COMPARE_VAR_ON == "true" ]]\u000a then\u000a # Prepare for second prep needed by second COMPARE_VAR run\u000a if [[ $taskcount == $COMPARE_VAR_NTASKS_1 ]]\u000a then\u000a for prepoutfile in $prepoutfiles\u000a do\u000a # Move prep output files to versions with special names for \u000a # comparison after second prep run\u000a mv -f $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "Cannot move $prepoutfile -> $prepoutfile.$COMPARE_VAR_NTASKS_1"\u000a done\u000a fi\u000a if [[ $taskcount == $COMPARE_VAR_NTASKS_2 ]]\u000a then\u000a # compare prep output files with first run \u000a # all the files in the $prepoutfiles list are expected to match\u000a for prepoutfile in $prepoutfiles\u000a do\u000a cmp -s $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "$prepoutfile does not match $prepoutfile.$COMPARE_VAR_NTASKS_1 after 2nd COMPARE_VAR prep run. Should it?"\u000a done\u000a # Restore original namelist file so humans looking in the fim \u000a # directory will see the correct number of tasks\u000a prevnl="$NLFILE.$COMPARE_VAR_NTASKS_2"\u000a # Save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE $prevnl"\u000a cp $orignl $NLFILE || fail "Cannot copy $orignl $NLFILE"\u000a fi\u000a fi\u000a done\u000afi # if [[ -d $PREPDIR ]]\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nprep finished\n"\u000a\u000areturn 0\u000a','2010-06-18 15:44:03.857000000') INSERT INTO CONFIG_FILE VALUES(71,'batchTemplate-fim.ksh','N','FIM',3,NULL,'#!/bin/ksh\u000a \u000a#make sure the shell path above is correct for bluefire.ucar.edu\u000a#type the rest of your script here or click the Import button...\u000a','2010-06-18 15:43:52.947000000') INSERT INTO CONFIG_FILE VALUES(72,'batchTemplate-prep.ksh','N','FIM',3,NULL,'#!/bin/ksh\u000a \u000a#make sure the shell path above is correct for bluefire.ucar.edu\u000a#type the rest of your script here or click the Import button...\u000a','2010-06-18 15:44:14.147000000') INSERT INTO CONFIG_FILE VALUES(73,'batchTemplate-post.ksh','N','FIM',3,NULL,'#!/bin/ksh\u000a \u000a#make sure the shell path above is correct for bluefire.ucar.edu\u000a#type the rest of your script here or click the Import button...\u000a','2010-06-18 15:44:25.257000000') INSERT INTO CONFIG_FILE VALUES(74,'FIMnamelist','Y','FIM',3,NULL,' ','2010-06-18 15:44:35.037000000') INSERT INTO CONFIG_FILE VALUES(75,'FIMnamelist','Y','FIM',3,NULL,' \u000a','2010-06-18 15:44:42.107000000') INSERT INTO CONFIG_FILE VALUES(76,'FIMnamelist','Y','FIM',3,NULL,' \u000a','2010-06-18 15:44:49.337000000') INSERT INTO CONFIG_FILE VALUES(77,'batchTemplate-prep-ksh.ksh','Y','FIM',3,1,'#!/bin/ksh\u000a\u000a# NOTE: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/prep. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000aif [[ $WFM == "ENSEMBLE" ]]\u000athen\u000a echo "This is an ensemble run"\u000afi\u000a\u000aCONTEXT_NAME="batchTemplate-prep"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest $WFM && (. $FIM_HOME/FIMrun/errhandler.ksh || exit 1)\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ $WFM && $FIM_HOME ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ ! $batchTemplate_setup_ran ]]\u000athen\u000a script="batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a pwd\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Preserve a pre-existing WFM prep dir by renaming with a timestamp\u000aif [[ $WFM && -d $PREP ]]\u000athen\u000a ls -ld --time-style=+%Y%m%d%H%M%S $PREP | awk ''{print $6}'' | \\u000a read timestamp || fail "Cannot ls $PREP"\u000a test -z $timestamp && fail "Cannot determine timestamp for $PREP"\u000a mv $PREP $PREP.$timestamp || fail "Cannot move $PREP -> $PREP.$timestamp"\u000afi\u000a\u000a# Make the prep directory\u000amkdir $PREP || fail "Cannot make directory $PREP"\u000a\u000a# If a pre-existing prep directory was identified, link its contents\u000aif [[ -d $PREPDIR ]]\u000athen\u000a test $COMPARE_VAR_ON == "true" && \\u000a fail "cannot use PREPDIR and COMPARE_VAR together"\u000a ln -s $PREPDIR/* $PREP || fail "Cannot link $PREP -> $PREPDIR/\*"\u000aelse\u000a # Copy/link needed items\u000a cp $fimnamelist $PREP/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $PREP/$NLFILE"\u000a cp $thetacoor $PREP/theta_coor.txt || \\u000a fail "Cannot copy $thetacoor -> $PREP/theta_coor.txt"\u000a cp $dpsig $PREP/dpsig.txt || \\u000a fail "Cannot copy $dpsig -> $PREP/dpsig.txt"\u000a cp $topgrid $PREP/top_grid || \\u000a fail "Cannot copy $topgrid -> $PREP/top_grid"\u000a test -d $DATADIR || fail "$DATADIR does not exist"\u000a test -d $DATADR2 || fail "$DATADR2 does not exist"\u000a cp $DATADIR/gfsltln.dat $PREP || \\u000a fail "Cannot copy $DATADIR/gfsltln.dat -> $PREP"\u000a cp $DATADIR/global_mtnvar.t382 $PREP || \\u000a fail "Cannot copy $DATADIR/global_mtnvar.t382 -> $PREP"\u000a if [[ $WFM ]]\u000a then\u000a if [[ $WFM == "ENSEMBLE" ]]\u000a then\u000a print "Setting up symbolic links for Ensemble Run"\u000a ln -s $sanlFile $PREP/$sanlFilename || \\u000a fail "Cannot link $sanlFile -> $PREP/$sanlFilename"\u000a ln -s $sfcanlFile $PREP/$sfcanlFilename || \\u000a fail "Cannot link $sfcanlFile -> $PREP/$sanlFilename"\u000a else\u000a ln -s ../ensics/$sanlFile $PREP || \\u000a fail "Cannot link ../ensics/$sanlFile -> $PREP"\u000a ln -s ../ensics/$sfcanlFile $PREP || \\u000a fail "Cannot link ../ensics/$sfcanlFile -> $PREP"\u000a fi\u000a else\u000a cp $DATADR2/$sanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sanlFile -> $PREP"\u000a cp $DATADR2/$sfcanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sfcanlFile -> $PREP"\u000a fi\u000a\u000a # For WFM runs, set yyyymmddhhmm in the namelist file''s TIMEnamelist to the\u000a # value in WFM-exported environment variable yyyymmddhhmm.\u000a if [[ $WFM ]]\u000a then\u000a $nlh $PREP/$NLFILE TIMEnamelist yyyymmddhhmm $yyyymmddhhmm || \\u000a fail "Cannot set yyyymmddhhmm in $NLFILE"\u000a fi\u000a\u000a # Enter the prep directory\u000a cd $PREP || fail "Cannot cd to $PREP"\u000a\u000a # Link files\u000a for file in grid ginfo getlvl ssfc2icos\u000a do\u000a ln -s $BINDIR/$file || fail "Cannot link $BINDIR/$file -> $PWD"\u000a done\u000a\u000a # If COMPARE_VAR is enabled, use $prepoutfiles to list prep output files that \u000a # will be compared as a sanity check when prep is finished. \u000a test $COMPARE_VAR_ON == "true" && \\u000a prepoutfiles="$GFSFC_FILE $GLVL_FILE $INFO_FILE $GRID_FILE $LATLON_FILE"\u000a\u000a # If COMPARE_VAR is enabled, run prep twice using task counts \u000a # $COMPARE_VAR_NTASKS_1 and $COMPARE_VAR_NTASKS_2. \u000a # Otherwise run prep once using $PES for task count. \u000a for taskcount in $taskcounts\u000a do\u000a # If COMPARE_VAR is enabled, edit the namelist file to replace value of \u000a # ComputeTasks with either $COMPARE_VAR_NTASKS_1 or $COMPARE_VAR_NTASKS_2\u000a if [[ $COMPARE_VAR_ON == "true" ]]\u000a then\u000a # modify ComputeTasks in the namelist file after saving old version\u000a orignl="$NLFILE.orig"\u000a test $taskcount == $COMPARE_VAR_NTASKS_1 && prevnl=$orignl\u000a test $taskcount == $COMPARE_VAR_NTASKS_2 && prevnl="$NLFILE.$COMPARE_VAR_NTASKS_1"\u000a # save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE -> $prevnl"\u000a # set ComputeTasks = $taskcount\u000a # note that this substitution would fail if CompteTasks = ''S'' but \u000a # fortunately qsubfim disallows use of COMPARE_VAR with a serial run\u000a sed -e "s/^ *ComputeTasks *= *''*[0-9][0-9]*''*/ ComputeTasks = ''$taskcount''/g" $prevnl > $NLFILE || \\u000a fail "sed failed"\u000a fi\u000a\u000a # grid\u000a grid || fail "grid failed"\u000a [[ -f $GRID_FILE && ! -z $GRID_FILE ]] || fail "grid no file $GRID_FILE"\u000a print "grid finished"\u000a\u000a # ginfo\u000a ginfo || fail "ginfo failed"\u000a [[ -f $INFO_FILE && ! -z $INFO_FILE ]] || fail "grid no file $INFO_FILE"\u000a print "ginfo finished"\u000a\u000a # getlvl\u000a getlvl || fail "getlvl failed"\u000a [[ -f $GLVL_FILE && ! -z $GLVL_FILE ]] || fail "grid no file $GLVL_FILE"\u000a print "getlvl finished"\u000a\u000a # ssfc2icos\u000a export F_UFMTENDIAN="big:11,21"\u000a export FORT90L="-Wl,-T11,-T21"\u000a ssfc2icos || fail "ssfc2icos failed"\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a [[ -f $GFSFC_FILE && ! -z $GFSFC_FILE ]] || fail "grid no file $GFSFC_FILE"\u000a print "ssfc2icos finished"\u000a\u000a if [[ $COMPARE_VAR_ON == "true" ]]\u000a then\u000a # Prepare for second prep needed by second COMPARE_VAR run\u000a if [[ $taskcount == $COMPARE_VAR_NTASKS_1 ]]\u000a then\u000a for prepoutfile in $prepoutfiles\u000a do\u000a # Move prep output files to versions with special names for \u000a # comparison after second prep run\u000a mv -f $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "Cannot move $prepoutfile -> $prepoutfile.$COMPARE_VAR_NTASKS_1"\u000a done\u000a fi\u000a if [[ $taskcount == $COMPARE_VAR_NTASKS_2 ]]\u000a then\u000a # compare prep output files with first run \u000a # all the files in the $prepoutfiles list are expected to match\u000a for prepoutfile in $prepoutfiles\u000a do\u000a cmp -s $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "$prepoutfile does not match $prepoutfile.$COMPARE_VAR_NTASKS_1 after 2nd COMPARE_VAR prep run. Should it?"\u000a done\u000a # Restore original namelist file so humans looking in the fim \u000a # directory will see the correct number of tasks\u000a prevnl="$NLFILE.$COMPARE_VAR_NTASKS_2"\u000a # Save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE $prevnl"\u000a cp $orignl $NLFILE || fail "Cannot copy $orignl $NLFILE"\u000a fi\u000a fi\u000a done\u000afi # if [[ -d $PREPDIR ]]\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nprep finished\n"\u000a\u000areturn 0\u000a','2010-07-15 02:14:54.785000000') INSERT INTO CONFIG_FILE VALUES(80,'batchTemplate-fim-ksh.ksh','Y','FIM',3,1,'#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/fim. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000a\u000aCONTEXT_NAME="batchTemplate-fim"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest $WFM && (. $FIM_HOME/FIMrun/errhandler.ksh || exit 1)\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ $WFM && $FIM_HOME ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ ! $batchTemplate_setup_ran ]]\u000athen\u000a script="batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Preserve a pre-existing WFM fim dir by renaming with a timestamp\u000aif [[ $WFM && -d $FIM ]]\u000athen\u000a ls -ld --time-style=+%Y%m%d%H%M%S $FIM | awk ''{print $6}'' | \\\u000a read timestamp || fail "Cannot ls $FIM"\u000a test -z $timestamp && fail "Cannot determine timestamp for $FIM"\u000a mv $FIM $FIM.$timestamp || fail "Cannot move $FIM -> $FIM.$timestamp"\u000afi\u000a\u000a# Make the fim directory\u000amkdir $FIM || fail "Cannot make directory $FIM"\u000a\u000a# If a pre-existing fim directory was identified, link its contents\u000aif [[ -d $FIMDIR ]]\u000athen\u000a ln -s $FIMDIR/* $FIM || fail "Cannot link $FIM -> $FIMDIR/\*"\u000aelse\u000a # Copy needed items\u000a if [[ -d $PREPDIR ]]\u000a then\u000a cp $fimnamelist $FIM/$NLFILE || fail "Cannot copoy $fimnamelist -> $FIM/$NLFILE"\u000a else\u000a cp $PREP/$NLFILE $FIM || fail "Cannot copy $PREP/$NLFILE -> $FIM"\u000a fi\u000a cp $configurefile $FIM/configure_file || fail "Cannot copy $configurefile -> $FIM/configure_file"\u000a if [[ -f $smsnamelist ]]\u000a then\u000a cp $smsnamelist $FIM/SMSnamelist || fail "Cannot copy $smsnamelist -> $FIM/SMSnamelist"\u000a fi\u000a\u000a # Enter the fim directory\u000a cd $FIM || fail "Cannot cd to $FIM"\u000a\u000a # Link items\u000a test -f $BINDIR/$FIMEXE || fail "Cannot find $BINDIR/$FIMEXE for linking"\u000a ln -s $BINDIR/$FIMEXE || fail "Cannot link $BINDIR/$FIMEXE -> $PWD"\u000a\u000a #mf 20091020 -- exclude topo.dat from ln -s --> topo.dat not created internally\u000a #for file in $LATLON_FILE $GLVL_FILE $sanlFile gfsltln.dat topo.dat gfsfc.dat theta_coor.txt dpsig.txt top_grid\u000a\u000a#For ensemble runs, we previously overwrote these variables and need to restore them\u000aif [[ $WFM == "ENSEMBLE" ]]\u000athen\u000a sanlFile=$sanlFilename\u000a sfcanlFile=$sfcanlFilename\u000afi\u000a\u000a for file in $LATLON_FILE $GLVL_FILE $sanlFile gfsltln.dat gfsfc.dat theta_coor.txt dpsig.txt top_grid\u000a do\u000a test -f $PREP/$file || fail "Cannot find $PREP/$file for linking"\u000a ln -s $PREP/$file || fail "Cannot link $PREP/$file -> $PWD"\u000a done\u000a\u000a # if COMPARE_VAR is enabled, link two DecompInfo*.dat files; else link only one\u000a for taskcount in $taskcounts\u000a do\u000a decompfile="$PREP/DecompInfo_$taskcount.dat"\u000a if [[ -f $decompfile ]]\u000a then\u000a ln -s $decompfile || fail "Cannot link $decompfile -> $PWD"\u000a else\u000a fail "Cannot find $decompfile"\u000a fi\u000a done # for taskcount in $taskcounts\u000a\u000a export F_UFMTENDIAN="big:82"\u000a export FORT90L="-Wl,-T82"\u000a\u000a if [[ $parallelism == "serial" ]]\u000a then # serial run\u000a ./$FIMEXEBASE >stdout 2>&1 || fail "./$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a elif [[ $parallelism == "parallel" ]]\u000a then # parallel run\u000a # If write tasks are present, use "tweak_hostfile" to \u000a # place write tasks and compute root on separate nodes in various\u000a # ways.\u000a let "total_pes=$PES+$WRITE_TASKS" || fail "Arithmetic error"\u000a # put compute root and each write task on a separate node\u000a # separate nodes come first\u000a tw_str="1"\u000a if [[ $WRITE_TASKS -eq 1 ]]\u000a then\u000a tw_str="${tw_str}:1"\u000a elif [[ $WRITE_TASKS -gt 1 ]]\u000a then\u000a#TODO: Remove hard-coded write_task_layout. \u000a#TODO: Add write_task_layout to FIMnamelist::WRITETASKnamelist and create \u000a#TODO: utility program to read it here. \u000a write_task_layout="max_per_node"\u000a if [[ $write_task_layout == "one_per_node" ]]\u000a then\u000a#TODO: It may be necessary to introduce a "sleep" between fim and \u000a#TODO: post when this scheme is used due to delays in propagating \u000a#TODO: file system changes made by one node to others. Despite the \u000a#TODO: use of an MPI_BARRIER to force all write and compute tasks to \u000a#TODO: synchronize after the last write operation. This problem has \u000a#TODO: been observed with LFS and other parallel file systems, especially \u000a#TODO: when other jobs are competing for I/O resources. \u000a n=0\u000a while [[ $n -le $WRITE_TASKS ]]\u000a do\u000a tw_str="${tw_str}:1"\u000a let "n=$n+1" || fail "Arithmetic error"\u000a done\u000a# elif ($write_task_layout == "two_per_node") then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 2 cores per node... \u000a# tw_str="${tw_str}:2:2:2:2:2:2:2:2:2:2:1"\u000a# elif [[ $write_task_layout == "three_per_node" ]]; then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 3 cores per node... \u000a# tw_str="${tw_str}:3:3:3:3:3:3:3"\u000a# elif [[ $write_task_layout == "four_per_node" ]]; then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 4 cores per node... \u000a# tw_str="${tw_str}:4:4:4:3:3:3"\u000a# elif [[ $write_task_layout == "five_per_node" ]]; then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 5 cores per node... \u000a# tw_str="${tw_str}:5:4:4:4:4"\u000a# elif [[ $write_task_layout == "six_per_node" ]]; then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 6 cores per node... \u000a# tw_str="${tw_str}:6:5:5:5"\u000a# elif [[ $write_task_layout == "seven_per_node" ]]; then\u000a#TODO: Generalize this to work with $WRITE_TASKS != 21 and fewer than \u000a#TODO: 7 cores per node... \u000a# tw_str="${tw_str}:7:7:7"\u000a elif [[ $write_task_layout == "max_per_node" ]]\u000a then\u000a#TODO: Generalize this to deduce number of tasks per node and \u000a#TODO: tw_str accordingly... \u000a tw_str="${tw_str}:7:7:7"\u000a else\u000a fail "Unrecognized write_task_layout"\u000a fi\u000a fi\u000a if [[ $COMPARE_VAR_ON == "true" ]]\u000a then\u000a # When COMPARE_VAR is enabled, set hostfile so first two MPI tasks \u000a # share the first host node. These will be used as "roots" of the two \u000a # task groups created by COMPARE_VAR. Putting them on the same node \u000a # as this script ensures that files created by this script will be \u000a # visible to both groups when fim executes. \u000a tw_str="2"\u000a fi\u000a # TODO ask tom about this... can all inside if [[ $MACHINE_FILE ]] ?\u000a if [[ $MACHINE_FILE ]]\u000a then\u000a print "tweak_hostfile will operate on <$MACHINE_FILE>..."\u000a test -f $MACHINE_FILE && cp $MACHINE_FILE ./MACHINE_FILE__save.orig || \\u000a fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.orig"\u000a fi\u000a print "tweak_hostfile -s $tw_str"\u000a tweak_hostfile -s $tw_str\u000a test -f $MACHINE_FILE && cp $MACHINE_FILE ./MACHINE_FILE__save.new || \\u000a fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.new"\u000a trap_off # mpirun''s exit status is unreliable\u000a mpirun -np $total_pes ./$FIMEXEBASE >stdout 2>&1\u000a trap_on # turn error trapping back on\u000a\u000a # Check for SMS completion message in stdout file\u000a grep ''SMS:: Program complete'' stdout || fail "$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a else # neither "serial" or "parallel" was specified\u000a fail "Parallelism error"\u000a fi # if serial/parallel\u000a\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a\u000afi # if [[ -d $FIMDIR ]]\u000a\u000acat stdout || fail "Cannot cat stdout"\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nDone with fim\n"\u000a\u000areturn 0\u000a','2010-07-15 02:15:02.314000000') INSERT INTO CONFIG_FILE VALUES(83,'batchTemplate-post-ksh.ksh','Y','FIM',3,1,'#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/pop. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-post"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest $WFM && (. $FIM_HOME/FIMrun/errhandler.ksh || exit 1)\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ $WFM && $FIM_HOME ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ ! $batchTemplate_setup_ran ]]\u000athen\u000a script="batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the post directory. For WFM runs, the post directory should already\u000a# exist except for the first incremental batch and mkdir''s -p option exits\u000a# with success if the directory already exists.\u000amkdir -p $POST || fail "Cannot make directory $POST"\u000a\u000a# Copy namelist from the appropriate fim directory\u000aif [[ -d $FIMDIR ]]\u000athen\u000a cp $fimnamelist $POST/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $POST/$NLFILE"\u000aelse\u000a cp $FIM/$NLFILE $POST || fail "Cannot copy $FIM/$NLFILE -> $POST"\u000afi\u000a\u000acp $fimgribtable $POST/fim_gribtable || \\u000a fail "Cannot copy $fimgribtable $POST/fim_gribtable"\u000a\u000a# Enter the post directory\u000acd $POST || fail "Cannot cd to $POST"\u000a\u000a# Link files\u000atest -f pop || (ln -s $BINDIR/pop || fail "Cannot link $BINDIR/pop -> $PWD")\u000atest -f $INFO_FILE || (ln -s $PREP/$INFO_FILE || fail "Cannot link $PREP/$INFO_FILE -> $PWD")\u000a\u000aif [[ $WFM ]]\u000athen # do WFM post sequence\u000a XTRACE_CONTEXT="batchTemplate-postall"\u000a . $FIM_HOME/FIMrun/batchTemplate-postall || \\u000a fail "Problem running $FIM_HOME/FIMrun/batchTemplate-postall"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000aelse # do non-WFM pop\u000a pop || fail "pop failed"\u000afi\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\npop finished\n"\u000a\u000areturn 0\u000a','2010-07-15 02:15:05.295000000') INSERT INTO CONFIG_FILE VALUES(86,'Test.ksh','Y','FIM',3,1,'#!/bin/ksh\u000a \u000a#make sure the shell path above is correct for bluefire.ucar.edu\u000a#type the rest of your script here or click the Import button...\u000a\u000aecho "test"\u000a','2010-07-15 02:15:08.608000000') INSERT INTO CONFIG_FILE VALUES(91,'dpsig.txt','Y','FIM',3,NULL,' ','2010-07-16 14:55:11.468000000') INSERT INTO CONFIG_FILE VALUES(92,'theta_coor.txt','Y','FIM',3,NULL,' ','2010-07-16 14:56:58.921000000') INSERT INTO MODEL_TASK_TYPE VALUES(32,'WRF',3,'def_ungrib',NULL,61) INSERT INTO MODEL_TASK_TYPE VALUES(33,'WRF',3,'def_metgrid',NULL,63) INSERT INTO MODEL_TASK_TYPE VALUES(34,'WRF',3,'def_real',NULL,65) INSERT INTO MODEL_TASK_TYPE VALUES(35,'WRF',3,'def_wrf',NULL,67) INSERT INTO MODEL_TASK_TYPE VALUES(37,'FIM',3,'batchTemplate-fim',NULL,71) INSERT INTO MODEL_TASK_TYPE VALUES(38,'FIM',3,'batchTemplate-prep',NULL,72) INSERT INTO MODEL_TASK_TYPE VALUES(39,'FIM',3,'batchTemplate-post',NULL,73) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(58,32,61) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(59,32,62) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(60,33,63) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(61,33,64) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(62,34,65) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(63,34,66) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(64,35,67) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(65,35,68) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(68,37,71) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(69,38,72) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(70,39,73) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(71,39,74) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(72,38,75) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(73,37,76) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(85,38,91) INSERT INTO MODEL_TASK_TYPE_CONFIG_FILE VALUES(86,38,92) INSERT INTO MODEL_CONFIG VALUES(173,1,'WRF','test',3,'/ptmp/lynge/FIM/FIMrun','2010-07-14 08:57:42.939000000') INSERT INTO MODEL_CONFIG VALUES(175,1,'FIM','WORKFLOW-TEMPLATE',3,'/ptmp/lynge/FIM/FIMrun','2010-07-15 01:04:30.933000000') INSERT INTO MODEL_CONFIG VALUES(176,1,'FIM','DAY1_WORKFLOW',3,'/ptmp/lynge/FIM/FIMrun','2010-07-16 00:05:40.659000000') INSERT INTO MODEL_CONFIG VALUES(177,1,'FIM','RAINER_WORKFLOW_TEMPLATE',3,'/ptmp/lynge/FIM/FIMrun','2010-07-16 11:33:32.010000000') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2527,'WPS_ROOT',32,173,'/wps/root/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2528,'WPS_USE_MPI',32,173,'No') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2529,'UNGRIB_SOURCE_PATH',32,173,'/model/input/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2530,'SOURCE',32,173,'NAM') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2531,'MOAD_DATAHOME',32,173,'/domain/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2532,'FORMAT',32,173,'%y%j%H00%F') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2533,'FCST_LENGTH',32,173,'60') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2534,'FCST_INTERVAL',32,173,'3') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2535,'EXT_DATAROOT',32,173,'$OUTPUT_RUN_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2536,'EXT_DATAHOME',32,173,'/domain/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2537,'WPS_ROOT',33,173,'/wps/root/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2538,'WPS_USE_MPI',33,173,'No') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2539,'SOURCE_PATH',33,173,'$OUTPUT_RUN_DIR/extprd') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2540,'SOURCE',33,173,'NAM') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2541,'PORTAL_ROOT_DIR',33,173,'$OUTPUT_BASE_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2542,'MOAD_DATAROOT',33,173,'$OUTPUT_RUN_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2543,'MOAD_DATAHOME',33,173,'/domain/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2544,'METGRID_PROC',33,173,'$NUM_PROCS') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2545,'FCST_LENGTH',33,173,'60') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2546,'FCST_INTERVAL',33,173,'3') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2547,'METGRID_INPUT_DIR',34,173,'$OUTPUT_RUN_DIR/wps-output') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2548,'WRF_ROOT',34,173,'/wrf/root/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2549,'WRF_CORE',34,173,'ARW') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2550,'WRF_USE_MPI',34,173,'No') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2551,'REALPROC',34,173,'$NUM_PROCS') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2552,'MOAD_DATAROOT',34,173,'$OUTPUT_RUN_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2553,'FCST_LENGTH',34,173,'60') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2554,'FCST_INTERVAL',34,173,'3') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2555,'WRF_USE_MPI',35,173,'No') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2556,'WRF_ROOT',35,173,'/wrf/root/dir/goes/here') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2557,'WRF_CORE',35,173,'ARW') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2558,'WRFPROC',35,173,'$NUM_PROCS') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2559,'MOAD_DATAROOT',35,173,'$OUTPUT_RUN_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2560,'FCST_LENGTH',35,173,'60') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2561,'FCST_INTERVAL',35,173,'3') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2571,'NLFILE',37,175,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2572,'RUNDIR',37,175,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2573,'LSF_RESOURCE',37,175,'span[ptile=64]') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2574,'NLFILE',38,175,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2575,'RUNDIR',38,175,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2576,'NLFILE',39,175,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2577,'T1',39,175,'$t1') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2578,'T2',39,175,'$t2') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2579,'RUNDIR',39,175,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2580,'CONFIG_FILES_DIR',38,175,'$TASK_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2581,'NLFILE',37,176,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2582,'RUNDIR',37,176,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2583,'LSF_RESOURCE',37,176,'span[ptile=64]') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2584,'NLFILE',38,176,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2585,'RUNDIR',38,176,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2586,'CONFIG_FILES_DIR',38,176,'$TASK_DIR') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2587,'NLFILE',39,176,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2588,'T1',39,176,'$t1') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2589,'T2',39,176,'$t2') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2590,'RUNDIR',39,176,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2591,'NLFILE',37,177,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2592,'RUNDIR',37,177,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2593,'LSF_RESOURCE',37,177,'span[ptile=64]') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2594,'NLFILE',38,177,'$TASK_DIR/FIMnamelist') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2595,'RUNDIR',38,177,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO TASK_ENVIRONMENT_VARIABLE VALUES(2596,'CONFIG_FILES_DIR',38,177,'$TASK_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(74,'WPS_ROOT',33,'/wps/root/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(75,'WPS_USE_MPI',33,'No') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(76,'SOURCE_PATH',33,'$OUTPUT_RUN_DIR/extprd') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(77,'SOURCE',33,'NAM') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(78,'PORTAL_ROOT_DIR',33,'$OUTPUT_BASE_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(79,'MOAD_DATAROOT',33,'$OUTPUT_RUN_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(80,'MOAD_DATAHOME',33,'/domain/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(81,'METGRID_PROC',33,'$NUM_PROCS') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(82,'FCST_LENGTH',33,'60') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(83,'FCST_INTERVAL',33,'3') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(84,'METGRID_INPUT_DIR',34,'$OUTPUT_RUN_DIR/wps-output') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(85,'WRF_ROOT',34,'/wrf/root/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(86,'WRF_CORE',34,'ARW') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(87,'WRF_USE_MPI',34,'No') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(88,'REALPROC',34,'$NUM_PROCS') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(89,'MOAD_DATAROOT',34,'$OUTPUT_RUN_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(90,'FCST_LENGTH',34,'60') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(91,'FCST_INTERVAL',34,'3') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(92,'WPS_ROOT',32,'/wps/root/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(93,'WPS_USE_MPI',32,'No') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(94,'UNGRIB_SOURCE_PATH',32,'/model/input/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(95,'SOURCE',32,'NAM') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(96,'MOAD_DATAHOME',32,'/domain/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(97,'FORMAT',32,'%y%j%H00%F') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(98,'FCST_LENGTH',32,'60') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(99,'FCST_INTERVAL',32,'3') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(100,'EXT_DATAROOT',32,'$OUTPUT_RUN_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(101,'EXT_DATAHOME',32,'/domain/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(102,'WRF_USE_MPI',35,'No') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(103,'WRF_ROOT',35,'/wrf/root/dir/goes/here') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(104,'WRF_CORE',35,'ARW') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(105,'WRFPROC',35,'$NUM_PROCS') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(106,'MOAD_DATAROOT',35,'$OUTPUT_RUN_DIR') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(107,'FCST_LENGTH',35,'60') INSERT INTO TASK_DEFAULT_ENVIRONMENT_VARIABLE VALUES(108,'FCST_INTERVAL',35,'3') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1423,'ATCFNAME',175,'F&GLVL;NN') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1424,'BUILDCONFIG',175,'bluefire') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1426,'PES',175,'128') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1427,'WRITE_TASKS',175,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1428,'NPROC',175,'127') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1429,'GLVL',175,'$GLVL') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1431,'WFM',175,'TRUE') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1432,'FIM_HOME',175,'/ptmp/lynge/FIM') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1433,'FIM_LOG',175,'&FIM_HOME;/FIMwfm/log') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1434,'FIM_RUN',175,'&FIM_HOME;/FIMrun') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1435,'FIM_WFM',175,'&FIM_HOME;/FIMwfm') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1436,'SCRIPTS',175,'&FIM_HOME;/FIMwfm/scripts') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1437,'SRCDIR',175,'&FIM_HOME;/FIMsrc_&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1439,'NCL_HOME',175,'&FIM_HOME;/FIMwfm/ncl/fimall') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1441,'COPYGB',175,'/blhome/lynge/copygb_JR/copygb.fd/copygb') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1444,'PUB_DIR',175,'/ptmp/lynge/public') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1445,'DATADR2',175,'/ptmp/lynge/gfs/spectral') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1446,'DATADIR',175,'/ptmp/lynge/fimdata') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1448,'MODL',175,'EXPER FIM-&GLVL;_&MEMBER_ID;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1449,'GRID_NAMES',175,'fim w_pacific') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1450,'GRID_SPECS',175,'fim:255 0 56 56 15000 115000 128 30000 130000 30000 30000 64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1454,'FCST_LENGTH',175,'120') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1455,'FCST_INTERVAL',175,'6') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1456,'FCST_LENGTH_STR',175,'120') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1458,'MODEL',175,'FIMDC') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1463,'K_STRINGS',175,'-t ''ano'' -k ''4*-1 7 100 :-t ''ano'' -k ''4*-1 33 100 :-t ''ano'' -k ''4*-1 34 100 :') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1465,'GETJOBID',175,'&FIM_RUN;/bsubGetJobID') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1466,'yyyymmddhhmm',175,'') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1467,'FC',175,'&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1468,'IS',175,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1469,'VAR_LIST',175,'hgtP tmpP rp3P up3P vp3P pr3D ph3D tk3D td3D ws3D rh3D us3D vs3D rn2D rc2D r12D r22D rg2D pw2D ts2D us2D hf2D qf2D sw2D lw2D ms2D sn2D cb2D ct2D') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1470,'SMOOTH_VAR',175,'4 1 1 1 1 0 4 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 4 0 0 0') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1471,'MEMBER_ID',175,'C') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1472,'MPIRUNCMD',175,'mpirun.lsf /usr/local/bin/launch') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1473,'RUNDIR',175,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1474,'NVL',175,'64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1475,'ATCFNAME',176,'F&GLVL;NN') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1476,'BUILDCONFIG',176,'bluefire') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1477,'PES',176,'64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1478,'WRITE_TASKS',176,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1479,'NPROC',176,'63') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1480,'GLVL',176,'$GLVL') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1481,'WFM',176,'TRUE') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1482,'FIM_HOME',176,'/ptmp/lynge/FIM') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1483,'FIM_LOG',176,'&FIM_HOME;/FIMwfm/log') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1484,'FIM_RUN',176,'&FIM_HOME;/FIMrun') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1485,'FIM_WFM',176,'&FIM_HOME;/FIMwfm') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1486,'SCRIPTS',176,'&FIM_HOME;/FIMwfm/scripts') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1487,'SRCDIR',176,'&FIM_HOME;/FIMsrc_&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1488,'NCL_HOME',176,'&FIM_HOME;/FIMwfm/ncl/fimall') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1489,'COPYGB',176,'/blhome/lynge/copygb_JR/copygb.fd/copygb') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1490,'PUB_DIR',176,'/ptmp/lynge/public') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1491,'DATADR2',176,'/ptmp/lynge/gfs/spectral') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1492,'DATADIR',176,'/ptmp/lynge/fimdata') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1493,'MODL',176,'EXPER FIM-&GLVL;_&MEMBER_ID;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1494,'GRID_NAMES',176,'fim w_pacific') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1495,'GRID_SPECS',176,'fim:255 0 56 56 15000 115000 128 30000 130000 30000 30000 64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1496,'FCST_LENGTH',176,'24') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1497,'FCST_INTERVAL',176,'6') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1498,'FCST_LENGTH_STR',176,'024') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1499,'MODEL',176,'FIMDC') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1500,'K_STRINGS',176,'-t ''ano'' -k ''4*-1 7 100 :-t ''ano'' -k ''4*-1 33 100 :-t ''ano'' -k ''4*-1 34 100 :') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1501,'GETJOBID',176,'&FIM_RUN;/bsubGetJobID') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1502,'yyyymmddhhmm',176,'') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1503,'FC',176,'&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1504,'IS',176,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1505,'VAR_LIST',176,'hgtP tmpP rp3P up3P vp3P pr3D ph3D tk3D td3D ws3D rh3D us3D vs3D rn2D rc2D r12D r22D rg2D pw2D ts2D us2D hf2D qf2D sw2D lw2D ms2D sn2D cb2D ct2D') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1506,'SMOOTH_VAR',176,'4 1 1 1 1 0 4 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 4 0 0 0') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1507,'MEMBER_ID',176,'C') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1508,'MPIRUNCMD',176,'mpirun.lsf /usr/local/bin/launch') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1509,'RUNDIR',176,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1510,'NVL',176,'64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1511,'ATCFNAME',177,'F&GLVL;NN') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1512,'BUILDCONFIG',177,'bluefire') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1513,'PES',177,'64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1514,'WRITE_TASKS',177,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1515,'NPROC',177,'63') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1516,'GLVL',177,'$GLVL') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1517,'WFM',177,'TRUE') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1518,'FIM_HOME',177,'/ptmp/lynge/FIM') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1519,'FIM_LOG',177,'&FIM_HOME;/FIMwfm/log') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1520,'FIM_RUN',177,'&FIM_HOME;/FIMrun') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1521,'FIM_WFM',177,'&FIM_HOME;/FIMwfm') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1522,'SCRIPTS',177,'&FIM_HOME;/FIMwfm/scripts') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1523,'SRCDIR',177,'&FIM_HOME;/FIMsrc_&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1524,'NCL_HOME',177,'&FIM_HOME;/FIMwfm/ncl/fimall') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1525,'COPYGB',177,'/blhome/lynge/copygb_JR/copygb.fd/copygb') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1526,'PUB_DIR',177,'/ptmp/lynge/public') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1527,'DATADR2',177,'/ptmp/lynge/gfs/spectral') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1528,'DATADIR',177,'/ptmp/lynge/fimdata') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1529,'MODL',177,'EXPER FIM-&GLVL;_&MEMBER_ID;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1530,'GRID_NAMES',177,'fim w_pacific') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1531,'GRID_SPECS',177,'fim:255 0 56 56 15000 115000 128 30000 130000 30000 30000 64') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1532,'FCST_LENGTH',177,'120') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1533,'FCST_INTERVAL',177,'6') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1534,'FCST_LENGTH_STR',177,'120') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1535,'MODEL',177,'FIMDC') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1536,'K_STRINGS',177,'-t ''ano'' -k ''4*-1 7 100 :-t ''ano'' -k ''4*-1 33 100 :-t ''ano'' -k ''4*-1 34 100 :') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1537,'GETJOBID',177,'&FIM_RUN;/bsubGetJobID') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1538,'yyyymmddhhmm',177,'') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1539,'FC',177,'&BUILDCONFIG;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1540,'IS',177,'1') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1541,'VAR_LIST',177,'hgtP tmpP rp3P up3P vp3P pr3D ph3D tk3D td3D ws3D rh3D us3D vs3D rn2D rc2D r12D r22D rg2D pw2D ts2D us2D hf2D qf2D sw2D lw2D ms2D sn2D cb2D ct2D') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1542,'SMOOTH_VAR',177,'4 1 1 1 1 0 4 1 1 1 1 1 1 0 0 0 0 0 0 0 1 0 0 0 0 4 0 0 0') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1543,'MEMBER_ID',177,'C') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1544,'MPIRUNCMD',177,'mpirun.lsf /usr/local/bin/launch') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1545,'RUNDIR',177,'$OUTPUT_BASE_DIR/fim_&GLVL;_&NVL;_&PES;_&yyyymmddhhmm;') INSERT INTO MODEL_CONFIG_ENVIRONMENT_VARIABLE VALUES(1546,'NVL',177,'64') INSERT INTO MODEL_TASK VALUES(959,173,32,0) INSERT INTO MODEL_TASK VALUES(960,173,33,1) INSERT INTO MODEL_TASK VALUES(961,173,34,2) INSERT INTO MODEL_TASK VALUES(962,173,35,3) INSERT INTO MODEL_TASK VALUES(966,175,37,0) INSERT INTO MODEL_TASK VALUES(967,175,38,1) INSERT INTO MODEL_TASK VALUES(968,175,39,2) INSERT INTO MODEL_TASK VALUES(969,176,37,0) INSERT INTO MODEL_TASK VALUES(970,176,38,1) INSERT INTO MODEL_TASK VALUES(971,176,39,2) INSERT INTO MODEL_TASK VALUES(972,177,37,0) INSERT INTO MODEL_TASK VALUES(973,177,38,1) INSERT INTO MODEL_CONFIG_FILE VALUES(4379,173,62,1,NULL,'Hint: click the Import button below to import namelist.wps from your domain directory\u000a','2010-07-14 08:57:49.069000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4380,173,64,1,NULL,'Hint: click the Import button below to import namelist.wps from your domain directory\u000a','2010-07-14 08:57:49.069000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4381,173,66,1,NULL,'Hint: click the Import button below to import namelist.input from\u000ayour domain directory\u000a','2010-07-14 08:57:49.069000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4382,173,68,1,NULL,'Hint: click the Import button below to import namelist.input from\u000ayour domain directory\u000a','2010-07-14 08:57:49.069000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4383,173,61,1,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_ungrib.rb ########################\u000a#\u000a# version 1.00 (runs WRF/WPS - ungrib.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WPS\u000a#\u000a##########################################\u000aclass WPS\u000a\u000a @@format_chars={\u000a "%Y"=>4,\u000a "%y"=>2,\u000a "%j"=>3,\u000a "%m"=>2,\u000a "%d"=>2,\u000a "%H"=>2,\u000a "%M"=>2,\u000a "%F"=>4,\u000a "%f"=>2\u000a }\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wps_root,\u000a domain_home,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wps_root,:domain_home]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WPS and domain home directories\u000a @wps_root=File.expand_path(wps_root)\u000a @domain_home=File.expand_path(domain_home)\u000a\u000a # Set the paths to the WPS executables\u000a @geogrid="#{@wps_root}/geogrid.exe"\u000a @ungrib="#{@wps_root}/ungrib.exe"\u000a @metgrid="#{@wps_root}/metgrid.exe"\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wps_root,:@domain_home]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Make sure WPS executables exist and are executable\u000a args=[:@geogrid,:@ungrib,:@metgrid]\u000a args.each { |arg|\u000a exe=eval("#{arg}")\u000a if !File.exist?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: #{exe} does not exist"\u000a end\u000a if !File.executable?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{exe}"\u000a end\u000a }\u000a\u000a # Set the WPS namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_ungrib/namelist.wps")\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # run_ungrib\u000a #\u000a #####################################################\u000a def run_ungrib(vtable_home,\u000a output_root,\u000a source,\u000a source_path,\u000a format,\u000a start_time,\u000a fcst_length,\u000a fcst_interval)\u000a\u000a begin\u000a\u000a puts "def_ungrib.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:vtable_home,:output_root,:source,:source_path,:format,:start_time,:fcst_length,:fcst_interval].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate the vtable_home argument\u000a @vtable_home=File.expand_path(vtable_home) \u000a if !File.exist?(@vtable_home)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable directory, ''#{@vtable_home}'', does not exist"\u000a elsif !File.directory?(@vtable_home)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable directory, ''#{@vtable_home}'', is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @ungrib_output_root=File.expand_path(output_root)\u000a if File.exist?(@ungrib_output_root)\u000a if !File.directory?(@ungrib_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Ungrib output directory, ''#{@ungrib_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the data source name\u000a @ungrib_source=source\u000a\u000a # Validate the data source path\u000a @ungrib_source_path=File.expand_path(source_path)\u000a if !File.exist?(@ungrib_source_path)\u000a raise "#{__FILE__}:#{__LINE__}:: Source path, ''#{@ungrib_source_path}'', does not exist"\u000a elsif !File.directory?(@ungrib_source_path)\u000a raise "#{__FILE__}:#{__LINE__}:: Source path, ''#{@ungrib_source_path}'', is not a directory"\u000a end\u000a\u000a # Set the source filename format\u000a @ungrib_format=format\u000a\u000a # Set the start time, forecast length, and forecast interval\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a\u000a # Make sure the Vtable for the specified source exists and is readable\u000a @vtable="#{@vtable_home}/Vtable.#{@ungrib_source}"\u000a if !File.exist?(@vtable)\u000a raise "#{__FILE__}:#{__LINE__}:: Vtable, ''#{@vtable}'', does not exist"\u000a end\u000a if !File.readable?(@vtable)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read #{@vtable}"\u000a end\u000a\u000a # Create a filename pattern to capture each format character in @ungrib_format\u000a @ungrib_format_pattern=Hash.new\u000a @@format_chars.each {|char,length|\u000a next unless /#{char}/.match(@ungrib_format)\u000a formatstr="#{@ungrib_format.gsub(char,"(\\d{#{length},#{length}})")}"\u000a @@format_chars.each { |c,l|\u000a formatstr.gsub!(c,"\\d\{#{l},#{l}\}")\u000a }\u000a @ungrib_format_pattern[char]=Regexp.new("^#{formatstr}$")\u000a }\u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a \u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@ungrib_output_root}/work/#{@source}"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do \u000a \u000a # Create a link to the Vtable\u000a File.delete("Vtable") if File.symlink?("Vtable")\u000a File.symlink(@vtable,"Vtable")\u000a\u000a # Set the start and end time fields in the namelist\u000a @namelist.set("share","start_date",[@start_time.strftime("%Y-%m-%d_%H:%M:%S")])\u000a @namelist.set("share","end_date",[(@start_time+3600*@fcst_length).strftime("%Y-%m-%d_%H:%M:%S")])\u000a \u000a # Set the interval seconds field in the namelist\u000a @namelist.set("share","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Set the prefix field in the namelist\u000a @namelist.set("ungrib","prefix",[@ungrib_source])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.wps")\u000a\u000a # Create links to source files whose name match the pattern and are valid during the forecast\u000a id="AAA"\u000a Dir.foreach(@ungrib_source_path) { |fname|\u000a\u000a catch(:mismatch) do\u000a\u000a @ungrib_format_pattern.each { |char,pattern|\u000a match=pattern.match(fname)\u000a throw :mismatch if match.nil?\u000a val=match.captures[0].to_i\u000a case char\u000a when "%y"\u000a throw :mismatch unless val == @start_time.strftime("%y").to_i\u000a when "%Y"\u000a throw :mismatch unless val == @start_time.year\u000a when "%j"\u000a throw :mismatch unless val == @start_time.yday\u000a when "%m"\u000a throw :mismatch if val != @start_time.month\u000a when "%d"\u000a throw :mismatch if val != @start_time.day\u000a when "%H"\u000a throw :mismatch if val != @start_time.hour\u000a when "%M"\u000a throw :mismatch if val != @start_time.minute\u000a when "%f","%F"\u000a throw :mismatch if val > @fcst_length\u000a end\u000a }\u000a\u000a File.delete("GRIBFILE.#{id}") if File.symlink?("GRIBFILE.#{id}")\u000a File.symlink("#{@ungrib_source_path}/#{fname}","GRIBFILE.#{id}")\u000a id=id.succ\u000a\u000a end # catch :mismatch\u000a\u000a } # Dir.foreach\u000a\u000a # Run ungrib\u000a system(@ungrib)\u000a status=$?\u000a\u000a # Check for successful completion of ungrib\u000a if status.signaled? \u000a raise "#{__FILE__}:#{__LINE__}:: #{@ungrib} was terminated by signal #{status.termsig}"\u000a elsif status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{@ungrib} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Calculate names of expected output files\u000a output_files=Array.new\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a output_files.push("#{(@start_time+f*3600).strftime("#{@ungrib_source}:%Y-%m-%d_%H")}")\u000a }\u000a\u000a # print list of expected ungrib files\u000a puts "List of expected ungrib files (if ungrib finishes successfully):"\u000a output_files.each {|file| puts " #{file}"}\u000a puts " "\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: Ungrib output file, ''#{workdir}#{outfile}'', is missing"\u000a end\u000a }\u000a\u000a # Move the output files to the extprd directory\u000a extprd="#{@ungrib_output_root}/extprd"\u000a Dir.mkdir(extprd) unless File.exist?(extprd)\u000a output_files.each {|outfile|\u000a File.rename(outfile,"#{@ungrib_output_root}/extprd/#{outfile}")\u000a }\u000a \u000a end # Dir.chdir\u000a\u000a status=0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a status=1\u000a ensure\u000a puts "run_ungrib terminated at: #{Time.now}"\u000a return status\u000a end \u000a \u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of ungrib.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WPS_ROOT","MOAD_DATAHOME",\u000a "EXT_DATAHOME","EXT_DATAROOT",\u000a "SOURCE","UNGRIB_SOURCE_PATH","FORMAT",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000awps_root=ENV["WPS_ROOT"]\u000adomain_home=ENV["MOAD_DATAHOME"]\u000avtable_home=ENV["EXT_DATAHOME"]\u000aoutput_root=ENV["EXT_DATAROOT"]\u000asource=ENV["SOURCE"]\u000asource_path=ENV["UNGRIB_SOURCE_PATH"]\u000aformat=ENV["FORMAT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000a\u000a# Create a WPS object\u000awps=WPS.new(wps_root,domain_home,output_root)\u000a\u000a# Run ungrib\u000astatus=wps.run_ungrib(vtable_home,\u000a output_root,\u000a source,\u000a source_path,\u000a format,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval)\u000a\u000aexit status\u000a','2010-07-14 08:57:49.069000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4384,173,63,1,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_metgrid.rb #######################\u000a#\u000a# version 1.00 (runs WRF/WPS - metgrid.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WPS\u000a#\u000a##########################################\u000aclass WPS\u000a\u000a @@format_chars={\u000a "%Y"=>4,\u000a "%y"=>2,\u000a "%j"=>3,\u000a "%m"=>2,\u000a "%d"=>2,\u000a "%H"=>2,\u000a "%M"=>2,\u000a "%F"=>4,\u000a "%f"=>2\u000a }\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wps_root,\u000a domain_home,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wps_root,:domain_home]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WPS and domain home directories\u000a @wps_root=File.expand_path(wps_root)\u000a @domain_home=File.expand_path(domain_home)\u000a\u000a # Set the paths to the WPS executables\u000a @geogrid="#{@wps_root}/geogrid.exe"\u000a @ungrib="#{@wps_root}/ungrib.exe"\u000a @metgrid="#{@wps_root}/metgrid.exe"\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wps_root,:@domain_home]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Make sure WPS executables exist and are executable\u000a args=[:@geogrid,:@ungrib,:@metgrid]\u000a args.each { |arg|\u000a exe=eval("#{arg}")\u000a if !File.exist?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: #{exe} does not exist"\u000a end\u000a if !File.executable?(exe)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{exe}"\u000a end\u000a }\u000a\u000a # Set the WPS namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_metgrid/namelist.wps")\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # run_metgrid\u000a #\u000a #####################################################\u000a def run_metgrid(output_root,\u000a sources,\u000a sources_paths,\u000a constants,\u000a constants_paths,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_metgrid.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a \u000a\u000a # Make sure the required input arguments are not nil\u000a [:output_root,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @metgrid_output_root=File.expand_path(output_root)\u000a if File.exist?(@metgrid_output_root)\u000a if !File.directory?(@metgrid_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Metgrid output directory, ''#{@metgrid_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Get the data sources\u000a if sources.nil?\u000a @metgrid_sources=@namelist.get("metgrid","fg_name")\u000a else\u000a if sources.kind_of?(Array)\u000a if sources.empty?\u000a @metgrid_sources=@namelist.get("metgrid","fg_name")\u000a else\u000a @metgrid_sources=sources\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources argument must be an array"\u000a end\u000a end\u000a\u000a # Get the data source paths\u000a if sources_paths.nil?\u000a @metgrid_sources_paths=nil\u000a else\u000a if sources_paths.kind_of?(Array)\u000a @metgrid_sources_paths=sources_paths.map {|src_path|\u000a if src_path.kind_of?(String)\u000a File.expand_path(src_path)\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources_path, ''#{src_path}'', is not a valid path"\u000a end\u000a }\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The sources_paths argument must be an array"\u000a end \u000a end\u000a\u000a # Get the constants\u000a if constants.nil?\u000a @metgrid_constants=@namelist.get("metgrid","constants_name")\u000a else\u000a if constants.kind_of?(Array)\u000a if constants.empty?\u000a @metgrid_constants=@namelist.get("metgrid","constants_name")\u000a else\u000a @metgrid_constants=constants\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants argument must be an array"\u000a end\u000a end\u000a\u000a # Get the constant paths\u000a if constants_paths.nil?\u000a @metgrid_constants_paths=nil\u000a else\u000a if constants_paths.kind_of?(Array)\u000a @metgrid_constants_paths=constants_paths.map {|constant_path|\u000a if constant_path.kind_of?(String)\u000a File.expand_path(constant_path)\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants_path, ''#{constant_path}'', is not a valid path"\u000a end\u000a }\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: The constants_paths argument must be an array"\u000a end \u000a end\u000a\u000a # Get the start time, forecast length, and forecast interval\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a\u000a # Get the number of processors\u000a @nprocs=nprocs\u000a\u000a use_mpi=ENV["WPS_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure that there is a legitimate sources_path for each source\u000a unless @metgrid_sources.nil?\u000a @metgrid_sources.each_with_index {|src,index|\u000a unless src.empty?\u000a if @metgrid_sources_paths.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: Sources are specified, but sources_paths is nil"\u000a elsif @metgrid_sources_paths[index].nil?\u000a raise "#{__FILE__}:#{__LINE__}:: The source path for source, ''#{src}'', is nil"\u000a elsif !File.directory?(@metgrid_sources_paths[index])\u000a raise "#{__FILE__}:#{__LINE__}:: The source path directory, ''#{@metgrid_sources_paths[index]}'', does not exist"\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Make sure that there is a legitimate constants_path for each constant\u000a unless @metgrid_constants.nil?\u000a @metgrid_constants.each_with_index {|constant,index|\u000a unless constant.empty?\u000a if @metgrid_constants_paths.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: Constants are specified, but constants_paths is nil"\u000a elsif @metgrid_constants_paths[index].nil?\u000a raise "#{__FILE__}:#{__LINE__}:: The constant path for constant, ''#{constant}'', is nil"\u000a elsif !File.directory?(@metgrid_constants_paths[index])\u000a raise "#{__FILE__}:#{__LINE__}:: The constant path directory, ''#{@metgrid_constants_paths[index]}'', does not exist"\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Make sure nprocs is an integer\u000a if !@nprocs.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: nprocs argument is not an integer"\u000a end\u000a\u000a # Set the output filename prefix\u000a wrf_core=@namelist.get("share","wrf_core")[0]\u000a case wrf_core\u000a when /^ARW$/i\u000a prefix="met_em"\u000a when /^NMM$/i\u000a prefix="met_nmm"\u000a end\u000a\u000a # Set the output filename suffix\u000a io_form=@namelist.get("metgrid","io_form_metgrid")[0]\u000a case io_form\u000a when 2\u000a suffix=".nc"\u000a else\u000a suffix=""\u000a end\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@metgrid_output_root}/wps-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do \u000a\u000a # Create links to geogrid files\u000a Dir["#{@domain_home}/geo_*.d*.nc"].each { |geo_file|\u000a local_file="./#{File.basename(geo_file)}"\u000a File.delete(local_file) if File.symlink?(local_file)\u000a File.symlink(geo_file,local_file)\u000a }\u000a\u000a # Set the start and end time fields\u000a @namelist.set("share","start_date",[@start_time.strftime("%Y-%m-%d_%H:%M:%S")])\u000a @namelist.set("share","end_date",[(@start_time+3600*@fcst_length).strftime("%Y-%m-%d_%H:%M:%S")])\u000a \u000a # For the rest of the script, offset the start_time by the number of hours away from UTC\u000a @start_time = start_time - Time.now.gmt_offset\u000a \u000a # Set the interval seconds field\u000a @namelist.set("share","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Set the fg_name\u000a unless @metgrid_sources.nil?\u000a unless @metgrid_sources.empty?\u000a @namelist.set("metgrid","fg_name",@metgrid_sources)\u000a end\u000a end\u000a\u000a # Set the constants_name\u000a unless @metgrid_constants.nil?\u000a unless @metgrid_constants.empty?\u000a @namelist.set("metgrid","constants_name",@metgrid_constants)\u000a end\u000a end\u000a\u000a #set the metgrid output dir\u000a @namelist.set("metgrid","opt_output_from_metgrid_path", "#{workdir}")\u000a \u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.wps")\u000a\u000a # Create links to all sources\u000a unless @metgrid_sources.nil?\u000a @metgrid_sources.each_with_index {|src,index|\u000a unless src.empty?\u000a @start_time.to_i.step(@start_time.to_i+3600*@fcst_length,@fcst_interval*3600) {|bndy_time|\u000a fname="#{src}:#{Time.at(bndy_time).strftime("%Y-%m-%d_%H")}"\u000a File.delete(fname) if File.symlink?(fname)\u000a if File.exists?("#{@metgrid_sources_paths[index]}/#{fname}")\u000a File.symlink("#{@metgrid_sources_paths[index]}/#{fname}",fname)\u000a end\u000a }\u000a end\u000a }\u000a end\u000a\u000a # Create links to all constants\u000a unless @metgrid_constants.nil?\u000a @metgrid_constants.each_with_index {|constant,index|\u000a unless constant.empty?\u000a File.delete(constant) if (File.symlink?(constant) || File.exists?(constant))\u000a if File.exists?("#{@metgrid_constants_paths[index]}/#{constant}")\u000a File.symlink("#{@metgrid_constants_paths[index]}/#{constant}",constant)\u000a end\u000a end\u000a }\u000a end\u000a\u000a # Calculate names of metgrid output files\u000a fnames=Array.new\u000a @start_time.to_i.step(@start_time.to_i+3600*@fcst_length,@fcst_interval*3600) {|bndy_time|\u000a fnames.push("#{prefix}.d01.#{Time.at(bndy_time).strftime("%Y-%m-%d_%H:%M:%S")}#{suffix}") \u000a }\u000a\u000a # print list of expected metgrid files\u000a puts "List of expected metgrid files (if metgrid finishes successfully):"\u000a fnames.each {|file| puts " #{file}"}\u000a puts " "\u000a\u000a # Remove pre-existing metgrid files\u000a fnames.each {|file| File.delete(file) if File.exists?(file)}\u000a\u000a # Run metgrid\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{@metgrid}")\u000a elsif\u000a system("#{@metgrid}")\u000a end\u000a status=$?\u000a\u000a # Check for successful completion of metgrid\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{@metgrid} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Check for existence of expected output\u000a fnames.each {|file|\u000a unless File.exist?("#{@metgrid_output_root}/wps-output/#{file}")\u000a raise "#{__FILE__}:#{__LINE__}:: output file ''#{@metgrid_output_root}/wps-output/#{file}'' is missing"\u000a end\u000a }\u000a\u000a end # Dir.chdir\u000a\u000a return 0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a return 1\u000a ensure\u000a puts "run_metgrid terminated at: #{Time.now}"\u000a end \u000a \u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000a\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of metgrid.rb\u000a#\u000a##########################################\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WPS_ROOT","MOAD_DATAHOME","MOAD_DATAROOT","SOURCE","SOURCE_PATH","WPS_USE_MPI",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","METGRID_PROC"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000awps_root=ENV["WPS_ROOT"]\u000adomain_home=ENV["MOAD_DATAHOME"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000asources=ENV["SOURCE"].nil? ? nil : ENV["SOURCE"].gsub(","," ").split(/\s+/)\u000asources_paths=ENV["SOURCE_PATH"].nil? ? nil : ENV["SOURCE_PATH"].gsub(","," ").split(/\s+/)\u000aconstants=ENV["CONSTANT"].nil? ? nil : ENV["CONSTANT"].gsub(","," ").split(/\s+/)\u000aconstants_paths=ENV["CONSTANT_PATH"].nil? ? nil : ENV["CONSTANT_PATH"].gsub(","," ").split(/\s+/)\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["METGRID_PROC"].to_i\u000a\u000a# Create a WPS object\u000awps=WPS.new(wps_root,domain_home,output_root)\u000a\u000a# Run metgrid\u000astatus=wps.run_metgrid(output_root,\u000a sources,\u000a sources_paths,\u000a constants,\u000a constants_paths,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000aexit status\u000a','2010-07-14 08:57:49.070000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4385,173,65,1,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_real.rb ##########################\u000a#\u000a# version 1.00 (runs WRF - real.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WRF\u000a#\u000a##########################################\u000aclass WRF\u000a\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wrf_root,\u000a output_root,\u000a metgrid_input_dir)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wrf_root,:output_root,:metgrid_input_dir]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to param directories\u000a @wrf_root=File.expand_path(wrf_root)\u000a @output_root=File.expand_path(output_root)\u000a @metgrid_input_dir=File.expand_path(metgrid_input_dir)\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wrf_root,:@output_root,:@metgrid_input_dir]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Set the WRF namelist\u000a namelist_dir=File.dirname("#{output_root}")\u000a @namelist=Namelist.new("#{namelist_dir}/static/def_real/namelist.input")\u000a\u000a # Initialize the list of TBL and DATA files\u000a @datfiles=["#{wrf_root}/run/LANDUSE.TBL",\u000a "#{wrf_root}/run/RRTM_DATA",\u000a "#{wrf_root}/run/VEGPARM.TBL",\u000a "#{wrf_root}/run/GENPARM.TBL",\u000a "#{wrf_root}/run/SOILPARM.TBL",\u000a "#{wrf_root}/run/ETAMPNEW_DATA",\u000a "#{wrf_root}/run/tr49t85",\u000a "#{wrf_root}/run/tr49t67",\u000a "#{wrf_root}/run/tr67t85",\u000a "#{wrf_root}/run/gribmap.txt"]\u000a\u000a # Make sure datfiles exist and are readable\u000a @datfiles.each { |file|\u000a if !File.exist?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF data file, ''#{file}'', does not exist"\u000a elif !File.readable?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read WRF data file, ''#{file}''"\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # run_real\u000a #\u000a #####################################################\u000a def run_real(core,\u000a input_root,\u000a output_root,\u000a metgrid_input_dir,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_real.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:core,:input_root,:output_root,:metgrid_input_dir,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate core and set the paths to the REAL executables and set the metgrid filename prefix\u000a case core\u000a when /^arw$/i\u000a real=File.exist?("#{@wrf_root}/main/real_arw.exe") ? "#{@wrf_root}/main/real_arw.exe" : "#{@wrf_root}/main/real.exe"\u000a prefix="met_em"\u000a when /^nmm$/i\u000a real="#{@wrf_root}/main/real_nmm.exe"\u000a prefix="met_nmm"\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid WRF core, ''#{core}''"\u000a end\u000a \u000a # Make sure REAL executables exist and are executable\u000a if !File.exist?(real)\u000a raise "#{__FILE__}:#{__LINE__}:: #{real} does not exist"\u000a elsif !File.executable?(real)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{real}"\u000a end\u000a\u000a # Make sure that input_root exists, and is a directory\u000a @real_input_root=File.expand_path(input_root)\u000a if !File.exist?(@real_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real input directory, ''#{@real_input_root}'' does not exist"\u000a elsif !File.directory?(@real_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real input directory, ''#{@real_input_root}'' is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @real_output_root=File.expand_path(output_root)\u000a if File.exist?(@real_output_root)\u000a if !File.directory?(@real_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Real output directory, ''#{@real_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Make sure that if metgrid_input_dir exists, it is a directory\u000a @metgrid_input_dir=File.expand_path(metgrid_input_dir)\u000a if File.exist?(@metgrid_input_dir)\u000a if !File.directory?(@metgrid_input_dir)\u000a raise "#{__FILE__}:#{__LINE__}:: Metgrid input directory, ''#{@metgrid_input_dir}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the start time, forecast length, forecast interval, and number of processors\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a @nprocs=nprocs\u000a\u000a use_mpi=ENV["WRF_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Calculate the names of the metgrid input files\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a fileglob="#{@metgrid_input_dir}/#{prefix}.d01.#{(@start_time+f*3600).strftime("%Y-%m-%d_%H:%M:%S")}*"\u000a if Dir[fileglob].empty?\u000a raise "#{__FILE__}:#{__LINE__}:: #{fileglob} does not exist"\u000a end\u000a }\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@real_output_root}/wrf-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do\u000a \u000a # Create links to realinput and realbdy if necessary\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a fileglob="#{@metgrid_input_dir}/#{prefix}.d01.#{(@start_time+f*3600).strftime("%Y-%m-%d_%H:%M:%S")}*"\u000a Dir[fileglob].each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a }\u000a\u000a # Create links to the WRF DAT files\u000a @datfiles.each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a\u000a # Compute number of days and hours for the run\u000a run_days = @fcst_length / 24 \u000a run_hours = @fcst_length % 24\u000a\u000a # Set the run_days and run_hours fields in the namelist\u000a @namelist.set("time_control","run_days",[run_days])\u000a @namelist.set("time_control","run_hours",[run_hours])\u000a\u000a # Set the start and end time fields in the namelist\u000a end_time=@start_time+3600*@fcst_length\u000a @namelist.set("time_control","start_year",[@start_time.year])\u000a @namelist.set("time_control","start_month",[@start_time.month])\u000a @namelist.set("time_control","start_day",[@start_time.day])\u000a @namelist.set("time_control","start_hour",[@start_time.hour])\u000a @namelist.set("time_control","start_minute",[@start_time.min])\u000a @namelist.set("time_control","start_second",[@start_time.sec])\u000a\u000a @namelist.set("time_control","end_year",[end_time.year])\u000a @namelist.set("time_control","end_month",[end_time.month])\u000a @namelist.set("time_control","end_day",[end_time.day])\u000a @namelist.set("time_control","end_hour",[end_time.hour])\u000a @namelist.set("time_control","end_minute",[end_time.min])\u000a @namelist.set("time_control","end_second",[end_time.sec])\u000a\u000a # Set the interval seconds field in the namelist\u000a @namelist.set("time_control","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.input")\u000a\u000a # Move existing rsl files to a subdir\u000a if File.exist?("rsl.error.0000")\u000a rsldir="#{output_root}/logs/rsl.real.#{File.mtime("rsl.error.0000").strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Get the current time\u000a runtime=Time.now\u000a\u000a # Run real\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{real}")\u000a elsif \u000a system("#{real}")\u000a end \u000a\u000a #get the return status right after system call\u000a status=$?\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Save a copy of the rsl files\u000a rsldir="#{output_root}/logs/rsl.real.#{runtime.strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end \u000a\u000a # Check return status of real\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{real} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a # Calculate names of expected output files\u000a output_files=["wrfinput_d01","wrfbdy_d01"]\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: Real output file, #{@real_output_root}/wrf-output/#{outfile}, is missing"\u000a end\u000a \u000a puts "Expected Real output file found: #{@real_output_root}/wrf-output/#{outfile}"\u000a }\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Look for completion messages in rsl files\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.error.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE REAL/\u000a raise "#{__FILE__}:#{__LINE__}:: REAL Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.out.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE REAL/\u000a raise "#{__FILE__}:#{__LINE__}:: REAL Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a else\u000a #need to write code to look for message \u000a #in ../logs/def_real_???.log file (where ''???'' changes)\u000a end\u000a \u000a\u000a end # Dir.chdir\u000a\u000a status=0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a status=1\u000a ensure\u000a puts "run_real terminated at: #{Time.now}"\u000a return status\u000a end \u000a \u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of real.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WRF_CORE","WRF_ROOT", "MOAD_DATAROOT","METGRID_INPUT_DIR",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","REALPROC"\u000a].each { |var|\u000a if var.nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000acore=ENV["WRF_CORE"]\u000awrf_root=ENV["WRF_ROOT"]\u000ametgrid_input_dir=ENV["METGRID_INPUT_DIR"]\u000ainput_root=ENV["MOAD_DATAROOT"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["REALPROC"].to_i\u000a\u000a# Create a WRF object\u000awrf=WRF.new(wrf_root,output_root,metgrid_input_dir)\u000a\u000a# Run real\u000astatus=wrf.run_real(core,\u000a input_root,\u000a output_root,\u000a metgrid_input_dir,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000aputs status.inspect\u000aexit status\u000a\u000a','2010-07-14 08:57:49.071000000') INSERT INTO MODEL_CONFIG_FILE VALUES(4386,173,67,1,NULL,'#!/usr/bin/ruby\u000a\u000arequire ''parsedate''\u000a\u000a################ def_wrf.rb ###########################\u000a#\u000a# version 1.00 (runs WRF - wrf.exe program)\u000a# Written by Chris Harrop\u000a# Modified for WRF Portal by Jeff Smith & Mark Govett\u000a# Earth System Research Lab - GSD / NOAA\u000a#\u000a#######################################################\u000a\u000a\u000a##########################################\u000a#\u000a# Class WRF\u000a#\u000a##########################################\u000aclass WRF\u000a\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(wrf_root,\u000a output_root)\u000a\u000a begin\u000a\u000a # Make sure none of the input arguments are nil\u000a args=[:wrf_root,:output_root]\u000a args.each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Set the paths to WRF and domain home directories\u000a @wrf_root=File.expand_path(wrf_root)\u000a @output_root=File.expand_path(output_root)\u000a\u000a # Make sure that the input directories actually exist and are directories\u000a args=[:@wrf_root,:@output_root]\u000a args.each { |arg|\u000a dir=eval("#{arg}")\u000a if !File.exist?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} does not exist"\u000a end\u000a if !File.directory?(dir)\u000a raise "#{__FILE__}:#{__LINE__}:: #{dir} is not a directory"\u000a end\u000a }\u000a \u000a # Set the WRF namelist\u000a topDir=File.dirname(output_root)\u000a @namelist=Namelist.new("#{topDir}/static/def_wrf/namelist.input")\u000a\u000a # Initialize the list of TBL and DATA files\u000a @datfiles=["#{wrf_root}/run/LANDUSE.TBL",\u000a "#{wrf_root}/run/RRTM_DATA",\u000a "#{wrf_root}/run/VEGPARM.TBL",\u000a "#{wrf_root}/run/GENPARM.TBL",\u000a "#{wrf_root}/run/SOILPARM.TBL",\u000a "#{wrf_root}/run/ETAMPNEW_DATA",\u000a "#{wrf_root}/run/tr49t85",\u000a "#{wrf_root}/run/tr49t67",\u000a "#{wrf_root}/run/tr67t85",\u000a "#{wrf_root}/run/gribmap.txt"]\u000a\u000a # Make sure datfiles exist and are readable\u000a @datfiles.each { |file|\u000a if !File.exist?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF data file, ''#{file}'', does not exist"\u000a elif !File.readable?(file)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read WRF data file, ''#{file}''"\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # run_wrf\u000a #\u000a #####################################################\u000a def run_wrf(core,\u000a input_root,\u000a output_root,\u000a start_time,\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000a\u000a begin\u000a\u000a puts "def_wrf.rb started at: #{Time.now}"\u000a puts "[start_time = #{start_time}] (as selected by user in WRF Portal ''Run Workflow'' window)"\u000a puts ""\u000a\u000a # Make sure input arguments are not nil\u000a [:core,:input_root,:output_root,:start_time,:fcst_length,:fcst_interval,:nprocs].each { |arg|\u000a raise "#{__FILE__}:#{__LINE__}:: #{arg.to_s} is nil" if eval("#{arg}").nil?\u000a }\u000a\u000a # Validate core and set the paths to the WRF executables\u000a case core\u000a when /^arw$/i\u000a wrf=File.exist?("#{@wrf_root}/main/wrf_arw.exe") ? "#{@wrf_root}/main/wrf_arw.exe" : "#{@wrf_root}/main/wrf.exe"\u000a when /^nmm$/i\u000a wrf=File.exist?("#{@wrf_root}/main/wrf_nmm.exe") ? "#{@wrf_root}/main/wrf_nmm.exe" : "#{@wrf_root}/main/wrf.exe"\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid WRF core, ''#{core}''"\u000a end\u000a \u000a # Make sure WRF executables exist and are executable\u000a if !File.exist?(wrf)\u000a raise "#{__FILE__}:#{__LINE__}:: #{wrf} does not exist"\u000a elsif !File.executable?(wrf)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to execute #{wrf}"\u000a end\u000a\u000a # Make sure that input_root exists, and is a directory\u000a @wrf_input_root=File.expand_path(input_root)\u000a if !File.exist?(@wrf_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf input directory, ''#{@wrf_input_root}'' does not exist"\u000a elsif !File.directory?(@wrf_input_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf input directory, ''#{@wrf_input_root}'' is not a directory"\u000a end\u000a\u000a # Make sure that if output_root exists, it is a directory\u000a @wrf_output_root=File.expand_path(output_root)\u000a if File.exist?(@wrf_output_root)\u000a if !File.directory?(@wrf_output_root)\u000a raise "#{__FILE__}:#{__LINE__}:: Wrf output directory, ''#{@wrf_output_root}'' is not a directory"\u000a end\u000a end\u000a\u000a # Set the start time, forecast length, forecast interval, and number of processors\u000a @start_time=start_time\u000a @fcst_length=fcst_length\u000a @fcst_interval=fcst_interval\u000a @nprocs=nprocs\u000a \u000a use_mpi=ENV["WRF_USE_MPI"]\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Get the path to mpirun\u000a mpirun=`which mpirun 2>&1`\u000a if $? !=0 \u000a raise "#{__FILE__}:#{__LINE__}:: The mpirun command is not in the path"\u000a end\u000a end \u000a\u000a # Make sure start_time is a time object\u000a if @start_time.class!=Time\u000a raise "#{__FILE__}:#{__LINE__}:: start_time argument must be a Time object"\u000a end\u000a\u000a # Make sure forecast length is an integer\u000a if !@fcst_length.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_length argument is not an integer"\u000a end\u000a \u000a # Make sure forecast interval is an integer\u000a if !@fcst_interval.kind_of? Integer\u000a raise "#{__FILE__}:#{__LINE__}:: fcst_interval argument is not an integer"\u000a end\u000a\u000a # Make sure the wrf_input and wrf_bdy input files exist\u000a if !File.exist?("#{@wrf_input_root}/wrf-output/wrfinput_d01")\u000a raise "#{__FILE__}:#{__LINE__}:: #{@wrf_input_root}/wrf-output/wrfinput_d01 does not exist"\u000a elsif !File.exist?("#{@wrf_input_root}/wrf-output/wrfbdy_d01")\u000a raise "#{__FILE__}:#{__LINE__}:: #{@wrf_input_root}/wrf-output/wrfbdy_d01 does not exist"\u000a end\u000a\u000a # Make sure the umask is set to 002\u000a File.umask(002)\u000a\u000a # Create a working directory\u000a workdir="#{@wrf_output_root}/wrf-output"\u000a tempdir=""\u000a workdir.split("/").each { |d|\u000a next if d.empty?\u000a tempdir="#{tempdir}/#{d}"\u000a Dir.mkdir(tempdir) unless File.exist?(tempdir)\u000a }\u000a\u000a # Move to the working directory\u000a Dir.chdir(workdir) do\u000a \u000a # Create links to wrfinput and wrfbdy if necessary\u000a unless @wrf_input_root==@wrf_output_root\u000a File.delete("wrfinput_d01") if File.exist?("wrfinput_d01")\u000a File.delete("wrfinput_d01") if File.symlink?("wrfinput_d01")\u000a File.symlink("#{@wrf_input_root}/wrf-output/wrfinput_d01","wrfinput_d01")\u000a File.delete("wrfbdy_d01") if File.exist?("wrfbdy_d01")\u000a File.delete("wrfbdy_d01") if File.symlink?("wrfbdy_d01")\u000a File.symlink("#{@wrf_input_root}/wrf-output/wrfbdy_d01","wrfbdy_d01")\u000a end\u000a\u000a # Create links to the WRF DAT files\u000a @datfiles.each { |file|\u000a localfile=File.basename(file)\u000a File.delete(localfile) if File.exist?(localfile)\u000a File.delete(localfile) if File.symlink?(localfile)\u000a File.symlink(file,localfile)\u000a }\u000a\u000a # Compute number of days and hours for the run\u000a run_days = @fcst_length / 24 \u000a run_hours = @fcst_length % 24\u000a\u000a # Set the run_days and run_hours fields in the namelist\u000a @namelist.set("time_control","run_days",[run_days])\u000a @namelist.set("time_control","run_hours",[run_hours])\u000a\u000a # Set the start and end time fields in the namelist\u000a end_time=@start_time+3600*@fcst_length\u000a @namelist.set("time_control","start_year",[@start_time.year])\u000a @namelist.set("time_control","start_month",[@start_time.month])\u000a @namelist.set("time_control","start_day",[@start_time.day])\u000a @namelist.set("time_control","start_hour",[@start_time.hour])\u000a @namelist.set("time_control","start_minute",[@start_time.min])\u000a @namelist.set("time_control","start_second",[@start_time.sec])\u000a\u000a @namelist.set("time_control","end_year",[end_time.year])\u000a @namelist.set("time_control","end_month",[end_time.month])\u000a @namelist.set("time_control","end_day",[end_time.day])\u000a @namelist.set("time_control","end_hour",[end_time.hour])\u000a @namelist.set("time_control","end_minute",[end_time.min])\u000a @namelist.set("time_control","end_second",[end_time.sec])\u000a\u000a # Set the interval seconds field in the namelist\u000a @namelist.set("time_control","interval_seconds",[@fcst_interval*3600])\u000a\u000a # Write out a local copy of the modified namelist\u000a @namelist.print(nil,"namelist.input")\u000a\u000a # Move existing rsl files to a subdir\u000a if File.exist?("rsl.error.0000")\u000a rsldir="#{output_root}/logs/rsl.wrf.#{File.mtime("rsl.error.0000").strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Get the current time\u000a runtime=Time.now\u000a\u000a # Run wrf\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a system("mpirun -np #{@nprocs} #{wrf}")\u000a elsif\u000a system("#{wrf}")\u000a end\u000a\u000a #get the return status right after system call\u000a status=$?\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Save a copy of the rsl files\u000a rsldir="#{output_root}/logs/rsl.wrf.#{runtime.strftime("%Y%m%d%H%M%S")}"\u000a Dir.mkdir(rsldir)\u000a Dir["rsl.out.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a Dir["rsl.error.*"].each { |file|\u000a File.rename(file,"#{rsldir}/#{File.basename(file)}")\u000a }\u000a end\u000a\u000a # Check return status of wrf\u000a if status.exited?\u000a exitstatus=status.exitstatus\u000a unless exitstatus.zero?\u000a raise "#{__FILE__}:#{__LINE__}:: #{wrf} exited with status=#{exitstatus}"\u000a end\u000a end\u000a\u000a if use_mpi==''Y'' || use_mpi==''Yes'' || use_mpi==''y'' || use_mpi==''yes''\u000a # Look for completion messages in rsl files\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.error.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE WRF/\u000a raise "#{__FILE__}:#{__LINE__}:: WRF Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a @nprocs.times {|n|\u000a rslfile=sprintf("#{rsldir}/rsl.out.%04d",n)\u000a unless File.readlines(rslfile).last=~/SUCCESS COMPLETE WRF/\u000a raise "#{__FILE__}:#{__LINE__}:: WRF Failed, completion message missing from #{rslfile}"\u000a end\u000a }\u000a else\u000a #need to write code to look for message \u000a #in ../logs/def_real_???.log file (where ''???'' changes)\u000a end\u000a \u000a\u000a # Calculate names of expected output files\u000a output_files=Array.new\u000a 0.step(@fcst_length,@fcst_interval) { |f|\u000a output_files.push("#{(@start_time+f*3600).strftime("wrfout_d01_%Y-%m-%d_%H:%M:%S")}")\u000a }\u000a\u000a # Make sure all the expected output is there\u000a output_files.each {|outfile|\u000a unless File.exist?(outfile)\u000a raise "#{__FILE__}:#{__LINE__}:: WRF output file, ''#{outfile}'', is missing"\u000a end\u000a \u000a puts ""\u000a puts "Expected WRF output file found: #{@real_output_root}/wrf-output/#{outfile}"\u000a }\u000a\u000a end # Dir.chdir\u000a\u000a return 0\u000a\u000a rescue\u000a puts\u000a puts $!\u000a self.info\u000a return 1\u000a ensure\u000a puts "run_wrf terminated at: #{Time.now}"\u000a end \u000a \u000a end\u000a\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info\u000a \u000a puts\u000a width=self.instance_variables.map {|var| var.length}.max\u000a self.instance_variables.sort.each { |var|\u000a puts "#{var.tr("@","").rjust(width)} = #{eval(var).inspect}"\u000a }\u000a puts\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Class Namelist\u000a#\u000a##########################################\u000aclass Namelist\u000a\u000a #####################################################\u000a #\u000a # initialize\u000a #\u000a #####################################################\u000a def initialize(filename)\u000a\u000a begin\u000a\u000a @filename=File.expand_path(filename)\u000a\u000a # Make sure filename is not nil\u000a if @filename.nil?\u000a raise "#{__FILE__}:#{__LINE__}:: filename argument is nil"\u000a end\u000a \u000a # Make sure filename exists\u000a if !File.exist?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: #{@filename} does not exist"\u000a end\u000a\u000a # Make sure filename is readable\u000a if !File.readable?(@filename)\u000a raise "#{__FILE__}:#{__LINE__}:: You do not have permission to read ''#{@filename}''"\u000a end\u000a\u000a # Initialize hash tables to hold namelist sections variables and values\u000a @sections=Hash.new\u000a @vars=Hash.new\u000a @values=Hash.new\u000a\u000a # Read in the entire namelist \u000a lines=IO.readlines(@filename)\u000a\u000a # Build the namelist tables\u000a section=nil\u000a var=nil\u000a lines.each {|line|\u000a case line.gsub(''"'',"''")\u000a\u000a # If the line is a section declaration\u000a when /^\s*&(\w+)\s*$/\u000a section=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate namelist section, ''#{section}''" unless @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a\u000a # If the line is a section end marker\u000a when /^\s*\/\s*$/\u000a section=nil\u000a\u000a # If the line is a variable assignment (i.e. a=b)\u000a when /^\s*(\S+)\s*=\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(\S+)\s*=\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a var=$1.downcase\u000a raise "#{__FILE__}:#{__LINE__}:: Duplicate variable, ''#{var}'', in section, ''#{section}''" unless @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a @values[section][var]=$2.gsub(/\s/,"").split(",").map {|value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a\u000a # If the line is a variable line assignment continuation (i.e. a list of values)\u000a when /^\s*([^,''\s]+\s*(?:,\s*[^,''\s]+\s*)*),?\s*$/,\u000a /^\s*(''[^,''\s]*''\s*(?:,\s*''[^,''\s]*''\s*)*),?\s*$/\u000a raise "#{__FILE__}:#{__LINE__}:: Namelist variables must be set inside a namelist section" if section.nil?\u000a @values[section][var]+=$1.gsub(/\s/,"").split(",").map { |value|\u000a case value\u000a when /^([+-]?[0-9]+)$/\u000a value.to_i\u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)|[+-]?[0-9]+.$/\u000a value.to_f\u000a when /.false./i\u000a false\u000a when /.true./i\u000a true\u000a else\u000a value.gsub("''","")\u000a end\u000a }\u000a end\u000a }\u000a\u000a rescue\u000a puts\u000a puts $!\u000a exit 1\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # print\u000a #\u000a #####################################################\u000a def print(sections=@sections.keys,filename=nil)\u000a\u000a if sections.nil?\u000a sections=@sections.keys\u000a elsif sections.class == String\u000a sections=[sections.downcase]\u000a end\u000a sections.sort! { |a,b| @sections[a] <=> @sections[b] }\u000a\u000a if filename.nil?\u000a file=$stdout\u000a else\u000a file=File.open(filename,"w")\u000a end\u000a\u000a # Print each namelist group\u000a sections.each { |section|\u000a file.write "&#{section}\n"\u000a varwidth=@vars[section].keys.map {|var| var.length}.max\u000a valwidth=0\u000a valstrs=Hash.new\u000a @values[section].keys.each { |var|\u000a valstrs[var]=@values[section][var].map {|value|\u000a if value.is_a?(TrueClass)\u000a ".true."\u000a elsif value.is_a?(FalseClass)\u000a ".false."\u000a elsif value.kind_of?(String)\u000a "''#{value}''"\u000a else\u000a "#{value}"\u000a end\u000a\u000a }\u000a if valstrs[var].length > 1\u000a max=valstrs[var].map{ |str| str.length}.max\u000a valwidth=max if max > valwidth\u000a end\u000a }\u000a\u000a @vars[section].keys.sort { |a,b| @vars[section][a] <=> @vars[section][b] }.each { |var|\u000a\u000a file.write sprintf(" #{var.ljust(varwidth)} = ")\u000a cols=0\u000a valstrs[var].each { |valstr| \u000a file.write "#{valstr},".ljust(valwidth+5)\u000a cols+=1\u000a if cols%5==0\u000a file.write "\n".ljust(varwidth+5)\u000a end\u000a \u000a }\u000a file.write "\n"\u000a }\u000a file.write "/\n\n"\u000a\u000a }\u000a\u000a unless filename.nil? \u000a file.close\u000a end\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # set\u000a #\u000a #####################################################\u000a def set(section,var,value)\u000a \u000a section=section.downcase\u000a var=var.downcase\u000a if @sections[section].nil?\u000a @sections[section]=@sections.values.empty? ? 0 : @sections.values.max + 1\u000a @vars[section]=Hash.new\u000a @values[section]=Hash.new\u000a end\u000a\u000a if @vars[section][var].nil?\u000a @vars[section][var]=@vars[section].values.empty? ? 0 : @vars[section].values.max + 1\u000a end\u000a\u000a @values[section][var]=value.map {|val|\u000a if val.kind_of?(Numeric)\u000a val \u000a elsif val.is_a?(FalseClass)\u000a val\u000a elsif val.is_a?(TrueClass)\u000a val\u000a elsif val.kind_of?(String) \u000a case val\u000a when /^\.false\.$/i,/^false$/i\u000a false\u000a when /^\.true\.$/i,/^true$/i\u000a true\u000a when /^([+-]?[0-9]+)$/\u000a val.to_i \u000a when /^([+-]?([0-9]*.)?[0-9]+(e[+-]?[0-9]+)?)$/\u000a val.to_f\u000a when /^''([^''\s]*)''$/\u000a $1\u000a when /^([^''\s]*)$/ \u000a val\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value, ''#{val}''"\u000a end\u000a else\u000a raise "#{__FILE__}:#{__LINE__}:: Invalid namelist value"\u000a end\u000a }\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # get\u000a #\u000a #####################################################\u000a def get(section,var)\u000a\u000a return nil if @values[section.downcase].nil?\u000a return @values[section.downcase][var.downcase]\u000a\u000a end\u000a\u000a #####################################################\u000a #\u000a # info\u000a #\u000a #####################################################\u000a def info(section,var)\u000a\u000a puts self.inspect\u000a\u000a end\u000aend\u000a\u000a\u000a\u000a##########################################\u000a#\u000a# Main body of wrf.rb\u000a#\u000a##########################################\u000a\u000a\u000a# Make sure all required environment vars are set\u000a[\u000a "WRF_CORE","WRF_ROOT","MOAD_DATAROOT",\u000a "START_TIME","FCST_LENGTH","FCST_INTERVAL","WRFPROC"\u000a].each { |var|\u000a if ENV[var].nil?\u000a puts "ERROR: Required environment variable, ''#{var}'', is not set"\u000a exit 1\u000a end\u000a}\u000a\u000a# Get values from environment variables\u000acore=ENV["WRF_CORE"]\u000awrf_root=ENV["WRF_ROOT"]\u000ainput_root=ENV["MOAD_DATAROOT"]\u000aoutput_root=ENV["MOAD_DATAROOT"]\u000astart_time=ParseDate.parsedate(ENV["START_TIME"],true)\u000afcst_length=ENV["FCST_LENGTH"].to_i\u000afcst_interval=ENV["FCST_INTERVAL"].to_i\u000anprocs=ENV["WRFPROC"].to_i\u000a\u000a# Create a WRF object\u000awrf=WRF.new(wrf_root,output_root)\u000a\u000a# Run real\u000astatus=wrf.run_wrf(core,\u000a input_root,\u000a output_root,\u000a Time.gm(*start_time),\u000a fcst_length,\u000a fcst_interval,\u000a nprocs)\u000aputs status.inspect\u000aexit status\u000a\u000a','2010-07-14 08:57:49.072000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5172,176,75,1,'/ptmp/lynge/FIM/FIMrun/FIMnamelist','&QUEUEnamelist\u000aComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000aMaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000aSRCDIR = '''' ! FIM source location\u000aPREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000aFIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000aDATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000aDATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a&TOPOnamelist\u000atopodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a&CNTLnamelist\u000aglvl = 6 ! Grid level\u000aSubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000anvl = 64 ! Number of vertical levels\u000a/\u000a&PREPnamelist\u000acurve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000aNumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000aalt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a&DIAGnamelist\u000aPrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000aPrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000aPrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000aPrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a&MODELnamelist\u000ants = 0 ! number of time steps\u000aWriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000aReadRestart = .false. ! DISABLED True means start by reading a restart file\u000aRestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000arleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000arleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000aptop = 50. ! pressure (Pa) at top of model domain\u000athktop = 50. ! min.thknss of uppermost model layer\u000aintfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000aslak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000aveldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000apure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a&PHYSICSnamelist\u000aPhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000aRadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000aGravityWaveDrag = .true. ! True means calculate gravity wave drag\u000aras = .false. ! false means call SAS\u000axkt2_scalar = 0.6 ! Can vary between 0 and 1\u000acharnock = 0.014 ! Can vary between 0.01 and 0.03\u000anum_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a&TIMEnamelist\u000ayyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a&OUTPUTnamelist\u000anumday = 1 ! number of integration days\u000anumhour = 0 ! number of integration hours\u000aOutputByHour = .true. ! True means output by hour, not step number.\u000aoutpd = 6 ! output period in hours (or time steps)\u000aPrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000aTimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000aFixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a&WRITETASKnamelist\u000anum_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000amax_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a&DEBUGMSGnamelist\u000adebugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a!\u000a! Ning Wang, June 2007\u000a!\u000a&POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000adatadir = "../fim"\u000aoutputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000ainput = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000aoutput = ""\u000a! if output has content, it overwrites the outputdir\u000aoutput_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000amultiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000agribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000agrid_id = 4 ! 228(144, 73), 45(288, 145),\u000a! 3(360, 181), 4(720, 361); only for grib output file.\u000amx = 720 ! only used by netcdf output file\u000amy = 360 ! only used by netcdf output file\u000alatlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000ais = 1 ! interpolation scheme:\u000a! 0 -- no interpolation: native grid;\u000a! 1 -- horizontal interpo. on native vertical coord.;\u000a! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000avres = 111 ! only used in vertical interpolation\u000amode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000avar_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000ansmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000anvars = 12\u000at1 = 0\u000at2 = 24\u000adelta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000amax_run_time_prep=''00:05:00''\u000amax_run_time_fim=''00:30:00''\u000amax_run_time_pop=''00:15:00''\u000abatch_size=''3''\u000aac_model_name=''FIMDC''\u000aanx_model_names=''GFS''\u000astats_model_name=''FIM''\u000asounding_model_name=''FIM''\u000ancl_model_name=''EXPER FIM-6''\u000ancl_diff_model_name=''FIM-FIMX''\u000arealtime=''F''\u000artfim_home=''/whome/rtfim''\u000ampiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000ape=''comp''\u000acycle=''*''\u000a/\u000a','2010-07-16 14:58:58.015000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5173,176,91,1,NULL,' 330 510 675 825 960 1080 1185 1275 1350 1410 \u000a1455 1485 1500 1500 1500 1500 1500 1500 1500 1500 \u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500\u000a----------------------------------------------------------\u000aother choices:\u000a\u000a 300 400 500 600 700 800 900 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000\u000a\u000a 330 510 675 825 960 1080 1185 1275 1350 1410 \u000a1455 1485 1500 1500 1500 1500 1500 1500 1500 1500 \u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500\u000a\u000a 250 500 650 800 950 1100 1250 1400 1550 1700 \u000a1850 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 \u000a\u000a 200 300 400 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500\u000a','2010-07-16 14:58:58.015000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5174,176,92,1,NULL,' 224 232 240 245 250 255 260 265 270 273 \u000a 276 279 282 285 288 291 293 295 297 299 \u000a 301 303 305 307 309 311 313 315 317 319 \u000a 321 323 325 328 332 337 343 350 358 367 \u000a 377 388 400 413 427 443 462 485 513 547 \u000a 590 638 692 746 800 850 900 960 1030 1100 \u000a 1200 1350 1700 2200 \u000a','2010-07-16 14:58:58.015000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5175,176,76,1,'C:\cygwin\home\lynge\FIMnamelist','&QUEUEnamelist\u000aComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000aMaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000aSRCDIR = '''' ! FIM source location\u000aPREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000aFIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000aDATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000aDATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a&TOPOnamelist\u000atopodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a&CNTLnamelist\u000aglvl = 6 ! Grid level\u000aSubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000anvl = 64 ! Number of vertical levels\u000a/\u000a&PREPnamelist\u000acurve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000aNumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000aalt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a&DIAGnamelist\u000aPrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000aPrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000aPrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000aPrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a&MODELnamelist\u000ants = 0 ! number of time steps\u000aWriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000aReadRestart = .false. ! DISABLED True means start by reading a restart file\u000aRestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000arleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000arleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000aptop = 50. ! pressure (Pa) at top of model domain\u000athktop = 50. ! min.thknss of uppermost model layer\u000aintfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000aslak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000aveldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000apure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a&PHYSICSnamelist\u000aPhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000aRadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000aGravityWaveDrag = .true. ! True means calculate gravity wave drag\u000aras = .false. ! false means call SAS\u000axkt2_scalar = 0.6 ! Can vary between 0 and 1\u000acharnock = 0.014 ! Can vary between 0.01 and 0.03\u000anum_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a&TIMEnamelist\u000ayyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a&OUTPUTnamelist\u000anumday = 1 ! number of integration days\u000anumhour = 0 ! number of integration hours\u000aOutputByHour = .true. ! True means output by hour, not step number.\u000aoutpd = 6 ! output period in hours (or time steps)\u000aPrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000aTimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000aFixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a&WRITETASKnamelist\u000anum_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000amax_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a&DEBUGMSGnamelist\u000adebugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a!\u000a! Ning Wang, June 2007\u000a!\u000a&POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000adatadir = "../fim"\u000aoutputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000ainput = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000aoutput = ""\u000a! if output has content, it overwrites the outputdir\u000aoutput_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000amultiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000agribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000agrid_id = 4 ! 228(144, 73), 45(288, 145),\u000a! 3(360, 181), 4(720, 361); only for grib output file.\u000amx = 720 ! only used by netcdf output file\u000amy = 360 ! only used by netcdf output file\u000alatlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000ais = 1 ! interpolation scheme:\u000a! 0 -- no interpolation: native grid;\u000a! 1 -- horizontal interpo. on native vertical coord.;\u000a! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000avres = 111 ! only used in vertical interpolation\u000amode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000avar_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000ansmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000anvars = 12\u000at1 = 0\u000at2 = 24\u000adelta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000amax_run_time_prep=''00:05:00''\u000amax_run_time_fim=''00:30:00''\u000amax_run_time_pop=''00:15:00''\u000abatch_size=''3''\u000aac_model_name=''FIMDC''\u000aanx_model_names=''GFS''\u000astats_model_name=''FIM''\u000asounding_model_name=''FIM''\u000ancl_model_name=''EXPER FIM-6''\u000ancl_diff_model_name=''FIM-FIMX''\u000arealtime=''F''\u000artfim_home=''/whome/rtfim''\u000ampiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000ape=''comp''\u000acycle=''*''\u000a/\u000a','2010-07-16 14:58:58.015000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5176,176,74,1,NULL,'&QUEUEnamelist\u000aComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000aMaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000aSRCDIR = '''' ! FIM source location\u000aPREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000aFIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000aDATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000aDATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a&TOPOnamelist\u000atopodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a&CNTLnamelist\u000aglvl = 6 ! Grid level\u000aSubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000anvl = 64 ! Number of vertical levels\u000a/\u000a&PREPnamelist\u000acurve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000aNumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000aalt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a&DIAGnamelist\u000aPrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000aPrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000aPrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000aPrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a&MODELnamelist\u000ants = 0 ! number of time steps\u000aWriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000aReadRestart = .false. ! DISABLED True means start by reading a restart file\u000aRestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000arleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000arleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000aptop = 50. ! pressure (Pa) at top of model domain\u000athktop = 50. ! min.thknss of uppermost model layer\u000aintfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000aslak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000aveldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000apure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a&PHYSICSnamelist\u000aPhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000aRadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000aGravityWaveDrag = .true. ! True means calculate gravity wave drag\u000aras = .false. ! false means call SAS\u000axkt2_scalar = 0.6 ! Can vary between 0 and 1\u000acharnock = 0.014 ! Can vary between 0.01 and 0.03\u000anum_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a&TIMEnamelist\u000ayyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a&OUTPUTnamelist\u000anumday = 1 ! number of integration days\u000anumhour = 0 ! number of integration hours\u000aOutputByHour = .true. ! True means output by hour, not step number.\u000aoutpd = 6 ! output period in hours (or time steps)\u000aPrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000aTimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000aFixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a&WRITETASKnamelist\u000anum_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000amax_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a&DEBUGMSGnamelist\u000adebugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a!\u000a! Ning Wang, June 2007\u000a!\u000a&POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000adatadir = "../fim"\u000aoutputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000ainput = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000aoutput = ""\u000a! if output has content, it overwrites the outputdir\u000aoutput_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000amultiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000agribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000agrid_id = 4 ! 228(144, 73), 45(288, 145),\u000a! 3(360, 181), 4(720, 361); only for grib output file.\u000amx = 720 ! only used by netcdf output file\u000amy = 360 ! only used by netcdf output file\u000alatlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000ais = 1 ! interpolation scheme:\u000a! 0 -- no interpolation: native grid;\u000a! 1 -- horizontal interpo. on native vertical coord.;\u000a! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000avres = 111 ! only used in vertical interpolation\u000amode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000avar_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000ansmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000anvars = 12\u000at1 = 0\u000at2 = 24\u000adelta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000amax_run_time_prep=''00:05:00''\u000amax_run_time_fim=''00:30:00''\u000amax_run_time_pop=''00:15:00''\u000abatch_size=''3''\u000aac_model_name=''FIMDC''\u000aanx_model_names=''GFS''\u000astats_model_name=''FIM''\u000asounding_model_name=''FIM''\u000ancl_model_name=''EXPER FIM-6''\u000ancl_diff_model_name=''FIM-FIMX''\u000arealtime=''F''\u000artfim_home=''/whome/rtfim''\u000ampiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000ape=''comp''\u000acycle=''*''\u000a/\u000a','2010-07-16 14:58:58.031000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5177,176,72,1,'C:\cygwin\home\lynge\batchTemplate-prep','#!/bin/ksh\u000a\u000a# NOTE: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/prep. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-prep"\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000atest "$WFM" == "ENSEMBLE" && print "This is an ensemble run."\u000a\u000apwd\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For the course, this will be here. Later, talk w/ Susan about where to put it\u000a# Update FIMnamelist with values from WFM\u000acp $NLFILE $FIM_HOME/FIMrun/FIMnamelist\u000aexport NPROC\u000aexport SRCDIR\u000aexport DATADIR\u000aexport DATADR2\u000aexport WRITE_TASKS\u000aexport FIM_HOME\u000a$FIM_HOME/FIMrun/nlfixup\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a#$SRCDIR/bin/GetNVL | read NVL_val || fail "Cannot execute $BINDIR/GetNVL"\u000a\u000a# Course temp\u000aecho "Moving Rainer files to their appropriate names"\u000acp $CONFIG_FILES_DIR/dpsig.txt $FIM_HOME/FIMrun/dpsig${NVL}.txt\u000acp $CONFIG_FILES_DIR/theta_coor.txt $FIM_HOME/FIMrun/theta_coor${NVL}.txt\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the prep directory\u000amkdir $PREP || fail "Cannot make directory $PREP"\u000a\u000a# If a pre-existing prep directory was identified, link its contents\u000aif [[ -d "$PREPDIR" ]]\u000athen\u000a test "$COMPARE_VAR_ON" == "true" && \\u000a fail "cannot use PREPDIR and COMPARE_VAR together"\u000a linksafe $PREPDIR/* $PREP\u000aelse\u000a # Copy/link needed items\u000a cp $fimnamelist $PREP/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $PREP/$NLFILE"\u000a cp $thetacoor $PREP/theta_coor.txt || \\u000a fail "Cannot copy $thetacoor -> $PREP/theta_coor.txt"\u000a cp $dpsig $PREP/dpsig.txt || \\u000a fail "Cannot copy $dpsig -> $PREP/dpsig.txt"\u000a cp $topgrid $PREP/top_grid || \\u000a fail "Cannot copy $topgrid -> $PREP/top_grid"\u000a test -d "$DATADIR" || fail "$DATADIR does not exist"\u000a test -d "$DATADR2" || fail "$DATADR2 does not exist"\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADIR/gfsltln.dat $PREP\u000a linksafe $DATADIR/global_mtnvar.t382 $PREP\u000a else\u000a cp $DATADIR/gfsltln.dat $PREP || \\u000a fail "Cannot copy $DATADIR/gfsltln.dat -> $PREP"\u000a cp $DATADIR/global_mtnvar.t382 $PREP || \\u000a fail "Cannot copy $DATADIR/global_mtnvar.t382 -> $PREP"\u000a fi\u000a if [[ -n "$WFM" ]]\u000a then\u000a if [[ "$WFM" == "ENSEMBLE" ]]\u000a then\u000a linksafe $sanlFile $PREP/$sanlFilename\u000a linksafe $sfcanlFile $PREP/$sfcanlFilename\u000a else\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a fi\u000a else\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a else\u000a cp $DATADR2/$sanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sanlFile -> $PREP"\u000a cp $DATADR2/$sfcanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sfcanlFile -> $PREP"\u000a fi\u000a fi\u000a\u000a\u000a#For the course, we''re only running one day at a time, so don''t do this\u000a # For WFM runs, set yyyymmddhhmm in the namelist file''s TIMEnamelist to the\u000a # value in WFM-exported environment variable yyyymmddhhmm.\u000a# if [[ -n "$WFM" ]]\u000a# then\u000a# $nlh $PREP/$NLFILE TIMEnamelist yyyymmddhhmm $yyyymmddhhmm || \\u000a# fail "Cannot set yyyymmddhhmm in $NLFILE"\u000a# fi\u000a\u000a # Enter the prep directory\u000a cd $PREP || fail "Cannot cd to $PREP"\u000a\u000a # Link files\u000a for file in grid ginfo getlvl ssfc2icos\u000a do\u000a linksafe $BINDIR/$file\u000a done\u000a\u000a # If COMPARE_VAR is enabled, use $prepoutfiles to list prep output files that \u000a # will be compared as a sanity check when prep is finished. \u000a test "$COMPARE_VAR_ON" == "true" && \\u000a prepoutfiles="$GFSFC_FILE $GLVL_FILE $INFO_FILE $GRID_FILE $LATLON_FILE"\u000a\u000a # If COMPARE_VAR is enabled, run prep twice using task counts \u000a # $COMPARE_VAR_NTASKS_1 and $COMPARE_VAR_NTASKS_2. \u000a # Otherwise run prep once using $PES for task count. \u000a for taskcount in $taskcounts\u000a do\u000a # grid\u000a ./grid || fail "grid failed"\u000a [[ -f "$GRID_FILE" && -n "$GRID_FILE" ]] || fail "grid no file $GRID_FILE"\u000a print "grid finished"\u000a\u000a # ginfo\u000a ./ginfo || fail "ginfo failed"\u000a [[ -f "$INFO_FILE" && -n "$INFO_FILE" ]] || fail "grid no file $INFO_FILE"\u000a print "ginfo finished"\u000a\u000a # getlvl\u000a ./getlvl || fail "getlvl failed"\u000a [[ -f "$GLVL_FILE" && -n "$GLVL_FILE" ]] || fail "grid no file $GLVL_FILE"\u000a print "getlvl finished"\u000a\u000a # ssfc2icos\u000a#TODO: These are machine-specific. Move them up into ?subfim scripts somehow. \u000a#TODO: Probably auto-generate script-bits and source here (yuck). \u000a export F_UFMTENDIAN="big:11,21"\u000a export FORT90L="-Wl,-T11,-T21"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:11,21"\u000a ./ssfc2icos || fail "ssfc2icos failed"\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a\u000a [[ -f "$GFSFC_FILE" && -n "$GFSFC_FILE" ]] || fail "grid no file $GFSFC_FILE"\u000a print "ssfc2icos finished"\u000a\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # Prepare for second prep needed by second COMPARE_VAR run\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_1" ]]\u000a then\u000a for prepoutfile in $prepoutfiles\u000a do\u000a # Move prep output files to versions with special names for \u000a # comparison after second prep run\u000a mv -f $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "Cannot move $prepoutfile -> $prepoutfile.$COMPARE_VAR_NTASKS_1"\u000a done\u000a fi\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_2" ]]\u000a then\u000a # compare prep output files with first run \u000a # all the files in the $prepoutfiles list are expected to match\u000a for prepoutfile in $prepoutfiles\u000a do\u000a cmp -s $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "$prepoutfile does not match $prepoutfile.$COMPARE_VAR_NTASKS_1 after 2nd COMPARE_VAR prep run. Should it?"\u000a done\u000a # Restore original namelist file so humans looking in the fim \u000a # directory will see the correct number of tasks\u000a prevnl="$NLFILE.$COMPARE_VAR_NTASKS_2"\u000a # Save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE $prevnl"\u000a cp $orignl $NLFILE || fail "Cannot copy $orignl $NLFILE"\u000a fi\u000a fi\u000a done\u000afi # if [[ -d "$PREPDIR" ]]\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nprep finished\n"\u000a\u000areturn 0\u000a','2010-07-16 14:58:58.031000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5178,176,71,1,'C:\cygwin\home\lynge\batchTemplate-fim','#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/fim. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-fim"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the fim directory\u000amkdir $FIM || fail "Cannot make directory $FIM"\u000a\u000a# If a pre-existing fim directory was identified, link its contents\u000aif [[ -d "$FIMDIR" ]]\u000athen\u000a linksafe $FIMDIR/* $FIM\u000aelse\u000a # Copy needed items\u000a if [[ -d "$PREPDIR" ]]\u000a then\u000a cp $fimnamelist $FIM/$NLFILE || fail "Cannot copy $fimnamelist -> $FIM/$NLFILE"\u000a else\u000a cp $PREP/$NLFILE $FIM || fail "Cannot copy $PREP/$NLFILE -> $FIM"\u000a fi\u000a cp $configurefile $FIM/configure_file || fail "Cannot copy $configurefile -> $FIM/configure_file"\u000a if [[ -f "$smsnamelist" ]]\u000a then\u000a cp $smsnamelist $FIM/SMSnamelist || fail "Cannot copy $smsnamelist -> $FIM/SMSnamelist"\u000a fi\u000a\u000a # Enter the fim directory\u000a cd $FIM || fail "Cannot cd to $FIM"\u000a\u000a # Link items\u000a linksafe $BINDIR/$FIMEXE\u000a\u000a# For ensemble runs, we previously overwrote these variables and need to restore them\u000aif [[ "$WFM" == "ENSEMBLE" ]]\u000athen\u000a sanlFile=$sanlFilename\u000a sfcanlFile=$sfcanlFilename\u000afi\u000a\u000a for file in $LATLON_FILE $GLVL_FILE $sanlFile gfsltln.dat gfsfc.dat theta_coor.txt dpsig.txt top_grid\u000a do\u000a linksafe $PREP/$file\u000a done\u000a\u000a # if COMPARE_VAR is enabled, link two DecompInfo*.dat files; else link only one\u000a for taskcount in $taskcounts\u000a do\u000a decompfile="$PREP/DecompInfo_$taskcount.dat"\u000a linksafe $decompfile\u000a done # for taskcount in $taskcounts\u000a\u000a export F_UFMTENDIAN="big:82"\u000a export FORT90L="-Wl,-T82"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:82"\u000a\u000a if [[ "$parallelism" == "serial" ]]\u000a then # serial run\u000a ./$FIMEXEBASE >stdout 2>&1 || fail "./$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a elif [[ "$parallelism" == "parallel" ]]\u000a then # parallel run\u000a # TODO generalize this by moving to a machine-specific script\u000a tw_str="1"\u000a # If write tasks are present, use tweak_hostfile to place write tasks and\u000a # compute root on separate nodes in various ways. Compute root gets its own\u000a # node. Allocate no more than max_write_tasks_per_node write tasks to each\u000a # write task node.\u000a if [[ "$WRITE_TASKS" -gt 0 ]]\u000a then\u000a n=$WRITE_TASKS\u000a while [[ "$n" -gt 0 ]]\u000a do\u000a test "$n" -ge "$mwtpn" && x="$mwtpn" || x=$n\u000a tw_str="$tw_str:$x"\u000a let "n=$n-$x"\u000a done\u000a fi\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # When COMPARE_VAR is enabled, set hostfile so first two MPI tasks \u000a # share the first host node. These will be used as "roots" of the two \u000a # task groups created by COMPARE_VAR. Putting them on the same node \u000a # as this script ensures that files created by this script will be \u000a # visible to both groups when fim executes. \u000a tw_str="2"\u000a fi\u000a #############################################\u000a # For the course we''re disabling tweak_hostfile to run fim root task and write\u000a # task on the same node as the rest of the fim tasks\u000a\u000a # TODO generalize this by moving to a machine-specific script\u000a #if [[ -n "$MACHINE_FILE" ]]\u000a #then\u000a # print "tweak_hostfile will operate on <$MACHINE_FILE>..."\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.orig || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.orig"\u000a # print "tweak_hostfile -s $tw_str"\u000a # tweak_hostfile -s $tw_str\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.new || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.new"\u000a #fi\u000a \u000a # For parallel runs:\u000a # Workflow Manager and *subfim should define MPIRUNCMD as follows for various architectures\u000a # Example Arch. MPIRUNCMD\u000a # SGE ''mpirun -np''\u000a # torque ''aprun -n''\u000a # intel ''mpiexec_mpt -n''\u000a # load-leveler* ''poe''\u000a # NCAR* ''mpirun.lsf /usr/local/bin/launch''\u000a # * no node count assigned\u000a\u000a # MPIRUNCMD *must* be defined: Fail if not\u000a test -z "$MPIRUNCMD" && fail "MPIRUNCMD not defined"\u000a # Calculate total cores to run on\u000a let "PES_ARG=$PES+$WRITE_TASKS" || fail "Arithmetic error"\u000a # Blank PES_ARG if our MPI run command doesn''t use it\u000a print "$MPIRUNCMD" | grep -q -e "poe" -e "^mpirun\.lsf" && PES_ARG=""\u000a # The exit status of some MPI run commands is unreliable, so disable trapping\u000a trap_off\u000a # Run FIM (PES_ARG may be blank)\u000a echo "$CONTEXT_NAME on host $(hostname) running: $MPIRUNCMD $PES_ARG ./$FIMEXEBASE" >stdout\u000a echo "Current directory is $PWD" >>stdout\u000a $MPIRUNCMD $PES_ARG ./$FIMEXEBASE >stdout 2>&1\u000a # Re-enable error trapping\u000a trap_on\u000a\u000a # Check for SMS completion message in stdout file\u000a grep ''SMS:: Program complete'' stdout || fail "$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a else # neither "serial" or "parallel" was specified\u000a fail "Parallelism error"\u000a fi # if serial/parallel\u000a\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a \u000afi # if [[ -d "$FIMDIR" ]]\u000a\u000acat stdout || fail "Cannot cat stdout"\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nDone with fim\n"\u000a\u000areturn 0\u000a','2010-07-16 14:58:58.031000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5179,176,73,1,'C:\cygwin\home\lynge\batchTemplate-post','#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/pop. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-post"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the post directory. For WFM runs, the post directory should already\u000a# exist except for the first incremental batch and mkdir''s -p option exits\u000a# with success if the directory already exists.\u000amkdir -p $POST || fail "Cannot make directory $POST"\u000a\u000a# Copy namelist from the appropriate fim directory\u000aif [[ -d "$FIMDIR" ]]\u000athen\u000a cp $fimnamelist $POST/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $POST/$NLFILE"\u000aelse\u000a cp $FIM/$NLFILE $POST || fail "Cannot copy $FIM/$NLFILE -> $POST"\u000afi\u000a\u000acp $fimgribtable $POST/fim_gribtable || \\u000a fail "Cannot copy $fimgribtable $POST/fim_gribtable"\u000a\u000acp $reduceinput $POST/REDUCEinput || \\u000a fail "Cannot copy $reduceinput $POST/REDUCEinput"\u000a\u000a# Enter the post directory\u000acd $POST || fail "Cannot cd to $POST"\u000a\u000a# Link files\u000atest -f pop || linksafe $BINDIR/pop\u000atest -f reduce || linksafe $BINDIR/reduce\u000atest -f "$INFO_FILE" || linksafe $PREP/$INFO_FILE\u000a\u000aif [[ -n "$WFM" ]]\u000athen # do WFM post sequence\u000a XTRACE_CONTEXT="batchTemplate-postall"\u000a . $FIM_HOME/FIMrun/batchTemplate-postall || \\u000a fail "Problem running $FIM_HOME/FIMrun/batchTemplate-postall"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000aelse # do non-WFM pop\u000a ./pop || fail "pop failed"\u000afi\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\npop finished\n"\u000a\u000areturn 0\u000a','2010-07-16 14:58:58.031000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5186,177,75,1,'/ptmp/lynge/FIM/FIMrun/FIMnamelist','&QUEUEnamelist\u000aComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000aMaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000aSRCDIR = '''' ! FIM source location\u000aPREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000aFIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000aDATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000aDATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a&TOPOnamelist\u000atopodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a&CNTLnamelist\u000aglvl = 6 ! Grid level\u000aSubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000anvl = 64 ! Number of vertical levels\u000a/\u000a&PREPnamelist\u000acurve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000aNumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000aalt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a&DIAGnamelist\u000aPrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000aPrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000aPrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000aPrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a&MODELnamelist\u000ants = 0 ! number of time steps\u000aWriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000aReadRestart = .false. ! DISABLED True means start by reading a restart file\u000aRestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000arleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000arleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000aptop = 50. ! pressure (Pa) at top of model domain\u000athktop = 50. ! min.thknss of uppermost model layer\u000aintfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000aslak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000aveldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000apure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a&PHYSICSnamelist\u000aPhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000aRadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000aGravityWaveDrag = .true. ! True means calculate gravity wave drag\u000aras = .false. ! false means call SAS\u000axkt2_scalar = 0.6 ! Can vary between 0 and 1\u000acharnock = 0.014 ! Can vary between 0.01 and 0.03\u000anum_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a&TIMEnamelist\u000ayyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a&OUTPUTnamelist\u000anumday = 5 ! number of integration days\u000anumhour = 0 ! number of integration hours\u000aOutputByHour = .true. ! True means output by hour, not step number.\u000aoutpd = 6 ! output period in hours (or time steps)\u000aPrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000aTimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000aFixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a&WRITETASKnamelist\u000anum_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000amax_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a&DEBUGMSGnamelist\u000adebugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a!\u000a! Ning Wang, June 2007\u000a!\u000a&POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000adatadir = "../fim"\u000aoutputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000ainput = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000aoutput = ""\u000a! if output has content, it overwrites the outputdir\u000aoutput_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000amultiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000agribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000agrid_id = 4 ! 228(144, 73), 45(288, 145),\u000a! 3(360, 181), 4(720, 361); only for grib output file.\u000amx = 720 ! only used by netcdf output file\u000amy = 360 ! only used by netcdf output file\u000alatlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000ais = 1 ! interpolation scheme:\u000a! 0 -- no interpolation: native grid;\u000a! 1 -- horizontal interpo. on native vertical coord.;\u000a! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000avres = 111 ! only used in vertical interpolation\u000amode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000avar_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000ansmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000anvars = 12\u000at1 = 0\u000at2 = 120\u000adelta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000amax_run_time_prep=''00:05:00''\u000amax_run_time_fim=''00:30:00''\u000amax_run_time_pop=''00:15:00''\u000abatch_size=''3''\u000aac_model_name=''FIMDC''\u000aanx_model_names=''GFS''\u000astats_model_name=''FIM''\u000asounding_model_name=''FIM''\u000ancl_model_name=''EXPER FIM-6''\u000ancl_diff_model_name=''FIM-FIMX''\u000arealtime=''F''\u000artfim_home=''/whome/rtfim''\u000ampiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000ape=''comp''\u000acycle=''*''\u000a/\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5187,177,91,1,'/ptmp/lynge/FIM/FIMrun/dpsig13.txt',' 2000 3000 4000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000 5000\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5188,177,92,1,'/ptmp/lynge/FIM/FIMrun/theta_coor13.txt','240 270 290 300 310 320 330 350 380 430 510 640 850\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5189,177,76,1,'C:\cygwin\home\lynge\FIMnamelist','&QUEUEnamelist\u000aComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000aMaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000aSRCDIR = '''' ! FIM source location\u000aPREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000aFIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000aDATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000aDATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a&TOPOnamelist\u000atopodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a&CNTLnamelist\u000aglvl = 6 ! Grid level\u000aSubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000anvl = 64 ! Number of vertical levels\u000a/\u000a&PREPnamelist\u000acurve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000aNumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000aalt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a&DIAGnamelist\u000aPrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000aPrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000aPrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000aPrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a&MODELnamelist\u000ants = 0 ! number of time steps\u000aWriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000aReadRestart = .false. ! DISABLED True means start by reading a restart file\u000aRestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000arleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000arleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000aptop = 50. ! pressure (Pa) at top of model domain\u000athktop = 50. ! min.thknss of uppermost model layer\u000aintfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000aslak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000aveldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000apure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a&PHYSICSnamelist\u000aPhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000aRadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000aGravityWaveDrag = .true. ! True means calculate gravity wave drag\u000aras = .false. ! false means call SAS\u000axkt2_scalar = 0.6 ! Can vary between 0 and 1\u000acharnock = 0.014 ! Can vary between 0.01 and 0.03\u000anum_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a&TIMEnamelist\u000ayyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a&OUTPUTnamelist\u000anumday = 5 ! number of integration days\u000anumhour = 0 ! number of integration hours\u000aOutputByHour = .true. ! True means output by hour, not step number.\u000aoutpd = 6 ! output period in hours (or time steps)\u000aPrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000aTimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000aFixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a&WRITETASKnamelist\u000anum_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000amax_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a&DEBUGMSGnamelist\u000adebugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a!\u000a! Ning Wang, June 2007\u000a!\u000a&POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000adatadir = "../fim"\u000aoutputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000ainput = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000aoutput = ""\u000a! if output has content, it overwrites the outputdir\u000aoutput_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000amultiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000agribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000agrid_id = 4 ! 228(144, 73), 45(288, 145),\u000a! 3(360, 181), 4(720, 361); only for grib output file.\u000amx = 720 ! only used by netcdf output file\u000amy = 360 ! only used by netcdf output file\u000alatlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000ais = 1 ! interpolation scheme:\u000a! 0 -- no interpolation: native grid;\u000a! 1 -- horizontal interpo. on native vertical coord.;\u000a! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000avres = 111 ! only used in vertical interpolation\u000amode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000avar_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000ansmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000anvars = 12\u000at1 = 0\u000at2 = 120\u000adelta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000amax_run_time_prep=''00:05:00''\u000amax_run_time_fim=''00:30:00''\u000amax_run_time_pop=''00:15:00''\u000abatch_size=''3''\u000aac_model_name=''FIMDC''\u000aanx_model_names=''GFS''\u000astats_model_name=''FIM''\u000asounding_model_name=''FIM''\u000ancl_model_name=''EXPER FIM-6''\u000ancl_diff_model_name=''FIM-FIMX''\u000arealtime=''F''\u000artfim_home=''/whome/rtfim''\u000ampiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000ape=''comp''\u000acycle=''*''\u000a/\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5190,177,72,1,'C:\cygwin\home\lynge\batchTemplate-prep','#!/bin/ksh\u000a\u000a# NOTE: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/prep. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-prep"\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000atest "$WFM" == "ENSEMBLE" && print "This is an ensemble run."\u000a\u000apwd\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For the course, this will be here. Later, talk w/ Susan about where to put it\u000a# Update FIMnamelist with values from WFM\u000acp $NLFILE $FIM_HOME/FIMrun/FIMnamelist\u000aexport NPROC\u000aexport SRCDIR\u000aexport DATADIR\u000aexport DATADR2\u000aexport WRITE_TASKS\u000aexport FIM_HOME\u000a$FIM_HOME/FIMrun/nlfixup\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a#$SRCDIR/bin/GetNVL | read NVL_val || fail "Cannot execute $BINDIR/GetNVL"\u000a\u000a# Course temp\u000aecho "Moving Rainer files to their appropriate names"\u000acp $CONFIG_FILES_DIR/dpsig.txt $FIM_HOME/FIMrun/dpsig${NVL}.txt\u000acp $CONFIG_FILES_DIR/theta_coor.txt $FIM_HOME/FIMrun/theta_coor${NVL}.txt\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the prep directory\u000amkdir $PREP || fail "Cannot make directory $PREP"\u000a\u000a# If a pre-existing prep directory was identified, link its contents\u000aif [[ -d "$PREPDIR" ]]\u000athen\u000a test "$COMPARE_VAR_ON" == "true" && \\u000a fail "cannot use PREPDIR and COMPARE_VAR together"\u000a linksafe $PREPDIR/* $PREP\u000aelse\u000a # Copy/link needed items\u000a cp $fimnamelist $PREP/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $PREP/$NLFILE"\u000a cp $thetacoor $PREP/theta_coor.txt || \\u000a fail "Cannot copy $thetacoor -> $PREP/theta_coor.txt"\u000a cp $dpsig $PREP/dpsig.txt || \\u000a fail "Cannot copy $dpsig -> $PREP/dpsig.txt"\u000a cp $topgrid $PREP/top_grid || \\u000a fail "Cannot copy $topgrid -> $PREP/top_grid"\u000a test -d "$DATADIR" || fail "$DATADIR does not exist"\u000a test -d "$DATADR2" || fail "$DATADR2 does not exist"\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADIR/gfsltln.dat $PREP\u000a linksafe $DATADIR/global_mtnvar.t382 $PREP\u000a else\u000a cp $DATADIR/gfsltln.dat $PREP || \\u000a fail "Cannot copy $DATADIR/gfsltln.dat -> $PREP"\u000a cp $DATADIR/global_mtnvar.t382 $PREP || \\u000a fail "Cannot copy $DATADIR/global_mtnvar.t382 -> $PREP"\u000a fi\u000a if [[ -n "$WFM" ]]\u000a then\u000a if [[ "$WFM" == "ENSEMBLE" ]]\u000a then\u000a linksafe $sanlFile $PREP/$sanlFilename\u000a linksafe $sfcanlFile $PREP/$sfcanlFilename\u000a else\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a fi\u000a else\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a else\u000a cp $DATADR2/$sanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sanlFile -> $PREP"\u000a cp $DATADR2/$sfcanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sfcanlFile -> $PREP"\u000a fi\u000a fi\u000a\u000a\u000a#For the course, we''re only running one day at a time, so don''t do this\u000a # For WFM runs, set yyyymmddhhmm in the namelist file''s TIMEnamelist to the\u000a # value in WFM-exported environment variable yyyymmddhhmm.\u000a# if [[ -n "$WFM" ]]\u000a# then\u000a# $nlh $PREP/$NLFILE TIMEnamelist yyyymmddhhmm $yyyymmddhhmm || \\u000a# fail "Cannot set yyyymmddhhmm in $NLFILE"\u000a# fi\u000a\u000a # Enter the prep directory\u000a cd $PREP || fail "Cannot cd to $PREP"\u000a\u000a # Link files\u000a for file in grid ginfo getlvl ssfc2icos\u000a do\u000a linksafe $BINDIR/$file\u000a done\u000a\u000a # If COMPARE_VAR is enabled, use $prepoutfiles to list prep output files that \u000a # will be compared as a sanity check when prep is finished. \u000a test "$COMPARE_VAR_ON" == "true" && \\u000a prepoutfiles="$GFSFC_FILE $GLVL_FILE $INFO_FILE $GRID_FILE $LATLON_FILE"\u000a\u000a # If COMPARE_VAR is enabled, run prep twice using task counts \u000a # $COMPARE_VAR_NTASKS_1 and $COMPARE_VAR_NTASKS_2. \u000a # Otherwise run prep once using $PES for task count. \u000a for taskcount in $taskcounts\u000a do\u000a # grid\u000a ./grid || fail "grid failed"\u000a [[ -f "$GRID_FILE" && -n "$GRID_FILE" ]] || fail "grid no file $GRID_FILE"\u000a print "grid finished"\u000a\u000a # ginfo\u000a ./ginfo || fail "ginfo failed"\u000a [[ -f "$INFO_FILE" && -n "$INFO_FILE" ]] || fail "grid no file $INFO_FILE"\u000a print "ginfo finished"\u000a\u000a # getlvl\u000a ./getlvl || fail "getlvl failed"\u000a [[ -f "$GLVL_FILE" && -n "$GLVL_FILE" ]] || fail "grid no file $GLVL_FILE"\u000a print "getlvl finished"\u000a\u000a # ssfc2icos\u000a#TODO: These are machine-specific. Move them up into ?subfim scripts somehow. \u000a#TODO: Probably auto-generate script-bits and source here (yuck). \u000a export F_UFMTENDIAN="big:11,21"\u000a export FORT90L="-Wl,-T11,-T21"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:11,21"\u000a ./ssfc2icos || fail "ssfc2icos failed"\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a\u000a [[ -f "$GFSFC_FILE" && -n "$GFSFC_FILE" ]] || fail "grid no file $GFSFC_FILE"\u000a print "ssfc2icos finished"\u000a\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # Prepare for second prep needed by second COMPARE_VAR run\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_1" ]]\u000a then\u000a for prepoutfile in $prepoutfiles\u000a do\u000a # Move prep output files to versions with special names for \u000a # comparison after second prep run\u000a mv -f $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "Cannot move $prepoutfile -> $prepoutfile.$COMPARE_VAR_NTASKS_1"\u000a done\u000a fi\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_2" ]]\u000a then\u000a # compare prep output files with first run \u000a # all the files in the $prepoutfiles list are expected to match\u000a for prepoutfile in $prepoutfiles\u000a do\u000a cmp -s $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "$prepoutfile does not match $prepoutfile.$COMPARE_VAR_NTASKS_1 after 2nd COMPARE_VAR prep run. Should it?"\u000a done\u000a # Restore original namelist file so humans looking in the fim \u000a # directory will see the correct number of tasks\u000a prevnl="$NLFILE.$COMPARE_VAR_NTASKS_2"\u000a # Save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE $prevnl"\u000a cp $orignl $NLFILE || fail "Cannot copy $orignl $NLFILE"\u000a fi\u000a fi\u000a done\u000afi # if [[ -d "$PREPDIR" ]]\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nprep finished\n"\u000a\u000areturn 0\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5191,177,71,1,'C:\cygwin\home\lynge\batchTemplate-fim','#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/fim. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-fim"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the fim directory\u000amkdir $FIM || fail "Cannot make directory $FIM"\u000a\u000a# If a pre-existing fim directory was identified, link its contents\u000aif [[ -d "$FIMDIR" ]]\u000athen\u000a linksafe $FIMDIR/* $FIM\u000aelse\u000a # Copy needed items\u000a if [[ -d "$PREPDIR" ]]\u000a then\u000a cp $fimnamelist $FIM/$NLFILE || fail "Cannot copy $fimnamelist -> $FIM/$NLFILE"\u000a else\u000a cp $PREP/$NLFILE $FIM || fail "Cannot copy $PREP/$NLFILE -> $FIM"\u000a fi\u000a cp $configurefile $FIM/configure_file || fail "Cannot copy $configurefile -> $FIM/configure_file"\u000a if [[ -f "$smsnamelist" ]]\u000a then\u000a cp $smsnamelist $FIM/SMSnamelist || fail "Cannot copy $smsnamelist -> $FIM/SMSnamelist"\u000a fi\u000a\u000a # Enter the fim directory\u000a cd $FIM || fail "Cannot cd to $FIM"\u000a\u000a # Link items\u000a linksafe $BINDIR/$FIMEXE\u000a\u000a# For ensemble runs, we previously overwrote these variables and need to restore them\u000aif [[ "$WFM" == "ENSEMBLE" ]]\u000athen\u000a sanlFile=$sanlFilename\u000a sfcanlFile=$sfcanlFilename\u000afi\u000a\u000a for file in $LATLON_FILE $GLVL_FILE $sanlFile gfsltln.dat gfsfc.dat theta_coor.txt dpsig.txt top_grid\u000a do\u000a linksafe $PREP/$file\u000a done\u000a\u000a # if COMPARE_VAR is enabled, link two DecompInfo*.dat files; else link only one\u000a for taskcount in $taskcounts\u000a do\u000a decompfile="$PREP/DecompInfo_$taskcount.dat"\u000a linksafe $decompfile\u000a done # for taskcount in $taskcounts\u000a\u000a export F_UFMTENDIAN="big:82"\u000a export FORT90L="-Wl,-T82"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:82"\u000a\u000a if [[ "$parallelism" == "serial" ]]\u000a then # serial run\u000a ./$FIMEXEBASE >stdout 2>&1 || fail "./$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a elif [[ "$parallelism" == "parallel" ]]\u000a then # parallel run\u000a # TODO generalize this by moving to a machine-specific script\u000a tw_str="1"\u000a # If write tasks are present, use tweak_hostfile to place write tasks and\u000a # compute root on separate nodes in various ways. Compute root gets its own\u000a # node. Allocate no more than max_write_tasks_per_node write tasks to each\u000a # write task node.\u000a if [[ "$WRITE_TASKS" -gt 0 ]]\u000a then\u000a n=$WRITE_TASKS\u000a while [[ "$n" -gt 0 ]]\u000a do\u000a test "$n" -ge "$mwtpn" && x="$mwtpn" || x=$n\u000a tw_str="$tw_str:$x"\u000a let "n=$n-$x"\u000a done\u000a fi\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # When COMPARE_VAR is enabled, set hostfile so first two MPI tasks \u000a # share the first host node. These will be used as "roots" of the two \u000a # task groups created by COMPARE_VAR. Putting them on the same node \u000a # as this script ensures that files created by this script will be \u000a # visible to both groups when fim executes. \u000a tw_str="2"\u000a fi\u000a #############################################\u000a # For the course we''re disabling tweak_hostfile to run fim root task and write\u000a # task on the same node as the rest of the fim tasks\u000a\u000a # TODO generalize this by moving to a machine-specific script\u000a #if [[ -n "$MACHINE_FILE" ]]\u000a #then\u000a # print "tweak_hostfile will operate on <$MACHINE_FILE>..."\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.orig || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.orig"\u000a # print "tweak_hostfile -s $tw_str"\u000a # tweak_hostfile -s $tw_str\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.new || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.new"\u000a #fi\u000a \u000a # For parallel runs:\u000a # Workflow Manager and *subfim should define MPIRUNCMD as follows for various architectures\u000a # Example Arch. MPIRUNCMD\u000a # SGE ''mpirun -np''\u000a # torque ''aprun -n''\u000a # intel ''mpiexec_mpt -n''\u000a # load-leveler* ''poe''\u000a # NCAR* ''mpirun.lsf /usr/local/bin/launch''\u000a # * no node count assigned\u000a\u000a # MPIRUNCMD *must* be defined: Fail if not\u000a test -z "$MPIRUNCMD" && fail "MPIRUNCMD not defined"\u000a # Calculate total cores to run on\u000a let "PES_ARG=$PES+$WRITE_TASKS" || fail "Arithmetic error"\u000a # Blank PES_ARG if our MPI run command doesn''t use it\u000a print "$MPIRUNCMD" | grep -q -e "poe" -e "^mpirun\.lsf" && PES_ARG=""\u000a # The exit status of some MPI run commands is unreliable, so disable trapping\u000a trap_off\u000a # Run FIM (PES_ARG may be blank)\u000a echo "$CONTEXT_NAME on host $(hostname) running: $MPIRUNCMD $PES_ARG ./$FIMEXEBASE" >stdout\u000a echo "Current directory is $PWD" >>stdout\u000a $MPIRUNCMD $PES_ARG ./$FIMEXEBASE >stdout 2>&1\u000a # Re-enable error trapping\u000a trap_on\u000a\u000a # Check for SMS completion message in stdout file\u000a grep ''SMS:: Program complete'' stdout || fail "$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a else # neither "serial" or "parallel" was specified\u000a fail "Parallelism error"\u000a fi # if serial/parallel\u000a\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a \u000afi # if [[ -d "$FIMDIR" ]]\u000a\u000acat stdout || fail "Cannot cat stdout"\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nDone with fim\n"\u000a\u000areturn 0\u000a','2010-07-16 15:03:43.828000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5200,175,75,1,'C:\cygwin\home\lynge\FIMnamelist',' &QUEUEnamelist\u000a ComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000a MaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000a SRCDIR = '''' ! FIM source location * MUST BE SET * [ WFM: use absolute pathname! ]\u000a PREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000a FIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000a DATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000a DATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a &TOPOnamelist\u000a topodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a &CNTLnamelist\u000a glvl = 6 ! Grid level\u000a SubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000a nvl = 64 ! Number of vertical levels\u000a/\u000a &PREPnamelist\u000a curve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000a NumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000a alt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a &DIAGnamelist\u000a PrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000a PrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000a PrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000a PrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a &MODELnamelist\u000a nts = 0 ! number of time steps\u000a WriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000a ReadRestart = .false. ! DISABLED True means start by reading a restart file\u000a RestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000a rleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000a rleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000a ptop = 50. ! pressure (Pa) at top of model domain\u000a thktop = 50. ! min.thknss of uppermost model layer\u000a intfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000a slak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000a veldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000a pure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a &PHYSICSnamelist\u000a PhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000a RadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000a GravityWaveDrag = .true. ! True means calculate gravity wave drag\u000a ras = .false. ! false means call SAS\u000a xkt2_scalar = 0.6 ! Can vary between 0 and 1\u000a charnock = 0.014 ! Can vary between 0.01 and 0.03\u000a num_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a &TIMEnamelist\u000a yyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a &OUTPUTnamelist\u000a numday = 5 ! number of integration days\u000a numhour = 0 ! number of integration hours\u000a OutputByHour = .true. ! True means output by hour, not step number.\u000a outpd = 6 ! output period in hours (or time steps)\u000a PrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000a TimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000a FixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a &WRITETASKnamelist\u000a num_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000a max_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a &DEBUGMSGnamelist\u000a debugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a! \u000a! Ning Wang, June 2007\u000a!\u000a &POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000a datadir = "../fim"\u000a outputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000a input = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000a output = ""\u000a! if output has content, it overwrites the outputdir\u000a output_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000a multiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000a gribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000a grid_id = 4 ! 228(144, 73), 45(288, 145), \u000a ! 3(360, 181), 4(720, 361); only for grib output file. \u000a mx = 720 ! only used by netcdf output file\u000a my = 360 ! only used by netcdf output file\u000a latlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000a is = 1 ! interpolation scheme:\u000a ! 0 -- no interpolation: native grid;\u000a ! 1 -- horizontal interpo. on native vertical coord.;\u000a ! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a ! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000a vres = 111 ! only used in vertical interpolation\u000a mode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000a var_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000a nsmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000a nvars = 12\u000a t1 = 0\u000a t2 = 120\u000a delta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000a max_run_time_prep=''00:05:00''\u000a max_run_time_fim=''00:30:00''\u000a max_run_time_pop=''00:15:00''\u000a batch_size=''3''\u000a ac_model_name=''FIMDC''\u000a anx_model_names=''GFS''\u000a stats_model_name=''FIM''\u000a sounding_model_name=''FIM''\u000a ncl_model_name=''EXPER FIM-6''\u000a ncl_diff_model_name=''FIM-FIMX''\u000a realtime=''F''\u000a rtfim_home=''/whome/rtfim''\u000a mpiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000a pe=''comp''\u000a cycle=''*''\u000a/\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5201,175,91,1,NULL,' 330 510 675 825 960 1080 1185 1275 1350 1410 \u000a1455 1485 1500 1500 1500 1500 1500 1500 1500 1500 \u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500\u000a----------------------------------------------------------\u000aother choices:\u000a\u000a 300 400 500 600 700 800 900 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000 1000 1000 1000 1000 1000 1000\u000a1000 1000 1000 1000\u000a\u000a 330 510 675 825 960 1080 1185 1275 1350 1410 \u000a1455 1485 1500 1500 1500 1500 1500 1500 1500 1500 \u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500 1500 1500 1500 1500 1500 1500\u000a1500 1500 1500 1500\u000a\u000a 250 500 650 800 950 1100 1250 1400 1550 1700 \u000a1850 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 2000 2000 2000 2000 2000 2000 \u000a2000 2000 2000 2000 \u000a\u000a 200 300 400 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500 500 500 500 500 500 500\u000a 500 500 500 500\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5202,175,92,1,NULL,' 224 232 240 245 250 255 260 265 270 273 \u000a 276 279 282 285 288 291 293 295 297 299 \u000a 301 303 305 307 309 311 313 315 317 319 \u000a 321 323 325 328 332 337 343 350 358 367 \u000a 377 388 400 413 427 443 462 485 513 547 \u000a 590 638 692 746 800 850 900 960 1030 1100 \u000a 1200 1350 1700 2200 \u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5203,175,76,1,'C:\cygwin\home\lynge\FIMnamelist',' &QUEUEnamelist\u000a ComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000a MaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000a SRCDIR = '''' ! FIM source location * MUST BE SET * [ WFM: use absolute pathname! ]\u000a PREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000a FIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000a DATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000a DATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a &TOPOnamelist\u000a topodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a &CNTLnamelist\u000a glvl = 6 ! Grid level\u000a SubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000a nvl = 64 ! Number of vertical levels\u000a/\u000a &PREPnamelist\u000a curve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000a NumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000a alt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a &DIAGnamelist\u000a PrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000a PrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000a PrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000a PrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a &MODELnamelist\u000a nts = 0 ! number of time steps\u000a WriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000a ReadRestart = .false. ! DISABLED True means start by reading a restart file\u000a RestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000a rleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000a rleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000a ptop = 50. ! pressure (Pa) at top of model domain\u000a thktop = 50. ! min.thknss of uppermost model layer\u000a intfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000a slak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000a veldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000a pure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a &PHYSICSnamelist\u000a PhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000a RadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000a GravityWaveDrag = .true. ! True means calculate gravity wave drag\u000a ras = .false. ! false means call SAS\u000a xkt2_scalar = 0.6 ! Can vary between 0 and 1\u000a charnock = 0.014 ! Can vary between 0.01 and 0.03\u000a num_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a &TIMEnamelist\u000a yyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a &OUTPUTnamelist\u000a numday = 5 ! number of integration days\u000a numhour = 0 ! number of integration hours\u000a OutputByHour = .true. ! True means output by hour, not step number.\u000a outpd = 6 ! output period in hours (or time steps)\u000a PrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000a TimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000a FixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a &WRITETASKnamelist\u000a num_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000a max_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a &DEBUGMSGnamelist\u000a debugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a! \u000a! Ning Wang, June 2007\u000a!\u000a &POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000a datadir = "../fim"\u000a outputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000a input = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000a output = ""\u000a! if output has content, it overwrites the outputdir\u000a output_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000a multiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000a gribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000a grid_id = 4 ! 228(144, 73), 45(288, 145), \u000a ! 3(360, 181), 4(720, 361); only for grib output file. \u000a mx = 720 ! only used by netcdf output file\u000a my = 360 ! only used by netcdf output file\u000a latlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000a is = 1 ! interpolation scheme:\u000a ! 0 -- no interpolation: native grid;\u000a ! 1 -- horizontal interpo. on native vertical coord.;\u000a ! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a ! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000a vres = 111 ! only used in vertical interpolation\u000a mode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000a var_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000a nsmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000a nvars = 12\u000a t1 = 0\u000a t2 = 120\u000a delta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000a max_run_time_prep=''00:05:00''\u000a max_run_time_fim=''00:30:00''\u000a max_run_time_pop=''00:15:00''\u000a batch_size=''3''\u000a ac_model_name=''FIMDC''\u000a anx_model_names=''GFS''\u000a stats_model_name=''FIM''\u000a sounding_model_name=''FIM''\u000a ncl_model_name=''EXPER FIM-6''\u000a ncl_diff_model_name=''FIM-FIMX''\u000a realtime=''F''\u000a rtfim_home=''/whome/rtfim''\u000a mpiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000a pe=''comp''\u000a cycle=''*''\u000a/\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5204,175,74,1,NULL,' &QUEUEnamelist\u000a ComputeTasks = '''' ! Number of compute tasks for FIM (S for Serial)\u000a MaxQueueTime = ''00:45:00'' ! Run time for complete job (HH:MM:SS) [ Ignored by WFM ]\u000a SRCDIR = '''' ! FIM source location * MUST BE SET * [ WFM: use absolute pathname! ]\u000a PREPDIR = ''nodir'' ! If exists, use for prep otherwise calculate prep\u000a FIMDIR = ''nodir'' ! If exists, use for FIM otherwise calculate FIM\u000a DATADIR = '''' ! Location of gfsltln.dat and global_mtnvar.t382\u000a DATADR2 = '''' ! Location of the sanl file and the sfcanl file\u000a/\u000a &TOPOnamelist\u000a topodatfile = ''/ptmp/hender/fimdata/wrf5mintopo.dat''\u000a/\u000a &CNTLnamelist\u000a glvl = 6 ! Grid level\u000a SubdivNum = 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 2 ! Subdivision numbers for each recursive refinement(2: bisection, 3: trisection, etc.)\u000a nvl = 64 ! Number of vertical levels\u000a/\u000a &PREPnamelist\u000a curve = 2 ! 0: ij order; 1: Hilbert curve order (only for all-bisection refinement); 2:ij block order\u000a NumCacheBlocksPerPE = 1 ! Number of cache blocks per processor. Only applies to ij block order\u000a alt_topo = .false. ! if true, use alternate srf.height field\u000a/\u000a &DIAGnamelist\u000a PrintIpnDiag = -1 ! ipn at which to print diagnostics (-1 means no print)\u000a PrintDiagProgVars = 12 ! Hourly increment to print diagnostic prognosis variables (-1=>none, 0=>every step)\u000a PrintDiagNoise = 1 ! Hourly increment to print diagnostic gravity wave noise (-1=>none, 0=>every step)\u000a PrintDiags = .false. ! True means print diagnostic messages\u000a/\u000a &MODELnamelist\u000a nts = 0 ! number of time steps\u000a WriteRestart = 9999 ! Hour (or time step) increment to write restart file\u000a ReadRestart = .false. ! DISABLED True means start by reading a restart file\u000a RestartFileName = ''fim_restart_000300'' ! Name of the restart file to be read\u000a rleigh_light = 0. ! rayleigh damping time scale (days^-1) if top-layer wind < 100 m/s\u000a rleigh_heavy = 0.2 ! rayleigh damping time scale (days^-1) if top-layer wind > 100 m/s\u000a ptop = 50. ! pressure (Pa) at top of model domain\u000a thktop = 50. ! min.thknss of uppermost model layer\u000a intfc_smooth = 0. ! diffusivity (m/s) for intfc smoothing (0 = no smoothing)\u000a slak = 1.0 ! intfc movement retardation coeff (1 = no retardation)\u000a veldff = 0. ! diffusion velocity (=diffusivity/mesh size)\u000a pure_sig = .false. ! if true, use pure sigma coord.\u000a/\u000a &PHYSICSnamelist\u000a PhysicsInterval = 180 ! Interval in seconds to call non-radiation physics (0=every step)\u000a RadiationInterval = 3600 ! Interval in seconds to call radiation physics (0=every step)\u000a GravityWaveDrag = .true. ! True means calculate gravity wave drag\u000a ras = .false. ! false means call SAS\u000a xkt2_scalar = 0.6 ! Can vary between 0 and 1\u000a charnock = 0.014 ! Can vary between 0.01 and 0.03\u000a num_p3d = 4 ! 4 means call Zhao/Carr/Sundqvist Microphysics\u000a/\u000a &TIMEnamelist\u000a yyyymmddhhmm = "200908060000" ! date of the model run\u000a/\u000a &OUTPUTnamelist\u000a numday = 5 ! number of integration days\u000a numhour = 0 ! number of integration hours\u000a OutputByHour = .true. ! True means output by hour, not step number.\u000a outpd = 6 ! output period in hours (or time steps)\u000a PrintMAXMINtimes = .true. ! True means print MAX MIN routine times, false means print for each PE\u000a TimingBarriers = .false. ! True means turn on timed barriers to measure task skew, set to .false. for production runs\u000a FixedGridOrder = .false. ! True: always output in the same order(IJ), False: order determined by curve. Does not apply to IJorder\u000a/\u000a! WRITETASKnamelist is used to optionally create a separate group of\u000a! FIM-specific write tasks to speed up FIM model output by overlapping disk\u000a! writes with computation. By default this feature is turned off. When enabled,\u000a! write tasks intercept FIM output and write to disk while the main compute\u000a! tasks continue with model computation. In NEMS lingo, write tasks are called\u000a! "quilt" tasks.\u000a!\u000a! WRITETASKnamelist is ignored for a serial run.\u000a!\u000a &WRITETASKnamelist\u000a num_write_tasks = 1 ! Use: 0 = no write tasks, 1 = one, 21 = one write task per output file\u000a max_write_tasks_per_node = 7 ! Maximum number of write tasks to place on a single node\u000a/\u000a &DEBUGMSGnamelist\u000a debugmsg_threshold = 0 ! Debug messages with priorities < threshold not printed (0=disable)\u000a/\u000a!\u000a! Namelist file for post processing\u000a! \u000a! Ning Wang, June 2007\u000a!\u000a &POSTnamelist\u000a!\u000a! input and output specifications:\u000a!\u000a datadir = "../fim"\u000a outputdir = "."\u000a! input = "/tg2/projects/fim/jlee/PREP/mdrag5h.dat"\u000a input = ""\u000a! if input has content, it overwrites the datadir\u000a! output = "/p72/fim/wang/nc_files/mdrag5h.nc"\u000a output = ""\u000a! if output has content, it overwrites the outputdir\u000a output_fmt = "grib" ! "nc" --netCDF file, "grib" --GRIB file\u000a multiple_output_files = 1 ! 1 -- multiple grib outputfiles.\u000a!\u000a! grid specifications:\u000a!\u000a gribtable = "fim_gribtable" ! only used by grib output file(s)\u000a! Brandon: or try 45\u000a grid_id = 4 ! 228(144, 73), 45(288, 145), \u000a ! 3(360, 181), 4(720, 361); only for grib output file. \u000a mx = 720 ! only used by netcdf output file\u000a my = 360 ! only used by netcdf output file\u000a latlonfld = 1 ! 1 -- create lat lon field in grib output file, 0 -- otherwise\u000a!\u000a! post processing specifications:\u000a!\u000a is = 1 ! interpolation scheme:\u000a ! 0 -- no interpolation: native grid;\u000a ! 1 -- horizontal interpo. on native vertical coord.;\u000a ! 2 -- horizontal interpo. + vertical interpo. on std. pressure levels;\u000a ! 3 -- horizontal interpo. + vertical interpo. on 10mb inc. pressure levels;\u000a vres = 111 ! only used in vertical interpolation\u000a mode = "linear" ! step or linear interpolation for vertical column\u000a!\u000a! variable specifications:\u000a!\u000a! var_list = "mp3d th3d us3d vs3d rn2d rc2d sw2d lw2d ts2d "\u000a var_list = "us3D vs3D up3P vp3P ph3D pr3D qv3D qw3D pw2D rn2D rc2D rg2D"\u000a nsmooth_var = 1 1 1 1 0 0 1 1 0 0 0 0\u000a nvars = 12\u000a t1 = 0\u000a t2 = 120\u000a delta_t = 6\u000a\u000a/\u000a\u000a! Everything below this line is of interest only to Workflow Manager users\u000a\u000a&WFMnamelist\u000a max_run_time_prep=''00:05:00''\u000a max_run_time_fim=''00:30:00''\u000a max_run_time_pop=''00:15:00''\u000a batch_size=''3''\u000a ac_model_name=''FIMDC''\u000a anx_model_names=''GFS''\u000a stats_model_name=''FIM''\u000a sounding_model_name=''FIM''\u000a ncl_model_name=''EXPER FIM-6''\u000a ncl_diff_model_name=''FIM-FIMX''\u000a realtime=''F''\u000a rtfim_home=''/whome/rtfim''\u000a mpiruncmd=''mpirun.lsf /usr/local/bin/launch''\u000a pe=''comp''\u000a cycle=''*''\u000a/\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5205,175,72,1,'C:\cygwin\home\lynge\batchTemplate-prep','#!/bin/ksh\u000a\u000a# NOTE: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/prep. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-prep"\u000a\u000a# When run in the WFM with ENSEMBLE, sets up an ensemble run\u000atest "$WFM" == "ENSEMBLE" && print "This is an ensemble run."\u000a\u000apwd\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000a# For the course, this will be here. Later, talk w/ Susan about where to put it\u000a# Update FIMnamelist with values from WFM\u000acp $NLFILE $FIM_HOME/FIMrun/FIMnamelist\u000aexport NPROC\u000aexport SRCDIR\u000aexport DATADIR\u000aexport DATADR2\u000aexport WRITE_TASKS\u000aexport FIM_HOME\u000a$FIM_HOME/FIMrun/nlfixup\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a#$SRCDIR/bin/GetNVL | read NVL_val || fail "Cannot execute $BINDIR/GetNVL"\u000a\u000a# Course temp\u000aecho "Moving Rainer files to their appropriate names"\u000acp $CONFIG_FILES_DIR/dpsig.txt $FIM_HOME/FIMrun/dpsig${NVL}.txt\u000acp $CONFIG_FILES_DIR/theta_coor.txt $FIM_HOME/FIMrun/theta_coor${NVL}.txt\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the prep directory\u000amkdir $PREP || fail "Cannot make directory $PREP"\u000a\u000a# If a pre-existing prep directory was identified, link its contents\u000aif [[ -d "$PREPDIR" ]]\u000athen\u000a test "$COMPARE_VAR_ON" == "true" && \\u000a fail "cannot use PREPDIR and COMPARE_VAR together"\u000a linksafe $PREPDIR/* $PREP\u000aelse\u000a # Copy/link needed items\u000a cp $fimnamelist $PREP/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $PREP/$NLFILE"\u000a cp $thetacoor $PREP/theta_coor.txt || \\u000a fail "Cannot copy $thetacoor -> $PREP/theta_coor.txt"\u000a cp $dpsig $PREP/dpsig.txt || \\u000a fail "Cannot copy $dpsig -> $PREP/dpsig.txt"\u000a cp $topgrid $PREP/top_grid || \\u000a fail "Cannot copy $topgrid -> $PREP/top_grid"\u000a test -d "$DATADIR" || fail "$DATADIR does not exist"\u000a test -d "$DATADR2" || fail "$DATADR2 does not exist"\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADIR/gfsltln.dat $PREP\u000a linksafe $DATADIR/global_mtnvar.t382 $PREP\u000a else\u000a cp $DATADIR/gfsltln.dat $PREP || \\u000a fail "Cannot copy $DATADIR/gfsltln.dat -> $PREP"\u000a cp $DATADIR/global_mtnvar.t382 $PREP || \\u000a fail "Cannot copy $DATADIR/global_mtnvar.t382 -> $PREP"\u000a fi\u000a if [[ -n "$WFM" ]]\u000a then\u000a if [[ "$WFM" == "ENSEMBLE" ]]\u000a then\u000a linksafe $sanlFile $PREP/$sanlFilename\u000a linksafe $sfcanlFile $PREP/$sfcanlFilename\u000a else\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a fi\u000a else\u000a if [[ "$TEST_SUITE_RUN" == "yes" ]]\u000a then\u000a linksafe $DATADR2/$sanlFile $PREP\u000a linksafe $DATADR2/$sfcanlFile $PREP\u000a else\u000a cp $DATADR2/$sanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sanlFile -> $PREP"\u000a cp $DATADR2/$sfcanlFile $PREP || \\u000a fail "Cannot copy $DATADR2/$sfcanlFile -> $PREP"\u000a fi\u000a fi\u000a\u000a\u000a#For the course, we''re only running one day at a time, so don''t do this\u000a # For WFM runs, set yyyymmddhhmm in the namelist file''s TIMEnamelist to the\u000a # value in WFM-exported environment variable yyyymmddhhmm.\u000a# if [[ -n "$WFM" ]]\u000a# then\u000a# $nlh $PREP/$NLFILE TIMEnamelist yyyymmddhhmm $yyyymmddhhmm || \\u000a# fail "Cannot set yyyymmddhhmm in $NLFILE"\u000a# fi\u000a\u000a # Enter the prep directory\u000a cd $PREP || fail "Cannot cd to $PREP"\u000a\u000a # Link files\u000a for file in grid ginfo getlvl ssfc2icos\u000a do\u000a linksafe $BINDIR/$file\u000a done\u000a\u000a # If COMPARE_VAR is enabled, use $prepoutfiles to list prep output files that \u000a # will be compared as a sanity check when prep is finished. \u000a test "$COMPARE_VAR_ON" == "true" && \\u000a prepoutfiles="$GFSFC_FILE $GLVL_FILE $INFO_FILE $GRID_FILE $LATLON_FILE"\u000a\u000a # If COMPARE_VAR is enabled, run prep twice using task counts \u000a # $COMPARE_VAR_NTASKS_1 and $COMPARE_VAR_NTASKS_2. \u000a # Otherwise run prep once using $PES for task count. \u000a for taskcount in $taskcounts\u000a do\u000a # grid\u000a ./grid || fail "grid failed"\u000a [[ -f "$GRID_FILE" && -n "$GRID_FILE" ]] || fail "grid no file $GRID_FILE"\u000a print "grid finished"\u000a\u000a # ginfo\u000a ./ginfo || fail "ginfo failed"\u000a [[ -f "$INFO_FILE" && -n "$INFO_FILE" ]] || fail "grid no file $INFO_FILE"\u000a print "ginfo finished"\u000a\u000a # getlvl\u000a ./getlvl || fail "getlvl failed"\u000a [[ -f "$GLVL_FILE" && -n "$GLVL_FILE" ]] || fail "grid no file $GLVL_FILE"\u000a print "getlvl finished"\u000a\u000a # ssfc2icos\u000a#TODO: These are machine-specific. Move them up into ?subfim scripts somehow. \u000a#TODO: Probably auto-generate script-bits and source here (yuck). \u000a export F_UFMTENDIAN="big:11,21"\u000a export FORT90L="-Wl,-T11,-T21"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:11,21"\u000a ./ssfc2icos || fail "ssfc2icos failed"\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a\u000a [[ -f "$GFSFC_FILE" && -n "$GFSFC_FILE" ]] || fail "grid no file $GFSFC_FILE"\u000a print "ssfc2icos finished"\u000a\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # Prepare for second prep needed by second COMPARE_VAR run\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_1" ]]\u000a then\u000a for prepoutfile in $prepoutfiles\u000a do\u000a # Move prep output files to versions with special names for \u000a # comparison after second prep run\u000a mv -f $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "Cannot move $prepoutfile -> $prepoutfile.$COMPARE_VAR_NTASKS_1"\u000a done\u000a fi\u000a if [[ "$taskcount" == "$COMPARE_VAR_NTASKS_2" ]]\u000a then\u000a # compare prep output files with first run \u000a # all the files in the $prepoutfiles list are expected to match\u000a for prepoutfile in $prepoutfiles\u000a do\u000a cmp -s $prepoutfile $prepoutfile.$COMPARE_VAR_NTASKS_1 || \\u000a fail "$prepoutfile does not match $prepoutfile.$COMPARE_VAR_NTASKS_1 after 2nd COMPARE_VAR prep run. Should it?"\u000a done\u000a # Restore original namelist file so humans looking in the fim \u000a # directory will see the correct number of tasks\u000a prevnl="$NLFILE.$COMPARE_VAR_NTASKS_2"\u000a # Save previous version first\u000a mv -f $NLFILE $prevnl || fail "Cannot move $NLFILE $prevnl"\u000a cp $orignl $NLFILE || fail "Cannot copy $orignl $NLFILE"\u000a fi\u000a fi\u000a done\u000afi # if [[ -d "$PREPDIR" ]]\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nprep finished\n"\u000a\u000areturn 0\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5206,175,71,1,'C:\cygwin\home\lynge\batchTemplate-fim','#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/fim. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-fim"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the fim directory\u000amkdir $FIM || fail "Cannot make directory $FIM"\u000a\u000a# If a pre-existing fim directory was identified, link its contents\u000aif [[ -d "$FIMDIR" ]]\u000athen\u000a linksafe $FIMDIR/* $FIM\u000aelse\u000a # Copy needed items\u000a if [[ -d "$PREPDIR" ]]\u000a then\u000a cp $fimnamelist $FIM/$NLFILE || fail "Cannot copy $fimnamelist -> $FIM/$NLFILE"\u000a else\u000a cp $PREP/$NLFILE $FIM || fail "Cannot copy $PREP/$NLFILE -> $FIM"\u000a fi\u000a cp $configurefile $FIM/configure_file || fail "Cannot copy $configurefile -> $FIM/configure_file"\u000a if [[ -f "$smsnamelist" ]]\u000a then\u000a cp $smsnamelist $FIM/SMSnamelist || fail "Cannot copy $smsnamelist -> $FIM/SMSnamelist"\u000a fi\u000a\u000a # Enter the fim directory\u000a cd $FIM || fail "Cannot cd to $FIM"\u000a\u000a # Link items\u000a linksafe $BINDIR/$FIMEXE\u000a\u000a# For ensemble runs, we previously overwrote these variables and need to restore them\u000aif [[ "$WFM" == "ENSEMBLE" ]]\u000athen\u000a sanlFile=$sanlFilename\u000a sfcanlFile=$sfcanlFilename\u000afi\u000a\u000a for file in $LATLON_FILE $GLVL_FILE $sanlFile gfsltln.dat gfsfc.dat theta_coor.txt dpsig.txt top_grid\u000a do\u000a linksafe $PREP/$file\u000a done\u000a\u000a # if COMPARE_VAR is enabled, link two DecompInfo*.dat files; else link only one\u000a for taskcount in $taskcounts\u000a do\u000a decompfile="$PREP/DecompInfo_$taskcount.dat"\u000a linksafe $decompfile\u000a done # for taskcount in $taskcounts\u000a\u000a export F_UFMTENDIAN="big:82"\u000a export FORT90L="-Wl,-T82"\u000a export XLFRTEOPTS="ufmt_littleendian=30"\u000a#JR added for gfortran\u000a export GFORTRAN_CONVERT_UNIT="big_endian:82"\u000a\u000a if [[ "$parallelism" == "serial" ]]\u000a then # serial run\u000a ./$FIMEXEBASE >stdout 2>&1 || fail "./$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a elif [[ "$parallelism" == "parallel" ]]\u000a then # parallel run\u000a # TODO generalize this by moving to a machine-specific script\u000a tw_str="1"\u000a # If write tasks are present, use tweak_hostfile to place write tasks and\u000a # compute root on separate nodes in various ways. Compute root gets its own\u000a # node. Allocate no more than max_write_tasks_per_node write tasks to each\u000a # write task node.\u000a if [[ "$WRITE_TASKS" -gt 0 ]]\u000a then\u000a n=$WRITE_TASKS\u000a while [[ "$n" -gt 0 ]]\u000a do\u000a test "$n" -ge "$mwtpn" && x="$mwtpn" || x=$n\u000a tw_str="$tw_str:$x"\u000a let "n=$n-$x"\u000a done\u000a fi\u000a if [[ "$COMPARE_VAR_ON" == "true" ]]\u000a then\u000a # When COMPARE_VAR is enabled, set hostfile so first two MPI tasks \u000a # share the first host node. These will be used as "roots" of the two \u000a # task groups created by COMPARE_VAR. Putting them on the same node \u000a # as this script ensures that files created by this script will be \u000a # visible to both groups when fim executes. \u000a tw_str="2"\u000a fi\u000a #############################################\u000a # For the course we''re disabling tweak_hostfile to run fim root task and write\u000a # task on the same node as the rest of the fim tasks\u000a\u000a # TODO generalize this by moving to a machine-specific script\u000a #if [[ -n "$MACHINE_FILE" ]]\u000a #then\u000a # print "tweak_hostfile will operate on <$MACHINE_FILE>..."\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.orig || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.orig"\u000a # print "tweak_hostfile -s $tw_str"\u000a # tweak_hostfile -s $tw_str\u000a # test -f "$MACHINE_FILE" && cp $MACHINE_FILE ./MACHINE_FILE__save.new || \\u000a # fail "Cannot copy $MACHINE_FILE -> ./MACHINE_FILE__save.new"\u000a #fi\u000a \u000a # For parallel runs:\u000a # Workflow Manager and *subfim should define MPIRUNCMD as follows for various architectures\u000a # Example Arch. MPIRUNCMD\u000a # SGE ''mpirun -np''\u000a # torque ''aprun -n''\u000a # intel ''mpiexec_mpt -n''\u000a # load-leveler* ''poe''\u000a # NCAR* ''mpirun.lsf /usr/local/bin/launch''\u000a # * no node count assigned\u000a\u000a # MPIRUNCMD *must* be defined: Fail if not\u000a test -z "$MPIRUNCMD" && fail "MPIRUNCMD not defined"\u000a # Calculate total cores to run on\u000a let "PES_ARG=$PES+$WRITE_TASKS" || fail "Arithmetic error"\u000a # Blank PES_ARG if our MPI run command doesn''t use it\u000a print "$MPIRUNCMD" | grep -q -e "poe" -e "^mpirun\.lsf" && PES_ARG=""\u000a # The exit status of some MPI run commands is unreliable, so disable trapping\u000a trap_off\u000a # Run FIM (PES_ARG may be blank)\u000a echo "$CONTEXT_NAME on host $(hostname) running: $MPIRUNCMD $PES_ARG ./$FIMEXEBASE" >stdout\u000a echo "Current directory is $PWD" >>stdout\u000a $MPIRUNCMD $PES_ARG ./$FIMEXEBASE >stdout 2>&1\u000a # Re-enable error trapping\u000a trap_on\u000a\u000a # Check for SMS completion message in stdout file\u000a grep ''SMS:: Program complete'' stdout || fail "$FIMEXEBASE failed"\u000a print "\n$FIMEXEBASE finished\n"\u000a else # neither "serial" or "parallel" was specified\u000a fail "Parallelism error"\u000a fi # if serial/parallel\u000a\u000a unset F_UFMTENDIAN\u000a unset FORT90L\u000a unset XLFRTEOPTS\u000a#JR added for gfortran\u000a unset GFORTRAN_CONVERT_UNIT\u000a \u000afi # if [[ -d "$FIMDIR" ]]\u000a\u000acat stdout || fail "Cannot cat stdout"\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\nDone with fim\n"\u000a\u000areturn 0\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MODEL_CONFIG_FILE VALUES(5207,175,73,1,'C:\cygwin\home\lynge\batchTemplate-post','#!/bin/ksh\u000a\u000a# Note: When run by Workflow Manager, this script''s output can be found in\u000a# FIMwfm/logs/pop. Also see FIMwfm/logs/workflow for general WFM messages.\u000a\u000aCONTEXT_NAME="batchTemplate-post"\u000a\u000a# The main batchTemplate wrapper script, which sets up the error-handling code,\u000a# is not not called by WFM, so WFM runs need to do that setup here.\u000atest -n "$WFM" && . $FIM_HOME/FIMrun/errhandler.ksh\u000aXTRACE_CONTEXT="$CONTEXT_NAME"\u000a\u000acp $FIM_HOME/FIMrun/FIMnamelist $NLFILE\u000a\u000a# For WFM runs, enter the appropriate FIMrun directory\u000aif [[ -n "$WFM" && -n "$FIM_HOME" ]]\u000athen\u000a cd $FIM_HOME/FIMrun || fail "Cannot cd to $FIM_HOME/FIMrun"\u000afi\u000a\u000a# Run batchTemplate-setup if it has not already been run\u000aif [[ -z "$batchTemplate_setup_ran" ]]\u000athen\u000a script="./batchTemplate-setup"\u000a XTRACE_CONTEXT="$script"\u000a . $script || fail "Problem sourcing $script"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000a unset script\u000afi\u000a\u000a# Enter the appropriate run directory (as defined by batchTemplate-setup)\u000aFIMRUN="$PWD"\u000acd $DIR || fail "Cannot cd to $DIR"\u000a\u000a# Make the post directory. For WFM runs, the post directory should already\u000a# exist except for the first incremental batch and mkdir''s -p option exits\u000a# with success if the directory already exists.\u000amkdir -p $POST || fail "Cannot make directory $POST"\u000a\u000a# Copy namelist from the appropriate fim directory\u000aif [[ -d "$FIMDIR" ]]\u000athen\u000a cp $fimnamelist $POST/$NLFILE || \\u000a fail "Cannot copy $fimnamelist -> $POST/$NLFILE"\u000aelse\u000a cp $FIM/$NLFILE $POST || fail "Cannot copy $FIM/$NLFILE -> $POST"\u000afi\u000a\u000acp $fimgribtable $POST/fim_gribtable || \\u000a fail "Cannot copy $fimgribtable $POST/fim_gribtable"\u000a\u000acp $reduceinput $POST/REDUCEinput || \\u000a fail "Cannot copy $reduceinput $POST/REDUCEinput"\u000a\u000a# Enter the post directory\u000acd $POST || fail "Cannot cd to $POST"\u000a\u000a# Link files\u000atest -f pop || linksafe $BINDIR/pop\u000atest -f reduce || linksafe $BINDIR/reduce\u000atest -f "$INFO_FILE" || linksafe $PREP/$INFO_FILE\u000a\u000aif [[ -n "$WFM" ]]\u000athen # do WFM post sequence\u000a XTRACE_CONTEXT="batchTemplate-postall"\u000a . $FIM_HOME/FIMrun/batchTemplate-postall || \\u000a fail "Problem running $FIM_HOME/FIMrun/batchTemplate-postall"\u000a XTRACE_CONTEXT="$CONTEXT_NAME"\u000aelse # do non-WFM pop\u000a ./pop || fail "pop failed"\u000afi\u000a\u000acd $FIMRUN || fail "Cannot cd to $FIMRUN"\u000a\u000aprint "\npop finished\n"\u000a\u000areturn 0\u000a','2010-07-16 15:07:44.312000000') INSERT INTO MCF_CONSOLIDATED VALUES(103,173,64,62) INSERT INTO MCF_CONSOLIDATED VALUES(104,173,68,66) INSERT INTO MCF_CONSOLIDATED VALUES(119,176,76,75) INSERT INTO MCF_CONSOLIDATED VALUES(120,176,74,75) INSERT INTO MCF_CONSOLIDATED VALUES(121,177,76,75) INSERT INTO MCF_CONSOLIDATED VALUES(122,175,76,75) INSERT INTO MCF_CONSOLIDATED VALUES(123,175,74,75) INSERT INTO TASK_DEFAULT VALUES(32,3,'WRF',32,NULL,1,'06:00','',3,1,NULL) INSERT INTO TASK_DEFAULT VALUES(33,3,'WRF',33,NULL,1,'06:00','',3,1,NULL) INSERT INTO TASK_DEFAULT VALUES(34,3,'WRF',34,NULL,1,'06:00','',3,1,NULL) INSERT INTO TASK_DEFAULT VALUES(35,3,'WRF',35,NULL,1,'06:00','',3,1,NULL) INSERT INTO TASK_DEFAULT VALUES(37,3,'FIM',37,NULL,128,'00:20','regular',3,1,'regular') INSERT INTO TASK_DEFAULT VALUES(38,3,'FIM',38,NULL,1,'00:03','share',3,1,'share') INSERT INTO TASK_DEFAULT VALUES(39,3,'FIM',39,NULL,2,'00:11','share',3,1,'share') INSERT INTO MODEL_TASK_DEP_TASK VALUES(20,960,959) INSERT INTO MODEL_TASK_DEP_TASK VALUES(21,961,960) INSERT INTO MODEL_TASK_DEP_TASK VALUES(22,962,961) INSERT INTO MODEL_TASK_DEP_TASK VALUES(34,969,970) INSERT INTO MODEL_TASK_DEP_TASK VALUES(35,971,969) INSERT INTO MODEL_TASK_DEP_TASK VALUES(36,972,973) INSERT INTO MODEL_TASK_DEP_TASK VALUES(37,966,967) INSERT INTO MODEL_TASK_DEP_TASK VALUES(38,968,966) INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(9,966,900,'&FIM_HOME;/FIMrun/fim_&GLVL;_&NVL;_&PES;_00/fim_C/stdout') INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(10,966,900,'&FIM_LOG;/fim/fim_C_.log') INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(11,969,900,'&FIM_HOME;/FIMrun/fim_&GLVL;_&NVL;_&PES;_00/fim_C/stdout') INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(12,969,900,'&FIM_LOG;/fim/fim_C_.log') INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(13,972,900,'&FIM_HOME;/FIMrun/fim_&GLVL;_&NVL;_&PES;_00/fim_C/stdout') INSERT INTO MODEL_TASK_HANG_DEP_FILE VALUES(14,972,900,'&FIM_LOG;/fim/fim_C_.log') INSERT INTO MODEL_METATASK VALUES('959',466,173,0) INSERT INTO MODEL_METATASK VALUES('960',467,173,1) INSERT INTO MODEL_METATASK VALUES('961',468,173,2) INSERT INTO MODEL_METATASK VALUES('962',469,173,3) INSERT INTO MODEL_METATASK VALUES('966',473,175,0) INSERT INTO MODEL_METATASK VALUES('967',474,175,1) INSERT INTO MODEL_METATASK VALUES('968',475,175,2) INSERT INTO MODEL_METATASK VALUES('969',476,176,0) INSERT INTO MODEL_METATASK VALUES('970',477,176,1) INSERT INTO MODEL_METATASK VALUES('971',478,176,2) INSERT INTO MODEL_METATASK VALUES('972',479,177,0) INSERT INTO MODEL_METATASK VALUES('973',480,177,1) INSERT INTO MODEL_METATASK VALUES('974',481,177,2) INSERT INTO MODEL_TASK_METATASK VALUES(511,959,32,466,173) INSERT INTO MODEL_TASK_METATASK VALUES(512,960,33,467,173) INSERT INTO MODEL_TASK_METATASK VALUES(513,961,34,468,173) INSERT INTO MODEL_TASK_METATASK VALUES(514,962,35,469,173) INSERT INTO MODEL_TASK_METATASK VALUES(553,966,37,473,175) INSERT INTO MODEL_TASK_METATASK VALUES(554,967,38,474,175) INSERT INTO MODEL_TASK_METATASK VALUES(555,968,39,475,175) INSERT INTO MODEL_TASK_METATASK VALUES(585,969,37,476,176) INSERT INTO MODEL_TASK_METATASK VALUES(586,970,38,477,176) INSERT INTO MODEL_TASK_METATASK VALUES(587,971,39,478,176) INSERT INTO MODEL_TASK_METATASK VALUES(591,972,37,479,177) INSERT INTO MODEL_TASK_METATASK VALUES(592,973,38,480,177) INSERT INTO MODEL_METATASK_VARIABLE VALUES(45,'t1',475,'000 006 012 018 024 030 036 042 048 054 060 066 072 078 084 090 096 102 108 114 120') INSERT INTO MODEL_METATASK_VARIABLE VALUES(46,'t2',475,'000 006 012 018 024 030 036 042 048 054 060 066 072 078 084 090 096 102 108 114 120') INSERT INTO MODEL_METATASK_VARIABLE VALUES(47,'t1',478,'000 006 012 018 024') INSERT INTO MODEL_METATASK_VARIABLE VALUES(48,'t2',478,'000 006 012 018 024') INSERT INTO MODEL_METATASK_VARIABLE VALUES(49,'t1',481,'000 006 012 018 024 030 036 042 048 054 060 066 072 078 084 090 096 102 108 114 120') INSERT INTO MODEL_METATASK_VARIABLE VALUES(50,'t2',481,'000 006 012 018 024 030 036 042 048 054 060 066 072 078 084 090 096 102 108 114 120') INSERT INTO DATABASE_VERSION VALUES(1,1.659999966621399E0) INSERT INTO USER_COMPUTER_DEFAULTS VALUES(3,3,1,'46660019',NULL,'/ptmp/lynge/FIM/FIMrun','External') #HSQL Database Engine 1.8.0.9 #Mon Jul 19 10:14:14 MDT 2010 hsqldb.script_format=0 runtime.gc_interval=0 sql.enforce_strict_size=false hsqldb.cache_size_scale=8 readonly=false hsqldb.nio_data_file=true hsqldb.cache_scale=14 version=1.8.0 hsqldb.default_table_type=memory hsqldb.cache_file_scale=1 hsqldb.log_size=200 modified=no hsqldb.cache_version=1.7.0 hsqldb.original_version=1.8.0 hsqldb.compatible_version=1.8.0