/[MITgcm]/MITgcm_contrib/ecco_utils/input_ecco_processing/code_nsidc/K_ice_load.m
ViewVC logotype

Annotation of /MITgcm_contrib/ecco_utils/input_ecco_processing/code_nsidc/K_ice_load.m

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


Revision 1.1 - (hide annotations) (download)
Tue Aug 16 18:58:04 2016 UTC (7 years, 9 months ago) by gforget
Branch: MAIN
CVS Tags: HEAD
- add C. King pre-processing codes.

1 gforget 1.1 function [x,y,obs]=K_ice_load(choiceData,year,month,day);
2     %choiceData = 51 or 79
3     %note the different formats for 51 and 79
4    
5     %/net/nares/raid11/gforget/2012mayInputs/seaice/nsidc_0051_nasateam/north/daily/2003/nt_20031231_f13_v01_n.bin
6    
7     dir0='/bay/scratch2/sea_ice/';
8     if ~isempty(whos('day'));
9     yyyymmdd=sprintf('%04i%02i%02i',year,month,day);
10     else;
11     yyyymmdd=sprintf('%04i%02i',year,month);
12     end;
13     %
14     if choiceData==51;
15     dir1=[dir0 'NSIDC0051_monthly/'];if~isempty(whos('day'));dir1=[dir0 'NSIDC0051_daily/'];end
16     filen=[dir1 '/nt_' yyyymmdd '_*_n.bin'];
17     files=[dir1 '/nt_' yyyymmdd '_*_s.bin'];
18     else;
19     dir1=[dir0 'NSIDC0079_monthly/'];if~isempty(whos('day'));dir1=[dir0 'NSIDC0079_daily/'];end
20     filen=[dir1 '/bt_' yyyymmdd '_*_n.bin'];
21     files=[dir1 '/bt_' yyyymmdd '_*_s.bin'];
22     end;
23     %
24     tmp1=dir(filen); filen=[dir1 tmp1.name];
25     tmp1=dir(files); files=[dir1 tmp1.name];
26    
27     global LATN LATS LONN LONS;
28     if isempty(LONN);
29     dirGrid=[dir0 '/NSIDC_grid/'];
30     fid=fopen([dirGrid 'psn25lats_v2.dat'],'r'); %ARCTIC
31     LATN=fread(fid,304*448,'long');LATN=LATN/100000;fclose(fid);
32     fid=fopen([dirGrid 'psn25lons_v2.dat'],'r');
33     LONN=fread(fid,304*448,'long');LONN=LONN/100000;fclose(fid);
34     fid=fopen([dirGrid 'pss25lats_v2.dat'],'r'); %ANTARCTIC
35     LATS=fread(fid,316*332,'long');LATS=LATS/100000;fclose(fid);
36     fid=fopen([dirGrid 'pss25lons_v2.dat'],'r');
37     LONS=fread(fid,316*332,'long');LONS=LONS/100000;fclose(fid);
38     end;
39    
40     if choiceData==51;
41     %filen='/bay/scratch2/sea_ice/NSIDC0051/nt_199609_f13_v01_n.bin';
42     fidn=fopen(filen,'r');
43     head=fread(fidn,300,'char');
44     OBSN=fread(fidn,304*448,'uchar');OBSN(OBSN>250)=NaN; % get rid of land, missing values
45     % OBSN(LATN>87.4671)=NaN; % bit around N pole
46     fclose(fidn);
47    
48     %files='/bay/scratch2/sea_ice/NSIDC0051/nt_199609_f13_v01_s.bin';
49     fids=fopen(files,'r');
50     head=fread(fids,300,'char');
51     OBSS=fread(fids,316*332,'uchar');OBSS(OBSS>250)=NaN;;
52     fclose(fids);
53    
54     OBSN=OBSN/250; OBSS=OBSS/250;
55     else;
56     %filen='/bay/scratch2/sea_ice/NSIDC0079/bt_199609_f13_v02_n.bin';
57     if(~exist(filen,'file'));filen='dummy';end
58     filen
59     fidn=fopen(filen,'r');
60     filen
61     OBSN=fread(fidn,304*448,'short');OBSN(OBSN>1000)=NaN; % get rid of land, missing values
62     fclose(fidn);
63    
64     %files='/bay/scratch2/sea_ice/NSIDC0079/bt_199609_f13_v02_s.bin';
65     files
66     if(~exist(files,'file'));filens='dummy';end
67     fids=fopen(files,'r');
68     files
69     OBSS=fread(fids,316*332,'short');OBSS(OBSS>1000)=NaN;;
70     fclose(fids);
71    
72     OBSN=OBSN/1e3; OBSS=OBSS/1e3;
73     end;
74    
75     %set edge points to 0 for extrapolation to behave later
76     OBSN=reshape(OBSN,[304 448]);
77     OBSN(1,:)=0; OBSN(end,:)=0; OBSN(:,1)=0; OBSN(:,end)=0;
78     OBSS=reshape(OBSS,[316 332]);
79     OBSS(1,:)=0; OBSS(end,:)=0; OBSS(:,1)=0; OBSS(:,end)=0;
80    
81     %assemble data
82     ii=find(~isnan(OBSN));
83     jj=find(~isnan(OBSS));
84     x=[LONN(ii);LONS(jj)];
85     y=[LATN(ii);LATS(jj)];
86     obs=[OBSN(ii);OBSS(jj)];
87    

  ViewVC Help
Powered by ViewVC 1.1.22