Mercurial > forge
changeset 12498:78807393548d octave-forge
Work-around for problem in netcdf 4.1.3
author | abarth93 |
---|---|
date | Mon, 26 May 2014 14:16:57 +0000 |
parents | f0a5ce270b36 |
children | 5afb735e674c |
files | main/netcdf/DESCRIPTION main/netcdf/NEWS main/netcdf/inst/test_netcdf.m main/netcdf/src/Makefile main/netcdf/src/__netcdf__.cc |
diffstat | 5 files changed, 36 insertions(+), 17 deletions(-) [+] |
line wrap: on
line diff
--- a/main/netcdf/DESCRIPTION Sun May 25 21:26:28 2014 +0000 +++ b/main/netcdf/DESCRIPTION Mon May 26 14:16:57 2014 +0000 @@ -1,6 +1,6 @@ Name: netcdf -Version: 1.0.3 -Date: 2014-05-08 +Version: 1.0.4 +Date: 2014-05-26 Author: Alexander Barth <barth.alexander@gmail.com> Maintainer: Alexander Barth <barth.alexander@gmail.com> Title: netcdf
--- a/main/netcdf/NEWS Sun May 25 21:26:28 2014 +0000 +++ b/main/netcdf/NEWS Mon May 26 14:16:57 2014 +0000 @@ -1,3 +1,9 @@ +Summary of important user-visible changes for netcdf 1.0.4: +------------------------------------------------------------------- + + ** Work-around for problem in netcdf 4.1.3 for reading a unlimited + variable of current size 0 + Summary of important user-visible changes for netcdf 1.0.3: -------------------------------------------------------------------
--- a/main/netcdf/inst/test_netcdf.m Sun May 25 21:26:28 2014 +0000 +++ b/main/netcdf/inst/test_netcdf.m Mon May 26 14:16:57 2014 +0000 @@ -8,6 +8,7 @@ tests = {'test_netcdf_constant',... 'test_netcdf_create'... 'test_netcdf_low_level_interface'... + 'test_netcdf_unlim',... 'test_netcdf_datatypes'... 'test_netcdf_scalar_variable'... 'test_netcdf_attributes'...
--- a/main/netcdf/src/Makefile Sun May 25 21:26:28 2014 +0000 +++ b/main/netcdf/src/Makefile Mon May 26 14:16:57 2014 +0000 @@ -25,3 +25,6 @@ check: ../PKG_ADD __netcdf__.oct ($(OCTAVE) -f --eval "pkg unload octcdf; addpath $$PWD; addpath $$PWD/../inst; test_netcdf") + +check2: ../PKG_ADD __netcdf__.oct + ($(OCTAVE) -f --eval "addpath $$PWD; addpath $$PWD/../inst; test_netcdf")
--- a/main/netcdf/src/__netcdf__.cc Sun May 25 21:26:28 2014 +0000 +++ b/main/netcdf/src/__netcdf__.cc Mon May 26 14:16:57 2014 +0000 @@ -1304,6 +1304,8 @@ check_err(nc_inq_varndims (ncid, varid, &ndims)); + //std::cout << "ndims " << ndims << std::endl; + if (error_state) { return octave_value(); @@ -1329,6 +1331,9 @@ } start_count_stride(ncid, varid, args, args.length(), ndims, start, count, stride); + // std::cout << "count " << count[0] << std::endl; + // std::cout << "start " << start[0] << std::endl; + // std::cout << "stide " << stride[0] << std::endl; if (error_state) { @@ -1344,24 +1349,28 @@ //sliced_dim_vector(i) = count[i]; } - - //cout << "start " << start[0] << endl; - // need to take count and stride - + // std::cout << "sz " << sz << std::endl; + // std::cout << "sliced_dim_vector " << sliced_dim_vector(0) << " x " << sliced_dim_vector(1) << std::endl; - - //cout << "sz " << sz << endl; - //cout << "sliced_dim_vector " << sliced_dim_vector(0) << " x " << sliced_dim_vector(1) << endl; - + // Array < float > arr = Array < float >(sliced_dim_vector); + // float* time; + // time = (float*)malloc(10 * sizeof(float)); + // check_err(nc_get_vars(ncid, varid, start, count, stride, time)); + // data = octave_value(arr); + // return data; + switch (xtype) { -#define OV_NETCDF_GET_VAR_CASE(netcdf_type,c_type) \ - case netcdf_type: \ - { \ - Array < c_type > arr = Array < c_type >(sliced_dim_vector); \ - check_err(nc_get_vars(ncid, varid, start, count, stride, arr.fortran_vec())); \ - data = octave_value(arr); \ - break; \ +#define OV_NETCDF_GET_VAR_CASE(netcdf_type,c_type) \ + case netcdf_type: \ + { \ + Array < c_type > arr = Array < c_type >(sliced_dim_vector); \ + /* necessary for netcdf 4.1.3 */ \ + if (sz > 0) { \ + check_err(nc_get_vars(ncid, varid, start, count, stride, arr.fortran_vec())); \ + } \ + data = octave_value(arr); \ + break; \ } OV_NETCDF_GET_VAR_CASE(NC_BYTE,octave_int8)