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

Scalar variables (introduced by toolbox v2.4) are not supported #14

Open ggalibert opened 8 years ago

ggalibert commented 8 years ago

ncParse('/mnt/opendap/1/IMOS/opendap/ANMN/NRS/NRSKAI/CTD_timeseries/IMOS_ANMN-NRS_ACESTZ_20140506T051319Z_NRSKAI_FV01_NRSKAI-1405-NXIC-CTD-104.49_END-20141104T031329Z_C-20150903T024338Z.nc')

triggers the following error:

Error using warning
A message identifier must be followed by another input argument, of type char, representing the message text.

Error in ncdataset/readdata (line 464)
                    warning('NCTOOLBOX:ncdataset:readdata', ['An error occurred while reading "' variable ...

Error in ncdataset/data (line 159)
                    d = obj.readdata(variable);

Error in ncParse (line 325)
                data =  (nctoolbox_datasetInfo.data(variablesToExport(iiVar)))
sspagnol commented 8 years ago

I always thought this was something wrong with my setup. Worked around by using code idea from http://au.mathworks.com/matlabcentral/fileexchange/28556-read-netcdf/content/read_netcdf.m and changing line

d = array.copyToNDJavaArray();

to

if v.getSize == 1 d = array.copyTo1DJavaArray; else d = array.copyToNDJavaArray(); end

I don't know if the comment "% this fails if the variable has no java shape/no dimension was assigned" still applies.

Simon.

On 29 January 2016 at 14:11, Guillaume Galibert notifications@github.com wrote:

ncParse('/mnt/opendap/1/IMOS/opendap/ANMN/NRS/NRSKAI/CTD_timeseries/ IMOS_ANMN-NRS_ACESTZ_20140506T051319Z_NRSKAI_FV01_NRSKAI-1405-NXIC-CTD-104.49_END-20141104T031329Z_C-20150903T024338Z.nc ')

triggers the following error:

Error using warning A message identifier must be followed by another input argument, of type char, representing the message text.

Error in ncdataset/readdata (line 464) warning('NCTOOLBOX:ncdataset:readdata', ['An error occurred while reading "' variable ...

Error in ncdataset/data (line 159) d = obj.readdata(variable);

Error in ncParse (line 325) data = (nctoolbox_datasetInfo.data(variablesToExport(iiVar)))

— Reply to this email directly or view it on GitHub https://github.com/aodn/imos-user-code-library/issues/14.

ggalibert commented 8 years ago

@sspagnol a fix is suggested here : https://github.com/aodn/imos-user-code-library/pull/15

ggalibert commented 8 years ago

@sspagnol thanks for your input though, this is relevant for nctoolbox, not ncParse from the imos user code library. I can pass this on to nctoolbox github.