Mercurial > forge
comparison main/netcdf/inst/ncread.m @ 12711:a4de85b2e6a0 octave-forge
fix bug 47014 and make test code work in matlab
author | abarth93 |
---|---|
date | Fri, 19 Feb 2016 13:45:14 +0000 |
parents | f2cf7070ccb5 |
children |
comparison
equal
deleted
inserted
replaced
12710:be04cf3bc03b | 12711:a4de85b2e6a0 |
---|---|
93 elseif strcmp(attname,'_FillValue') | 93 elseif strcmp(attname,'_FillValue') |
94 fv = netcdf_getAtt(gid,varid,'_FillValue'); | 94 fv = netcdf_getAtt(gid,varid,'_FillValue'); |
95 end | 95 end |
96 end | 96 end |
97 | 97 |
98 if !isempty(factor) || !isempty(factor) || !isempty(offset) | 98 netcdf_close(ncid); |
99 | |
100 # the scaling does not make sense of characters | |
101 if xtype == netcdf_getConstant('char') || ... | |
102 xtype == netcdf_getConstant('string') | |
103 | |
104 return; | |
105 end | |
106 | |
107 if !isempty(fv) || !isempty(factor) || !isempty(offset) | |
99 if !isa(x,'double') | 108 if !isa(x,'double') |
100 x = double(x); | 109 x = double(x); |
101 end | 110 end |
102 end | 111 end |
103 | 112 |
104 if !isempty(fv) && xtype != netcdf_getConstant('char') && ... | 113 if !isempty(fv) |
105 xtype != netcdf_getConstant('string') | |
106 x(x == fv) = NaN; | 114 x(x == fv) = NaN; |
107 end | 115 end |
108 | 116 |
109 if !isempty(factor) | 117 if !isempty(factor) |
110 x = x * factor; | 118 x = x * factor; |
112 | 120 |
113 if !isempty(offset) | 121 if !isempty(offset) |
114 x = x + offset; | 122 x = x + offset; |
115 end | 123 end |
116 | 124 |
117 netcdf_close(ncid); |