Home > custom > glimmer > glimmer_parameteric_uncertainty.m

glimmer_parameteric_uncertainty

PURPOSE ^

Usage: glimmer_parameteric_uncertainty(nstart,nend,conf,foutname,foutdir)

SYNOPSIS ^

function glimmer_parameteric_uncertainty(nstart,nend,conf,foutname,foutdir)

DESCRIPTION ^

 Usage: glimmer_parameteric_uncertainty(nstart,nend,conf,foutname,foutdir)
 Where: nstart and nend are the start and endnumbers of config files to create
        conf is the config file with default values (use
        get_glimmer_default_config())
        foutname is the base config file name, with n appended

 Purpose: this file creates a GLIMMER config file for use with gen_pdd_glide
 - parameters are varying for a parameteric sensitivity test
 - parameters are not varying over time!
 default values are read in from config and varied according to specify
 pdf

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

SOURCE CODE ^

0001 function glimmer_parameteric_uncertainty(nstart,nend,conf,foutname,foutdir)
0002 % Usage: glimmer_parameteric_uncertainty(nstart,nend,conf,foutname,foutdir)
0003 % Where: nstart and nend are the start and endnumbers of config files to create
0004 %        conf is the config file with default values (use
0005 %        get_glimmer_default_config())
0006 %        foutname is the base config file name, with n appended
0007 %
0008 % Purpose: this file creates a GLIMMER config file for use with gen_pdd_glide
0009 % - parameters are varying for a parameteric sensitivity test
0010 % - parameters are not varying over time!
0011 % default values are read in from config and varied according to specify
0012 % pdf
0013 
0014 %% generation parameters
0015 
0016 if ~exist('conf','var')
0017     conf=get_glimmer_default_config();
0018 end
0019 if exist('foutname','var')
0020     % check if extension is provided, delete and store it as ext
0021     % no yet implemented
0022     ext='.config';
0023 else
0024     foutdir='';
0025     foutname='gen_pdd';
0026     ext='.config';
0027 end
0028 %% get default parameters
0029 newconf=conf;
0030 %% Main file
0031 for c = nstart:nend
0032 %% vary MAAT (deviation from recent MAAT)
0033     % assumption: MAAT is normal distributed around the default value
0034     % global_mean_sl_temperature is assumed to give default, but is not used
0035     % in config, rather sstm_file is used together with input temp from nc
0036     % file
0037     temp = conf.Gen_pdd_climate.global_mean_sl_temperature;
0038     stdev = 1.5; % stddev in degCn
0039     temp=round(normrnd(temp,stdev)*100);
0040     tsfname=['sstm_',num2str(temp),'.txt'];
0041     newconf.Gen_pdd_climate.global_mean_sl_temperature=temp/100;
0042     newconf.Gen_pdd_climate.sstm_file_name=[tsfname];
0043     write_glimmer_ts([conf.time.tstart conf.time.tend newconf.Gen_pdd_climate.global_mean_sl_temperature],[foutdir,tsfname]);
0044 %% vary seasonal temp amplitude
0045     temp = conf.Gen_pdd_climate.global_sl_temperature_range;
0046     %temp = round(normrnd(temp,2)*100)/100;
0047     newconf.Gen_pdd_climate.global_sl_temperature_range = round(normrnd(temp,2)*100)/100;
0048 
0049 %% vary prec and precip range
0050     % assumption: precip is normal distributed around the default value
0051     % global_mean__precipitation is assumed to give default, but is not used
0052     % in config, rather pptm_file is used together with input precip from nc
0053     % file
0054     %temp = conf.Gen_pdd_climate.global_mean_precipitation;
0055     stdev = 0.15; % stddev in percent of local precip in m/a
0056     temp=1+round(normrnd(0,stdev)*100)/100;
0057     tsfname=['pptm_s',num2str(temp),'.txt'];
0058     newconf.Gen_pdd_climate.global_mean_precipitation=temp; % bug fixed: deleted div by 100, 3/10/07
0059     newconf.Gen_pdd_climate.pptm_file_name=[tsfname];
0060     write_glimmer_ts([conf.time.tstart conf.time.tend newconf.Gen_pdd_climate.global_mean_precipitation],[foutdir,tsfname]);
0061 
0062 %% vary lapse rate
0063     %default is -0.0065 from input file
0064     %use values mu -0.007, sigma 0.0010
0065     newconf.Gen_pdd_climate.global_lapse_rate=normrnd(-0.007,0.0010);
0066     
0067 %% vary flow factor
0068     %default is 1
0069     %mu 0.08 ; plus 1 , restricting to max of 5 resulting in distribution of 1 to max 5
0070     %temp = exprnd(0.8)+conf.parameters.flow_factor;
0071  
0072     % mu 0.1, sigme 0.36, lognormal distribution
0073     temp = lognrnd(0.1,0.36);
0074     temp(temp>5)=1;
0075     temp(temp<0.5)=1;
0076     newconf.parameters.flow_factor=temp;
0077 
0078 %% vary geothermal
0079     % draw from uniform distribution between 42 and 60 mW m-2
0080     newconf.parameters.geothermal=-(normrnd(49,7))/1000;
0081     
0082 %% vary snow threshold (gen_pdd_glide)
0083     temp=lognrnd(0.1,0.3);
0084     temp(temp>3)=1;
0085     temp(temp<0.5)=1;
0086     newconf.Gen_pdd_climate.snow_threshold=temp;
0087     
0088 %% vary basal traction max/const/slope
0089     % GLIMMER default is 0.0001
0090     % lognormal distribution with between mu 0.00001 and sigma 0.75,
0091     % divided by 1000
0092     temp=lognrnd(1e-005,0.75)/1000;
0093     newconf.parameters.basal_tract_max=temp;
0094     %newconf.parameters.basal_tract_slope=0.02;
0095 
0096 %% vary ice limit
0097     % integer drawn from uniform distribution 200:600
0098     newconf.parameters.ice_limit=round(unifrnd(200,600));
0099 
0100 %% vary marine limit (% check that marine margin has right parameter
0101     % does not apply
0102 
0103 %% vary PDDice
0104     % standard value of PPD_ice 0.008 is used as mu, with devation of 0,001
0105     % resulting in an effective range of between ~0.006-0.010
0106     newconf.GLIMMER_annual_pdd.pddfac_ice=normrnd(conf.GLIMMER_annual_pdd.pddfac_ice,0.001);
0107 %% vary PPDsnow
0108     % standard value of PPD_snow 0.003 is used as lower limit of an
0109     % exponential distribution with mu 0.001, resulting in an effective
0110     % range of between ~0.003-0.009, with major range between 0.3 and 0.6.
0111     newconf.GLIMMER_annual_pdd.pddfac_snow=exprnd(0.001)+conf.GLIMMER_annual_pdd.pddfac_snow;
0112 
0113 %% vary refreezing fraction
0114     % default value of wmax is used as mu for normal distribution with sigma
0115     % 0.065
0116     newconf.GLIMMER_annual_pdd.wmax=normrnd(conf.GLIMMER_annual_pdd.wmax,0.065);
0117 
0118 %% set filename
0119     newconf.CF_output(1).name=[foutname,num2str(c),'.nc'];
0120     newconf.CF_output2(1).name=[foutname,num2str(c),'_thk.nc'];
0121 %% write out file
0122     print_glimmer_conf(newconf,[foutdir,foutname,num2str(c),ext],['GLIMMER parametric uncertainty config file number ',num2str(c),' of ',num2str(nend)]);
0123 end

Generated on Tue 24-Feb-2009 19:14:50 by m2html © 2003