/[MITgcm]/MITgcm_contrib/gael/bulkMatlab/sst_load_field.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/bulkMatlab/sst_load_field.m

Parent Directory Parent Directory | Revision Log Revision Log | View Revision Graph Revision Graph


Revision 1.1 - (hide annotations) (download)
Tue Feb 19 21:28:59 2008 UTC (17 years, 4 months ago) by gforget
Branch: MAIN
CVS Tags: HEAD
matlab script to compute bulk formulae forcing etc.

1 gforget 1.1 function [field_sst]=sst_load_field(rep_sst,suff_sst,pref_sst,ycur,hcur);
2     %loads the fields and does the interpolation to the 1x1 ECCO grid
3     domaine_global_def;
4    
5     mask=squeeze(tmask3D(:,:,1));
6    
7     %typically: rep_sst='/net/ross/raid2/king/data_1x1_92-03/obs/'; pref_sst='SST_monthly_r2_'; suff_sst='';
8    
9     %interpolate from the monthly field:
10     % coeffs etc:
11     dcur=ceil((hcur)/4); [mcur,mcurW]=coeff_MonthlyAtlasInterp(dcur);
12     ycur2=[ycur ycur];
13     if ~isempty(find(mcur==1))&dcur>300; ycur2(find(mcur==1))=ycur+1; end;
14     if ~isempty(find(mcur==12))&dcur<100; ycur2(find(mcur==12))=ycur-1; end;
15     tmp1=find(ycur2==1991); ycur2(tmp1)=1992; mcur(tmp1)=1;
16     tmp1=find(ycur2==2007); ycur2(tmp1)=2006; mcur(tmp1)=12;
17     % load the two fields:
18     fid=fopen([rep_sst pref_sst num2str(ycur2(1)) suff_sst],'r','b');
19     recl=jpi*jpj*4; position0=recl*(mcur(1)-1); status=fseek(fid,position0,'bof');
20     field1=fread(fid,[jpi jpj],'float32'); fclose(fid);
21     field1(field1==0)=NaN; field1(field1<-1.9)=NaN; %accomodate various mask cases
22     fid=fopen([rep_sst pref_sst num2str(ycur2(2)) suff_sst],'r','b');
23     recl=jpi*jpj*4; position0=recl*(mcur(2)-1); status=fseek(fid,position0,'bof');
24     field2=fread(fid,[jpi jpj],'float32'); fclose(fid);
25     field2(field2==0)=NaN; field2(field2<-1.9)=NaN; %accomodate various mask cases
26     % weighted average -> time interpolation
27     field_sst=(1-mcurW)*field1+mcurW*field2;
28     field_sst=field_sst.*mask;
29    
30    

  ViewVC Help
Powered by ViewVC 1.1.22