Parent Directory
|
Revision Log
|
Revision Graph
- process2nctiles.m: rename 'step' netcdf variable as 'timstep' to avoid conflict with existing function; add hard coded 'diagsDir' param; omit grid variables in netcdf file when RAC has not been defined; use repmat to avoid loop over size(myDiag{1},4). - write2file.m: add omitNaNs option (2nd optional input parameter; 1 by default) - write2meta.m: add fldList option (2nd optional input parameter; [] by default) - write2nctiles.m: switch to 'NETCDF4' if array size exceed 1.5G; clear temporary variables once they are no longer needed.
1 | function []=write2file(fileOut,fldIn,varargin); |
2 | %purpose: write array to binary file |
3 | % |
4 | %inputs: fileOut is the file name |
5 | % fldIn is the array to write to disk |
6 | %(optional) prec is the file precision (32, by default, or 64) |
7 | |
8 | if nargin>2; prec=varargin{1}; else; prec=32; end; |
9 | if nargin>3; omitNaNs=varargin{2}; else; omitNaNs=1; end; |
10 | |
11 | if ~ischar(fldIn); |
12 | fid=fopen(fileOut,'w','b'); tmp1=fldIn; |
13 | if omitNaNs; tmp1(isnan(tmp1))=0; end; |
14 | fwrite(fid,tmp1,['float' num2str(prec)]); |
15 | fclose(fid); |
16 | else; |
17 | fid=fopen(fileOut,'wt'); fwrite(fid,fldIn); fclose(fid); |
18 | end; |
19 | |
20 | |
21 |
ViewVC Help | |
Powered by ViewVC 1.1.22 |