changeset 2608:59724598d7c5 octave-forge

Add isrecord function
author abarth93
date Fri, 06 Oct 2006 14:33:54 +0000
parents fd60101db45d
children 5897fc687b42
files main/octcdf/DESCRIPTION main/octcdf/PKG_ADD main/octcdf/inst/netcdf_setup.m main/octcdf/src/ov-ncfile.cc main/octcdf/src/ov-netcdf.cc
diffstat 5 files changed, 28 insertions(+), 16 deletions(-) [+]
line wrap: on
line diff
--- 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 <abarth@marine.usf.edu>
 Maintainer: Alexander Barth <abarth@marine.usf.edu>
--- 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"));
--- 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');
--- 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;
       }
--- 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\