aodn / imos-user-code-library

Code library of helper functions and examples for working with NetCDF data files typically sourced from IMOS
GNU General Public License v3.0
24 stars 17 forks source link

Option to skip NaN of variables data from valid_min/valid_max #3

Closed sspagnol closed 10 years ago

sspagnol commented 11 years ago

An option to not NaN out variables data based on valid_min/valid_max. In my case had a change of sensor from one deployment to next with an increase sensor range but the automatic netcdf file creator hadn't updated valid_max. Yes the file needs to be corrected but would be nice to see all the original data in the file.

This seems be not just in ncParse.m or nctoolbox but also lower down due to the java library used by nctoolbox. I have the same result if I bypass ncParse and use an nctoolbox ncdataset call then get the variable. But if I access the variable using matlab's netcdf.getVar(ncid,varid) then get data without valid_min/valid_max applied. From netcdf-java site can determine that access of a variable using NetcdfDataset interface applies scale/offset and makes values outside of the valid range into NaN.

But I can't determine how to use ncParse/nctoolbox nice'n'easy semantics but not have the outside valid range NaNed out.

Any advice appreciated. Simon.

ggalibert commented 10 years ago

This has been fixed. valid_min/max values shouldn't be applied on the dataset to change a value to NaN. This was an error.