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
19 stars 15 forks source link

Long variable names not retrieved #10

Open ggalibert opened 9 years ago

ggalibert commented 9 years ago

Because a NetCDF variable name ends up in the struct name itself:

dataset.variables.TEMP= dimensions: {'TIME'} data: [16699x1 double] data_CORR: [16699x1 double] standard_name: 'sea_water_temperature' long_name: 'sea_water_temperature' units: 'Celsius' ...

in this case TEMP is the variable name, this strategy doesn't support NetCDF variable names that are longer than 63 characters in Matlab (Matlab limit for variable names) and triggers an warning saying that the actual name has been truncated.

Instead, use the following strategy:

dataset.variables{1}= name: 'TEMP' dimensions: {'TIME'} data: [16699x1 double] data_CORR: [16699x1 double] standard_name: 'sea_water_temperature' long_name: 'sea_water_temperature' units: 'Celsius' ...