I have a tab separated model input file i would like to vary for ensemble analysis formatted such as this
cat input.txt
#############################################
### Parameter file for the program ###
#############################################
### GENERAL PARAMETERS
4 /* nbout # Number of outputs */
46 /* numesp # Number of species */
0.05 /* p # light incidence param (diff through turbid medium) */
0.1357158 0.2446549 0.3535940 0.4992873 0.6449806 0.6957850 0.7465893 0.8130218 0.8794543 0.9397271 1.0000000 0.9397271 0.8794543 0.8078294 0.7362045 0.6899817 0.6437589 0.5989616 0.5541642 0.4617186 0.3692730 0.3633708 0.3574686 0.2426215 /* normalized daily light course (from 7am to 7pm, with a half-hour time-step */
1 /* vox_la_max. The max voxel leaf area. */
0 /* l_growth_scheme. 0 = top down; 1 = random; 2 = homogeneous; 3 = bottom up */
0.1 /* knockout_max. Parameter controlling the extent to which lianas can knock out trees */
0.05 /* shed_prob. With this probability, the liana is completely shed from the voxel. */
### Species description
**** Nmass LMA wsg dmax hmax ah tmax seedmass Fregdistgr Pmass g1 s_liana
Alvaradoa_amorphoides 0.0214 74.775 0.584 0.5 24.44 0.892 1 0.0078 40 0.00145 3.77 0
Annona_reticulata 0.0350 74.529 0.503 0.5 24.44 0.892 1 0.2392 40 0.00142 3.77 0
Brosimum_alicastrum 0.0201 104.281 0.760 0.5 17.31 0.117 1 1.2486 40 0.00097 3.77 0
### Climate (input environment)
25.47447 26.02723 26.87827 27.58436 26.95839 25.63987 25.61669 25.26543 24.99990 24.10808 24.71997 24.67287 /*Temperature in degree C*/
I have another tab separated file of multipliers selected from a distribution formatted such as this
cat multipliers.txt
2 3 4
3 2 2
4 3 3
I am trying to multiply 3 specific input fields by multipliers to generate a series of new input files equal to the number of multipliers (in this case 3), while leaving the rest of the input file unchanged. In this scenario, I would like to multiply vox_la_max,knockout_max, and shed_prob by 2, 3, and 4 respectively for the first file, 3, 2, and 2 for the second file, and 4, 3, and 3 for the third. I would have 3 new files generated such as this
cat input1.txt
#############################################
### Parameter file for the program ###
#############################################
### GENERAL PARAMETERS
4 /* nbout # Number of outputs */
46 /* numesp # Number of species */
0.05 /* p # light incidence param (diff through turbid medium) */
0.1357158 0.2446549 0.3535940 0.4992873 0.6449806 0.6957850 0.7465893 0.8130218 0.8794543 0.9397271 1.0000000 0.9397271 0.8794543 0.8078294 0.7362045 0.6899817 0.6437589 0.5989616 0.5541642 0.4617186 0.3692730 0.3633708 0.3574686 0.2426215 /* normalized daily light course (from 7am to 7pm, with a half-hour time-step */
2 /* vox_la_max. The max voxel leaf area. */
0 /* l_growth_scheme. 0 = top down; 1 = random; 2 = homogeneous; 3 = bottom up */
0.3 /* knockout_max. Parameter controlling the extent to which lianas can knock out trees */
0.2 /* shed_prob. With this probability, the liana is completely shed from the voxel. */
### Species description
**** Nmass LMA wsg dmax hmax ah tmax seedmass Fregdistgr Pmass g1 s_liana
Alvaradoa_amorphoides 0.0214 74.775 0.584 0.5 24.44 0.892 1 0.0078 40 0.00145 3.77 0
Annona_reticulata 0.0350 74.529 0.503 0.5 24.44 0.892 1 0.2392 40 0.00142 3.77 0
Brosimum_alicastrum 0.0201 104.281 0.760 0.5 17.31 0.117 1 1.2486 40 0.00097 3.77 0
### Climate (input environment)
25.47447 26.02723 26.87827 27.58436 26.95839 25.63987 25.61669 25.26543 24.99990 24.10808 24.71997 24.67287 /*Temperature in degree C*/
cat input2.txt
#############################################
### Parameter file for the program ###
#############################################
### GENERAL PARAMETERS
4 /* nbout # Number of outputs */
46 /* numesp # Number of species */
0.05 /* p # light incidence param (diff through turbid medium) */
0.1357158 0.2446549 0.3535940 0.4992873 0.6449806 0.6957850 0.7465893 0.8130218 0.8794543 0.9397271 1.0000000 0.9397271 0.8794543 0.8078294 0.7362045 0.6899817 0.6437589 0.5989616 0.5541642 0.4617186 0.3692730 0.3633708 0.3574686 0.2426215 /* normalized daily light course (from 7am to 7pm, with a half-hour time-step */
3 /* vox_la_max. The max voxel leaf area. */
0 /* l_growth_scheme. 0 = top down; 1 = random; 2 = homogeneous; 3 = bottom up */
0.2 /* knockout_max. Parameter controlling the extent to which lianas can knock out trees */
0.1 /* shed_prob. With this probability, the liana is completely shed from the voxel. */
### Species description
**** Nmass LMA wsg dmax hmax ah tmax seedmass Fregdistgr Pmass g1 s_liana
Alvaradoa_amorphoides 0.0214 74.775 0.584 0.5 24.44 0.892 1 0.0078 40 0.00145 3.77 0
Annona_reticulata 0.0350 74.529 0.503 0.5 24.44 0.892 1 0.2392 40 0.00142 3.77 0
Brosimum_alicastrum 0.0201 104.281 0.760 0.5 17.31 0.117 1 1.2486 40 0.00097 3.77 0
### Climate (input environment)
25.47447 26.02723 26.87827 27.58436 26.95839 25.63987 25.61669 25.26543 24.99990 24.10808 24.71997 24.67287 /*Temperature in degree C*/
cat input3.txt
#############################################
### Parameter file for the program ###
#############################################
### GENERAL PARAMETERS
4 /* nbout # Number of outputs */
46 /* numesp # Number of species */
0.05 /* p # light incidence param (diff through turbid medium) */
0.1357158 0.2446549 0.3535940 0.4992873 0.6449806 0.6957850 0.7465893 0.8130218 0.8794543 0.9397271 1.0000000 0.9397271 0.8794543 0.8078294 0.7362045 0.6899817 0.6437589 0.5989616 0.5541642 0.4617186 0.3692730 0.3633708 0.3574686 0.2426215 /* normalized daily light course (from 7am to 7pm, with a half-hour time-step */
4 /* vox_la_max. The max voxel leaf area. */
0 /* l_growth_scheme. 0 = top down; 1 = random; 2 = homogeneous; 3 = bottom up */
0.3 /* knockout_max. Parameter controlling the extent to which lianas can knock out trees */
0.15 /* shed_prob. With this probability, the liana is completely shed from the voxel. */
### Species description
**** Nmass LMA wsg dmax hmax ah tmax seedmass Fregdistgr Pmass g1 s_liana
Alvaradoa_amorphoides 0.0214 74.775 0.584 0.5 24.44 0.892 1 0.0078 40 0.00145 3.77 0
Annona_reticulata 0.0350 74.529 0.503 0.5 24.44 0.892 1 0.2392 40 0.00142 3.77 0
Brosimum_alicastrum 0.0201 104.281 0.760 0.5 17.31 0.117 1 1.2486 40 0.00097 3.77 0
### Climate (input environment)
25.47447 26.02723 26.87827 27.58436 26.95839 25.63987 25.61669 25.26543 24.99990 24.10808 24.71997 24.67287 /*Temperature in degree C*/
I think I should be using awk, but have only been successful at varying one parameter with a one-column multipliers file at a time so far, and I need to be able to vary these 3 parameters simultaneously. What sort of script could I set up to generate these outputs?
multipliers.txt? And isinput.txtjust that or does it contain several models, all to undergo the same multipliers?multipliers.txtis 1000 rows and 3 columns of numeric values. The actualinput.txthas many more parameters. In this example,vox_la_max,knockout_max, andshed_probare on lines 9, 11, and 12. In the actual file they are on lines 36, 38, and 39. It is the parameter file for a single ecosystem model