# HG changeset patch # User abarth93 # Date 1160145234 0 # Node ID 59724598d7c5d4ce3c0691c8086e2d431bcf11af # Parent fd60101db45dcb30937a0e1dbe01b4ec8e7e1e9c Add isrecord function diff -r fd60101db45d -r 59724598d7c5 main/octcdf/DESCRIPTION --- a/main/octcdf/DESCRIPTION Fri Oct 06 13:29:15 2006 +0000 +++ b/main/octcdf/DESCRIPTION Fri Oct 06 14:33:54 2006 +0000 @@ -1,5 +1,5 @@ Name: octcdf -Version: 1.0.0 +Version: 1.0.1 Date: 2006-08-05 Author: Alexander Barth Maintainer: Alexander Barth diff -r fd60101db45d -r 59724598d7c5 main/octcdf/PKG_ADD --- a/main/octcdf/PKG_ADD Fri Oct 06 13:29:15 2006 +0000 +++ b/main/octcdf/PKG_ADD Fri Oct 06 14:33:54 2006 +0000 @@ -9,3 +9,4 @@ autoload ("ncdatatype", which ("netcdf")); autoload ("ncautonan", which ("netcdf")); autoload ("ncautoscale", which ("netcdf")); +autoload ("ncisrecord", which ("netcdf")); diff -r fd60101db45d -r 59724598d7c5 main/octcdf/inst/netcdf_setup.m --- a/main/octcdf/inst/netcdf_setup.m Fri Oct 06 13:29:15 2006 +0000 +++ b/main/octcdf/inst/netcdf_setup.m Fri Oct 06 14:33:54 2006 +0000 @@ -45,3 +45,5 @@ dispatch('autoscale','ncautoscale','ncvar'); dispatch('autonan','ncautonan','ncvar'); + +dispatch('isrecord','ncisrecord','ncdim'); diff -r fd60101db45d -r 59724598d7c5 main/octcdf/src/ov-ncfile.cc --- a/main/octcdf/src/ov-ncfile.cc Fri Oct 06 13:29:15 2006 +0000 +++ b/main/octcdf/src/ov-ncfile.cc Fri Oct 06 14:33:54 2006 +0000 @@ -302,7 +302,6 @@ const std::list < octave_value_list > &idx) { int dimid, status; - size_t length; octave_value retval; // check_args_string("octave_ncfile::subsref",idx.front()); @@ -335,21 +334,7 @@ return octave_value(); } - // previously a call like nc('dimension name') return the size of the dimension, - // now it return the dimension object in order to be compatible with the - // Matlab toolbox. - -# if 0 - status = nc_inq_dimlen(get_ncid(), dimid, &length); - - if (status != NC_NOERR) { - error("Error while querying dimension %s: %s",name.c_str(), nc_strerror(status)); - return octave_value(); - } - retval = octave_value(length); -# else retval = octave_value(new octave_ncdim(this,dimid)); -# endif break; } diff -r fd60101db45d -r 59724598d7c5 main/octcdf/src/ov-netcdf.cc --- a/main/octcdf/src/ov-netcdf.cc Fri Oct 06 13:29:15 2006 +0000 +++ b/main/octcdf/src/ov-netcdf.cc Fri Oct 06 14:33:54 2006 +0000 @@ -484,6 +484,30 @@ } } +DEFUN_DLD(ncisrecord, args,, +"-*- texinfo -*-\n\ +@deftypefn {Loadable Function} @var{r} = ncisrecord(@var{nd}) \n\ +Return 1 if the netcdf dimension is a record dimension, otherwise 0. \n\ +@end deftypefn") +{ + + if (args.length() != 1) { + print_usage (); + return octave_value(); + } + + if (args(0).class_name() != "ncdim" ) { + print_usage (); + return octave_value(); + } + + octave_ncdim& ncdim = (octave_ncdim&)args(0).get_rep(); + + return octave_value(ncdim.is_record()); +} + + + DEFUN_DLD(ncautoscale, args,, "-*- texinfo -*-\n\ @deftypefn {Loadable Function} @var{status} = ncautoscale(@var{nv}) \n\