clear

%loaddap('http://iridl.ldeo.columbia.edu/expert/IRIONLY/ds:/SOURCES/.IRI/.FD/.ECHAM4p5/.Forecast/.ca_sst/.ensemble24/.MONTHLY/.t2m/Y/-15/15/RANGE/S/%281%20Oct%29VALUES/S/%281%20Oct%201960%29%281%20Oct%202001%29RANGE%5BM%5Daverage/L/3/runningAverage/L/3.5/VALUE/home/.tippett/.scratch/.na/.hindcasts/.obs/.t2m/Y/-60/80/RANGE/S/%281%20Oct%29VALUES/S/%281%20Oct%201960%29%281%20Oct%202001%29RANGE/L/3.5/VALUE/%28name%29%28obs%29def/:ds/dods')


%obs = squeeze(obs.obs);

loaddap('http://iridl.ldeo.columbia.edu/expert/SOURCES/.NOAA/.NCEP/.CPC/.GHCN_CAMS/.gridded/.deg0p5/.temp/T/3/runningAverage/T/%28Dec-Feb%29VALUES/T/%281960%29%282002%29RANGE/X/-20/2.5/340/GRID/Y/-60/2.5/80/GRID/dods')

obs = squeeze(temp.temp);
obs = permute(obs,[2,1,3]);

%loaddap('http://iridl.ldeo.columbia.edu/SOURCES/.UEA/.CRU/.TS2p1/.monthly/.mean/.temp/T/3/runningAverage/T/%28Dec-Feb%29VALUES/T/%281960%29%282002%29RANGE/X/-20/2./340/GRID/Y/-60/2/80/GRID/dods')

%obs = squeeze(temp.temp);
%obs = permute(obs,[2,1,3]);

[my,mx,nt] = size(obs);
y = reshape(obs,my*mx,nt);


loaddap('http://iridl.ldeo.columbia.edu/expert/ds:/SOURCES/.Indices/.nino/.EXTENDED/a:/.NINO34/T/3/runningAverage/T/%28Sep-Nov%29VALUES/T/%281960%29%282001%29RANGE/:a:/.NINO4/T/3/runningAverage/T/%28Sep-Nov%29VALUES/T/%281960%29%282001%29RANGE/:a:/.NINO3/T/3/runningAverage/T/%28Sep-Nov%29VALUES/T/%281960%29%282001%29RANGE/:a:/.NINO12/T/3/runningAverage/T/%28Sep-Nov%29VALUES/T/%281960%29%282001%29RANGE/:a/:ds/dods')

loaddap('http://iridl.ldeo.columbia.edu/expert/SOURCES/.Indices/.CPC_Indices/.NHTI/.NAO/T/3/runningAverage/T/%28Sep-Nov%29VALUES/T/%281960%29%282001%29RANGE/dods')

n12 = NINO12.NINO12';
n34 = NINO34.NINO34';
n4 = NINO4.NINO4';
n3 = NINO3.NINO3';
nao = squeeze(NAO.NAO)';

ninos = [n12-mean(n12) ; n3-mean(n3); n34-mean(n34) ; n4-mean(n4);];
ninos = [n34-mean(n34) ];


nn = 1;
x = [ones(1,nt);T';randn(nn,nt)];
x = [ones(1,nt);randn(2,nt)];
inds{1}=1;

for ii=2:(nn+2)
  inds{ii}=[1,ii];
  lbs{ii} = int2str(ii-1);
  lbs{ii} = 'noise';
end

inds={[1],[1,2],[1,2,3],[1,3]};

lbs{1} = 'CL';
lbs{2} = 'Noise';
lbs{3} = 'Noise';
lbs{4} = 'Noise+Noise';

make_pic=1;
casename='Noise3_DJF_t2m';
selection_core
