This archive contains answers to questions sent to Unidata support through mid-2025. Note that the archive is no longer being updated. We provide the archive for reference; many of the answers presented here remain technically correct, even if somewhat outdated. For the most up-to-date information on the use of NSF Unidata software and data services, please consult the Software Documentation first.
>From: address@hidden (Dave Duling) >Organization: National Institute of Health >Keywords: 199512132213.AA10849 netCDF byte swapped Dave, >I have some data (Kratos Mass Spec Mach3) that is supposedly netcdf. >However, ncdump does not recognize the data as netcdf. I noticed that >the data looks netcdf like and that if I change the first three bytes >from FDC to CDF then ncdump opens the file and reports: > error: ncopen: NC_xtypelen: Unknown type 13. > >The original file was transferred via binary ftp. I then made an nfs link >and just copied the file. Same result. > >I have put the original file in a public accessible nfs directory if >anyone is that interested: ... OK, I mounted the drive; transferred the file; and verified your observation. >I suppose I could take a binary editor and change the data type to one >of the magic 6 types, but that doesnt seem kosher. No, this is not the problem. Someone byte-swapped the file. This should never be done on an netCDF file since the netCDF always writes the files in the IEEE standard format (big-endian). The netCDF interface then translates to the byte ordering needed on the machine on which routines are being run. I byte-swapped your file and verified that ncdump works correctly on it: ncdump 1129950013.cdf | more netcdf 1129950013 { dimensions: _2_byte_stri = 2 ; _4_byte_stri = 4 ; _8_byte_stri = 8 ; _16_byte_str = 16 ; _32_byte_str = 32 ; _64_byte_str = 64 ; _128_byte_string = 128 ; _255_byte_string = 255 ; rang = 2 ; scan_num = 73 ; point_number = UNLIMITED ; // (1 currently) error_number = 1 ; instrument_numbe = 1 ; variables: char error_lo(error_number, _64_byte_str) ; float actual_run_time_leng ; float actual_delay_tim ; long scan_ind(scan_num) ; long point_co(scan_num) ; double abcissa_valu(point_number) ; abcissa_valu:unit = "Z/M" ; abcissa_valu:add_offs = 0. ; abcissa_valu:scale_factor = 1. ; abcissa_valu:long_nam = "Z/M" ; long ordinate_val(point_number) ; ordinate_val:unit = "Total Counts" ; ordinate_val:add_offs = 0. ; ordinate_val:scale_factor = 1. ; ordinate_val:long_nam = "ADC UNIT" ; float a_d_sampling_rat(scan_num) ; short a_d_coaddition_facto(scan_num) ; float scan_acquisition_tim(scan_num) ; scan_acquisition_tim:non_uniform_sampling_fla = 0s ; float scan_duratio(scan_num) ; float inter_scan_t(scan_num) ; float resoluti(scan_num) ; double total_intens(scan_num) ; ... I put the byte-swapped file out in our anonymous FTP pub directory for you to grab. >I have complained to the manufacturer of the system, but ... You should inform them that they should not byte-swap the files. Tom Yoksas