<html dir="ltr">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
<style id="owaParaStyle" type="text/css">P {margin-top:0;margin-bottom:0;}</style>
</head>
<body ocsi="0" fpstyle="1">
<div style="direction: ltr;font-family: Tahoma;color: #000000;font-size: 10pt;">Hi<br>
<br>
I have managed to sub-sample 39 models using the generate_sample_indices function.<br>
<br>
I just have a question about how I can do 50 iterations of this to obtain different models for each time I sub-sample.<br>
<br>
I think I need to use a do loop but I am not sure as to what the syntax should be in my code as I have a loop already to loop through the different number of models I sub-sample.<br>
<br>
Below is my code currently that is working for just 1 iteration.<br>
<br>
I have commented out the attempt at adding the addition iterations loop.<br>
<br>
Many thanks!<br>
<br>
Kind Regards<br>
Melissa<br>
<br>
; ==============================================================<br>
; sub-sampling_1.ncl<br>
; ==============================================================<br>
<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_code.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/gsn_csm.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/contributed.ncl&quot;<br>
load &quot;$NCARG_ROOT/lib/ncarg/nclscripts/csm/shea_util.ncl&quot;<br>
load &quot;./generate_sample_indices.ncl&quot;<br>
<br>
begin<br>
&nbsp;<br>
model = (/&quot;ACCESS1-0&quot;, &quot;ACCESS1-3&quot;, &quot;bcc-csm1-1&quot;, &quot;CanESM2&quot;, &quot;CCSM4&quot;, &quot;CESM1-BGC&quot;, &quot;CESM1-CAM5&quot;, &quot;CMCC-CM&quot;, &quot;CMCC-CMS&quot;, &quot;CNRM-CM5&quot;, &quot;CSIRO-Mk3-6-0&quot;, &quot;EC-EARTH&quot;, &quot;FGOALS-g2&quot;, &quot;FIO-ESM&quot;,&quot;GFDL-CM3&quot;, &quot;GFDL-ESM2G&quot;, &quot;GFDL-ESM2M&quot;, &quot;GISS-E2-H_p1&quot;, &quot;GISS-E2-H_p2&quot;, &quot;GISS-E2-H_p3&quot;,
 &quot;GISS-E2-R_p1&quot;, &quot;GISS-E2-R_p2&quot;, &quot;GISS-E2-R_p3&quot;, &quot;HadGEM2-AO&quot;, &quot;HadGEM2-CC&quot;, &quot;HadGEM2-ES&quot;, &quot;inmcm4&quot;, &quot;IPSL-CM5A-LR&quot;, &quot;IPSL-CM5A-MR&quot;, &quot;IPSL-CM5B-LR&quot;,&quot;MIROC5&quot;, &quot;MPI-ESM-LR&quot;, &quot;MPI-ESM-MR&quot;, &quot;MRI-CGCM3&quot;, &quot;NorESM1-ME&quot;, &quot;NorESM1-M&quot;/)<br>
<br>
nmodels = (/1,2,3,4,5,6,7,8,9,10,11,12,13,14,15,16,17,18,19,20,21,22,23,24,25,26,27,28,29,30,31,32,33,34,35,36,37,38,39/)<br>
<br>
samplesize = (/5,10,15,20,25,30,35/)<br>
ntimes = 50<br>
<br>
<br>
printVarSummary(samplesize)<br>
<br>
Smean = new(7,&quot;float&quot;)<br>
Stdand = new(7,&quot;float&quot;)<br>
Srange = new(7,&quot;float&quot;)<br>
S25 = new(7,&quot;float&quot;)<br>
S75 = new(7,&quot;float&quot;)<br>
Smedian = new(7,&quot;float&quot;)<br>
;stat = new(7,&quot;float&quot;)<br>
<br>
dPDJF = asciiread(&quot;pr_ens_percent_change_boxplot_DJF.txt&quot;,39,&quot;float&quot;)<br>
<br>
&nbsp;printVarSummary(dPDJF) <br>
&nbsp;print(dPDJF)&nbsp;&nbsp;&nbsp;&nbsp; ; Print the values<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;do it=0, ntimes-1<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; do ni=0,6<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sdPDJF = dPDJF(generate_sample_indices(samplesize(ni),0))<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; dimt = dimsizes(sdPDJF)&nbsp;&nbsp; ; should be 5,10,15,20,25,30,35<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x25&nbsp; = round(.25*dimt,3)-1&nbsp;&nbsp;&nbsp;&nbsp; ; -1 to account for NCL indexing starting<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; x75&nbsp; = round(.75*dimt,3)-1&nbsp;&nbsp;&nbsp;&nbsp; ; at 0 <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; printVarSummary(sdPDJF)<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;opt = True<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;opt@PrintStat = True<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;stat(ni) = stat_dispersion(sdPDJF,opt)<br>
<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Smean(ni) = avg(sdPDJF)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Stdand(ni) = stddev(sdPDJF)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Srange(ni) = max(sdPDJF)-min(sdPDJF) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S25(ni) = sdPDJF(x25) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; S75(ni) = sdPDJF(x75)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; Smedian(ni) = dim_median(sdPDJF) <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(Smean)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(Stdand)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(Srange)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(S25)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(S75)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; print(Smedian)<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; delete(sdPDJF)<br>
&nbsp;&nbsp;&nbsp;&nbsp; <br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; end do<br>
&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ;end do<br>
end<br>
</div>
</body>
</html>