[Git][debian-gis-team/ruby-netcdf][upstream] New upstream version 0.8.0

Youhei SASAKI (@uwabami) gitlab at salsa.debian.org
Fri Apr 1 03:07:16 BST 2022



Youhei SASAKI pushed to branch upstream at Debian GIS Project / ruby-netcdf


Commits:
f00e2782 by Youhei SASAKI at 2022-03-26T00:33:46+09:00
New upstream version 0.8.0
- - - - -


17 changed files:

- + .gitignore
- + ChangeLog
- LICENSE.txt
- ext/numru/netcdfraw.c
- lib/numru/netcdf.rb
- lib/numru/netcdf/version.rb
- ruby-netcdf-bigmem.gemspec
- ruby-netcdf.gemspec
- test/aref_aset.rb
- test/char_var.rb
- test/clone.rb
- test/create_tmp.rb
- test/def_var_with_dim.rb
- test/factor_offset.rb
- test/putatt.rb
- test/test.rb
- test/type.rb


Changes:

=====================================
.gitignore
=====================================
@@ -0,0 +1,6 @@
+*.[oa]
+*~
+*.so
+Makefile
+/pkg/
+/tmp/


=====================================
ChangeLog
=====================================
@@ -0,0 +1,456 @@
+2022-03-21  Takeshi Horinouchi  (HEAD -> master)
+version number updated to 0.8.0
+
+M	lib/numru/netcdf/version.rb
+
+2022-03-21  Takeshi Horinouchi 
+LICENSE text updated
+
+M	LICENSE.txt
+
+2022-03-21  Takeshi Horinouchi 
+Merge remote-tracking branch 'origin/rewrite_test_use_unit-test'
+
+2022-03-21  Takeshi Horinouchi 
+Merge remote-tracking branch 'origin/Fix_Obsolete_rb_secure'
+
+2022-03-21  Takeshi Horinouchi 
+Revert "Fixnum -> Integer"
+
+This reverts commit 2c2fd995df1865e6f521679aeca746385203a42f.
+
+M	lib/numru/netcdf.rb
+
+2021-05-22  Takeshi Horinouchi  (origin/master, origin/HEAD)
+Fixnum -> Integer
+
+M	lib/numru/netcdf.rb
+
+2020-05-21  Youhei SASAKI  (origin/rewrite_test_use_unit-test)
+Rewrite test: use Test::Unit
+
+Rewrite test using Test::Unit
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+
+M	ruby-netcdf-bigmem.gemspec
+M	ruby-netcdf.gemspec
+M	test/aref_aset.rb
+M	test/char_var.rb
+M	test/clone.rb
+M	test/create_tmp.rb
+M	test/def_var_with_dim.rb
+M	test/factor_offset.rb
+M	test/putatt.rb
+M	test/test.rb
+M	test/type.rb
+
+2020-05-21  Youhei SASAKI  (origin/Fix_Obsolete_rb_secure, Fix_Obsolete_rb_secure)
+Drop obsolete rb_secure, rb_safe_level
+
+Ref.
+  - https://tmtms.hatenablog.com/entry/201912/ruby27-misc2
+  - https://bugs.ruby-lang.org/issues/15344
+
+Signed-off-by: Youhei SASAKI <uwabami at gfd-dennou.org>
+
+M	ext/numru/netcdfraw.c
+M	lib/numru/netcdf.rb
+
+2016-09-27  Takeshi Horinouchi  (tag: v0.7.2)
+Commented out the gemspec file for the bibmem version
+
+M	Rakefile
+
+2015-06-09  Takeshi Horinouchi 
+corrected the previous commit
+
+M	lib/numru/netcdf.rb
+
+2015-06-09  Takeshi Horinouchi 
+Increased the supprted argument value by NetCDF.creation_format (NC_FORMAT_*)
+
+M	lib/numru/netcdf.rb
+
+2015-06-09  Takeshi Horinouchi 
+Added a method NetCDF#format (for NetCDF-4) and related constants NC_FORMAT_CLASSIC etc
+
+M	ext/numru/netcdfraw.c
+
+2015-05-21  Takeshi Horinouchi 
+Deleted ".alpha" from VERSION (since gem did not solve the dependency when I tried to install gphys)
+
+M	lib/numru/netcdf/version.rb
+
+2015-05-21  Takeshi Horinouchi 
+Created a gemspec to depend on narray-bigmem
+
+M	Rakefile
+M	ext/numru/extconf.rb
+A	ruby-netcdf-bigmem.gemspec
+
+2015-04-02  Takeshi Horinouchi  (origin/rubygems, rubygems)
+changed to require 'numru/netcdf/version'
+
+M	Rakefile
+M	ruby-netcdf.gemspec
+
+2015-04-02  Takeshi Horinouchi 
+changed to require 'numru/netcdf/version'
+
+M	lib/numru/netcdf.rb
+
+2015-04-02  Takeshi Horinouchi 
+Created the version.rb file
+
+A	lib/numru/netcdf/version.rb
+
+2015-03-30  Eriko Nishimoto 
+Modified test.rb
+
+Corrected require libraries
+
+M	test/test.rb
+
+2015-03-30  Eriko Nishimoto 
+Corrected require_paths
+
+M	ruby-netcdf.gemspec
+
+2015-03-30  Eriko Nishimoto 
+Modified git ignore list
+
+Added "tmp" and "pkg" folders to the list
+
+M	.gitignore
+
+2015-03-30  Eriko Nishimoto 
+Corrected typo
+
+M	Rakefile
+M	ruby-netcdf.gemspec
+
+2015-03-30  Eriko Nishimoto 
+Added VERSION number
+
+M	lib/numru/netcdf.rb
+
+2015-03-30  Eriko Nishimoto 
+Changed folder structure under lib
+
+R100	lib/netcdf.rb	lib/numru/netcdf.rb
+R100	lib/netcdf_miss.rb	lib/numru/netcdf_miss.rb
+
+2015-03-30  Eriko Nishimoto 
+Moved extentional files to ext/numru
+
+R100	extconf.rb	ext/numru/extconf.rb
+R100	netcdfraw.c	ext/numru/netcdfraw.c
+
+2015-03-30  Eriko Nishimoto 
+Added setting files for rubygems
+
+A	Gemfile
+A	Rakefile
+A	ruby-netcdf.gemspec
+
+2015-03-30  Takeshi Horinouchi 
+Renamed the current ChangeLog to back up.
+
+R100	ChangeLog	.ChangeLog.until20150117
+
+2015-03-30  Takeshi Horinouchi 
+Registered files (patterns) to ignore in the repository
+
+A	.gitignore
+
+2015-01-27  Takeshi Horinouchi  (tag: ruby-netcdf-0_7_1)
+Updated. ruby-netcdf-0.7.1 to be released.
+
+M	ChangeLog
+
+2015-01-27  Takeshi Horinouchi 
+	* doc/ updated
+
+M	doc/Ref_man.html
+M	doc/Ref_man.rd
+M	doc/Ref_man_jp.html
+M	doc/Ref_man_jp.rd
+M	doc/to_html
+
+2015-01-27  Takeshi Horinouchi 
+	* demo/demo5-netcdf4.rb: created
+
+A	demo/demo5-netcdf4.rb
+
+2015-01-27  Takeshi Horinouchi 
+Tue Jan 27  2015  T Horinouchi
+	* netcdfraw.c:
+	  * added new NetCDF-4 methods:
+	    * NetCDFVar::deflate : to set compression
+	    * NetCDFVar::deflate_params : returns current values of
+	      compression parameters
+	    * NetCDFVar::endian= : set (change) the endian
+	    * NetCDFVar::endian : returns the current endian setting
+	   * added new constants: NC_ENDIAN_NATIVE (=0),
+	     NC_ENDIAN_LITTLE (=1), NC_ENDIAN_BIG (=2)
+	   * updated the safe-level condition, which was missed in the
+	     change on Jan 22.
+
+M	netcdfraw.c
+
+2015-01-23  Takeshi Horinouchi 
+corrected the charset setting
+
+M	doc/Ref_man_jp.html
+
+2015-01-23  Takeshi Horinouchi 
+further updated (a little)
+
+M	doc/Ref_man.html
+M	doc/Ref_man.rd
+M	doc/Ref_man_jp.html
+M	doc/Ref_man_jp.rd
+
+2015-01-23  Takeshi Horinouchi 
+Updated the reference manuals
+
+M	doc/Ref_man.html
+M	doc/Ref_man.rd
+M	doc/Ref_man_jp.html
+M	doc/Ref_man_jp.rd
+M	doc/to_html
+
+2015-01-22  Takeshi Horinouchi  (tag: ruby-netcdf-0_7_0)
+ChangeLog updated to release ruby-netcdf-0.7.0 (relase tag: ruby-netcdf-0_7_0)
+
+M	ChangeLog
+
+2015-01-22  Takeshi Horinouchi 
+extconf.rb: supported to configure gem-installed narray.
+(also reverted the previous commit.)
+
+M	extconf.rb
+
+2015-01-22  Takeshi Horinouchi 
+	* extconf.rb: deleted a reference to "/usr/local"
+
+M	ChangeLog
+M	extconf.rb
+
+2015-01-22  Takeshi Horinouchi 
+	* lib/netcdf.rb: revised along the patch [dennou-ruby:003705].
+
+M	lib/netcdf.rb
+
+2015-01-22  Takeshi Horinouchi 
+Deleted an unused variable (nc_tlen) in many methods
+
+M	netcdfraw.c
+
+2015-01-22  Takeshi Horinouchi 
+	* netcdfraw.c: further type update to na_shape_t (not covered
+	  by the patch)
+
+M	netcdfraw.c
+
+2015-01-22  Takeshi Horinouchi 
+Thu Jan 22  2015  T Horinouchi
+	* netcdfraw.c: changed rb_secure(4) to rb_secure(3), since security
+	  level 4 is abolished in ruby 2.
+
+M	netcdfraw.c
+
+2015-01-22  Takeshi Horinouchi 
+Thu Jan 22  2015  T Horinouchi
+	* netcdfraw.c: revised based on the patch posted by seiya with
+	  [dennou-ruby:003705] but adopted the typedef in the latest
+	  narray-bigmem (namely, used na_shape_t).
+
+M	netcdfraw.c
+
+2014-09-08  Takeshi Horinouchi 
+Mon Sep  8  2014  T Horinouchi
+	* lib/netcdf.rb: Tentative treatment of the very slow netcdf-4's
+	  strided reading.
+
+M	ChangeLog
+M	lib/netcdf.rb
+
+2014-09-06  Takeshi Horinouchi 
+
+minor update
+
+M	extconf.rb
+
+2014-09-06  Takeshi Horinouchi 
+	* lib/netcdf.rb: Refactoring of NetCDF#simple_get.
+
+M	ChangeLog
+M	lib/netcdf.rb
+
+2014-09-06  Takeshi Horinouchi 
+Sat Sep  6  2014  T Horinouchi
+	* netcdfraw.c: Added constants such as NC_NETCDF4;
+	  This enables one to individually specify the creation format by
+	  using the low level interface NetCDF.nc_create
+	* lib/netcdf.rb: Supported the "default" file creation format
+	  by adding NetCDF.creation_format= and NetCDF.creation_format
+
+M	ChangeLog
+M	lib/netcdf.rb
+M	netcdfraw.c
+
+2014-09-06  Takeshi Horinouchi 
+Sat Sep  6  2014  T Horinouchi
+	* extconf.rb
+	  * introduced the macro NCVER
+	  * changed to give a higer priority to NetCDF 4;
+	  * added $vendorarchdir to dir_config
+	* netcdfraw.c: Added the class method NetCDF.libvers (<- nc_inq_libvers)
+	* lib/netcdf.rb: Added the class constant NCVERSION (<- NetCDF.libvers)
+
+M	ChangeLog
+M	extconf.rb
+M	lib/netcdf.rb
+M	netcdfraw.c
+
+2014-08-25  Takeshi Horinouchi 
+Mon Aug 25  2014  T Horinouchi
+	* netcdfraw.c: to avoid a compile error when -Werror=format-security
+
+M	ChangeLog
+M	netcdfraw.c
+
+2012-02-19  Takeshi Horinouchi  (tag: ruby-netcdf-0_6_6)
+Sun Feb 19  2011  T Horinouchi
+	* ruby-netcdf-0.6.6 released (relase tag: ruby-netcdf-0_6_6)
+
+M	ChangeLog
+
+2012-02-19  Takeshi Horinouchi 
+Sun Feb 19  2011  T Horinouchi
+	* lib/netcdf.rb: method pack: debug of enbug made
+	  when 1.1 -> 1.2 (cvs tag) commited in Jan 2010.
+	* netcdfraw.c: Added macro NC_RAISE2. Enhanced error
+	  messaging in NetCDF_open and NetCDF_create to show file name.
+
+M	ChangeLog
+M	lib/netcdf.rb
+M	netcdfraw.c
+
+2011-02-17  Takeshi Horinouchi  (tag: ruby-netcdf-0_6_5)
+Thu Feb 17  2011  T Horinouchi
+	* ruby-netcdf-0.6.5 released (relase tag: ruby-netcdf-0_6_5)
+
+M	ChangeLog
+
+2011-02-17  Takeshi Horinouchi 
+Thu Feb 17  2011  T Horinouchi
+	* extconf.rb: Debug to have the --disable-opendap option really work
+
+M	ChangeLog
+M	extconf.rb
+
+2011-02-12  Takeshi Horinouchi 
+	* ruby-netcdf-0.6.5 preview release.
+
+M	ChangeLog
+
+2010-12-22  Tsuyoshi Koshiro 
+Thu Dec 23  2010  T Koshiro
+        * test/aref_aset.rb : updated for Ruby 1.9.2
+        * lib/netcdf.rb: NetCDF.clean_tmpfile : lambda -> proc
+        * verified that all test programs work fine with Ruby 1.9.2.
+
+M	ChangeLog
+M	lib/netcdf.rb
+M	test/aref_aset.rb
+
+2010-12-14  Tsuyoshi Koshiro 
+Tue Dec 14  2010  T Koshiro
+        * netcdfraw.c : nctype2natype : char* -> const char*
+        * test/aref_aset.rb, test/factor_offset.rb : bug fix.
+
+M	ChangeLog
+M	netcdfraw.c
+M	test/aref_aset.rb
+M	test/factor_offset.rb
+
+2010-12-13  Tsuyoshi Koshiro 
+Mon Dec 13  2010  T Koshiro
+        * netcdfraw.c : patch for Ruby 1.9.2
+          - by S Kouketsu (dennou-ruby:003191)
+          - by T Koshiro  (dennou-ruby:003226)
+
+M	ChangeLog
+M	netcdfraw.c
+
+2010-03-15  Takeshi Horinouchi  (tag: ruby-netcdf-0_6_4)
+Mon Mar 15  2010  T Horinouchi
+	* ruby-netcdf-0.6.4 released (relase tag: ruby-netcdf-0_6_4)
+
+M	ChangeLog
+
+2010-01-14  Takeshi Horinouchi 
+Thu Jan 14  2010  T Horinouchi < T Koshiro
+	* netcdfraw.c : patch for Ruby 1.9.1 (dennou-ruby:003138)
+	* extconf.rb : patch for NetCDF-4.1-beta2 (dcdvlop Nov 20, 2009)
+
+M	ChangeLog
+M	extconf.rb
+M	netcdfraw.c
+
+2010-01-14  Takeshi Horinouchi 
+Fri Aug 15  2008  T Horinouchi
+	* lib/netcdf_miss.rb: in __interpret_missing_params,
+	  changed just to warn, not to raise an exception,
+	  if the missing value or fill value is within the
+	  valid range (warning can be suppressed by $VERBOSE = nil)
+Thu Jul 17  2008  T Horinouchi
+	* lib/netcdf.rb: NetCDFVar's private method pack : to take
+	  round if the type of self is integer.
+	* lib/netcdf_miss.rb: debug in the handling of missing data
+	  specification using the external data type.
+Wed Jul 16  2008  T Horinouchi < M Otsuka
+	* netcdfraw.c : patch for Ruby 1.9
+
+M	ChangeLog
+M	lib/netcdf.rb
+M	lib/netcdf_miss.rb
+M	netcdfraw.c
+
+2010-01-14  Takeshi Horinouchi 
+Initial revision
+
+A	ChangeLog
+A	INSTALL
+A	LICENSE.txt
+A	ToDo
+A	demo/README
+A	demo/demo1-create-alt.rb
+A	demo/demo1-create.rb
+A	demo/demo2-graphic.rb
+A	demo/demo3-ncepclim.rb
+A	demo/demo4-copy.rb
+A	doc/README_JP.txt
+A	doc/Ref_man.html
+A	doc/Ref_man.rd
+A	doc/Ref_man_jp.html
+A	doc/Ref_man_jp.rd
+A	doc/to_html
+A	extconf.rb
+A	lib/netcdf.rb
+A	lib/netcdf_miss.rb
+A	netcdfraw.c
+A	test/aref_aset.rb
+A	test/char_var.rb
+A	test/clone.rb
+A	test/create_tmp.rb
+A	test/def_var_with_dim.rb
+A	test/factor_offset.rb
+A	test/putatt.cdl
+A	test/putatt.rb
+A	test/test.cdl
+A	test/test.rb
+A	test/type.rb


=====================================
LICENSE.txt
=====================================
@@ -1,59 +1,34 @@
-Ruby/NetCDF is copyrighted free software by Takeshi Horinouchi and the 
+Ruby/NetCDF is copyrighted free software by Takeshi Horinouchi and 
 GFD Dennou Club.
-You can redistribute it and/or modify it under either the terms of the
-GPL, or the conditions below, which is idential to Ruby's license
-(http://www.ruby-lang.org/en/LICENSE.txt):
 
-  1. You may make and give away verbatim copies of the source form of the
-     software without restriction, provided that you duplicate all of the
-     original copyright notices and associated disclaimers.
-
-  2. You may modify your copy of the software in any way, provided that
-     you do at least ONE of the following:
-
-       a) place your modifications in the Public Domain or otherwise
-          make them Freely Available, such as by posting said
-	  modifications to Usenet or an equivalent medium, or by allowing
-	  the author to include your modifications in the software.
-
-       b) use the modified software only within your corporation or
-          organization.
-
-       c) rename any non-standard executables so the names do not conflict
-	  with standard executables, which must also be provided.
-
-       d) make other distribution arrangements with the author.
-
-  3. You may distribute the software in object code or executable
-     form, provided that you do at least ONE of the following:
-
-       a) distribute the executables and library files of the software,
-	  together with instructions (in the manual page or equivalent)
-	  on where to get the original distribution.
-
-       b) accompany the distribution with the machine-readable source of
-	  the software.
-
-       c) give non-standard executables non-standard names, with
-          instructions on where to get the original software distribution.
-
-       d) make other distribution arrangements with the author.
-
-  4. You may modify and include the part of the software into any other
-     software (possibly commercial).  But some files in the distribution
-     are not written by the author, so that they are not under this terms.
-
-     They are gc.c(partly), utils.c(partly), regex.[ch], st.[ch] and some
-     files under the ./missing directory.  See each file for the copying
-     condition.
-
-  5. The scripts and library files supplied as input to or produced as 
-     output from the software do not automatically fall under the
-     copyright of the software, but belong to whomever generated them, 
-     and may be sold commercially, and may be aggregated with this
-     software.
-
-  6. THIS SOFTWARE IS PROVIDED "AS IS" AND WITHOUT ANY EXPRESS OR
-     IMPLIED WARRANTIES, INCLUDING, WITHOUT LIMITATION, THE IMPLIED
-     WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
-     PURPOSE.
+Copyright 2003-2022 (C) GFD Dennou Club
+(http://www.gfd-dennou.org/) All rights reserved.
+
+Redistribution and use in source and binary forms, with or without
+modification, are permitted provided that the following conditions are
+met:
+
+   1. Redistributions of source code must retain the above copyright
+      notice, this list of conditions and the following disclaimer.
+
+   2. Redistributions in binary form must reproduce the above copyright
+      notice, this list of conditions and the following disclaimer in
+      the documentation and/or other materials provided with the
+      distribution.
+
+THIS SOFTWARE IS PROVIDED BY GFD DENNOU CLUB AND CONTRIBUTORS ``AS IS'' 
+AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, 
+THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
+PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL GFD DENNOU CLUB OR
+CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL,
+EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO,
+PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR
+PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
+LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
+NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS
+SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+
+The views and conclusions contained in the software and documentation
+are those of the authors and should not be interpreted as representing
+official policies, either expressed or implied, of Takeshi Horinouchi
+and GFD Dennou Club.


=====================================
ext/numru/netcdfraw.c
=====================================
@@ -198,7 +198,7 @@ typedef int    na_shape_t;
   obj = na_cast_object(obj, NA_SINT); \
   GetNArray(obj, na); \
   ptr = (int16_t *) NA_PTR(na,0); \
-} 
+}
 #define Array_to_Clint(obj, ptr) \
 { \
   struct NARRAY *na; \
@@ -257,7 +257,7 @@ static VALUE rb_eNetcdfFatal;
 static VALUE rb_eNetcdfEntool;
 static VALUE rb_eNetcdfExdr;
 static VALUE rb_eNetcdfSyserr;
- 
+
 
 struct Netcdf{
   int ncid;
@@ -290,7 +290,7 @@ NetCDF_init(int ncid,char *filename)
   Netcdffile->ncid=ncid;
   Netcdffile->closed=0;
   Netcdffile->name=xmalloc((strlen(filename)+1)*sizeof(char));
-  strcpy(Netcdffile->name,filename);  
+  strcpy(Netcdffile->name,filename);
   return(Netcdffile);
 }
 
@@ -322,7 +322,7 @@ NetCDF_att_init(int ncid,int varid,char *attname)
   Netcdf_att->ncid=ncid;
   Netcdf_att->varid=varid;
   Netcdf_att->name=xmalloc((strlen(attname)+1)*sizeof(char));
-  strcpy(Netcdf_att->name,attname);   
+  strcpy(Netcdf_att->name,attname);
   return(Netcdf_att);
 }
 
@@ -351,7 +351,7 @@ NetCDF_free(struct Netcdf *Netcdffile)
   if (!Netcdffile->closed){
       nc_close(Netcdffile->ncid); /* no error check -- not to stop during GC */
   }
-  free(Netcdffile->name); 
+  free(Netcdffile->name);
   free(Netcdffile);
 }
 
@@ -576,14 +576,11 @@ NetCDF_close(file)
   int ncid;
   struct Netcdf *Netcdffile;
 
-  if (rb_safe_level() >= 3 && !OBJ_TAINTED(file)) {
-      rb_raise(rb_eSecurityError, "Insecure: can't close");
-  }
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid=Netcdffile->ncid;
   if(!Netcdffile->closed){
       status = nc_close(ncid);
-      if(status != NC_NOERR) NC_RAISE(status); 
+      if(status != NC_NOERR) NC_RAISE(status);
       Netcdffile->closed = 1;
   } else {
       rb_warn("file %s is already closed", Netcdffile->name);
@@ -602,10 +599,9 @@ NetCDF_def_dim(VALUE file,VALUE dim_name,VALUE length)
   struct Netcdf *Netcdffile;
   struct NetCDFDim *Netcdf_dim;
   VALUE Dimension;
-  
-  rb_secure(3);
+
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
-  
+
   Check_Type(dim_name,T_STRING);
   c_dim_name=RSTRING_PTR(dim_name);
   c_length=NUM2UINT(length);
@@ -696,19 +692,19 @@ NetCDF_put_att_numeric(int ncid, char *name,VALUE value,VALUE atttype, int varid
     len = na_val->total;
     ptr = na_val->ptr;
     switch(na_typecode){
-    case NA_BYTE: 
+    case NA_BYTE:
 	status = nc_put_att_uchar(ncid,varid,name,NC_BYTE,len,(unsigned char *)ptr);
 	break;
-    case NA_SINT: 
+    case NA_SINT:
 	status = nc_put_att_short(ncid,varid,name,NC_SHORT,len,(short *)ptr);
 	break;
-    case NA_LINT: 
+    case NA_LINT:
 	status = nc_put_att_int(ncid,varid,name,NC_INT,len,(int *)ptr);
 	break;
-    case NA_SFLOAT: 
+    case NA_SFLOAT:
 	status = nc_put_att_float(ncid,varid,name,NC_FLOAT,len,(float *)ptr);
 	break;
-    case NA_DFLOAT: 
+    case NA_DFLOAT:
 	status = nc_put_att_double(ncid,varid,name,NC_DOUBLE,len,(double*)ptr);
 	break;
     default:
@@ -746,7 +742,6 @@ NetCDF_put_att(VALUE file,VALUE att_name,VALUE value,VALUE atttype)
     struct Netcdf *ncfile;
     char *name;
 
-    rb_secure(3);
     Data_Get_Struct(file,struct Netcdf,ncfile);
     Check_Type(att_name,T_STRING);
     name = RSTRING_PTR(att_name);
@@ -764,7 +759,6 @@ NetCDF_put_att_var(VALUE var,VALUE att_name,VALUE value,VALUE atttype)
     struct NetCDFVar *ncvar;
     char *name;
 
-    rb_secure(3);
     Data_Get_Struct(var,struct NetCDFVar,ncvar);
     Check_Type(att_name,T_STRING);
     name = RSTRING_PTR(att_name);
@@ -791,20 +785,19 @@ NetCDF_def_var(VALUE file,VALUE var_name,VALUE vartype,VALUE dimensions)
   struct NetCDFDim *Netcdf_dim;
   VALUE Var;
 
-  rb_secure(3);
   Check_Type(var_name,T_STRING);
   Check_Type(dimensions,T_ARRAY);
 
   c_var_name=RSTRING_PTR(var_name);
   c_ndims=RARRAY_LEN(dimensions);
-  
+
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid=Netcdffile->ncid;
 
   if (TYPE(vartype) == T_STRING){
-      xtype = natype2nctype(RSTRING_PTR(vartype));     
+      xtype = natype2nctype(RSTRING_PTR(vartype));
   } else if (TYPE(vartype) == T_FIXNUM){
-      xtype = natypecode2nctype(NUM2INT(vartype));     
+      xtype = natypecode2nctype(NUM2INT(vartype));
   } else {
       rb_raise(rb_eNetcdfError,
 	       "type specfication must be by a string or nil");
@@ -827,12 +820,12 @@ NetCDF_def_var(VALUE file,VALUE var_name,VALUE vartype,VALUE dimensions)
       rb_raise(rb_eNetcdfError, "No such object of the netCDF dimension class.");
     }
   }
-  
+
   status = nc_def_var(ncid,c_var_name,xtype,c_ndims,c_dimids,&varidp);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Netcdf_var = NetCDF_var_init(ncid,varidp,file);
-  
+
   Var=Data_Wrap_Struct(cNetCDFVar,nc_mark_obj,NetCDF_var_free,Netcdf_var);
   return Var;
 }
@@ -852,10 +845,10 @@ NetCDF_dim(VALUE file,VALUE dim_name)
   ncid=Netcdffile->ncid;
   Check_Type(dim_name,T_STRING);
   c_dim_name=RSTRING_PTR(dim_name);
-  
+
   status = nc_inq_dimid(ncid,c_dim_name,&dimidp);
   if(status !=NC_NOERR){
-    if(status == NC_EBADDIM){ 
+    if(status == NC_EBADDIM){
       return(Qnil);  /*2003/08/27 back to orig (from changes on 2003/02/03)*/
     } else{
       NC_RAISE(status);
@@ -863,14 +856,14 @@ NetCDF_dim(VALUE file,VALUE dim_name)
   }
 
   Netcdf_dim=NetCDF_dim_init(ncid,dimidp);
-  
+
   Dimension = Data_Wrap_Struct(cNetCDFDim,0,NetCDF_dim_free,Netcdf_dim);
   return Dimension;
 }
 
-VALUE  
+VALUE
 NetCDF_var(VALUE file,VALUE var_name)
-{  
+{
   int ncid;
   int status;
   int varidp;
@@ -883,16 +876,16 @@ NetCDF_var(VALUE file,VALUE var_name)
   ncid=Netcdffile->ncid;
   Check_Type(var_name,T_STRING);
   c_var_name=RSTRING_PTR(var_name);
-  
+
   status=nc_inq_varid(ncid,c_var_name,&varidp);
   if(status != NC_NOERR){
     if(status == NC_ENOTVAR){
       return(Qnil); /*2003/08/27 back to orig (from changes on 2003/02/03)*/
-    } else{ 
+    } else{
       NC_RAISE(status);
     }
   }
-  
+
   Netcdf_var = NetCDF_var_init(ncid,varidp,file);
   Variable = Data_Wrap_Struct(cNetCDFVar,nc_mark_obj,NetCDF_var_free,Netcdf_var);
   return Variable;
@@ -913,7 +906,7 @@ NetCDF_att(VALUE file,VALUE att_name)
   ncid=Netcdffile->ncid;
   Check_Type(att_name,T_STRING);
   c_att_name=RSTRING_PTR(att_name);
-  
+
 
   status = nc_inq_attid(ncid,NC_GLOBAL,c_att_name,&attnump);
   if(status != NC_NOERR){
@@ -924,11 +917,11 @@ NetCDF_att(VALUE file,VALUE att_name)
       NC_RAISE(status);
     }
   }
-  
+
   Netcdf_att = NetCDF_att_init(ncid,NC_GLOBAL,c_att_name);
-  
+
   Attribute = Data_Wrap_Struct(cNetCDFAtt,0,Netcdf_att_free,Netcdf_att);
-   
+
   return Attribute;
 }
 VALUE
@@ -938,7 +931,7 @@ NetCDF_fill(VALUE file,VALUE mode)
   int status;
   struct Netcdf *Netcdffile;
   int old_modep;
-  
+
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid = Netcdffile->ncid;
   if(mode==Qfalse){
@@ -961,7 +954,6 @@ NetCDF_redef(VALUE file)
   int status;
   struct Netcdf *Netcdffile;
 
-  rb_secure(3);
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid=Netcdffile->ncid;
   status = nc_redef(ncid);
@@ -976,18 +968,17 @@ NetCDF_redef(VALUE file)
   return Qtrue;
 }
 
-VALUE 
+VALUE
 NetCDF_enddef(VALUE file)
 {
   int ncid;
   int status;
   struct Netcdf *Netcdffile;
 
-  rb_secure(3);
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid=Netcdffile->ncid;
   status = nc_enddef(ncid);
-  if(status !=NC_NOERR){ 
+  if(status !=NC_NOERR){
     if(status == NC_ENOTINDEFINE){
       return Qnil;
     }
@@ -998,7 +989,7 @@ NetCDF_enddef(VALUE file)
   return Qtrue;
 }
 
-VALUE 
+VALUE
 NetCDF_whether_in_define_mode(VALUE file)
 {
   /* returns true if the NetCDF object is currently in the define mode,
@@ -1010,7 +1001,6 @@ NetCDF_whether_in_define_mode(VALUE file)
   int status;
   struct Netcdf *Netcdffile;
 
-  rb_secure(3);
   Data_Get_Struct(file,struct Netcdf,Netcdffile);
   ncid=Netcdffile->ncid;
   status = nc_redef(ncid);
@@ -1030,7 +1020,7 @@ NetCDF_whether_in_define_mode(VALUE file)
 }
 
 VALUE
-NetCDF_open(VALUE mod,VALUE filename,VALUE omode)     
+NetCDF_open(VALUE mod,VALUE filename,VALUE omode)
 {
   int status;
   int ncid;
@@ -1044,7 +1034,7 @@ NetCDF_open(VALUE mod,VALUE filename,VALUE omode)
   c_filename=RSTRING_PTR(filename);
   Check_Type(omode,T_FIXNUM);
   c_omode=NUM2INT(omode);
-  
+
   status = nc_open(c_filename,c_omode,&ncid);
   if(status !=NC_NOERR){NC_RAISE2(status,c_filename);}
 
@@ -1061,13 +1051,13 @@ NetCDF_create(VALUE mod,VALUE filename,VALUE cmode)
   char* c_filename;
   int c_cmode;
   struct Netcdf *ncfile;
-  
+
   Check_Type(filename,T_STRING);
   SafeStringValue(filename);
   c_filename=RSTRING_PTR(filename);
   Check_Type(cmode,T_FIXNUM);
   c_cmode=NUM2INT(cmode);
-  
+
   status = nc_create(c_filename,c_cmode,&ncid);
   if(status != NC_NOERR) NC_RAISE2(status, c_filename);
 
@@ -1075,7 +1065,7 @@ NetCDF_create(VALUE mod,VALUE filename,VALUE cmode)
   return( Data_Wrap_Struct(cNetCDF,0,NetCDF_free,ncfile) );
 }
 
-VALUE 
+VALUE
 NetCDF_ndims(VALUE file)
 {
   int ncid;
@@ -1092,7 +1082,7 @@ NetCDF_ndims(VALUE file)
   return Integer;
 }
 
-VALUE 
+VALUE
 NetCDF_nvars(VALUE file)
 {
   int ncid;
@@ -1108,7 +1098,7 @@ NetCDF_nvars(VALUE file)
   return Integer;
 }
 
-VALUE 
+VALUE
 NetCDF_natts(VALUE file)
 {
   int ncid;
@@ -1139,10 +1129,10 @@ NetCDF_unlimited(VALUE file)
   ncid=ncfile->ncid;
   status=nc_inq_unlimdim(ncid,&unlimdimidp);
   if(status !=NC_NOERR) NC_RAISE(status);
-  
+
   Netcdf_dim = NetCDF_dim_init(ncid,unlimdimidp);
-  
-  /* If unlimdimidp=-1,No unlimited dimension is defined in the netCDF dataset */ 
+
+  /* If unlimdimidp=-1,No unlimited dimension is defined in the netCDF dataset */
   if(unlimdimidp != -1)
     {
       Dimension = Data_Wrap_Struct(cNetCDFDim,0,NetCDF_dim_free,Netcdf_dim);
@@ -1156,7 +1146,7 @@ NetCDF_unlimited(VALUE file)
 
 #if NCVER >= 400
 
-VALUE 
+VALUE
 NetCDF_format(VALUE file)
 {
   int ncid;
@@ -1177,7 +1167,7 @@ NetCDF_format(VALUE file)
 }
 
 #endif
-			       
+
 VALUE
 NetCDF_sync(VALUE file)
 {
@@ -1185,7 +1175,6 @@ NetCDF_sync(VALUE file)
   int status;
   struct Netcdf *ncfile;
 
-  rb_secure(3);
   Data_Get_Struct(file,struct Netcdf,ncfile);
   ncid=ncfile->ncid;
   status = nc_sync(ncid);
@@ -1198,7 +1187,7 @@ NetCDF_path(VALUE file)
 {
   char *path;
   struct Netcdf *ncfile;
-  
+
   Data_Get_Struct(file,struct Netcdf,ncfile);
   path=ncfile->name;
   return(rb_str_new2(path));
@@ -1212,14 +1201,14 @@ NetCDF_dim_length(VALUE Dim)
   int dimid;
   size_t lengthp;
   struct NetCDFDim *Netcdf_dim;
-  
+
   Data_Get_Struct(Dim,struct NetCDFDim,Netcdf_dim);
   ncid=Netcdf_dim->ncid;
   dimid=Netcdf_dim->dimid;
 
   status = nc_inq_dimlen(ncid,dimid,&lengthp);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   return(INT2NUM(lengthp));
 }
 
@@ -1231,8 +1220,7 @@ NetCDF_dim_name(VALUE Dim,VALUE dimension_newname)
   int dimid;
   char *c_dim_name;
   struct NetCDFDim *Netcdf_dim;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Dim,struct NetCDFDim,Netcdf_dim);
   ncid=Netcdf_dim->ncid;
   dimid=Netcdf_dim->dimid;
@@ -1241,7 +1229,7 @@ NetCDF_dim_name(VALUE Dim,VALUE dimension_newname)
 
   status = nc_rename_dim(ncid,dimid,c_dim_name);
   if(status !=NC_NOERR) NC_RAISE(status);
-  
+
   return Qnil;
 }
 
@@ -1254,14 +1242,14 @@ NetCDF_dim_inqname(VALUE Dim)
   char c_dim_name[NC_MAX_NAME];
   struct NetCDFDim *Netcdf_dim;
   VALUE str;
-  
+
   Data_Get_Struct(Dim,struct NetCDFDim,Netcdf_dim);
   ncid=Netcdf_dim->ncid;
   dimid=Netcdf_dim->dimid;
-  
+
   status = nc_inq_dimname(ncid,dimid,c_dim_name);
   if(status !=NC_NOERR) NC_RAISE(status);
-  
+
   str = rb_str_new2(c_dim_name);
   OBJ_TAINT(str);
   return(str);
@@ -1273,7 +1261,7 @@ NetCDF_dim_whether_unlimited(VALUE Dim)
   int status;
   int uldid;
   struct NetCDFDim *Netcdf_dim;
-  
+
   Data_Get_Struct(Dim,struct NetCDFDim,Netcdf_dim);
   status=nc_inq_unlimdim(Netcdf_dim->ncid,&uldid);
   if(status !=NC_NOERR) NC_RAISE(status);
@@ -1293,7 +1281,7 @@ NetCDF_att_inq_name(VALUE Att)
 
   Data_Get_Struct(Att,struct NetCDFAtt,Netcdf_att);
   c_att_name=Netcdf_att->name;
-  
+
   str = rb_str_new2(c_att_name);
   OBJ_TAINT(str);
   return(str);
@@ -1311,16 +1299,16 @@ NetCDF_att_rename(VALUE Att,VALUE new_att_name)
   Data_Get_Struct(Att,struct NetCDFAtt,Netcdf_att);
   ncid=Netcdf_att->ncid;
   varid=Netcdf_att->varid;
-  
+
   c_att_name=Netcdf_att->name;
-  
+
   Check_Type(new_att_name,T_STRING);
   SafeStringValue(new_att_name);
   c_new_att_name=StringValueCStr(new_att_name);
-  
+
   status = nc_rename_att(ncid,varid,c_att_name,c_new_att_name);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   strcpy(Netcdf_att->name,c_new_att_name);
   return Qnil;
 }
@@ -1351,7 +1339,7 @@ NetCDF_id2var(VALUE file,VALUE varid)
   struct Netcdf *ncfile;
   struct NetCDFVar *Netcdf_var;
   VALUE Var;
-  
+
   Data_Get_Struct(file,struct Netcdf,ncfile);
   ncid=ncfile->ncid;
   Check_Type(varid,T_FIXNUM);
@@ -1373,7 +1361,7 @@ NetCDF_id2att(VALUE file,VALUE attnum)
   char *c_att_name;
   VALUE Att;
   c_att_name=ALLOCA_N(char,NC_MAX_NAME);
-  
+
   Data_Get_Struct(file,struct Netcdf,ncfile);
   ncid=ncfile->ncid;
 
@@ -1401,7 +1389,7 @@ NetCDF_var_deflate(int argc, VALUE *argv, VALUE Var)
   struct NetCDFVar *Netcdf_var;
 
   int shuffle;
-    /* If non-zero, turn on the shuffle filter. 
+    /* If non-zero, turn on the shuffle filter.
 
        http://www.unidata.ucar.edu/software/netcdf/papers/AMS_2008.pdf :
        The shuffle algorithm changes the byte order in the data stream;
@@ -1421,7 +1409,7 @@ NetCDF_var_deflate(int argc, VALUE *argv, VALUE Var)
            level specified by the deflate_level parameter.
          */
 
-  if (argc>2 || argc<1) rb_raise(rb_eArgError, 
+  if (argc>2 || argc<1) rb_raise(rb_eArgError,
 		         "wrong # of arguments (%d). It must be 1 or 2", argc);
 
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
@@ -1457,7 +1445,7 @@ NetCDF_var_deflate_params(VALUE Var)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  status = nc_inq_var_deflate(ncid, varid, &shufflep, &deflatep, 
+  status = nc_inq_var_deflate(ncid, varid, &shufflep, &deflatep,
 			      &deflate_levelp);
   if(status != NC_NOERR) NC_RAISE(status);
   if (shufflep==0) {sh=Qfalse;} else {sh=Qtrue;}
@@ -1508,7 +1496,7 @@ NetCDF_var_id2att(VALUE Var,VALUE attnum)
   struct NetCDFAtt *Netcdf_att;
   char *c_att_name;
   VALUE Att;
-  
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   c_varid=Netcdf_var->varid;
@@ -1520,7 +1508,7 @@ NetCDF_var_id2att(VALUE Var,VALUE attnum)
 
   status = nc_inq_attname(ncid,c_varid,c_attnum,c_att_name);
   if(status != NC_NOERR) NC_RAISE(status);
- 
+
   Netcdf_att=NetCDF_att_init(ncid,c_varid,c_att_name);
   Att=Data_Wrap_Struct(cNetCDFAtt,0,Netcdf_att_free,Netcdf_att);
   return(Att);
@@ -1545,7 +1533,7 @@ NetCDF_var_dims(VALUE Var)
   Dims = rb_ary_new();
   for(i=0;i<ndims;i++){
       Netcdf_dim = NetCDF_dim_init(ncid,dimids[ndims-1-i]);
-      rb_ary_push(Dims, 
+      rb_ary_push(Dims,
 		  Data_Wrap_Struct(cNetCDFDim,0,NetCDF_dim_free,Netcdf_dim));
   }
   return(Dims);
@@ -1589,7 +1577,6 @@ NetCDF_att_copy(VALUE Att,VALUE Var_or_File)
   struct Netcdf    *ncfile;
   struct NetCDFAtt *Netcdf_att_out;
 
-  rb_secure(3);
   Data_Get_Struct(Att,struct NetCDFAtt,Netcdf_att);
   ncid_in=Netcdf_att->ncid;
   varid_in=Netcdf_att->varid;
@@ -1635,7 +1622,7 @@ NetCDF_att_atttype(VALUE Att)
   Attname = nctype2natype(xtypep);
   return(rb_str_new2(Attname));
 }
-  
+
 VALUE
 NetCDF_att_typecode(VALUE Att)
 {
@@ -1653,10 +1640,10 @@ NetCDF_att_typecode(VALUE Att)
 
   status = nc_inq_atttype(ncid,varid,att_name,&xtypep);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   return(INT2NUM(nctype2natypecode(xtypep)));
 }
-  
+
 VALUE
 NetCDF_att_delete(VALUE Att)
 {
@@ -1666,7 +1653,6 @@ NetCDF_att_delete(VALUE Att)
   char *c_att_name;
   struct NetCDFAtt *Netcdf_att;
 
-  rb_secure(3);
   Data_Get_Struct(Att,struct NetCDFAtt,Netcdf_att);
 
   ncid=Netcdf_att->ncid;
@@ -1675,7 +1661,7 @@ NetCDF_att_delete(VALUE Att)
 
   status = nc_del_att(ncid,varid,c_att_name);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   return Qnil;
 }
 
@@ -1687,13 +1673,12 @@ NetCDF_att_put(VALUE Att,VALUE value,VALUE atttype)
       */
 {
   struct NetCDFAtt *ncatt;
- 
-  rb_secure(3);
+
   Data_Get_Struct(Att,struct NetCDFAtt,ncatt);
-  return( NetCDF_put_att__(ncatt->ncid, ncatt->name, value, 
+  return( NetCDF_put_att__(ncatt->ncid, ncatt->name, value,
 			   atttype, ncatt->varid) );
 }
-  
+
 VALUE
 NetCDF_att_get(VALUE Att)
 {
@@ -1740,7 +1725,7 @@ NetCDF_att_get(VALUE Att)
 
     attlen[0]=lenp;
     Cbyte_to_NArray(NArray,1,attlen,up);
-  
+
     status = nc_get_att_uchar(ncid,varid,c_attname,up);
     if(status != NC_NOERR) NC_RAISE(status);
 
@@ -1753,7 +1738,7 @@ NetCDF_att_get(VALUE Att)
 
     attlen[0]=lenp;
     Csint_to_NArray(NArray,1,attlen,sp);
-    
+
     status = nc_get_att_short(ncid,varid,c_attname,sp);
     if(status != NC_NOERR) NC_RAISE(status);
     OBJ_TAINT(NArray);
@@ -1762,10 +1747,10 @@ NetCDF_att_get(VALUE Att)
   case NC_INT:
     status = nc_inq_attlen(ncid,varid,c_attname,&lenp);
     if(status != NC_NOERR) NC_RAISE(status);
-    
+
     attlen[0]=lenp;
     Clint_to_NArray(NArray,1,attlen,ip);
-    
+
     status = nc_get_att_int(ncid,varid,c_attname,ip);
     if(status != NC_NOERR) NC_RAISE(status);
 
@@ -1778,7 +1763,7 @@ NetCDF_att_get(VALUE Att)
 
     attlen[0]=lenp;
     Cfloat_to_NArray(NArray,1,attlen,fp);
-    
+
     status = nc_get_att_float(ncid,varid,c_attname,fp);
     if(status != NC_NOERR) NC_RAISE(status);
 
@@ -1791,7 +1776,7 @@ NetCDF_att_get(VALUE Att)
 
     attlen[0]=lenp;
     Cdouble_to_NArray(NArray,1,attlen,dp);
-    
+
     status = nc_get_att_double(ncid,varid,c_attname,dp);
     if(status != NC_NOERR) NC_RAISE(status);
     OBJ_TAINT(NArray);
@@ -1803,7 +1788,7 @@ NetCDF_att_get(VALUE Att)
   return Qnil;
 }
 
-		  
+
 VALUE
 NetCDF_var_inq_name(VALUE Var)
 {
@@ -1820,7 +1805,7 @@ NetCDF_var_inq_name(VALUE Var)
   varid=Netcdf_var->varid;
   status = nc_inq_varname(ncid,varid,c_var_name);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Var_name=rb_str_new2(c_var_name);
   OBJ_TAINT(Var_name);
   return Var_name;
@@ -1837,7 +1822,7 @@ NetCDF_var_ndims(VALUE Var)
   VALUE Var_ndims;
 
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndimsp);
@@ -1855,15 +1840,15 @@ NetCDF_var_vartype(VALUE Var)
   nc_type xtypep;
   struct NetCDFVar *Netcdf_var;
   const char *Vartype;
-  
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   status = nc_inq_vartype(ncid,varid,&xtypep);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Vartype=nctype2natype(xtypep);
   return(rb_str_new2(Vartype));
 }
@@ -1876,19 +1861,19 @@ NetCDF_var_typecode(VALUE Var)
   int varid;
   nc_type xtypep;
   struct NetCDFVar *Netcdf_var;
-  
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   status = nc_inq_vartype(ncid,varid,&xtypep);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   return(INT2NUM(nctype2natypecode(xtypep)));
 }
 
- 
+
 VALUE
 NetCDF_var_natts(VALUE Var)
 {
@@ -1898,16 +1883,16 @@ NetCDF_var_natts(VALUE Var)
   int nattsp;
   struct NetCDFVar *Netcdf_var;
   VALUE Var_natts;
-  
+
 
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
-  
+
   status= nc_inq_varnatts(ncid,varid,&nattsp);
   if(status !=NC_NOERR) NC_RAISE(status);
-  
+
   Var_natts=INT2FIX(nattsp);
   return Var_natts;
 }
@@ -1918,7 +1903,7 @@ NetCDF_var_file(VALUE Var)
   struct NetCDFVar *Netcdf_var;
   /* VALUE file; */
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   return (Netcdf_var->file);
 }
 
@@ -1930,15 +1915,14 @@ NetCDF_var_rename(VALUE Var,VALUE var_new_name)
   int varid;
   char *c_var_new_name;
   struct NetCDFVar *Netcdf_var;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   Check_Type(var_new_name,T_STRING);
   c_var_new_name=StringValueCStr(var_new_name);
-  
+
   status = nc_rename_var(ncid,varid,c_var_new_name);
   if(status !=NC_NOERR) NC_RAISE(status);
 
@@ -1958,13 +1942,13 @@ NetCDF_var_att(VALUE Var,VALUE att_name)
   VALUE Att;
 
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
-  
+
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   Check_Type(att_name,T_STRING);
   c_att_name=StringValueCStr(att_name);
-  
+
   status = nc_inq_attid(ncid,varid,c_att_name,&c_attnump);
   if(status == NC_NOERR){
     Netcdf_att=NetCDF_att_init(ncid,varid,c_att_name);
@@ -1982,17 +1966,17 @@ NetCDF_var_att(VALUE Var,VALUE att_name)
 
 /* Redifinition of the "==" and "eql?" methods */
 
-VALUE 
+VALUE
 NetCDF_eql(VALUE filea,VALUE fileb)
 {
   struct Netcdf *ncfilea;
   struct Netcdf *ncfileb;
-  
+
   if( rb_obj_is_kind_of(fileb, cNetCDF) ){
       Data_Get_Struct(filea,struct Netcdf,ncfilea);
       Data_Get_Struct(fileb,struct Netcdf,ncfileb);
-    
-      if(ncfilea->ncid == ncfileb->ncid && 
+
+      if(ncfilea->ncid == ncfileb->ncid &&
 	 strcmp(ncfilea->name,ncfileb->name)==0){
 	  return Qtrue;
       } else {
@@ -2008,12 +1992,12 @@ NetCDF_var_eql(VALUE Vara,VALUE Varb)
 {
   struct NetCDFVar *Netcdf_vara;
   struct NetCDFVar *Netcdf_varb;
-  
+
   if( rb_obj_is_kind_of(Varb, cNetCDFVar) ){
       Data_Get_Struct(Vara,struct NetCDFVar,Netcdf_vara);
       Data_Get_Struct(Varb,struct NetCDFVar,Netcdf_varb);
 
-      if(Netcdf_vara->ncid == Netcdf_varb->ncid && 
+      if(Netcdf_vara->ncid == Netcdf_varb->ncid &&
 	 Netcdf_vara->varid == Netcdf_varb->varid){
 	  return Qtrue;
       } else {
@@ -2024,7 +2008,7 @@ NetCDF_var_eql(VALUE Vara,VALUE Varb)
   }
 }
 
-VALUE 
+VALUE
 NetCDF_dim_eql(VALUE Dima,VALUE Dimb)
 {
   struct NetCDFDim *Netcdf_dima;
@@ -2033,8 +2017,8 @@ NetCDF_dim_eql(VALUE Dima,VALUE Dimb)
   if( rb_obj_is_kind_of(Dimb, cNetCDFDim) ){
       Data_Get_Struct(Dima,struct NetCDFDim,Netcdf_dima);
       Data_Get_Struct(Dimb,struct NetCDFDim,Netcdf_dimb);
-  
-      if(Netcdf_dima->ncid == Netcdf_dimb->ncid && 
+
+      if(Netcdf_dima->ncid == Netcdf_dimb->ncid &&
 	 Netcdf_dima->dimid == Netcdf_dimb->dimid){
 	  return Qtrue;
       } else {
@@ -2050,16 +2034,16 @@ NetCDF_att_eql(VALUE Atta,VALUE Attb)
 {
   struct NetCDFAtt *Netcdf_atta;
   struct NetCDFAtt *Netcdf_attb;
-  
+
   if( rb_obj_is_kind_of(Attb, cNetCDFAtt) ){
       Data_Get_Struct(Atta,struct NetCDFAtt,Netcdf_atta);
       Data_Get_Struct(Attb,struct NetCDFAtt,Netcdf_attb);
-  
-      if(Netcdf_atta->ncid == Netcdf_atta->ncid && 
-	 Netcdf_atta->varid == Netcdf_attb->varid && 
+
+      if(Netcdf_atta->ncid == Netcdf_atta->ncid &&
+	 Netcdf_atta->varid == Netcdf_attb->varid &&
 	 strcmp(Netcdf_atta->name,Netcdf_attb->name)==0){
 	  return Qtrue;
-      } else { 
+      } else {
 	  return Qfalse;
       }
   } else {
@@ -2104,7 +2088,7 @@ NetCDF_get_var_char(VALUE Var)
   }
 
   Cbyte_to_NArray(NArray,ndimsp,shape,ptr);
-  
+
   status = nc_get_var_text(ncid,varid,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2148,7 +2132,7 @@ NetCDF_get_var_byte(VALUE Var)
   }
 
   Cbyte_to_NArray(NArray,ndimsp,shape,ptr);
-  
+
   status = nc_get_var_uchar(ncid,varid,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2192,7 +2176,7 @@ NetCDF_get_var_sint(VALUE Var)
   }
 
   Csint_to_NArray(NArray,ndimsp,shape,ptr);
-  
+
   status = nc_get_var_short(ncid,varid,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2236,7 +2220,7 @@ NetCDF_get_var_int(VALUE Var)
   }
 
   Clint_to_NArray(NArray,ndimsp,shape,ptr);
-  
+
   status = nc_get_var_int(ncid,varid,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2324,7 +2308,7 @@ NetCDF_get_var_double(VALUE Var)
   }
 
   Cdouble_to_NArray(NArray,ndimsp,shape,ptr);
-  
+
   status = nc_get_var_double(ncid,varid,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2332,7 +2316,7 @@ NetCDF_get_var_double(VALUE Var)
   return NArray;
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_char(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2349,7 +2333,7 @@ NetCDF_get_var1_char(VALUE Var,VALUE start)
   na_shape_t *c_count;
   VALUE NArray;
 
-  
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
@@ -2358,12 +2342,12 @@ NetCDF_get_var1_char(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2376,13 +2360,13 @@ NetCDF_get_var1_char(VALUE Var,VALUE start)
       l_start += dimlen;
     }
     c_start[i]=l_start;
-    
+
     c_count[i]=1;
   }
-  
-  
-  
-  
+
+
+
+
   Cbyte_to_NArray(NArray,ndims,c_count,ptr);
   status = nc_get_var1_text(ncid,varid,c_start,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
@@ -2392,7 +2376,7 @@ NetCDF_get_var1_char(VALUE Var,VALUE start)
 
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_byte(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2409,7 +2393,7 @@ NetCDF_get_var1_byte(VALUE Var,VALUE start)
   na_shape_t *c_count;
   VALUE NArray;
 
-  
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
@@ -2418,12 +2402,12 @@ NetCDF_get_var1_byte(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2436,13 +2420,13 @@ NetCDF_get_var1_byte(VALUE Var,VALUE start)
       l_start += dimlen;
     }
     c_start[i]=l_start;
-    
+
     c_count[i]=1;
   }
-  
-  
-  
-  
+
+
+
+
   Cbyte_to_NArray(NArray,ndims,c_count,ptr);
   status = nc_get_var1_uchar(ncid,varid,c_start,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
@@ -2452,7 +2436,7 @@ NetCDF_get_var1_byte(VALUE Var,VALUE start)
 
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_sint(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2477,12 +2461,12 @@ NetCDF_get_var1_sint(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2497,9 +2481,9 @@ NetCDF_get_var1_sint(VALUE Var,VALUE start)
     c_start[i]=l_start;
     c_count[i]=1;
   }
-  
+
   Csint_to_NArray(NArray,ndims,c_count,ptr);
-  
+
   status = nc_get_var1_short(ncid,varid,c_start,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2508,7 +2492,7 @@ NetCDF_get_var1_sint(VALUE Var,VALUE start)
 
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_int(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2533,12 +2517,12 @@ NetCDF_get_var1_int(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2553,9 +2537,9 @@ NetCDF_get_var1_int(VALUE Var,VALUE start)
     c_start[i]=l_start;
     c_count[i]=1;
   }
-  
+
   Clint_to_NArray(NArray,ndims,c_count,ptr);
-  
+
   status = nc_get_var1_int(ncid,varid,c_start,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2564,7 +2548,7 @@ NetCDF_get_var1_int(VALUE Var,VALUE start)
 
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_float(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2589,12 +2573,12 @@ NetCDF_get_var1_float(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2609,9 +2593,9 @@ NetCDF_get_var1_float(VALUE Var,VALUE start)
     c_start[i]=l_start;
     c_count[i]=1;
   }
-  
+
   Cfloat_to_NArray(NArray,ndims,c_count,ptr);
-  
+
   status = nc_get_var1_float(ncid,varid,c_start,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2620,7 +2604,7 @@ NetCDF_get_var1_float(VALUE Var,VALUE start)
 
 }
 
-VALUE 
+VALUE
 NetCDF_get_var1_double(VALUE Var,VALUE start)
 {
   int ncid;
@@ -2645,12 +2629,12 @@ NetCDF_get_var1_double(VALUE Var,VALUE start)
   if(ndims == 0) {
     rb_raise(rb_eNetcdfError,"Cannot specify a subset of a rank-0 scalar\n");
   }
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
   }
-  
+
   c_start=ALLOCA_N(size_t,ndims);
   c_count=ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
@@ -2665,9 +2649,9 @@ NetCDF_get_var1_double(VALUE Var,VALUE start)
     c_start[i]=l_start;
     c_count[i]=1;
   }
-  
+
   Cdouble_to_NArray(NArray,ndims,c_count,ptr);
-  
+
   status = nc_get_var1_double(ncid,varid,c_start,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2698,7 +2682,7 @@ NetCDF_get_vars_char(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -2708,7 +2692,7 @@ NetCDF_get_vars_char(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -2716,7 +2700,7 @@ NetCDF_get_vars_char(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -2769,14 +2753,14 @@ NetCDF_get_vars_char(VALUE Var,VALUE start,VALUE end,VALUE stride)
     }
   }
 
-  
+
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
-  
+
   Cbyte_to_NArray(NArray,ndims,shape,ptr);
-  
+
   status = nc_get_vars_text(ncid,varid,c_start,c_count,c_stride,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2806,7 +2790,7 @@ NetCDF_get_vars_byte(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -2816,7 +2800,7 @@ NetCDF_get_vars_byte(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -2824,7 +2808,7 @@ NetCDF_get_vars_byte(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -2877,14 +2861,14 @@ NetCDF_get_vars_byte(VALUE Var,VALUE start,VALUE end,VALUE stride)
     }
   }
 
-  
+
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
-  
+
   Cbyte_to_NArray(NArray,ndims,shape,ptr);
-  
+
   status = nc_get_vars_uchar(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -2914,7 +2898,7 @@ NetCDF_get_vars_sint(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -2924,7 +2908,7 @@ NetCDF_get_vars_sint(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -2932,7 +2916,7 @@ NetCDF_get_vars_sint(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -2984,19 +2968,19 @@ NetCDF_get_vars_sint(VALUE Var,VALUE start,VALUE end,VALUE stride)
       c_count[i]=(l_end-c_start[i])/c_stride[i]+1;
     }
   }
-  
-  
+
+
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
 
   Csint_to_NArray(NArray,ndims,shape,ptr);
-  
+
 
   status = nc_get_vars_short(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   OBJ_TAINT(NArray);
   return NArray;
 }
@@ -3023,7 +3007,7 @@ NetCDF_get_vars_int(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -3033,7 +3017,7 @@ NetCDF_get_vars_int(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -3041,7 +3025,7 @@ NetCDF_get_vars_int(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3094,14 +3078,14 @@ NetCDF_get_vars_int(VALUE Var,VALUE start,VALUE end,VALUE stride)
     }
   }
 
-  
+
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
 
   Clint_to_NArray(NArray,ndims,shape,ptr);
-  
+
 
   status = nc_get_vars_int(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
@@ -3132,7 +3116,7 @@ NetCDF_get_vars_float(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -3142,7 +3126,7 @@ NetCDF_get_vars_float(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -3150,7 +3134,7 @@ NetCDF_get_vars_float(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3202,16 +3186,16 @@ NetCDF_get_vars_float(VALUE Var,VALUE start,VALUE end,VALUE stride)
       c_count[i]=(l_end-c_start[i])/c_stride[i]+1;
     }
   }
-  
+
 
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
-  
+
   Cfloat_to_NArray(NArray,ndims,shape,ptr);
-  
-  
+
+
   status = nc_get_vars_float(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -3241,7 +3225,7 @@ NetCDF_get_vars_double(VALUE Var,VALUE start,VALUE end,VALUE stride)
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid = Netcdf_var->ncid;
   varid = Netcdf_var->varid;
-  
+
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
   if(ndims == 0) {
@@ -3251,7 +3235,7 @@ NetCDF_get_vars_double(VALUE Var,VALUE start,VALUE end,VALUE stride)
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims){
     rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
@@ -3259,7 +3243,7 @@ NetCDF_get_vars_double(VALUE Var,VALUE start,VALUE end,VALUE stride)
   c_start = ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-   
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3311,15 +3295,15 @@ NetCDF_get_vars_double(VALUE Var,VALUE start,VALUE end,VALUE stride)
       c_count[i]=(l_end-c_start[i])/c_stride[i]+1;
     }
   }
-  
+
 
   shape = ALLOCA_N(na_shape_t,ndims);
   for(i=0;i<ndims;i++){
     shape[ndims-1-i]=c_count[i];
   }
-  
+
   Cdouble_to_NArray(NArray,ndims,shape,ptr);
-  
+
   status = nc_get_vars_double(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
 
@@ -3343,13 +3327,12 @@ NetCDF_put_var_char(VALUE Var,VALUE NArray)
   size_t lengthp;
   char *var_name;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   Array_to_Cbyte_len(NArray,ptr,len);
-  
+
   status = nc_inq_varndims(ncid,varid,&ndimsp);
   if(status != NC_NOERR) NC_RAISE(status);
   for(i=0;i<ndimsp;i++){
@@ -3388,13 +3371,12 @@ NetCDF_put_var_byte(VALUE Var,VALUE NArray)
   size_t lengthp;
   char *var_name;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   Array_to_Cbyte_len(NArray,ptr,len);
-  
+
   status = nc_inq_varndims(ncid,varid,&ndimsp);
   if(status != NC_NOERR) NC_RAISE(status);
   for(i=0;i<ndimsp;i++){
@@ -3433,12 +3415,11 @@ NetCDF_put_var_short(VALUE Var,VALUE NArray)
   size_t lengthp;
   char *var_name;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   Array_to_Csint_len(NArray,ptr,len);
-  
+
   status = nc_inq_varndims(ncid,varid,&ndimsp);
   if(status != NC_NOERR) NC_RAISE(status);
   for(i=0;i<ndimsp;i++){
@@ -3478,7 +3459,6 @@ NetCDF_put_var_int(VALUE Var,VALUE NArray)
   size_t lengthp;
   char *var_name;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -3503,8 +3483,8 @@ NetCDF_put_var_int(VALUE Var,VALUE NArray)
     if(status != NC_NOERR) NC_RAISE(status);
     rb_raise(rb_eNetcdfError,"Length of NArray don't equal to length of total array length in the '%s'\n",var_name);
   }
-  
-  
+
+
   status = nc_put_var_int(ncid,varid,ptr);
   if(status !=NC_NOERR) NC_RAISE(status);
   return Qnil;
@@ -3525,15 +3505,14 @@ NetCDF_put_var_float(VALUE Var,VALUE NArray)
   int dimids[NC_MAX_DIMS];
   size_t lengthp;
   char *var_name;
-  
-  
-  rb_secure(3);
+
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
 
   Array_to_Cfloat_len(NArray,ptr,len);
-  
+
   status = nc_inq_varndims(ncid,varid,&ndimsp);
   if(status != NC_NOERR) NC_RAISE(status);
   for(i=0;i<ndimsp;i++){
@@ -3574,7 +3553,6 @@ NetCDF_put_var_double(VALUE Var,VALUE NArray)
   char *var_name;
 
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -3619,19 +3597,18 @@ NetCDF_put_var1_char(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3640,7 +3617,7 @@ NetCDF_put_var1_char(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3670,19 +3647,18 @@ NetCDF_put_var1_byte(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3691,7 +3667,7 @@ NetCDF_put_var1_byte(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3721,19 +3697,18 @@ NetCDF_put_var1_sint(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3742,7 +3717,7 @@ NetCDF_put_var1_sint(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3771,19 +3746,18 @@ NetCDF_put_var1_int(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3792,7 +3766,7 @@ NetCDF_put_var1_int(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3822,19 +3796,18 @@ NetCDF_put_var1_float(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3843,7 +3816,7 @@ NetCDF_put_var1_float(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3873,19 +3846,18 @@ NetCDF_put_var1_double(VALUE Var,VALUE NArray,VALUE start)
   int ndims;
   int   *dimids;
   size_t dimlen;
-  
-  rb_secure(3);
+
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
   status = nc_inq_varndims(ncid,varid,&ndims);
   if(status != NC_NOERR) NC_RAISE(status);
 
-  
+
   dimids = ALLOCA_N(int,ndims);
   status = nc_inq_vardimid(ncid,varid,dimids);
   if(status != NC_NOERR) NC_RAISE(status);
-  
+
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) <ndims) {
     rb_raise(rb_eNetcdfError,"Length of 'start' is too short\n");
@@ -3894,7 +3866,7 @@ NetCDF_put_var1_double(VALUE Var,VALUE NArray,VALUE start)
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0;i<ndims;i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
       status = nc_inq_dimlen(ncid,dimids[i],&dimlen);
       if(status != NC_NOERR) NC_RAISE(status);
@@ -3930,7 +3902,6 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -3943,12 +3914,12 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -3956,7 +3927,7 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -3967,12 +3938,12 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -3990,7 +3961,7 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4007,11 +3978,11 @@ NetCDF_put_vars_char(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 	  ptr = ALLOCA_N(unsigned char,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	rb_raise(rb_eNetcdfError, 
-		 "lengh of the array does not agree with that of the subset\n"); 
-      } 
-  } 
-  
+	rb_raise(rb_eNetcdfError,
+		 "lengh of the array does not agree with that of the subset\n");
+      }
+  }
+
   status = nc_put_vars_text(ncid,varid,c_start,c_count,c_stride,(char *)ptr);
   if(status != NC_NOERR) NC_RAISE(status);
   return Qnil;
@@ -4036,7 +4007,6 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -4049,12 +4019,12 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -4062,7 +4032,7 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -4073,12 +4043,12 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -4096,7 +4066,7 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4113,11 +4083,11 @@ NetCDF_put_vars_byte(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 	  ptr = ALLOCA_N(unsigned char,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	rb_raise(rb_eNetcdfError, 
-		 "lengh of the array does not agree with that of the subset\n"); 
-      } 
-  } 
-  
+	rb_raise(rb_eNetcdfError,
+		 "lengh of the array does not agree with that of the subset\n");
+      }
+  }
+
   status = nc_put_vars_uchar(ncid,varid,c_start,c_count,c_stride,ptr);
   if(status != NC_NOERR) NC_RAISE(status);
   return Qnil;
@@ -4142,7 +4112,6 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -4155,12 +4124,12 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -4168,7 +4137,7 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -4179,12 +4148,12 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -4202,7 +4171,7 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4219,8 +4188,8 @@ NetCDF_put_vars_sint(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 	  ptr = ALLOCA_N(short,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	  rb_raise(rb_eNetcdfError, 
-              "lengh of the array does not agree with that of the subset\n"); 
+	  rb_raise(rb_eNetcdfError,
+              "lengh of the array does not agree with that of the subset\n");
       }
   }
 
@@ -4249,7 +4218,6 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -4262,12 +4230,12 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -4275,7 +4243,7 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -4286,12 +4254,12 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -4309,7 +4277,7 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4326,8 +4294,8 @@ NetCDF_put_vars_int(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 	  ptr = ALLOCA_N(int,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	  rb_raise(rb_eNetcdfError, 
-              "length of the array does not agree with that of the subset\n"); 
+	  rb_raise(rb_eNetcdfError,
+              "length of the array does not agree with that of the subset\n");
       }
   }
 
@@ -4356,7 +4324,6 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -4369,12 +4336,12 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -4382,7 +4349,7 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -4393,12 +4360,12 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -4416,7 +4383,7 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4433,8 +4400,8 @@ NetCDF_put_vars_float(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride)
 	  ptr = ALLOCA_N(float,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	  rb_raise(rb_eNetcdfError, 
-              "lengh of the array does not agree with that of the subset\n"); 
+	  rb_raise(rb_eNetcdfError,
+              "lengh of the array does not agree with that of the subset\n");
       }
   }
 
@@ -4463,7 +4430,6 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
   int   *dimids;
   size_t dimlen;
 
-  rb_secure(3);
   Data_Get_Struct(Var,struct NetCDFVar,Netcdf_var);
   ncid=Netcdf_var->ncid;
   varid=Netcdf_var->varid;
@@ -4476,12 +4442,12 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
 
   Check_Type(start,T_ARRAY);
   if(RARRAY_LEN(start) < ndims) {
-      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n"); 
+      rb_raise(rb_eNetcdfError, "Length of 'start' is too short\n");
   }
   c_start=ALLOCA_N(size_t,ndims);
   for(i=0; i<ndims; i++){
     l_start=NUM2INT(RARRAY_PTR(start)[ndims-1-i]);
-    
+
     if(l_start < 0) {
 	status = nc_inq_dimlen(ncid, dimids[i], &dimlen);
 	if(status != NC_NOERR) NC_RAISE(status);
@@ -4489,7 +4455,7 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
     }
     c_start[i]=l_start;
   }
-  
+
   c_stride=ALLOCA_N(ptrdiff_t,ndims);
   switch(TYPE(stride)){
   case T_NIL:
@@ -4500,12 +4466,12 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
   default:
       Check_Type(stride,T_ARRAY);
       if(RARRAY_LEN(stride) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'stride' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  c_stride[i]=NUM2INT(RARRAY_PTR(stride)[ndims-1-i]);
 	  if(c_stride[i]==0) {
-	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n"); 
+	      rb_raise(rb_eNetcdfError, "stride cannot be zero\n");
 	  }
       }
   }
@@ -4523,7 +4489,7 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
   default:
       Check_Type(end,T_ARRAY);
       if(RARRAY_LEN(end) < ndims) {
-	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n"); 
+	  rb_raise(rb_eNetcdfError, "Length of 'end' is too short\n");
       }
       for(i=0; i<ndims; i++){
 	  l_end=NUM2INT(RARRAY_PTR(end)[ndims-1-i]);
@@ -4540,8 +4506,8 @@ NetCDF_put_vars_double(VALUE Var,VALUE NArray,VALUE start,VALUE end,VALUE stride
 	  ptr = ALLOCA_N(double,c_count_all);
 	  for(i=0;i<c_count_all;i++){ptr[i]=scalar;}
       } else if(len != c_count_all) {
-	  rb_raise(rb_eNetcdfError, 
-              "lengh of the array does not agree with that of the subset\n"); 
+	  rb_raise(rb_eNetcdfError,
+              "lengh of the array does not agree with that of the subset\n");
       }
   }
 
@@ -4589,7 +4555,7 @@ Init_netcdfraw(void)
   rb_eNetcdfEdge = rb_define_class("NetcdfEdge",rb_eNetcdfError);
   rb_eNetcdfStride = rb_define_class("NetcdfStride",rb_eNetcdfError);
   rb_eNetcdfBadname = rb_define_class("NetcdfBadname",rb_eNetcdfError);
-  /* N.B. following must match value in ncx.h */ 
+  /* N.B. following must match value in ncx.h */
   rb_eNetcdfRange = rb_define_class("NetcdfRange",rb_eNetcdfError);
   rb_eNetcdfNomem = rb_define_class("NetcdfNomem",rb_eNetcdfError);
   /* Global error status */
@@ -4607,10 +4573,10 @@ Init_netcdfraw(void)
   rb_define_const(cNetCDF, "NC_NOCLOBBER", INT2FIX(NC_NOCLOBBER));
 #if NCVER >= 400
   rb_define_const(cNetCDF, "NC_64BIT_OFFSET", INT2FIX(NC_64BIT_OFFSET));
-     /* NC_64BIT_OFFSET supports large files in the class data format */ 
+     /* NC_64BIT_OFFSET supports large files in the class data format */
   rb_define_const(cNetCDF, "NC_NETCDF4", INT2FIX(NC_NETCDF4));
   rb_define_const(cNetCDF, "NC_CLASSIC_MODEL", INT2FIX(NC_CLASSIC_MODEL));
-     /* for use as ( NC_NETCDF4 | NC_CLASSIC_MODEL ) to ensure the classic 
+     /* for use as ( NC_NETCDF4 | NC_CLASSIC_MODEL ) to ensure the classic
         data model in NetCDF4 by disabling new features like groups */
   rb_define_const(cNetCDF, "NC_ENDIAN_NATIVE", INT2FIX(NC_ENDIAN_NATIVE));
   rb_define_const(cNetCDF, "NC_ENDIAN_LITTLE", INT2FIX(NC_ENDIAN_LITTLE));
@@ -4621,7 +4587,7 @@ Init_netcdfraw(void)
   rb_define_const(cNetCDF, "NC_FORMAT_NETCDF4", INT2FIX(NC_FORMAT_NETCDF4));
   rb_define_const(cNetCDF, "NC_FORMAT_NETCDF4_CLASSIC", INT2FIX(NC_FORMAT_NETCDF4_CLASSIC));
 #endif
- 
+
 #ifdef NARRAY_BIGMEM
   rb_define_const(cNetCDF, "SUPPORT_BIGMEM", Qtrue);
 #else
@@ -4658,7 +4624,7 @@ Init_netcdfraw(void)
   rb_define_private_method(cNetCDF,"id2var",NetCDF_id2var,1);
   rb_define_private_method(cNetCDF,"id2dim",NetCDF_id2dim,1);
   rb_define_private_method(cNetCDF,"id2att",NetCDF_id2att,1);
-  rb_define_method(cNetCDF,"==",NetCDF_eql,1); 
+  rb_define_method(cNetCDF,"==",NetCDF_eql,1);
   /* rb_define_method(cNetCDF,"eql?",NetCDF_eql,1); */
 
   /* The methods of the NetCDFDim class */
@@ -4736,7 +4702,7 @@ Init_netcdfraw(void)
   rb_define_method(cNetCDFVar,"get_var_int",NetCDF_get_var_int,0);
   rb_define_method(cNetCDFVar,"get_var_sfloat",NetCDF_get_var_float,0);
   rb_define_method(cNetCDFVar,"get_var_float",NetCDF_get_var_double,0);
-  
+
   rb_define_method(cNetCDFVar,"get_vars_char",NetCDF_get_vars_char,3);
   rb_define_method(cNetCDFVar,"get_vars_byte",NetCDF_get_vars_byte,3);
   rb_define_method(cNetCDFVar,"get_vars_sint",NetCDF_get_vars_sint,3);


=====================================
lib/numru/netcdf.rb
=====================================
@@ -36,7 +36,7 @@ module NumRu
       raise("This method is available only for NetCDF >= 4") unless @@nc4
       case cmode
       when  0, nil, NC_CLASSIC_MODEL, /^CLASSIC$/i, NC_FORMAT_CLASSIC
-            # classic netcdf ver 3 fmt
+        # classic netcdf ver 3 fmt
         @@cr_format = 0
       when NC_64BIT_OFFSET, /^64BIT_OFFSET$/i, NC_FORMAT_64BIT
         @@cr_format = NC_64BIT_OFFSET
@@ -65,229 +65,225 @@ module NumRu
     end
 
     def NetCDF.open(filename,mode="r",share=false)
-       call_create=false   # false-> nc_open; true->nc_create
-       case(mode)
-       when "r","rb"                          # read only
-	  mode=NC_NOWRITE
-       when "w","w+","wb","w+b"               # overwrite if exits
-          call_create=true
-	  mode=NC_CLOBBER
-       when "a","a+","r+","ab","a+b","r+b"    # append if exits
-	  if( File.exists?(filename) )
-	     mode=NC_WRITE
-	  else
-	     call_create=true   #(nonexsitent --> create)
-	     mode=NC_CLOBBER
-	  end
-       else
-	  raise NetcdfError, "Mode #{mode} is not supported"
-       end
-       case(share)
-       when false
-	  share=0
-       when true
-	  share=NC_SHARE
-       else
-	  raise NetcdfError, "We can't use the sharing mode you typed"
-       end
-       omode = mode | share
-       if(!call_create)
-	  nc_open(filename,omode)
-       else
-	  nc_create(filename,omode)
-       end
-    end
-    
+      call_create=false   # false-> nc_open; true->nc_create
+      case(mode)
+      when "r","rb"                          # read only
+        mode=NC_NOWRITE
+      when "w","w+","wb","w+b"               # overwrite if exits
+        call_create=true
+        mode=NC_CLOBBER
+      when "a","a+","r+","ab","a+b","r+b"    # append if exits
+        if( File.exists?(filename) )
+          mode=NC_WRITE
+        else
+          call_create=true   #(nonexsitent --> create)
+          mode=NC_CLOBBER
+        end
+      else
+        raise NetcdfError, "Mode #{mode} is not supported"
+      end
+      case(share)
+      when false
+        share=0
+      when true
+        share=NC_SHARE
+      else
+        raise NetcdfError, "We can't use the sharing mode you typed"
+      end
+      omode = mode | share
+      if(!call_create)
+        nc_open(filename,omode)
+      else
+        nc_create(filename,omode)
+      end
+    end
+
     class << NetCDF
       alias new open
     end
-    
-    
+
+
     def NetCDF.create(filename,noclobber=false,share=false)
       case(noclobber)
       when false
-	noclobber=NC_CLOBBER
+        noclobber=NC_CLOBBER
       when true
-	noclobber=NC_NOCLOBBER
+        noclobber=NC_NOCLOBBER
       else
-	raise NetcdfError,"noclobber (2nd argument) must be true or false"
+        raise NetcdfError,"noclobber (2nd argument) must be true or false"
       end
       case(share)
       when false
-	share=0
+        share=0
       when true
-	share=NC_SHARE
+        share=NC_SHARE
       else
-	raise NetcdfError,"share (3rd argument) must be true or false"
+        raise NetcdfError,"share (3rd argument) must be true or false"
       end
-      
+
       cmode=noclobber | share | @@cr_format
       nc_create(filename,cmode)
     end
-    
+
     class << NetCDF
-       def clean_tmpfile(path)
-	  proc {
-	     print "removing ", path, "..." if $DEBUG
-	     if File.exist?(path)
-		File.unlink(path) 
-	     end
-	     print "done\n" if $DEBUG
-	  }
-       end
-       protected :clean_tmpfile
-    end
-
-    def NetCDF.create_tmp(tmpdir=ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'.', 
-			  share=false)
-       basename = 'temp'
-       if $SAFE > 0 and tmpdir.tainted?
-	  tmpdir = '.'
-       end
-
-       n = 0
-       while true
-	 begin
-	   tmpname = sprintf('%s/%s%d_%d.nc', tmpdir, basename, $$, n)
-	   unless File.exist?(tmpname)
-	      netcdf = NetCDF.create(tmpname, true, share)
-	      ObjectSpace.define_finalizer(netcdf, 
-					   NetCDF.clean_tmpfile(tmpname))
-	      break
-	   end
-	 rescue
-	   raise NetcdfError, "cannot generate tempfile `%s'" % tmpname if n >= Max_Try
-	 end
-	 n += 1
-       end
-       netcdf
+      def clean_tmpfile(path)
+        proc {
+          print "removing ", path, "..." if $DEBUG
+          if File.exist?(path)
+            File.unlink(path)
+          end
+          print "done\n" if $DEBUG
+        }
+      end
+      protected :clean_tmpfile
+    end
+
+    def NetCDF.create_tmp(tmpdir=ENV['TMPDIR']||ENV['TMP']||ENV['TEMP']||'.',
+                          share=false)
+      basename = 'temp'
+      n = 0
+      while true
+        begin
+          tmpname = sprintf('%s/%s%d_%d.nc', tmpdir, basename, $$, n)
+          unless File.exist?(tmpname)
+            netcdf = NetCDF.create(tmpname, true, share)
+            ObjectSpace.define_finalizer(netcdf,
+                                         NetCDF.clean_tmpfile(tmpname))
+            break
+          end
+        rescue
+          raise NetcdfError, "cannot generate tempfile `%s'" % tmpname if n >= Max_Try
+        end
+        n += 1
+      end
+      netcdf
     end
 
 
     def put_att(attname,val,atttype=nil)
-       put_attraw(attname,val,atttype)
+      put_attraw(attname,val,atttype)
     end
-    
+
     def def_var_with_dim(name, vartype, shape_ul0, dimnames)
-       # Same as def_var but defines dimensions first if needed.
-       # Use zero in shape to define an unlimited dimension.
-       if (shape_ul0.length != dimnames.length ) then
-	  raise ArgumentError, 'lengths of shape and dimnames do not agree'
-       end
-       dims = []
-       dimnames.each_index{ |i|
-	  dim = self.dim( dimnames[i] )
-	  if ( dim != nil ) then
-	     # dim exists --> check the length
-	     if (shape_ul0[i] != dim.length_ul0 ) then
-		raise ArgumentError, "dimension length do not agree: #{i}th dim: "+\
-		"#{shape_ul0[i]} and #{dim.length_ul0}"
-	     end
-	     dims.push(dim)
-	  else
-	     # dim does not exist --> define it
-	     dims.push( def_dim( dimnames[i], shape_ul0[i] ) )
-	  end
-       }
-       def_var(name, vartype, dims)
+      # Same as def_var but defines dimensions first if needed.
+      # Use zero in shape to define an unlimited dimension.
+      if (shape_ul0.length != dimnames.length ) then
+        raise ArgumentError, 'lengths of shape and dimnames do not agree'
+      end
+      dims = []
+      dimnames.each_index{ |i|
+        dim = self.dim( dimnames[i] )
+        if ( dim != nil ) then
+          # dim exists --> check the length
+          if (shape_ul0[i] != dim.length_ul0 ) then
+            raise ArgumentError, "dimension length do not agree: #{i}th dim: "+\
+                                 "#{shape_ul0[i]} and #{dim.length_ul0}"
+          end
+          dims.push(dim)
+        else
+          # dim does not exist --> define it
+          dims.push( def_dim( dimnames[i], shape_ul0[i] ) )
+        end
+      }
+      def_var(name, vartype, dims)
     end
 
     # Iterators:
     def each_dim
-      num_dim=ndims()    
+      num_dim=ndims()
       for dimid in 0..num_dim-1
-	obj_Dim=id2dim(dimid)
-	 yield(obj_Dim)
+        obj_Dim=id2dim(dimid)
+        yield(obj_Dim)
       end
     end
-    
+
     def each_var
       num_var=nvars()
       for varid in 0..num_var-1
-	obj_Var=id2var(varid)
-	yield(obj_Var)
+        obj_Var=id2var(varid)
+        yield(obj_Var)
       end
     end
-    
+
     def each_att
       num_att=natts()
       for attnum in 0..num_att-1
-	obj_Att=id2att(attnum)
-	 yield(obj_Att)
+        obj_Att=id2att(attnum)
+        yield(obj_Att)
       end
     end
-    
+
     def dims( names=nil )   # return all if names==nil
-       if names == nil
-	  dims = (0..ndims()-1).collect{|dimid| id2dim(dimid)}
-       else
-	  raise TypeError, "names is not an array" if ! names.is_a?(Array)
-	  dims = names.collect{|name| dim(name)}
-	  raise ArgumentError, "One or more dimensions do not exist" if dims.include?(nil)
-       end
-       dims
+      if names == nil
+        dims = (0..ndims()-1).collect{|dimid| id2dim(dimid)}
+      else
+        raise TypeError, "names is not an array" if ! names.is_a?(Array)
+        dims = names.collect{|name| dim(name)}
+        raise ArgumentError, "One or more dimensions do not exist" if dims.include?(nil)
+      end
+      dims
     end
 
     def vars( names=nil )   # return all if names==nil
-       if names == nil
-	  vars = (0..nvars()-1).collect{ |varid| id2var(varid) }
-       else
-	  raise TypeError, "names is not an array" if ! names.is_a?(Array)
-	  vars = names.collect{|name| var(name)}
-	  raise ArgumentError, "One or more variables do not exist" if vars.include?(nil)
-       end
-       vars
+      if names == nil
+        vars = (0..nvars()-1).collect{ |varid| id2var(varid) }
+      else
+        raise TypeError, "names is not an array" if ! names.is_a?(Array)
+        vars = names.collect{|name| var(name)}
+        raise ArgumentError, "One or more variables do not exist" if vars.include?(nil)
+      end
+      vars
     end
 
     def dim_names
       num_dim=ndims()
       names=[]
       for dimid in 0..num_dim-1
-	obj_Dim=id2dim(dimid)    
-	names=names+[obj_Dim.name]
+        obj_Dim=id2dim(dimid)
+        names=names+[obj_Dim.name]
       end
       return names
-    end    
-    
+    end
+
     def var_names
       num_var=nvars()
       names=[]
       for varid in 0..num_var-1
-	obj_Var=id2var(varid)
-	names=names+[obj_Var.name]
+        obj_Var=id2var(varid)
+        names=names+[obj_Var.name]
       end
       return names
     end
-    
+
     def att_names
       num_att=natts()
       names=[]
       for attnum in 0..num_att-1
-	obj_Att=id2att(attnum)    
-	names=names+[obj_Att.name]
+        obj_Att=id2att(attnum)
+        names=names+[obj_Att.name]
       end
       return names
     end
-    
+
     def inspect
       "NetCDF:"+path
     end
-    
+
   end
-  
+
   class NetCDFVar
-    
+
     class << NetCDFVar
-       def new(file,varname,mode="r",share=false)
-	  if(file.is_a?(String))
-	     file = NetCDF.open(file,mode,share)
-	  elsif(!file.is_a?(NetCDF))
-	    raise TypeError, "1st arg must be a NetCDF (file object) or a String (path)"
-	  end
-	  file.var(varname)
-       end
+      def new(file,varname,mode="r",share=false)
+        if(file.is_a?(String))
+          file = NetCDF.open(file,mode,share)
+        elsif(!file.is_a?(NetCDF))
+          raise TypeError, "1st arg must be a NetCDF (file object) or a String (path)"
+        end
+        file.var(varname)
+      end
 
-       alias open new
+      alias open new
     end
 
     alias :rank :ndims
@@ -295,516 +291,516 @@ module NumRu
     def each_att
       num_att=natts()
       for attnum in 0..num_att-1
-	obj_Att=id2att(attnum)
-	yield(obj_Att)
+        obj_Att=id2att(attnum)
+        yield(obj_Att)
       end
     end
-    
+
     def dim_names
       ary = Array.new()
       dims.each{|dim| ary.push(dim.name)}
       ary
     end
-    
-   def att_names
-     num_att=natts()
-     names=[]
-     for attnum in 0..num_att-1
-       obj_Att=id2att(attnum)
-       names=names+[obj_Att.name]
-     end
-     return names
-   end
-   
-   def put_att(attname,val,atttype=nil)
+
+    def att_names
+      num_att=natts()
+      names=[]
+      for attnum in 0..num_att-1
+        obj_Att=id2att(attnum)
+        names=names+[obj_Att.name]
+      end
+      return names
+    end
+
+    def put_att(attname,val,atttype=nil)
       put_attraw(attname,val,atttype)
-   end
+    end
 
-   def shape_ul0
+    def shape_ul0
       sh = []
       dims.each{|d|
-	 if d.unlimited? then
-	    sh.push(0)
-	 else
-	    sh.push(d.length)
-	 end
+        if d.unlimited? then
+          sh.push(0)
+        else
+          sh.push(d.length)
+        end
       }
       sh
-   end
-   
-   def shape_current
+    end
+
+    def shape_current
       sh = []
       dims.each{|d|
-	 sh.push(d.length)
+        sh.push(d.length)
       }
       sh
-   end
-   
-   # The put and get methods in the NetCDFVar class
-
-   def pack(na)
-     sf = att('scale_factor')
-     ao = att('add_offset')
-     if ( sf == nil && ao == nil ) then
-       na
-     else
-       na = NArray.to_na(na) if na.is_a?(Array)
-       if sf
-	 csf = sf.get
-	 raise NetcdfError,"scale_factor is not a numeric" if csf.is_a?(String)
-	 raise NetcdfError, "scale_factor is not unique" if csf.length != 1
-	 raise NetcdfError, "zero scale_factor" if csf[0] == 0
-       else
-	 csf = nil
-       end
-       if ao
-	 cao = ao.get
-	 raise NetcdfError, "add_offset is not a numeric" if cao.is_a?(String)
-	 raise NetcdfError, "add_offset is not unique" if cao.length != 1
-       else
-	 cao = nil
-       end
-       if csf and cao
-	 packed = (na - cao) / csf
-       elsif csf
-	 packed = na / csf
-       elsif cao
-	 packed = na - cao
-       end
-       if self.typecode <= NArray::LINT
-         packed = packed.round
-       end
-       packed
-     end
-   end
-   
-   def scaled_put(var,hash=nil)
-     simple_put( pack(var), hash)
-   end
-
-   @@unpack_type = nil
-   class << NetCDFVar
-     def unpack_type
-       @@unpack_type
-     end
-     def unpack_type=(na_type)
-       if [NArray::BYTE, NArray::SINT, NArray::INT, 
-	   NArray::SFLOAT, NArray::FLOAT, nil].include?(na_type)
-	 @@unpack_type = na_type
-       else
-	 raise ArgumentError, "Arg must be one of NArray::BYTE, NArray::SINT, NArray::INT, NArray::SFLOAT, NArray::FLOAT"
-       end
-     end
-
-   end
-
-   def unpack(na)
-     sf = att('scale_factor')
-     ao = att('add_offset')
-     if ( sf == nil && ao == nil ) then
-       na
-     else
-       if sf
-	 csf = sf.get
-	 raise NetcdfError,"scale_factor is not a numeric" if csf.is_a?(String)
-	 raise NetcdfError, "scale_factor is not unique" if csf.length != 1
-	 raise NetcdfError, "zero scale_factor" if csf[0] == 0
-       else
-	 csf =nil
-       end
-       if ao
-	 cao = ao.get
-	 raise NetcdfError, "add_offset is not a numeric" if cao.is_a?(String)
-	 raise NetcdfError, "add_offset is not unique" if cao.length != 1
-       else
-	 cao = nil
-       end
-       if csf and cao
-	 una = na * csf + cao  # csf & cao are NArray -> coerced to their types
-       elsif csf
-	 una = na * csf
-       elsif cao
-	 una = na + cao
-       end
-       una = una.to_type(@@unpack_type) if @@unpack_type
-       una
-     end
-   end
-
-   def scaled_get(hash=nil)
-     unpack( simple_get(hash) )
-   end
-
-   def simple_put(var,hash=nil)
-     if hash==nil
-       if self.vartype == "char"
-	 put_var_char(var)
-       elsif self.vartype == "byte"
-	 put_var_byte(var)
-       elsif self.vartype == "sint"
-	 put_var_sint(var)
-       elsif self.vartype == "int"
-	 put_var_int(var)
-       elsif self.vartype == "sfloat"
-	 put_var_sfloat(var)
-       elsif self.vartype == "float"
-	 put_var_float(var)
-       else 
-	 raise NetcdfError,"variable type isn't supported in netCDF" 
-       end
-     elsif hash.key?("index")==true 
-       if self.vartype == "char"
-	 put_var1_char(var,hash["index"])
-       elsif self.vartype=="byte"
-	 put_var1_byte(var,hash["index"])
-       elsif self.vartype=="sint"
-	 put_var1_sint(var,hash["index"])
-       elsif self.vartype == "int"
-	 put_var1_int(var,hash["index"])
-       elsif self.vartype == "sfloat"
-	 put_var1_sfloat(var,hash["index"])
-       elsif self.vartype == "float"
-	 put_var1_float(var,hash["index"])
-       else 
-	 raise NetcdfError,"variable type isn't supported in netCDF"
-       end
-     elsif hash.key?("start")==true
-       if hash.key?("end")==false && hash.key?("stride")==false
-	 if self.vartype == "char"
-	   put_vars_char(var,hash["start"],nil,nil)
-	 elsif self.vartype=="byte"
-	   put_vars_byte(var,hash["start"],nil,nil)
-	 elsif self.vartype=="sint"
-	   put_vars_sint(var,hash["start"],nil,nil)
-	 elsif self.vartype=="int"
-	   put_vars_int(var,hash["start"],nil,nil)
-	 elsif self.vartype=="sfloat"
-	   put_vars_sfloat(var,hash["start"],nil,nil)
-	 elsif self.vartype=="float"
-	   put_vars_float(var,hash["start"],nil,nil)
-	 else
-	   raise NetcdfError, "variable type isn't supported in netCDF"
-	 end
-       elsif hash.key?("end")==true && hash.key?("stride") == false
-	 if self.vartype == "char"
-	   put_vars_char(var,hash["start"],hash["end"],nil)
-	 elsif self.vartype=="byte"
-	   put_vars_byte(var,hash["start"],hash["end"],nil)
-	 elsif self.vartype=="sint"
-	   put_vars_sint(var,hash["start"],hash["end"],nil)
-	 elsif self.vartype=="int"
-	   put_vars_int(var,hash["start"],hash["end"],nil)
-	 elsif self.vartype == "sfloat"
-	   put_vars_sfloat(var,hash["start"],hash["end"],nil)
-	 elsif self.vartype =="float"
-	   put_vars_float(var,hash["start"],hash["end"],nil)
-	 else
-	   raise NetcdfError, "variable type isn't supported in netCDF"
-	 end
-       elsif hash.key?("end")==false && hash.key?("stride")==true
-	 if self.vartype == "char"
-	   put_vars_char(var,hash["start"],nil,hash["stride"])
-	 elsif self.vartype=="byte"
-	   put_vars_byte(var,hash["start"],nil,hash["stride"])
-	 elsif self.vartype=="sint"
-	   put_vars_sint(var,hash["start"],nil,hash["stride"])
-	 elsif self.vartype=="int"
-	   put_vars_int(var,hash["start"],nil,hash["stride"])
-	 elsif self.vartype=="sfloat"
-	   put_vars_sfloat(var,hash["start"],nil,hash["stride"])
-	 elsif self.vartype=="float"
-	   put_vars_float(var,hash["start"],nil,hash["stride"])
-	 else
-	   raise NetcdfError, "variable type isn't supported in netCDF"
-	 end
-       else hash.key?("end")==true && hash.key?("stride")==true
-	 if self.vartype == "char"
-	   put_vars_char(var,hash["start"],hash["end"],hash["stride"])
-	 elsif self.vartype=="byte"
-	   put_vars_byte(var,hash["start"],hash["end"],hash["stride"])
-	 elsif self.vartype=="sint"
-	   put_vars_sint(var,hash["start"],hash["end"],hash["stride"])
-	 elsif self.vartype=="int"
-	   put_vars_int(var,hash["start"],hash["end"],hash["stride"])
-	 elsif self.vartype=="sfloat"
-	   put_vars_sfloat(var,hash["start"],hash["end"],hash["stride"])
-	 elsif self.vartype=="float"
-	   put_vars_float(var,hash["start"],hash["end"],hash["stride"])
-	 else
-	   raise NetcdfError, "variable type isn't supported in netCDF"
-	 end
-       end
-     else
-       raise ArgumentError,"{'start'}=>[ARRAY] or {'index'}=>[ARRAY] is needed"
-     end
-   end
-
-   alias put simple_put
-
-   def simple_get(hash=nil)
-     t_var = self.vartype
-     if hash == nil
-       if t_var == "char"
-	 get_var_char
-       elsif t_var == "byte"
-	 get_var_byte
-       elsif t_var == "sint"
-	 get_var_sint
-       elsif t_var == "int"
-	 get_var_int
-       elsif t_var == "sfloat"
-	 get_var_sfloat
-       elsif t_var == "float"
-	 get_var_float
-       else
-	  raise NetcdfError, "variable type #{t_var} isn't supported in netCDF"
-       end
-     elsif hash.key?("index")==true
-       ind = hash["index"]
-       if t_var == "char"
-	 get_var1_char(ind)
-       elsif t_var == "byte"
-	 get_var1_byte(ind)
-       elsif t_var == "sint"
-	 get_var1_sint(ind)
-       elsif t_var == "int"
-	 get_var1_int(ind)
-       elsif t_var == "sfloat"
-	 get_var1_sfloat(ind)
-       elsif t_var == "float"
-	 get_var1_float(ind)
-       else
-	 raise NetcdfError,"variable type #{t_var} isn't supported in netCDF"
-       end
-     elsif hash.key?("start")==true
-       h_sta = hash["start"]
-       h_end = hash["end"]     # can be nill
-       h_str = hash["stride"]  # can be nill
-       if NetCDF.nc4? && h_str && ((xstr=h_str[0]) != 1)
-         # Tentative treatment for the very slow netcdf-4 reading with step.
-         # Reading with step is generally slow with NetCDF 4, but it is
-         # particularly so for the first dimension.
-         # Ref: http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2013/msg00311.html
-         h_str[0] = 1 
-         nc4remedy = true
-       else
-         nc4remedy = false
-       end
-       if t_var == "char"
-         v = get_vars_char(h_sta,h_end,h_str)
-       elsif t_var == "byte"
-         v = get_vars_byte(h_sta,h_end,h_str)
-       elsif t_var == "sint"
-         v = get_vars_sint(h_sta,h_end,h_str)
-       elsif t_var == "int"
-         v = get_vars_int(h_sta,h_end,h_str)
-       elsif t_var == "sfloat"
-         v = get_vars_sfloat(h_sta,h_end,h_str)
-       elsif t_var == "float"
-         v = get_vars_float(h_sta,h_end,h_str)
-       else
-         raise NetcdfError, "variable type #{t_var} isn't supported in netCDF"
-       end
-       if nc4remedy
-         idx = []
-         (0...v.shape[0]).step(xstr){|k| idx.push(k)}
-         v = v[idx,false]
-       end
-       v
-     else
-       raise ArgumentError,"{'start'}=>{ARRAY} or {'index'}=>{ARRAY} is needed"
-     end
-   end
-
-   alias get simple_get
-
-   def __rubber_expansion( args )
-     if (id = args.index(false))  # substitution into id
-       # false is incuded
-       alen = args.length
-       if args.rindex(false) != id
-	 raise ArguemntError,"only one rubber dimension is permitted"
-       elsif alen > rank+1
-	 raise ArgumentError, "too many args"
-       end
-       ar = ( id!=0 ? args[0..id-1] : [] )
-       args = ar + [true]*(rank-alen+1) + args[id+1..-1]
-     elsif args.length == 0   # to support empty [], []=
-       args = [true]*rank
-     end
-     args
-   end
-   private :__rubber_expansion
-
-   def [](*a)
-     if a.length == 0
-       return self.get
-     end
-     a = __rubber_expansion(a)
-     first = Array.new
-     last = Array.new
-     stride = Array.new
-     set_stride = false
-     a.each{|i|
-       if(i.is_a?(Fixnum))
-	 first.push(i)
-	 last.push(i)
-	 stride.push(1)
-       elsif(i.is_a?(Range))
-	 first.push(i.first)
-	 last.push(i.exclude_end? ? i.last-1 : i.last)
-	 stride.push(1)
-       elsif(i.is_a?(Hash))
-	 r = (i.to_a[0])[0]
-         s = (i.to_a[0])[1]
-         if ( !( r.is_a?(Range) ) || ! ( s.is_a?(Integer) ) )
-	    raise TypeError, "Hash argument must be {a_Range, step}"
-	 end
-	 first.push(r.first) 
-	 last.push(r.exclude_end? ? r.last-1 : r.last)
-	 stride.push(s)
-	 set_stride = true
-       elsif(i.is_a?(TrueClass))
-	 first.push(0)
-	 last.push(-1)
-	 stride.push(1)
-       elsif( i.is_a?(Array) || i.is_a?(NArray))
-	 a_new = a.dup
-	 at = a.index(i)
-	 i = NArray.to_na(i) if i.is_a?(Array)
-	 for n in 0..i.length-1
-	   a_new[at] = i[n]..i[n]
-	   na_tmp = self[*a_new]
-	   if n==0 then
-	     k = at
-	     if at > 0
-	       a[0..at-1].each{|x| if x.is_a?(Fixnum) then k -= 1 end}
-	     end
-	     shape_tmp = na_tmp.shape
-	     shape_tmp[k] = i.length
-	     na = na_tmp.class.new(na_tmp.typecode,*shape_tmp)
-	     index_tmp = Array.new(shape_tmp.length,true)
-	   end
-	   index_tmp[k] = n..n
-	   na[*index_tmp] = na_tmp
-	 end
-	 return na
-       else
-	 raise TypeError, "argument must be Fixnum, Range, Hash, TrueClass, Array, or NArray"
-       end
-     }
-
-     if(set_stride)
-       na = self.get({"start"=>first, "end"=>last, "stride"=>stride})
-     else
-       na = self.get({"start"=>first, "end"=>last})
-     end
-     shape = na.shape
-     (a.length-1).downto(0){ |i|
-	 shape.delete_at(i) if a[i].is_a?(Fixnum)
+    end
+
+    # The put and get methods in the NetCDFVar class
+
+    def pack(na)
+      sf = att('scale_factor')
+      ao = att('add_offset')
+      if ( sf == nil && ao == nil ) then
+        na
+      else
+        na = NArray.to_na(na) if na.is_a?(Array)
+        if sf
+          csf = sf.get
+          raise NetcdfError,"scale_factor is not a numeric" if csf.is_a?(String)
+          raise NetcdfError, "scale_factor is not unique" if csf.length != 1
+          raise NetcdfError, "zero scale_factor" if csf[0] == 0
+        else
+          csf = nil
+        end
+        if ao
+          cao = ao.get
+          raise NetcdfError, "add_offset is not a numeric" if cao.is_a?(String)
+          raise NetcdfError, "add_offset is not unique" if cao.length != 1
+        else
+          cao = nil
+        end
+        if csf and cao
+          packed = (na - cao) / csf
+        elsif csf
+          packed = na / csf
+        elsif cao
+          packed = na - cao
+        end
+        if self.typecode <= NArray::LINT
+          packed = packed.round
+        end
+        packed
+      end
+    end
+
+    def scaled_put(var,hash=nil)
+      simple_put( pack(var), hash)
+    end
+
+    @@unpack_type = nil
+    class << NetCDFVar
+      def unpack_type
+        @@unpack_type
+      end
+      def unpack_type=(na_type)
+        if [NArray::BYTE, NArray::SINT, NArray::INT,
+            NArray::SFLOAT, NArray::FLOAT, nil].include?(na_type)
+          @@unpack_type = na_type
+        else
+          raise ArgumentError, "Arg must be one of NArray::BYTE, NArray::SINT, NArray::INT, NArray::SFLOAT, NArray::FLOAT"
+        end
+      end
+
+    end
+
+    def unpack(na)
+      sf = att('scale_factor')
+      ao = att('add_offset')
+      if ( sf == nil && ao == nil ) then
+        na
+      else
+        if sf
+          csf = sf.get
+          raise NetcdfError,"scale_factor is not a numeric" if csf.is_a?(String)
+          raise NetcdfError, "scale_factor is not unique" if csf.length != 1
+          raise NetcdfError, "zero scale_factor" if csf[0] == 0
+        else
+          csf =nil
+        end
+        if ao
+          cao = ao.get
+          raise NetcdfError, "add_offset is not a numeric" if cao.is_a?(String)
+          raise NetcdfError, "add_offset is not unique" if cao.length != 1
+        else
+          cao = nil
+        end
+        if csf and cao
+          una = na * csf + cao  # csf & cao are NArray -> coerced to their types
+        elsif csf
+          una = na * csf
+        elsif cao
+          una = na + cao
+        end
+        una = una.to_type(@@unpack_type) if @@unpack_type
+        una
+      end
+    end
+
+    def scaled_get(hash=nil)
+      unpack( simple_get(hash) )
+    end
+
+    def simple_put(var,hash=nil)
+      if hash==nil
+        if self.vartype == "char"
+          put_var_char(var)
+        elsif self.vartype == "byte"
+          put_var_byte(var)
+        elsif self.vartype == "sint"
+          put_var_sint(var)
+        elsif self.vartype == "int"
+          put_var_int(var)
+        elsif self.vartype == "sfloat"
+          put_var_sfloat(var)
+        elsif self.vartype == "float"
+          put_var_float(var)
+        else
+          raise NetcdfError,"variable type isn't supported in netCDF"
+        end
+      elsif hash.key?("index")==true
+        if self.vartype == "char"
+          put_var1_char(var,hash["index"])
+        elsif self.vartype=="byte"
+          put_var1_byte(var,hash["index"])
+        elsif self.vartype=="sint"
+          put_var1_sint(var,hash["index"])
+        elsif self.vartype == "int"
+          put_var1_int(var,hash["index"])
+        elsif self.vartype == "sfloat"
+          put_var1_sfloat(var,hash["index"])
+        elsif self.vartype == "float"
+          put_var1_float(var,hash["index"])
+        else
+          raise NetcdfError,"variable type isn't supported in netCDF"
+        end
+      elsif hash.key?("start")==true
+        if hash.key?("end")==false && hash.key?("stride")==false
+          if self.vartype == "char"
+            put_vars_char(var,hash["start"],nil,nil)
+          elsif self.vartype=="byte"
+            put_vars_byte(var,hash["start"],nil,nil)
+          elsif self.vartype=="sint"
+            put_vars_sint(var,hash["start"],nil,nil)
+          elsif self.vartype=="int"
+            put_vars_int(var,hash["start"],nil,nil)
+          elsif self.vartype=="sfloat"
+            put_vars_sfloat(var,hash["start"],nil,nil)
+          elsif self.vartype=="float"
+            put_vars_float(var,hash["start"],nil,nil)
+          else
+            raise NetcdfError, "variable type isn't supported in netCDF"
+          end
+        elsif hash.key?("end")==true && hash.key?("stride") == false
+          if self.vartype == "char"
+            put_vars_char(var,hash["start"],hash["end"],nil)
+          elsif self.vartype=="byte"
+            put_vars_byte(var,hash["start"],hash["end"],nil)
+          elsif self.vartype=="sint"
+            put_vars_sint(var,hash["start"],hash["end"],nil)
+          elsif self.vartype=="int"
+            put_vars_int(var,hash["start"],hash["end"],nil)
+          elsif self.vartype == "sfloat"
+            put_vars_sfloat(var,hash["start"],hash["end"],nil)
+          elsif self.vartype =="float"
+            put_vars_float(var,hash["start"],hash["end"],nil)
+          else
+            raise NetcdfError, "variable type isn't supported in netCDF"
+          end
+        elsif hash.key?("end")==false && hash.key?("stride")==true
+          if self.vartype == "char"
+            put_vars_char(var,hash["start"],nil,hash["stride"])
+          elsif self.vartype=="byte"
+            put_vars_byte(var,hash["start"],nil,hash["stride"])
+          elsif self.vartype=="sint"
+            put_vars_sint(var,hash["start"],nil,hash["stride"])
+          elsif self.vartype=="int"
+            put_vars_int(var,hash["start"],nil,hash["stride"])
+          elsif self.vartype=="sfloat"
+            put_vars_sfloat(var,hash["start"],nil,hash["stride"])
+          elsif self.vartype=="float"
+            put_vars_float(var,hash["start"],nil,hash["stride"])
+          else
+            raise NetcdfError, "variable type isn't supported in netCDF"
+          end
+        else hash.key?("end")==true && hash.key?("stride")==true
+          if self.vartype == "char"
+            put_vars_char(var,hash["start"],hash["end"],hash["stride"])
+          elsif self.vartype=="byte"
+            put_vars_byte(var,hash["start"],hash["end"],hash["stride"])
+          elsif self.vartype=="sint"
+            put_vars_sint(var,hash["start"],hash["end"],hash["stride"])
+          elsif self.vartype=="int"
+            put_vars_int(var,hash["start"],hash["end"],hash["stride"])
+          elsif self.vartype=="sfloat"
+            put_vars_sfloat(var,hash["start"],hash["end"],hash["stride"])
+          elsif self.vartype=="float"
+            put_vars_float(var,hash["start"],hash["end"],hash["stride"])
+          else
+            raise NetcdfError, "variable type isn't supported in netCDF"
+          end
+        end
+      else
+        raise ArgumentError,"{'start'}=>[ARRAY] or {'index'}=>[ARRAY] is needed"
+      end
+    end
+
+    alias put simple_put
+
+    def simple_get(hash=nil)
+      t_var = self.vartype
+      if hash == nil
+        if t_var == "char"
+          get_var_char
+        elsif t_var == "byte"
+          get_var_byte
+        elsif t_var == "sint"
+          get_var_sint
+        elsif t_var == "int"
+          get_var_int
+        elsif t_var == "sfloat"
+          get_var_sfloat
+        elsif t_var == "float"
+          get_var_float
+        else
+          raise NetcdfError, "variable type #{t_var} isn't supported in netCDF"
+        end
+      elsif hash.key?("index")==true
+        ind = hash["index"]
+        if t_var == "char"
+          get_var1_char(ind)
+        elsif t_var == "byte"
+          get_var1_byte(ind)
+        elsif t_var == "sint"
+          get_var1_sint(ind)
+        elsif t_var == "int"
+          get_var1_int(ind)
+        elsif t_var == "sfloat"
+          get_var1_sfloat(ind)
+        elsif t_var == "float"
+          get_var1_float(ind)
+        else
+          raise NetcdfError,"variable type #{t_var} isn't supported in netCDF"
+        end
+      elsif hash.key?("start")==true
+        h_sta = hash["start"]
+        h_end = hash["end"]     # can be nill
+        h_str = hash["stride"]  # can be nill
+        if NetCDF.nc4? && h_str && ((xstr=h_str[0]) != 1)
+          # Tentative treatment for the very slow netcdf-4 reading with step.
+          # Reading with step is generally slow with NetCDF 4, but it is
+          # particularly so for the first dimension.
+          # Ref: http://www.unidata.ucar.edu/mailing_lists/archives/netcdfgroup/2013/msg00311.html
+          h_str[0] = 1
+          nc4remedy = true
+        else
+          nc4remedy = false
+        end
+        if t_var == "char"
+          v = get_vars_char(h_sta,h_end,h_str)
+        elsif t_var == "byte"
+          v = get_vars_byte(h_sta,h_end,h_str)
+        elsif t_var == "sint"
+          v = get_vars_sint(h_sta,h_end,h_str)
+        elsif t_var == "int"
+          v = get_vars_int(h_sta,h_end,h_str)
+        elsif t_var == "sfloat"
+          v = get_vars_sfloat(h_sta,h_end,h_str)
+        elsif t_var == "float"
+          v = get_vars_float(h_sta,h_end,h_str)
+        else
+          raise NetcdfError, "variable type #{t_var} isn't supported in netCDF"
+        end
+        if nc4remedy
+          idx = []
+          (0...v.shape[0]).step(xstr){|k| idx.push(k)}
+          v = v[idx,false]
+        end
+        v
+      else
+        raise ArgumentError,"{'start'}=>{ARRAY} or {'index'}=>{ARRAY} is needed"
+      end
+    end
+
+    alias get simple_get
+
+    def __rubber_expansion( args )
+      if (id = args.index(false))  # substitution into id
+        # false is incuded
+        alen = args.length
+        if args.rindex(false) != id
+          raise ArguemntError,"only one rubber dimension is permitted"
+        elsif alen > rank+1
+          raise ArgumentError, "too many args"
+        end
+        ar = ( id!=0 ? args[0..id-1] : [] )
+        args = ar + [true]*(rank-alen+1) + args[id+1..-1]
+      elsif args.length == 0   # to support empty [], []=
+        args = [true]*rank
+      end
+      args
+    end
+    private :__rubber_expansion
+
+    def [](*a)
+      if a.length == 0
+        return self.get
+      end
+      a = __rubber_expansion(a)
+      first = Array.new
+      last = Array.new
+      stride = Array.new
+      set_stride = false
+      a.each{|i|
+        if(i.is_a?(Integer))
+          first.push(i)
+          last.push(i)
+          stride.push(1)
+        elsif(i.is_a?(Range))
+          first.push(i.first)
+          last.push(i.exclude_end? ? i.last-1 : i.last)
+          stride.push(1)
+        elsif(i.is_a?(Hash))
+          r = (i.to_a[0])[0]
+          s = (i.to_a[0])[1]
+          if ( !( r.is_a?(Range) ) || ! ( s.is_a?(Integer) ) )
+            raise TypeError, "Hash argument must be {a_Range, step}"
+          end
+          first.push(r.first)
+          last.push(r.exclude_end? ? r.last-1 : r.last)
+          stride.push(s)
+          set_stride = true
+        elsif(i.is_a?(TrueClass))
+          first.push(0)
+          last.push(-1)
+          stride.push(1)
+        elsif( i.is_a?(Array) || i.is_a?(NArray))
+          a_new = a.dup
+          at = a.index(i)
+          i = NArray.to_na(i) if i.is_a?(Array)
+          for n in 0..i.length-1
+            a_new[at] = i[n]..i[n]
+            na_tmp = self[*a_new]
+            if n==0 then
+              k = at
+              if at > 0
+                a[0..at-1].each{|x| if x.is_a?(Integer) then k -= 1 end}
+              end
+              shape_tmp = na_tmp.shape
+              shape_tmp[k] = i.length
+              na = na_tmp.class.new(na_tmp.typecode,*shape_tmp)
+              index_tmp = Array.new(shape_tmp.length,true)
+            end
+            index_tmp[k] = n..n
+            na[*index_tmp] = na_tmp
+          end
+          return na
+        else
+          raise TypeError, "argument must be Integer, Range, Hash, TrueClass, Array, or NArray"
+        end
+      }
+
+      if(set_stride)
+        na = self.get({"start"=>first, "end"=>last, "stride"=>stride})
+      else
+        na = self.get({"start"=>first, "end"=>last})
+      end
+      shape = na.shape
+      (a.length-1).downto(0){ |i|
+        shape.delete_at(i) if a[i].is_a?(Integer)
       }
       na.reshape!( *shape )
-     na
-   end
-
-   def []=(*a)
-     val = a.pop
-     a = __rubber_expansion(a)
-     first = Array.new
-     last = Array.new
-     stride = Array.new
-     set_stride = false
-     a.each{|i|
-       if(i.is_a?(Fixnum))
-	 first.push(i)
-	 last.push(i)
-	 stride.push(1)
-       elsif(i.is_a?(Range))
-	 first.push(i.first)
-	 last.push(i.exclude_end? ? i.last-1 : i.last)
-	 stride.push(1)
-       elsif(i.is_a?(Hash))
-	 r = (i.to_a[0])[0]
-         s = (i.to_a[0])[1]
-         if ( !( r.is_a?(Range) ) || ! ( s.is_a?(Integer) ) )
-	    raise ArgumentError, "Hash argument must be {first..last, step}"
-	 end
-	 first.push(r.first) 
-	 last.push(r.exclude_end? ? r.last-1 : r.last)
-	 stride.push(s)
-	 set_stride = true
-       elsif(i.is_a?(TrueClass))
-	 first.push(0)
-	 last.push(-1)
-	 stride.push(1)
-       elsif(i.is_a?(Array) || i.is_a?(NArray))
-	 a_new = a.dup
-	 at = a.index(i)
-	 i = NArray.to_na(i) if i.is_a?(Array)
-	 val = NArray.to_na(val) if val.is_a?(Array)
-	 rank_of_subset = a.dup.delete_if{|v| v.is_a?(Fixnum)}.length
-	 if val.rank != rank_of_subset
-	   raise "rank of the rhs (#{val.rank}) is not equal to the rank "+
-                 "of the subset specified by #{a.inspect} (#{rank_of_subset})"
-	 end
-	 k = at
-	 a[0..at-1].each{|x| if x.is_a?(Fixnum) then k -= 1 end}
-	 if i.length != val.shape[k]
-	   raise "length of the #{k+1}-th dim of rhs is incorrect "+
-                 "(#{i.length} for #{val.shape[k]})"
-	 end
-	 index_tmp = Array.new(val.rank,true) if !val.is_a?(Numeric) #==>Array-like
-	 for n in 0..i.length-1
-	   a_new[at] = i[n]..i[n]
-	   if !val.is_a?(Numeric) then
-	     index_tmp[k] = n..n
-	     self[*a_new] = val[*index_tmp]
-	   else
-	     self[*a_new] = val
-	   end
-	 end
-	 return self
-       else
-	 raise TypeError, "argument must be Fixnum, Range, Hash, TrueClass, Array, or NArray"
-       end
-     }
-
-     if(set_stride)
-	self.put(val, {"start"=>first, "end"=>last, "stride"=>stride})
-     else
-	self.put(val, {"start"=>first, "end"=>last})
-     end
-   end
-
-   def inspect
-     'NetCDFVar:'+file.path+'?var='+name
-   end
-   
- end
- 
- class NetCDFAtt
-   
-   def put(val,atttype=nil)
+      na
+    end
+
+    def []=(*a)
+      val = a.pop
+      a = __rubber_expansion(a)
+      first = Array.new
+      last = Array.new
+      stride = Array.new
+      set_stride = false
+      a.each{|i|
+        if(i.is_a?(Integer))
+          first.push(i)
+          last.push(i)
+          stride.push(1)
+        elsif(i.is_a?(Range))
+          first.push(i.first)
+          last.push(i.exclude_end? ? i.last-1 : i.last)
+          stride.push(1)
+        elsif(i.is_a?(Hash))
+          r = (i.to_a[0])[0]
+          s = (i.to_a[0])[1]
+          if ( !( r.is_a?(Range) ) || ! ( s.is_a?(Integer) ) )
+            raise ArgumentError, "Hash argument must be {first..last, step}"
+          end
+          first.push(r.first)
+          last.push(r.exclude_end? ? r.last-1 : r.last)
+          stride.push(s)
+          set_stride = true
+        elsif(i.is_a?(TrueClass))
+          first.push(0)
+          last.push(-1)
+          stride.push(1)
+        elsif(i.is_a?(Array) || i.is_a?(NArray))
+          a_new = a.dup
+          at = a.index(i)
+          i = NArray.to_na(i) if i.is_a?(Array)
+          val = NArray.to_na(val) if val.is_a?(Array)
+          rank_of_subset = a.dup.delete_if{|v| v.is_a?(Integer)}.length
+          if val.rank != rank_of_subset
+            raise "rank of the rhs (#{val.rank}) is not equal to the rank "+
+                  "of the subset specified by #{a.inspect} (#{rank_of_subset})"
+          end
+          k = at
+          a[0..at-1].each{|x| if x.is_a?(Integer) then k -= 1 end}
+          if i.length != val.shape[k]
+            raise "length of the #{k+1}-th dim of rhs is incorrect "+
+                  "(#{i.length} for #{val.shape[k]})"
+          end
+          index_tmp = Array.new(val.rank,true) if !val.is_a?(Numeric) #==>Array-like
+          for n in 0..i.length-1
+            a_new[at] = i[n]..i[n]
+            if !val.is_a?(Numeric) then
+              index_tmp[k] = n..n
+              self[*a_new] = val[*index_tmp]
+            else
+              self[*a_new] = val
+            end
+          end
+          return self
+        else
+          raise TypeError, "argument must be Integer, Range, Hash, TrueClass, Array, or NArray"
+        end
+      }
+
+      if(set_stride)
+        self.put(val, {"start"=>first, "end"=>last, "stride"=>stride})
+      else
+        self.put(val, {"start"=>first, "end"=>last})
+      end
+    end
+
+    def inspect
+      'NetCDFVar:'+file.path+'?var='+name
+    end
+
+  end
+
+  class NetCDFAtt
+
+    def put(val,atttype=nil)
       putraw(val,atttype)
-   end
-   
-   def inspect
-     'NetCDFAtt:'+name
-   end
- end
- 
- class NetCDFDim
-   def inspect
-     'NetCDFDim:'+name
-   end
-
-   def length_ul0
+    end
+
+    def inspect
+      'NetCDFAtt:'+name
+    end
+  end
+
+  class NetCDFDim
+    def inspect
+      'NetCDFDim:'+name
+    end
+
+    def length_ul0
       if unlimited?
-	 0
+        0
       else
-	 length
+        length
       end
-   end
+    end
 
- end
+  end
 end


=====================================
lib/numru/netcdf/version.rb
=====================================
@@ -1,7 +1,7 @@
 module NumRu
   class NetCDF
 
-    VERSION = "0.7.2"
+    VERSION = "0.8.0"
 
   end
 end


=====================================
ruby-netcdf-bigmem.gemspec
=====================================
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
   spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
   spec.add_runtime_dependency(%q<narray-bigmem>, [">= 0"])
   spec.add_runtime_dependency(%q<narray_miss-bigmem>, [">= 0"])
+  spec.add_development_dependency "test-unit"
 
 end


=====================================
ruby-netcdf.gemspec
=====================================
@@ -24,5 +24,6 @@ Gem::Specification.new do |spec|
   spec.required_ruby_version = Gem::Requirement.new(">= 1.8")
   spec.add_runtime_dependency(%q<narray>, [">= 0"])
   spec.add_runtime_dependency(%q<narray_miss>, [">= 0"])
+  spec.add_development_dependency "test-unit"
 
 end


=====================================
test/aref_aset.rb
=====================================
@@ -1,37 +1,67 @@
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
-s = 'tmp.nc'
-f = NetCDF.create(s)
-f.redef
-dx = f.def_dim('x',5)
-dy = f.def_dim('y',3)
-v = f.def_var('x','sfloat',[dx])
-v2 = f.def_var('x2',NArray::SFLOAT,[dx])
-vxy = f.def_var('xy','sfloat',[dx,dy])
-f.enddef
-v.put([1,2,3,4,5])
-p 'testing []= ...'
-v[{0..3=>2}]=[100,500]
-v[1]=999
-v[3..4]=[-99,-99]
-v2.put(666)
-v2[0..2]=777
-vxy.put(NArray.sfloat(5,3).indgen!)
-vxy[[2,0],[0,2,1]] = [[1,2],[3,4],[5,6]]
-vxy[1,[2,0,1]] = [10,20,30]
-vxy[[4,3],2] = [100,200]
 
-f.close
+class TestArefAset < Test::Unit::TestCase
+  def startup  # call once before tests
+  end
+  def setup     # call before each test
+    @s = 'tmp.nc'
+  end
+  def teardown  # call after each test
+  end
+  def shutdown  # call once after tests
+  end
 
-f = NetCDF.open(s)
-v = f.var('x')
-p 'testing [] ...'
-p '*0*',v[{0..3=>2}]
-p '*1*',v[1]
-p '*2*',v[3..4],v.rank
-p '*3*',v[[2,0,0]]
-vxy = f.var('xy')
-p '*4*',vxy[[2,0],[0,2,1]]
-p '*5*',vxy[1,[2,0,1]]
-p '*6*',vxy[[4,3],2]
-f.close
+  def test_netcdf_create
+    f = NetCDF.create(@s)
+    f.redef
+    dx = f.def_dim('x',5)
+    dy = f.def_dim('y',3)
+    v = f.def_var('x','sfloat',[dx])
+    v2 = f.def_var('x2',NArray::SFLOAT,[dx])
+    vxy = f.def_var('xy','sfloat',[dx,dy])
+    f.enddef
+    v.put([1,2,3,4,5])
+    v[{0..3=>2}]=[100,500]
+    v[1]=999
+    v[3..4]=[-99,-99]
+    v2.put(666)
+    v2[0..2]=777
+    vxy.put(NArray.sfloat(5,3).indgen!)
+    vxy[[2,0],[0,2,1]] = [[1,2],[3,4],[5,6]]
+    vxy[1,[2,0,1]] = [10,20,30]
+    vxy[[4,3],2] = [100,200]
+    f.close
+  end
+
+  def test_netcdf_open
+    unless File.exist?(@s)
+      test_netcdf_create
+    else
+      f = NetCDF.open(@s)
+      v = f.var('x')
+      assert_equal v[{0..3=>2}], NArray[100.0,500.0].to_f
+      assert_equal v[1], NArray[999.0].to_f
+      assert_equal v[3..4], NArray[-99.0,-99.0].to_f
+      assert_equal v.rank, 1
+      assert_equal v[[2,0,0]], NArray[500.0,100.0,100.0].to_f
+      vxy = f.var('xy')
+      assert_equal vxy[[2,0],[0,2,1]],
+                   NArray[[1.0,2.0],[3.0,4.0],[5.0,6.0]].to_f
+      assert_equal vxy[1,[2,0,1]],
+                   NArray[10.0,20.0,30.0].to_f
+      assert_equal vxy[[4,3],2],
+                   NArray[100.0,200.0].to_f
+      f.close
+    end
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
+
+end


=====================================
test/char_var.rb
=====================================
@@ -1,25 +1,36 @@
-## test of "char" variables
-
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
-s = 'tmp.nc'
-f = NetCDF.create(s)
-d = f.def_dim('x',5)
-v = f.def_var('x','char',[d])
-tv = f.def_var('text','char',[d])
-f.enddef
-v.put( NArray.byte(5).indgen! )
-tv.put( NArray.to_na("hello","byte",5) )
-tv.put( NArray.to_na("LO","byte",2), 'start'=>[3] )
-tv.put( NArray.to_na("H","byte",1), 'index'=>[0] )
-f.close
-
-f = NetCDF.open(s)
-v = f.var('x')
-p v.get
-tv = f.var('text')
-p tv.get
-p tv.get.to_s
-
+class TestCharVar < Test::Unit::TestCase
+  def setup
+    @s = 'tmp.nc'
+    f = NetCDF.create(@s)
+    d = f.def_dim('x',5)
+    v = f.def_var('x','char',[d])
+    tv = f.def_var('text','char',[d])
+    f.enddef
+    v.put( NArray.byte(5).indgen! )
+    tv.put( NArray.to_na("hello","byte",5) )
+    tv.put( NArray.to_na("LO","byte",2), 'start'=>[3] )
+    tv.put( NArray.to_na("H","byte",1), 'index'=>[0] )
+    f.close
+  end
+  def teardown
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
 
+  def test_char_var
+  f = NetCDF.open(@s)
+  v = f.var('x')
+  assert_equal v.get, NArray.byte(5).indgen!
+  tv = f.var('text')
+  assert_equal tv.get.to_s, "HelLO"
+  end
 
+end


=====================================
test/clone.rb
=====================================
@@ -1,54 +1,49 @@
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
-s = 'tmp.nc'
-#f = NetCDF.new(s,'rw')
-f = NetCDF.create(s)
-f.redef
-d = f.def_dim('x',3)
-v = f.def_var('x','sfloat',[d])
-a = f.put_att('long_name','xx')
-f.enddef
-v.put([1,2,3])
-f.taint
-f.freeze
-f2 = f.clone
-p 'netcdf  clone'
-p f.path, f2.path   
-p f.tainted?, f2.tainted?, f.frozen?, f2.frozen?  
-
-p 'netcdf  dup'
-f3 = f.dup
-p f.tainted?, f3.tainted?, f.frozen?, f3.frozen?  
-
-p 'netcdfdim'
-d.taint
-d2 = d.clone
-d3 = d.dup
-p d.tainted?, d2.tainted?, d3.tainted?
-
-p 'netcdfvar'
-v.taint
-v2 = v.clone
-v3 = v.dup
-p v.tainted?, v2.tainted?, v3.tainted?
-
-p 'netcdfatt'
-a.taint
-a2 = a.clone
-a3 = a.dup
-p a.tainted?, a2.tainted?, a3.tainted?
-
-f.close
-
-p 'narray (for reference)'
-a = NArray.float(3)
-a.taint
-b = a.clone
-p a.tainted?, b.tainted?  
-b = a.dup
-p a.tainted?, b.tainted?  
-
-
-
-
 
+class TestClone < Test::Unit::TestCase
+  def setup
+    @s = 'tmp.nc'
+    @f = NetCDF.create(@s)
+    @f.redef
+    @d = @f.def_dim('x',3)
+    @v = @f.def_var('x','sfloat',[@d])
+    @a = @f.put_att('long_name','xx')
+    @f.enddef
+    @v.put([1,2,3])
+    @f.freeze
+  end
+
+  def teardown
+    @f.close
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
+
+  def test_clone_netcdf_path
+    f = @f.clone
+    assert_equal @f.path, f.path
+    assert(@f.frozen? == f.frozen?)
+    d = @d.clone
+    assert_equal @d, d
+    v = @v.clone
+    assert_equal @v, v
+    a = @a.clone
+    assert_equal @a, a
+  end
+
+  def test_clone_netcdf_dup
+    f = @f.dup
+    assert(@f.frozen? != f.frozen?)
+    # d = @d.dup
+    # v = @v.dup
+    # a = @a.dup
+  end
+
+end


=====================================
test/create_tmp.rb
=====================================
@@ -1,15 +1,19 @@
+require 'test/unit'
 require 'numru/netcdf'
-
-$DEBUG = true
 include NumRu
-file = NetCDF.create_tmp
-file.def_dim('x',5)
-file.put_att("history", __FILE__ )
-p file.path
-p file.att("history").get
-print "environment variable TEMP ="+(ENV['TEMP'] || '')+"\n"
-file2=file
-print "000\n"
-file.close
-GC.start
-print "aaa\n"
+class CreateTMP < Test::Unit::TestCase
+  def setup
+    @file = NetCDF.create_tmp
+    @file.def_dim('x',5)
+    @file.put_att("history", __FILE__ )
+  end
+  def teardown
+    @file.close
+    GC.start
+  end
+  def test_create_tmp
+    assert_equal @file.att("history").get, __FILE__
+    # print "environment variable TEMP ="+(ENV['TEMP'] || '')+"\n"
+    # file2 = @file
+  end
+end


=====================================
test/def_var_with_dim.rb
=====================================
@@ -1,14 +1,32 @@
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
-file = NetCDF.create("tmp.nc")
-var1 = file.def_var_with_dim("var1","sfloat",[6],["x"])
-var2 = file.def_var_with_dim("var2","sfloat",[6,3],["x","y"])
-var3 = file.def_var_with_dim("var3","sfloat",[3],["y"])
-var3 = file.def_var_with_dim("var4","sfloat",[0],["t"])
-att = var1.put_att("long_name","test")
-file.close
+class TestDefVarWithDim < Test::Unit::TestCase
+  def setup
+    @fname = "tmp.nc"
+    @file = NetCDF.create(@fname)
+    @var1 = @file.def_var_with_dim("var1","sfloat",[6],["x"])
+    @var2 = @file.def_var_with_dim("var2","sfloat",[6,3],["x","y"])
+    @var3 = @file.def_var_with_dim("var3","sfloat",[3],["y"])
+    @var3 = @file.def_var_with_dim("var4","sfloat",[0],["t"])
+    @att = @var1.put_att("long_name","test")
+    @file.close
+  end
+  def teardown
+    if File.exist?(@fname)
+      begin
+        File.delete(@fname)
+      rescue
+        p $!
+      end
+    end
+  end
 
-p var1 == nil
-p file == nil
-p att == nil
-p att == att, var1 ==var1, file == file
+  def test_def_var_with_dim
+    assert_not_nil @var1
+    assert_not_nil @var2
+    assert_not_nil @var3
+    assert_not_nil @file
+    assert_not_nil @att
+  end
+end


=====================================
test/factor_offset.rb
=====================================
@@ -1,53 +1,84 @@
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
 
-s = 'tmp.nc'
-f = NetCDF.create(s)
+class TestFactorOffset < Test::Unit::TestCase
+  def setup
+    @s = 'tmp.nc'
+    f = NetCDF.create(@s)
+    nx = 10
+    d = f.def_dim('x',nx)
+    v1 = f.def_var('v1','sint',[d])
+    v2 = f.def_var('v2','sint',[d])
+    v3 = f.def_var('v3','int',[d])
+    v1.put_att('scale_factor',0.1,'sfloat')
+    v1.put_att('add_offset',100.0,'sfloat')
+    v2.put_att('scale_factor',0.1,'sfloat')
+    v2.put_att('add_offset',100.0,'sfloat')
+    v3.put_att('scale_factor',0.1,'sfloat')
+    v3.put_att('add_offset',100.0,'sfloat')
+    f.enddef
+    v1.put( NArray.sint(nx).indgen!+100 )
+    v2.scaled_put( NArray.float(nx).indgen!+100 )
+    v3.scaled_put( NArray.float(nx).indgen!+100 )
+    f.close
+  end
 
-nx = 10
-d = f.def_dim('x',nx)
-v1 = f.def_var('v1','sint',[d])
-v2 = f.def_var('v2','sint',[d])
-v3 = f.def_var('v3','int',[d])
-v1.put_att('scale_factor',0.1,'sfloat')
-v1.put_att('add_offset',100.0,'sfloat')
-v2.put_att('scale_factor',0.1,'sfloat')
-v2.put_att('add_offset',100.0,'sfloat')
-v3.put_att('scale_factor',0.1,'sfloat')
-v3.put_att('add_offset',100.0,'sfloat')
-f.enddef
-v1.put( NArray.sint(nx).indgen!+100 )
-v2.scaled_put( NArray.float(nx).indgen!+100 )
-v3.scaled_put( NArray.float(nx).indgen!+100 )
-f.close
+  def teardown
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
+  def test_originally_uscaled
+    f = NetCDF.open(@s)
+    v1 = f.var('v1')
+    v11 = v1.get
+    assert_equal v11,
+                 NArray[ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ].to_i
+    v12 = v1.scaled_get
+    assert_equal v12,
+                 NArray[ 110.0, 110.1, 110.2, 110.3, 110.4, 110.5, 110.6, 110.7, 110.8, 110.9 ].to_type(NArray::SFLOAT)
+    f.close
+  end
 
+  def test_originally_scaled
+    f = NetCDF.open(@s)
+    v2 = f.var('v2')
+    v21 = v2.get
+    assert_equal v21,
+                 NArray[ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ].to_i
+    v22 = v2.scaled_get
+    assert_equal v22,
+                 NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
+    f.close
+  end
 
-print "** originally unscaled\n"
-f = NetCDF.open(s)
-v1 = f.var('v1')
-v11 = v1.get
-v12 = v1.scaled_get
-p v11
-p v12
+  def test_originally_scaled_int_to_double
+    f = NetCDF.open(@s)
+    v3 = f.var('v3')
+    v31 = v3.get
+    assert_equal v31,
+                 NArray[ 0, 10, 20, 30, 40, 50, 60, 70, 80, 90 ].to_i
+    v32 = v3.scaled_get
+    assert_equal v32,
+                 NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
+    f.close
+  end
 
-print "** originally scaled\n"
-v2 = f.var('v2')
-v21 = v2.get
-v22 = v2.scaled_get
-p v21
-p v22
-
-print "** originally sclaed (int --> double)\n"
-v3 = f.var('v3')
-v31 = v3.get
-v32 = v3.scaled_get
-p v31
-p v32
-
-print "** unpack type fixed to sfloat\n"
-NetCDFVar.unpack_type = NArray::SFLOAT
-v33 = v3.scaled_get
-p v33
-NetCDFVar.unpack_type = NArray::INT
-v33 = v3.scaled_get
-p v33
+  def test_unpack_type_fixed_to_sfloat
+    f = NetCDF.open(@s)
+    v3 = f.var('v3')
+    NetCDFVar.unpack_type = NArray::SFLOAT
+    v33 = v3.scaled_get
+    assert_equal v33,
+                 NArray[ 100.0, 101.0, 102.0, 103.0, 104.0, 105.0, 106.0, 107.0, 108.0, 109.0 ].to_type(NArray::SFLOAT)
+    NetCDFVar.unpack_type = NArray::INT
+    v33 = v3.scaled_get
+    assert_equal v33,
+                 NArray[ 100, 101, 102, 103, 104, 105, 106, 107, 108, 109 ].to_i
+  end
+end


=====================================
test/putatt.rb
=====================================
@@ -1,56 +1,78 @@
+require 'test/unit'
 require 'numru/netcdf'
-include NumRu
-s = 'tmp.nc'
-f = NetCDF.create(s)
-d = f.def_dim('x',5)
-v = f.def_var('x','sfloat',[d])
-
 require 'date'
-att = f.put_att("history", Date.today.to_s )
-p att.get, f.att("history").get
-att = f.put_att("int_att",123)
-att = f.put_att("sfloat_att",1.0/3.0,'sfloat')
-att = f.put_att("sfloat_att2",2.0/3.0,NArray::SFLOAT)
-att = v.put_att("long_name",'test variable')
-att = v.put_att("int_att",123)
-p att.get, v.att("int_att").get
-att = v.put_att("float_att",1.0/3.0)
-att = v.put_att("float_array",[0.1, 0.2, 30])
-att = v.put_att("sfloat_narray",NArray.sfloat(3).indgen!/3)
-att = v.put_att("float_narray",NArray.float(3).indgen!)
-att = v.put_att("sint_narray",NArray.sint(3).indgen!)
-att = v.put_att("int2float",10,'float')
-att = att = v.put_att("dummy",10,'float')
-att.put('changed to text')
-att.name = 'changed'
-begin
-   v.put_att("destined_to_fail",9.8,'complex')
-rescue
-   print "*1* exception raised as expected -- (",
-         __FILE__,":",__LINE__,") ", $!,"\n"
-end
-begin
-   v.put_att("destined_to_fail",9.8,'string')
-rescue
-   print "*2* exception raised as expected -- (",
-         __FILE__,":",__LINE__,") ", $!,"\n"
-end
+include NumRu
+class TestPutAttr < Test::Unit::TestCase
+  def setup
+    @s = 'tmp.nc'
+    @f = NetCDF.create(@s)
+    @d = @f.def_dim('x',5)
+    @v = @f.def_var('x','sfloat',[@d])
+  end
+  def teardown
+    @f.close
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
+  def test_att_history_get
+    att = @f.put_att("history", Date.today.to_s )
+    assert_equal att.get,
+                 @f.att("history").get
+  end
+  def test_att_int_att_get
+    att = @f.put_att("int_att",123)
+    att = @f.put_att("sfloat_att",1.0/3.0,'sfloat')
+    att = @f.put_att("sfloat_att2",2.0/3.0,NArray::SFLOAT)
+    att = @v.put_att("long_name",'test variable')
+    att = @v.put_att("int_att",123)
+    assert_equal att.get,
+                 @v.att("int_att").get
+  end
 
-begin
-   v.put_att("destined_to_fail",'hello','int')
-rescue
-   print "*3* exception raised as expected -- (",
-         __FILE__,":",__LINE__,") ", $!,"\n"
-end
+  def test_att_changed_to_text
+    att = @v.put_att("float_att",1.0/3.0)
+    att = @v.put_att("float_array",[0.1, 0.2, 30])
+    tmp = NArray.sfloat(3).indgen!
+    tmp = tmp/3
+    att = @v.put_att("sfloat_narray",tmp)
+    att = @v.put_att("float_narray",NArray.float(3).indgen!)
+    att = @v.put_att("sint_narray",NArray.sint(3).indgen!)
+    att = @v.put_att("int2float",10,'float')
+    att = att = @v.put_att("dummy",10,'float')
+    assert att.put('changed to text')
+    att.name = 'changed'
+  end
 
-begin
-   v.put_att("destined_to_fail",[10,30,'sss'])
-rescue
-   print "*4* exception raised as expected -- (",
-         __FILE__,":",__LINE__,") ", $!,"\n"
-end
+  def test_destined_to_fail_complex
+    assert_raise(NetcdfError) do
+      @v.put_att("destined_to_fail", 9.8, 'complex')
+      # "unsupported type. code = 7"
+    end
+  end
 
+  def test_destined_to_fail_string
+    assert_raise(ArgumentError) do
+      @v.put_att("destined_to_fail", 9.8, 'string')
+      # Unrecognized NArray type>
+    end
+  end
 
-f.close
+  def test_destined_to_fail_int
+    assert_raise(NetcdfError) do
+      @v.put_att("destined_to_fail", 'hello', 'int')
+      # attribute type must be 'char' (or nil) for a String value
+    end
+  end
 
-print `ncdump tmp.nc`
+  def test_destined_to_fail_mixed_array
+    assert_raise(TypeError) do
+      @v.put_att("destined_to_fail",[10,30,'sss'])
+      # no implicit conversion of String into Integer
+    end
+  end
+end


=====================================
test/test.rb
=====================================
@@ -1,192 +1,199 @@
-require 'numru/netcdf' 
-## // to test before make install -->
-#require 'narray'
-#require '../netcdfraw'  
-#require '../lib/netcdf'
-## <-- to test before make install //
-
+require 'test/unit'
+require 'numru/netcdf'
 include NumRu
 
-filename = "test.nc"
-print "creating ",filename,"...\n"
-file=NetCDF.create(filename,false,false)
-
-dimx=file.def_dim("x",15)
-dimy=file.def_dim("y",10)
-dimz=file.def_dim("z",10)
-
-batt = file.put_att("type_byte",5,"byte")
-file.put_att("type_short",[222,333,444],"sint")
-file.put_att("type_int",[2222,3333,4444])
-file.put_att("type_float",[2.22,3.33,4.44],"sfloat")
-file.put_att("type_double",[2.222,3.333,4.444])
-string = file.put_attraw("string","netCDF for Ruby","string")
-batt.put(6,"byte")
-
-sint_var=file.def_var("test_sint","sint",["x"])
-byte_var=file.def_var("test_byte","byte",["y"])
-byte_var2=file.def_var("test_byte2","byte",[dimy,dimz])
-int_var=file.def_var("test_int","int",["y"])
-sfloat_var=file.def_var("test_sfloat","sfloat",["z"])
-float_var=file.def_var("test_float","float",["y"])
-
-a=NArray.sint(10).indgen
-b=NArray.sint(10).fill(7)
-c=NArray.byte(10).indgen
-d=NArray.int(10).indgen
-e=NArray.sfloat(10).fill(1.111)
-f=NArray.float(10).fill(5.5555555)
-file.enddef
-file2 = file
-(file2 == file)
-
-byte_var.put_var_byte(c)
-int_var.put_var_int(d)
-sfloat_var.put_var_sfloat(e)
-float_var.put_var_float(f)
-
-file.redef
-byte_vara=file.def_var("test_byte_vara","byte",[dimy,dimz]);
-sint_vara=file.def_var("test_sint_vara","sint",["y","z"]);
-int_vara=file.def_var("test_int_vara","int",["y","z"]);
-sfloat_vara=file.def_var("test_sfloat_vara","sfloat",["y","z"]);
-float_vara=file.def_var("test_float_vara","float",["y","z"]);
-file.enddef
-
-byte_vara2 = byte_vara
-(byte_vara2 == byte_vara)
-
-g=NArray.byte(10,10).indgen
-h=NArray.byte(2,3).indgen
-gh=NArray.byte(1,1).fill(33)
-k=NArray.sint(10,10).indgen
-l=NArray.sint(2,3).indgen
-kl=NArray.sint(1,1).fill(44)
-m=NArray.int(10,10).indgen
-n=NArray.int(2,3).indgen
-mn=NArray.int(1,1).fill(55)
-o=NArray.sfloat(10,10).fill(1.234567)
-p=NArray.sfloat(2,3).fill(2.345678)
-op=NArray.int(1,1).fill(3.4)
-q=NArray.float(10,10).fill(1.234)
-r=NArray.float(2,3).fill(2.345)
-qr=NArray.float(1,1).fill(4.5)
-s=NArray.float(2,2).fill(10.0)
-
-
-byte_vara.put(g)
-byte_vara.put(h,{"start"=>[3,5]})
-byte_vara.put(g,{"start"=>[0,0],"end"=>[9,9]})
-byte_vara.put(h,{"start"=>[-8,2]})
-byte_vara.put(h,{"start"=>[0,0],"stride"=>[2,3]})
-byte_vara.put(h,{'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-byte_vara.put(gh,{"index"=>[4,7]})
-
-sint_vara.put(k)
-sint_vara.put(l,{"start"=>[3,5]})
-sint_vara.put(k,{"start"=>[0,0],"end"=>[9,9]})
-sint_vara.put(l,{"start"=>[-8,2]})
-sint_vara.put(l,{"start"=>[0,0],"stride"=>[2,3]})
-sint_vara.put(l,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-sint_vara.put(kl,{"index"=>[4,7]})
-
-int_vara.put(m)
-int_vara.put(n,{"start"=>[3,5]})
-int_vara.put(m,{"start"=>[0,0],"end"=>[9,9]})
-int_vara.put(n,{"start"=>[-8,2]})
-int_vara.put(n,{"start"=>[0,0],"stride"=>[2,3]})
-int_vara.put(n,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-int_vara.put(mn,{"index"=>[4,7]})
-
-sfloat_vara.put(o)
-sfloat_vara.put(p,{"start"=>[3,5]})
-sfloat_vara.put(o,{"start"=>[0,0],"end"=>[9,9]})
-sfloat_vara.put(p,{"start"=>[-8,2]})
-sfloat_vara.put(p,{"start"=>[0,0],"stride"=>[2,3]})
-sfloat_vara.put(p,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-sfloat_vara.put(op,{"index"=>[4,7]})
-
-float_vara.put(q)
-float_vara.put(r,{"start"=>[3,5]})
-float_vara.put(q,{"start"=>[0,0],"end"=>[9,9]})
-float_vara.put(r,{"start"=>[-8,2]})
-float_vara.put(r,{"start"=>[0,0],"stride"=>[2,3]})
-float_vara.put(r,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-float_vara.put(qr,{"index"=>[4,7]})
-
-float_vara.dim_names
-
-na_aaa=byte_vara.get({"start"=>[3,5]})
-na_aab=byte_vara.get({"start"=>[0,0],"end"=>[9,9]})
-na_aac=byte_vara.get({"start"=>[-8,2]})
-na_aad=byte_vara.get({"start"=>[0,0],"stride"=>[2,3]})
-na_aae=byte_vara.get({'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-na_aaf=byte_vara.get({"index"=>[4,7]})
-na_aag=byte_vara.get
-
-na_bba=sint_vara.get({"start"=>[3,5]})
-na_bbb=sint_vara.get({"start"=>[0,0],"end"=>[9,9]})
-na_bbc=sint_vara.get({"start"=>[-8,2]})
-na_bbd=sint_vara.get({"start"=>[0,0],"stride"=>[2,3]})
-na_bbf=sint_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-na_bbg=sint_vara.get({"index"=>[4,7]})
-na_bbh=sint_vara.get
-
-na_cca=int_vara.get({"start"=>[3,5]})
-na_ccb=int_vara.get({"start"=>[0,0],"end"=>[9,9]})
-na_ccc=int_vara.get({"start"=>[-8,2]})
-na_ccd=int_vara.get({"start"=>[0,0],"stride"=>[2,3]})
-na_cce=int_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-na_ccf=int_vara.get({"index"=>[4,7]})
-na_ccg=int_vara.get
-
-na_dda=sfloat_vara.get({"start"=>[3,5]})
-na_ddb=sfloat_vara.get({"start"=>[0,0],"end"=>[9,9]})
-na_ddc=sfloat_vara.get({"start"=>[-8,2]})
-na_ddd=sfloat_vara.get({"start"=>[0,0],"stride"=>[2,3]})
-na_dde=sfloat_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-na_ddf=sfloat_vara.get({"index"=>[4,7]})
-na_ddg=sfloat_vara.get
-
-na_eea=float_vara.get({"start"=>[3,5]})
-na_eeb=float_vara.get({"start"=>[0,0],"end"=>[9,9]})
-na_eec=float_vara.get({"start"=>[-8,2]})
-na_eed=float_vara.get({"start"=>[0,0],"stride"=>[2,3]})
-na_eee=float_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
-na_eef=float_vara.get({"index"=>[4,7]})
-na_eeg=float_vara.get
-
-file.redef
-
-copy_byte = string.copy(byte_vara) 
-copy_byte.put([0,20],"byte") 
-copy_byte.name="new_name"
-
-copy_byte2 = copy_byte
-(copy_byte2 == copy_byte)
-
-copy_sint = string.copy(sint_vara)
-copy_sint.put("%%%%%")
-copy_int = string.copy(int_vara)
-copy_int.put([0,60],"int")
-copy_sfloat = string.copy(sfloat_vara)
-copy_sfloat.put([0.01,5.5],"sfloat")
-copy_float = string.copy(float_vara)
-copy_float.put([0.0001,5.5555],"float")
-file.enddef
-nm = copy_byte.name
-att0 = string.get
-att1 = copy_byte.get
-att2 = copy_sint.get
-att3 = copy_int.get
-att4 = copy_sfloat.get
-att5 = copy_float.get
-file.fill(true)
-file.fill(false)
-
-float_vara.dim_names
-float_vara.att_names
-
-file.close
-exit(0)
-
+# What checked?
+
+class TestCreate < Test::Unit::TestCase
+
+  def test_create_netcdf_file
+    @filename = "test.nc"
+    file=NetCDF.create(@filename,false,false)
+    assert dimx=file.def_dim("x",15)
+    assert dimy=file.def_dim("y",10)
+    assert dimz=file.def_dim("z",10)
+    batt = file.put_att("type_byte",5,"byte")
+    file.put_att("type_short",[222,333,444],"sint")
+    file.put_att("type_int",[2222,3333,4444])
+    file.put_att("type_float",[2.22,3.33,4.44],"sfloat")
+    file.put_att("type_double",[2.222,3.333,4.444])
+    string = file.put_attraw("string","netCDF for Ruby","string")
+    batt.put(6,"byte")
+
+    assert sint_var=file.def_var("test_sint","sint",["x"])
+    assert byte_var=file.def_var("test_byte","byte",["y"])
+    assert byte_var2=file.def_var("test_byte2","byte",[dimy,dimz])
+    assert int_var=file.def_var("test_int","int",["y"])
+    assert sfloat_var=file.def_var("test_sfloat","sfloat",["z"])
+    assert float_var=file.def_var("test_float","float",["y"])
+
+    assert a=NArray.sint(10).indgen
+    assert b=NArray.sint(10).fill(7)
+    assert c=NArray.byte(10).indgen
+    assert d=NArray.int(10).indgen
+    assert e=NArray.sfloat(10).fill(1.111)
+    assert f=NArray.float(10).fill(5.5555555)
+    file.enddef
+    file2 = file
+    assert_equal file2, file
+
+    assert_nil byte_var.put_var_byte(c)
+    assert_nil int_var.put_var_int(d)
+    assert_nil sfloat_var.put_var_sfloat(e)
+    assert_nil float_var.put_var_float(f)
+
+    file.redef
+    byte_vara=file.def_var("test_byte_vara","byte",[dimy,dimz]);
+    sint_vara=file.def_var("test_sint_vara","sint",["y","z"]);
+    int_vara=file.def_var("test_int_vara","int",["y","z"]);
+    sfloat_vara=file.def_var("test_sfloat_vara","sfloat",["y","z"]);
+    float_vara=file.def_var("test_float_vara","float",["y","z"]);
+    file.enddef
+
+    byte_vara2 = byte_vara
+    assert_equal byte_vara2, byte_vara
+
+    assert g=NArray.byte(10,10).indgen
+    assert h=NArray.byte(2,3).indgen
+    assert gh=NArray.byte(1,1).fill(33)
+    assert k=NArray.sint(10,10).indgen
+    assert l=NArray.sint(2,3).indgen
+    assert kl=NArray.sint(1,1).fill(44)
+    assert m=NArray.int(10,10).indgen
+    assert n=NArray.int(2,3).indgen
+    assert mn=NArray.int(1,1).fill(55)
+    assert o=NArray.sfloat(10,10).fill(1.234567)
+    assert p=NArray.sfloat(2,3).fill(2.345678)
+    assert op=NArray.int(1,1).fill(3.4)
+    assert q=NArray.float(10,10).fill(1.234)
+    assert r=NArray.float(2,3).fill(2.345)
+    assert qr=NArray.float(1,1).fill(4.5)
+    assert s=NArray.float(2,2).fill(10.0)
+
+    assert_nil byte_vara.put(g)
+    assert_nil byte_vara.put(h,{"start"=>[3,5]})
+    assert_nil byte_vara.put(g,{"start"=>[0,0],"end"=>[9,9]})
+    assert_nil byte_vara.put(h,{"start"=>[-8,2]})
+    assert_nil byte_vara.put(h,{"start"=>[0,0],"stride"=>[2,3]})
+    assert_nil byte_vara.put(h,{'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert_nil byte_vara.put(gh,{"index"=>[4,7]})
+
+    sint_vara.put(k)
+    sint_vara.put(l,{"start"=>[3,5]})
+    sint_vara.put(k,{"start"=>[0,0],"end"=>[9,9]})
+    sint_vara.put(l,{"start"=>[-8,2]})
+    sint_vara.put(l,{"start"=>[0,0],"stride"=>[2,3]})
+    sint_vara.put(l,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    sint_vara.put(kl,{"index"=>[4,7]})
+
+    int_vara.put(m)
+    int_vara.put(n,{"start"=>[3,5]})
+    int_vara.put(m,{"start"=>[0,0],"end"=>[9,9]})
+    int_vara.put(n,{"start"=>[-8,2]})
+    int_vara.put(n,{"start"=>[0,0],"stride"=>[2,3]})
+    int_vara.put(n,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    int_vara.put(mn,{"index"=>[4,7]})
+
+    sfloat_vara.put(o)
+    sfloat_vara.put(p,{"start"=>[3,5]})
+    sfloat_vara.put(o,{"start"=>[0,0],"end"=>[9,9]})
+    sfloat_vara.put(p,{"start"=>[-8,2]})
+    sfloat_vara.put(p,{"start"=>[0,0],"stride"=>[2,3]})
+    sfloat_vara.put(p,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    sfloat_vara.put(op,{"index"=>[4,7]})
+
+    float_vara.put(q)
+    float_vara.put(r,{"start"=>[3,5]})
+    float_vara.put(q,{"start"=>[0,0],"end"=>[9,9]})
+    float_vara.put(r,{"start"=>[-8,2]})
+    float_vara.put(r,{"start"=>[0,0],"stride"=>[2,3]})
+    float_vara.put(r,{"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    float_vara.put(qr,{"index"=>[4,7]})
+
+    float_vara.dim_names
+
+    assert na_aaa=byte_vara.get({"start"=>[3,5]})
+    assert na_aab=byte_vara.get({"start"=>[0,0],"end"=>[9,9]})
+    assert na_aac=byte_vara.get({"start"=>[-8,2]})
+    assert na_aad=byte_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+    assert na_aae=byte_vara.get({'start'=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert na_aaf=byte_vara.get({"index"=>[4,7]})
+    assert na_aag=byte_vara.get
+
+    assert na_bba=sint_vara.get({"start"=>[3,5]})
+    assert na_bbb=sint_vara.get({"start"=>[0,0],"end"=>[9,9]})
+    assert na_bbc=sint_vara.get({"start"=>[-8,2]})
+    assert na_bbd=sint_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+    assert na_bbf=sint_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert na_bbg=sint_vara.get({"index"=>[4,7]})
+    assert na_bbh=sint_vara.get
+
+    assert na_cca=int_vara.get({"start"=>[3,5]})
+    assert na_ccb=int_vara.get({"start"=>[0,0],"end"=>[9,9]})
+    assert na_ccc=int_vara.get({"start"=>[-8,2]})
+    assert na_ccd=int_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+    assert na_cce=int_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert na_ccf=int_vara.get({"index"=>[4,7]})
+    assert na_ccg=int_vara.get
+
+    assert na_dda=sfloat_vara.get({"start"=>[3,5]})
+    assert na_ddb=sfloat_vara.get({"start"=>[0,0],"end"=>[9,9]})
+    assert na_ddc=sfloat_vara.get({"start"=>[-8,2]})
+    assert na_ddd=sfloat_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+    assert na_dde=sfloat_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert na_ddf=sfloat_vara.get({"index"=>[4,7]})
+    assert na_ddg=sfloat_vara.get
+
+    assert na_eea=float_vara.get({"start"=>[3,5]})
+    assert na_eeb=float_vara.get({"start"=>[0,0],"end"=>[9,9]})
+    assert na_eec=float_vara.get({"start"=>[-8,2]})
+    assert na_eed=float_vara.get({"start"=>[0,0],"stride"=>[2,3]})
+    assert na_eee=float_vara.get({"start"=>[1,1],"end"=>[3,7],"stride"=>[2,3]})
+    assert na_eef=float_vara.get({"index"=>[4,7]})
+    assert na_eeg=float_vara.get
+
+    file.redef
+
+    copy_byte = string.copy(byte_vara)
+    copy_byte.put([0,20],"byte")
+    copy_byte.name="new_name"
+
+    copy_byte2 = copy_byte
+    assert_equal copy_byte2, copy_byte
+
+    copy_sint = string.copy(sint_vara)
+    copy_sint.put("%%%%%")
+    copy_int = string.copy(int_vara)
+    copy_int.put([0,60],"int")
+    copy_sfloat = string.copy(sfloat_vara)
+    copy_sfloat.put([0.01,5.5],"sfloat")
+    copy_float = string.copy(float_vara)
+    copy_float.put([0.0001,5.5555],"float")
+    file.enddef
+    assert nm = copy_byte.name
+    assert att0 = string.get
+    assert att1 = copy_byte.get
+    assert att2 = copy_sint.get
+    assert att3 = copy_int.get
+    assert att4 = copy_sfloat.get
+    assert att5 = copy_float.get
+    file.fill(true)
+    file.fill(false)
+
+    float_vara.dim_names
+    float_vara.att_names
+
+    file.close
+  end
+
+  def teardown
+    if File.exist?(@filename)
+      begin
+        File.delete(@filename)
+      rescue
+        p $!
+      end
+    end
+  end
+
+end


=====================================
test/type.rb
=====================================
@@ -1,13 +1,29 @@
+require 'test/unit'
 require 'numru/netcdf'
 include NumRu
-s = 'tmp.nc'
-f = NetCDF.create(s)
-d = f.def_dim('x',2)
-v = f.def_var('x','sfloat',[d])
-p v.vartype, v.ntype
-v = f.def_var('x1','sint',[d])
-p v.vartype, v.ntype
-v = f.def_var('x2','byte',[d])
-p v.vartype, v.ntype
-
-f.close
+class TestType < Test::Unit::TestCase
+  def test_type
+    @s = 'tmp.nc'
+    f = NetCDF.create(@s)
+    d = f.def_dim('x',2)
+    v = f.def_var('x','sfloat',[d])
+    assert_equal v.vartype,
+                 v.ntype
+    v = f.def_var('x1','sint',[d])
+    assert_equal v.vartype,
+                 v.ntype
+    v = f.def_var('x2','byte',[d])
+    assert_equal v.vartype,
+                 v.ntype
+    f.close
+  end
+  def teardown
+    if File.exist?(@s)
+      begin
+        File.delete(@s)
+      rescue
+        p $!
+      end
+    end
+  end
+end



View it on GitLab: https://salsa.debian.org/debian-gis-team/ruby-netcdf/-/commit/f00e278256061e78720c4f8ee5b1b253d9820d04

-- 
View it on GitLab: https://salsa.debian.org/debian-gis-team/ruby-netcdf/-/commit/f00e278256061e78720c4f8ee5b1b253d9820d04
You're receiving this email because of your account on salsa.debian.org.


-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://alioth-lists.debian.net/pipermail/pkg-grass-devel/attachments/20220401/acb61e68/attachment-0001.htm>


More information about the Pkg-grass-devel mailing list