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

Contents of /MITgcm_contrib/gael/matlab_class/gcmfaces_IO/ncvars.m

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


Revision 1.1 - (show annotations) (download)
Sun Jan 24 17:05:13 2016 UTC (9 years, 5 months ago) by gforget
Branch: MAIN
CVS Tags: checkpoint65x, checkpoint65v, checkpoint65w, checkpoint65t, checkpoint65u, checkpoint66f, checkpoint66e, checkpoint66d, checkpoint66c, checkpoint66b, checkpoint66a, checkpoint66o, HEAD
- move routines from MITprof/profiles_misc/ to gcmfaces/gcmfaces_IO/
  to allow for nctiles IO without having to rely on MITprof
- these wrapper routines were originally provided by F. Roquet
  that work both with the native implememtation of ncetcf in recent
  Matlab versions and the third party mex codes used earlier

1 function [vars]=ncvars(ncid);
2 %input: ncid is a netcdf file id
3 %output: vars is the list of its variables name (in cell)
4
5 global useNativeMatlabNetcdf; if isempty(useNativeMatlabNetcdf); useNativeMatlabNetcdf = ~isempty(which('netcdf.open')); end;
6
7 if useNativeMatlabNetcdf;
8
9 [numdims, numvars, numglobalatts, unlimdimID] = netcdf.inq(ncid);
10 for ii=1:numvars;
11 aa=netcdf.inqVar(ncid,ii-1);
12 if ii==1; vars={aa}; else; vars=[vars aa]; end;
13 end;
14
15 else;%try to use old mex stuff
16 vars=ncnames(var(ncid));
17 end;

  ViewVC Help
Powered by ViewVC 1.1.22