function [field_sst]=sst_load_field(rep_sst,suff_sst,pref_sst,ycur,hcur); %loads the fields and does the interpolation to the 1x1 ECCO grid domaine_global_def; mask=squeeze(tmask3D(:,:,1)); %typically: rep_sst='/net/ross/raid2/king/data_1x1_92-03/obs/'; pref_sst='SST_monthly_r2_'; suff_sst=''; %interpolate from the monthly field: % coeffs etc: dcur=ceil((hcur)/4); [mcur,mcurW]=coeff_MonthlyAtlasInterp(dcur); ycur2=[ycur ycur]; if ~isempty(find(mcur==1))&dcur>300; ycur2(find(mcur==1))=ycur+1; end; if ~isempty(find(mcur==12))&dcur<100; ycur2(find(mcur==12))=ycur-1; end; tmp1=find(ycur2==1991); ycur2(tmp1)=1992; mcur(tmp1)=1; tmp1=find(ycur2==2007); ycur2(tmp1)=2006; mcur(tmp1)=12; % load the two fields: fid=fopen([rep_sst pref_sst num2str(ycur2(1)) suff_sst],'r','b'); recl=jpi*jpj*4; position0=recl*(mcur(1)-1); status=fseek(fid,position0,'bof'); field1=fread(fid,[jpi jpj],'float32'); fclose(fid); field1(field1==0)=NaN; field1(field1<-1.9)=NaN; %accomodate various mask cases fid=fopen([rep_sst pref_sst num2str(ycur2(2)) suff_sst],'r','b'); recl=jpi*jpj*4; position0=recl*(mcur(2)-1); status=fseek(fid,position0,'bof'); field2=fread(fid,[jpi jpj],'float32'); fclose(fid); field2(field2==0)=NaN; field2(field2<-1.9)=NaN; %accomodate various mask cases % weighted average -> time interpolation field_sst=(1-mcurW)*field1+mcurW*field2; field_sst=field_sst.*mask;