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

Diff of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/write2nctiles.m

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

revision 1.1 by gforget, Thu Jan 30 17:05:12 2014 UTC revision 1.3 by gforget, Sun Feb 2 01:47:38 2014 UTC
# Line 7  function [dimOut]=write2nctiles(fileOut, Line 7  function [dimOut]=write2nctiles(fileOut,
7  %         can be provided in the form {'name',value}  %         can be provided in the form {'name',value}
8  %         those that are currently active are  %         those that are currently active are
9  %               'descr' is the file description (default '').  %               'descr' is the file description (default '').
10    %               'rdm' is the extended estimate description (default '').
11  %               'fldName' is the nc variable name for fld (default : the outside name of fldIn).  %               'fldName' is the nc variable name for fld (default : the outside name of fldIn).
12  %               'longName' is the corresponding long name (default : '').  %               'longName' is the corresponding long name (default : '').
13  %               'units' is the unit of fld (default : '(unknown)').  %               'units' is the unit of fld (default : '(unknown)').
# Line 20  doCheck=0;%set to one to print stuff to Line 21  doCheck=0;%set to one to print stuff to
21    
22  %set more optional paramaters to default values  %set more optional paramaters to default values
23  descr='';  descr='';
24    rdm='';
25  fldName=inputname(2); longName='';  fldName=inputname(2); longName='';
26  units='(unknown)'; missval=NaN; fillval=NaN;  units='(unknown)'; missval=NaN; fillval=NaN;
27  dimIn=[];  dimIn=[];
# Line 41  for ii=1:nargin-3; Line 43  for ii=1:nargin-3;
43              '         Type ''help write2nctiles'' for details.']);              '         Type ''help write2nctiles'' for details.']);
44      else;      else;
45          if strcmp(varargin{ii}{1},'descr')|...          if strcmp(varargin{ii}{1},'descr')|...
46                    strcmp(varargin{ii}{1},'rdm')|...
47                  strcmp(varargin{ii}{1},'fldName')|...                  strcmp(varargin{ii}{1},'fldName')|...
48                  strcmp(varargin{ii}{1},'longName')|...                  strcmp(varargin{ii}{1},'longName')|...
49                  strcmp(varargin{ii}{1},'units')|...                  strcmp(varargin{ii}{1},'units')|...
# Line 108  if doCreate; Line 111  if doCreate;
111    %-------------------    %-------------------
112    ncid=nccreate(fileTile,'NETCDF4');    ncid=nccreate(fileTile,'NETCDF4');
113    
114    aa=sprintf([descr '    [file created with gcmfaces_IO/write2nctiles.m]']);    if ~isempty(rdm);
115    ncputAtt(ncid,'','description',aa);      descr2=[descr ' -- ' rdm{1}];
116      else;
117        descr2=descr;
118      end;
119      ncputAtt(ncid,'','description',descr);
120      for pp=2:length(rdm);
121      tmp1=char(pp+63);
122      netcdf.putAtt(ncid,nc_global,tmp1,rdm{pp});
123      end;
124      %append readme
125      pp=length(rdm)+1;
126      netcdf.putAtt(ncid,nc_global,tmp1,'file created using gcmfaces_IO/write2nctiles.m');
127    ncputAtt(ncid,'','date',date);    ncputAtt(ncid,'','date',date);
128    
129    ncdefDim(ncid,'itxt',30);    ncdefDim(ncid,'itxt',30);

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.3

  ViewVC Help
Powered by ViewVC 1.1.22