Wednesday, March 23, 2005

Parameter space exploration in ROMS

Often, I find that I want to run roms over some set of parameters. The best way to do this is to make critical parameters dependent on the USER parameters in the roms.in file. I have written a program in python which does just this, automatically.



The program, pspace.py, creates a series of input files using all permutations of parameters specified in a parameter file. The program then runs the code using a user specified run line. Here is the text you see when you run pspace.py - -help


PSPACE runs a ROMS application over a series of parameters by modifying the
input file. Output file names are also changed to include the parameter
values of each particular run.

Usage: pspace [options] 〈base〉

Required argument 〈base〉 is the root of the input and output files.
Input, output, history, and other NetCDF output files are renamed in
a format like base_values.in or base_values_his.nc, where 'values' is
a string of parameters changed in the run separated by underscores.

Options are:
-b, - -basefile= Base input file, to be modified by parameters in
paramfile. Default is 'base.in'.

-e, - -execstr= Execution string, e.g.,

'nohup mpirun -np NP ./oceanM INFILE >& OUTFILE &'

values NP, INFILE, and OUTFILE are replaced with the
modified input file, output file. If present, NP is
replaced with NtileI*NtileJ.

-p, - -paramfile= Parameter file (default=base.param) with format:

VAR1:
value1
value2
VAR2:
value1 value2
value3 value4
[etc..]

-h, - -help Help

No comments:

Post a Comment