function []=testrun()

	VAR_TO_RUN = [5];
	MODEL_NUM = 5;
	EXP_NUM = 4;
	HIST_NUM = ' '; % used for write and get_curvilinear_rcmdata
	outputdir = '/';
	writehistorical = 0; % 1 == save file
	writefuture = 0; % 1 == save file
	CMIP_NUM = 'cmip5';
	sdmode = ''; % does nothing

	
	[outputdir,method_name,region_string,MODEL_NAME,EXP_NAME,HIST_NAME,VAR_NAME,VAR_MULT_OR_ADD,...
	OBS_COARSE_DIR,OBS_FINE_DIR,GCM_DIR,...
	COARSE_XX,COARSE_YY,...
	FINE_XX_TARGET,FINE_YY_TARGET,HISTORICAL_YEARS,FUTURE_YEARS,...
    EA_YR_WINDOW,EA_DAY_WINDOW,...
    BC_SEMI_DAY_WINDOW_MULT,BC_SEMI_DAY_WINDOW_ADD,...
    MACA_SEMI_DAY_WINDOW,MACA_NUM_BEST_MODELS,GRID_CHUNK_PTS,units,...
	RSDS_DIR,BC_MAX_PR_RATIO,EA_VARIABLES,DRY_DAY_THRES_COARSE,DRY_DAY_THRES_FINE,...
	VAR_OF_PREC,ERRORYES]=...
		parameters(5,4,5,'/', 'cmip5');

	
	dp = ncread('9by10_pnnl.nc', 'PREC');
	dc = ncread('9by10_ccsm4.nc', 'PREC');
	xs = ncread('9by10_ccsm4.nc', 'x');
	ys = ncread('9by10_ccsm4.nc', 'y');

	dp = permute(dp, [4,3,1,2]);
	dc = permute(dc, [4,3,1,2]);

	
	obsdataFine = dp;
	gcmdataFine = dc;


	FINE_XX = xs'; % Not even used
	FINE_YY = ys'; % Not even used
	NUM_FINE_XX = size(FINE_XX,2);
	NUM_FINE_YY = size(FINE_YY,2);
	HISTORICAL_YEAR = [1970:1999];
	FUTURE_YEARS = [2000:2099];
	FUTURE_REF_YEAR = min(FUTURE_YEARS);
	HISTORICAL_YEAR_INDICES = (HISTORICAL_YEARS - min(HISTORICAL_YEARS) + 1);
	FUTURE_YEAR_INDICES = (FUTURE_YEARS - FUTURE_REF_YEAR + 1) + max(HISTORICAL_YEAR_INDICES);
	VAR_MULT_OR_ADD = [0;0;0;0;1;0;0;0;1;1;];
	kk = 5;
	BC_SEMI_DAY_WINDOW_MULT = 15;
	BC_SEMI_DAY_WINDOW_ADD = 15;
	BC_MAX_PR_RATIO =  5.0;
	CUTOFF = 0.0039;
	DRY_DAY_THRES_FINE = CUTOFF * 25.4;
  
    
  [gcmdataFine(:,:,:,:)]=get_bias_correction_100percentiles(obsdataFine,gcmdataFine, ...
							    FINE_XX,FINE_YY,NUM_FINE_XX,NUM_FINE_YY,...
							    HISTORICAL_YEAR_INDICES,FUTURE_YEAR_INDICES,...
							    VAR_MULT_OR_ADD(kk),kk,...
							    BC_SEMI_DAY_WINDOW_MULT,BC_SEMI_DAY_WINDOW_ADD,...
							    BC_MAX_PR_RATIO,DRY_DAY_THRES_FINE);

	size(gcmdataFine)
	
	
	out = '9by10_cmp.nc';
	ncwrite(out, 'PREC', permute(gcmdataFine, [3,4,2,1]));

	

	

	
	
%[FULL_FINE_XX,FULL_FINE_YY,X_ranges,Y_ranges]=break_curvilinear_grid(OBS_FINE_DIR,FINE_XX_TARGET,FINE_YY_TARGET,GRID_CHUNK_PTS,1);






%[gcmdataFine(:,:,:,:)]=get_bias_correction_100percentiles(
%	obsdataFine -> dataobs
%	gcmdataFine -> datagcm
%	FINE_XX -> XX
%	FINE_YY -> YY
%	NUM_FINE_XX -> NUM_XX
%	NUM_FINE_YY -> NUM_YY
%	HISTORICAL_YEAR_INDICES -> HISTORICAL_YEAR_INDICES
%	FUTURE_YEAR_INDICES -> FUTURE_YEAR_INDICES
%	VAR_MULT_OR_ADD(kk) -> bc_mult_or_add
%	kk -> var
%	BC_SEMI_DAY_WINDOW_MULT -> BC_SEMI_DAY_WINDOW_MULT
%	BC_SEMI_DAY_WINDOW_ADD -> BC_SEMI_DAY_WINDOW_ADD
%	BC_MAX_PR_RATIO -> BC_MAX_PR_RATIO
%	DRY_DAY_THRES_FINE -> DRY_DAY_THRES

%biascorrect_parfor_function_100percentiles(
%	dataobs(:,:,:,j) -> temp_dataobs
%	datagcm(:,:,:,j) -> temp_datagcm
%	XX(j) -> temp_XX
%	YY -> YY
%	NUM_YY -> NUM_YY
%	DAYS -> DAYS
%	YEARS -> YEARS
%	HISTORICAL_YEAR_INDICES -> HISTORICAL_YEAR_INDICES
%	FUTURE_YEAR_INDICES -> FUTURE_YEAR_INDICES
%	bc_mult_or_add -> bc_mult_or_add
%	var -> var
%	BC_SEMI_DAY_WINDOW_MULT -> BC_SEMI_DAY_WINDOW_MULT
%	BC_SEMI_DAY_WINDOW_ADD -> BC_SEMI_DAY_WINDOW_ADD
%	BC_MAX_PR_RATIO -> BC_MAX_PR_RATIO
%	DRY_DAY_THRES -> DRY_DAY_THRES

%biascorrect_window_100percentiles(
%	temp_dataobs(:,:,i) -> obsdata
%	temp_datagcm(:,:,i) -> gcmdata
%	bc_mult_or_add -> bc_mult_or_add
%	YY(i) -> lat
%	temp_XX -> lon
%	HISTORICAL_YEAR_INDICES -> HISTORICAL_YEAR_INDICES
%	FUTURE_YEAR_INDICES -> FUTURE_YEAR_INDICES
%	var -> var
%	BC_SEMI_DAY_WINDOW_MULT -> BC_SEMI_DAY_WINDOW_MULT
%	BC_SEMI_DAY_WINDOW_ADD -> BC_SEMI_DAY_WINDOW_ADD
%	BC_MAX_PR_RATIO -> BC_MAX_PR_RATIO
%	DRY_DAY_THRES -> DRY_DAY_THRES


%bias_correction_100percentiles(
%	obsdata(dayWindow,:) -> obsdat_temp
%    gcmdata(dayWindow,HISTORICAL_YEAR_INDICES) -> gcm_temp
%	gcmdata(dayWindow,FUTURE_YEAR_INDICES) -> gcm_f_temp
%	bc_mult_or_add -> bc_mult_or_add
%	var -> var
%	DRY_DAY_THRES -> DRY_DAY_THRES
%	calendarDays -> calendarDays
%	BC_MAX_PR_RATIO -> BC_MAX_PR_RATIO
	

	
	
	
	
	
	
