Home > atmlab > arts > netcdf > arts_nc_read_arrayofvector.m

arts_nc_read_arrayofvector

PURPOSE ^

ARTS_NC_READ_ARRAYOFVECTOR Read ArrayOfVector from ARTS NetCDF file.

SYNOPSIS ^

function [ret, gattr] = arts_nc_read_arrayofvector (filename)

DESCRIPTION ^

 ARTS_NC_READ_ARRAYOFVECTOR   Read ArrayOfVector from ARTS NetCDF file.

    Reads an ArrayOfVector from a NetCDF file saved with Arts.

 FORMAT   ret = arts_nc_read_arrayofvector(filename)
        
 OUT   ret      ArrayOfVector
 OUT   gattr    Global attributes
       
 IN    filename Name of NetCDF input file.

CROSS-REFERENCE INFORMATION ^

This function calls: This function is called by:

DOWNLOAD ^

arts_nc_read_arrayofvector.m

SOURCE CODE ^

0001 % ARTS_NC_READ_ARRAYOFVECTOR   Read ArrayOfVector from ARTS NetCDF file.
0002 %
0003 %    Reads an ArrayOfVector from a NetCDF file saved with Arts.
0004 %
0005 % FORMAT   ret = arts_nc_read_arrayofvector(filename)
0006 %
0007 % OUT   ret      ArrayOfVector
0008 % OUT   gattr    Global attributes
0009 %
0010 % IN    filename Name of NetCDF input file.
0011 
0012 % 2010-02-02   Created by Oliver Lemke.
0013 
0014 function [ret, gattr] = arts_nc_read_arrayofvector (filename)
0015 
0016 ncid = netcdf.open (filename, 'NOWRITE');
0017 
0018 gattr = loadncglobalattr (filename);
0019 
0020 varid = netcdf.inqVarID (ncid, 'Vector_nelem');
0021 nv = netcdf.getVar (ncid, varid);
0022 
0023 varid = netcdf.inqVarID (ncid, 'ArrayOfVector');
0024 v = netcdf.getVar (ncid, varid);
0025 netcdf.close (ncid);
0026 
0027 startelem = 1;
0028 
0029 ret=cell(1,length(nv));
0030 for i = 1:length(nv)
0031     endelem = startelem + nv(i) - 1;
0032     ret{i} = reshape (v(startelem:endelem), nv(i), 1);
0033     startelem = endelem + 1;
0034 end
0035

Generated on Mon 15-Sep-2014 13:31:28 by m2html © 2005