/[MITgcm]/MITgcm_contrib/high_res_cube/matlab-grid-generator/write_tile.m
ViewVC logotype

Annotation of /MITgcm_contrib/high_res_cube/matlab-grid-generator/write_tile.m

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


Revision 1.1.1.1 - (hide annotations) (download) (vendor branch)
Tue Nov 11 18:08:08 2003 UTC (21 years, 8 months ago) by cnh
Branch: MAIN, initial
CVS Tags: baseline, HEAD
Changes since 1.1: +0 -0 lines
Checking in work done with Dimitri on high-resolution cube gridding and parallel 
communications. 
   o code is in a contrib experiment for now so we can continue collaborating
     on it. However most code is general and will be moved into main branch once 
     it is fully hardened.
   o There are README files in the contrib root and in the subdirectories that
     explain the contents

1 cnh 1.1 function [] = write_tile(fn,A,varargin)
2     % Write tiled field to single file "fn.bin".
3     %
4     % Data is in IEEE-bigendian real*8 format by default.
5     %
6     % Dimensions of A must be (n,n)
7     %
8     % Usage:
9     % >> write_tiles('LATC',latC);
10     % >> write_tiles('LATC',latC,'real*4');
11    
12     % Default precision
13     prec='real*8';
14     ieee='b';
15    
16     % Check optional arguments
17     args=char(varargin);
18     while (size(args,1) > 0)
19     if deblank(args(1,:)) == 'real*4' | deblank(args(1,:)) == 'float32'
20     prec='real*4';
21     elseif deblank(args(1,:)) == 'real*8' | deblank(args(1,:)) == 'float64'
22     prec='real*8';
23     else
24     sprintf(['Optional argument ' args(1,:) ' is unknown'])
25     return
26     end
27     args=args(2:end,:);
28     end
29    
30     fid=fopen(sprintf('%s.bin',fn),'w',ieee);
31     if fid<0
32     error('Unable to create file')
33     end
34     fwrite(fid,A,prec);
35     fclose(fid);

  ViewVC Help
Powered by ViewVC 1.1.22