/[MITgcm]/MITgcm_contrib/gael/matlab_class/gcmfaces_IO/process2UEVN.m
ViewVC logotype

Annotation of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/process2UEVN.m

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


Revision 1.1 - (hide annotations) (download)
Wed Mar 16 15:02:48 2016 UTC (9 years, 3 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
+ process2UEVN.m (new): computes eastward/northward vector components
  and output result to 'diags_post_tmp/' (the binary results can then
  be converted to nctiles using process2nctiles.m after adding
  new definitions in available_diagnostics.log).
+ process2interp.m (new): interpolates fields in 'nctiles/' that at
  grid cell centers and output result to 'diags_interp_tmp/' (the
  binary results can then be converted to nctiles using process2nctiles.m
  through interp2nctiles.m)
+ interp2nctiles.m (new): creates netcdf files from interpolated
  fields that were created by process2interp. This routine overrides
  mygrid with mygrid_latlon after storing the reference grid in mygrid_orig.

1 gforget 1.1 function []=process2UEVN(ff);
2     % PROCESS2UEVN(ff) computes eastward/northward vector components
3     % and output result to 'diags_post_tmp/'
4    
5     gcmfaces_global;
6    
7     %ff=1;
8     dir0=[pwd filesep];
9     dirIn=[dir0 'diags/'];
10     dirOut=[dir0 'diags_post_tmp/'];
11     if ~isdir(dirOut); mkdir(dirOut); end;
12    
13     if ff==1;
14     dirIn = [dirIn 'TRSP/'];
15     dirOut = [dirOut 'TRSP/'];
16     fil = 'trsp_3d_set1';
17     pairsIn={{'UVELMASS','VVELMASS'}};
18     pairsOut={{'EVELMASS','NVELMASS'}};
19     elseif ff==2;
20     dirIn = [dirIn 'TRSP/'];
21     dirOut = [dirOut 'TRSP/'];
22     fil = 'trsp_3d_set2';
23     pairsIn={{'DFxE_TH ','DFyE_TH '},{'DFxE_SLT','DFyE_SLT'}};
24     pairsOut={{'DFeE_TH ','DFnE_TH '},{'DFeE_SLT','DFnE_SLT'}};
25     pairsIn={pairsIn{:},{'ADVx_TH ','ADVy_TH '},{'ADVx_SLT','ADVy_SLT'}};
26     pairsOut={pairsOut{:},{'ADVe_TH ','ADVn_TH '},{'ADVe_SLT','ADVn_SLT'}};
27     elseif ff==3;
28     dirIn = [dirIn 'STATE/'];
29     dirOut = [dirOut 'STATE/'];
30     fil= 'state_2d_set1';
31     pairsIn={{'DFxEHEFF','DFyEHEFF'},{'DFxESNOW','DFyESNOW'}};
32     pairsOut={{'DFeEHEFF','DFnEHEFF'},{'DFeESNOW','DFnESNOW'}};
33     pairsIn={pairsIn{:},{'ADVxHEFF','ADVyHEFF'},{'ADVxSNOW','ADVySNOW'}};
34     pairsOut={pairsOut{:},{'ADVeHEFF','ADVnHEFF'},{'ADVeSNOW','ADVnSNOW'}};
35     pairsIn={pairsIn{:},{'oceTAUX ','oceTAUY '},{'SIuice ','SIvice '}};
36     pairsOut={pairsOut{:},{'oceTAUE ','oceTAUN '},{'EVELice ','NVELice '}};
37     end;
38    
39     listIn=dir([dirIn fil '*meta']);
40     for tt=1:length(listIn);
41     disp([tt length(listIn)]);
42     fldsOut=gcmfaces;
43     listOut={};
44     for pp=1:length(pairsIn);
45     pIn=pairsIn{pp}; pOut=pairsOut{pp};
46     filIn=listIn(tt).name(1:end-5);
47     metaIn=rdmds_meta([dirIn filIn]);
48     i1=find(strcmp(metaIn.fldList,pIn{1}));
49     i2=find(strcmp(metaIn.fldList,pIn{2}));
50     %[i1 i2]
51     %
52     UX=rdmds2gcmfaces([dirIn filIn],'rec',i1);
53     VY=rdmds2gcmfaces([dirIn filIn],'rec',i2);
54     [UE,VN]=calc_UEVNfromUXVY(UX,VY);
55     %store binary
56     fldsOut=cat(3,fldsOut,UE);
57     fldsOut=cat(3,fldsOut,VN);
58     listOut={listOut{:},pOut{:}};
59     end;
60     %output binary file
61     filOut=['post_' filIn];
62     tmp1=convert2gcmfaces(fldsOut);
63     tmp1(isnan(tmp1))=0;
64     if ~isdir(dirOut); mkdir(dirOut); end;
65     write2file([dirOut filOut '.data'],tmp1,32);
66     %create meta file
67     tmp2=size(tmp1); tmp2(end)=tmp2(end)/length(pairsIn)/2;
68     if tmp2(end)==1; tmp2=tmp2(1:2); end;
69     write2meta([dirOut filOut '.data'],tmp2,32,listOut);
70     end;
71    
72    

  ViewVC Help
Powered by ViewVC 1.1.22