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.
Hi Bruno: I should have a release fixing this in the next few days. thanks for reporting. > Hi John, > For file test3_p1_d1wave.nc (In Big Endian) this works correctly, but for > file fpscminicodac_1.nc (in Little Endian) the API modifications produce the > previous error (reported in last e-mail but now for little-endian files)... > In this API version vlen_t values are always read in Big Endian and in last > version they were read in Little Endian... The modifications inverted the > error and does not detect the order of endian in the file. > Thanks for your support, > Regards, > > Bruno Santos > > > 2010/12/23 Unidata netCDF Java Support <address@hidden > > > > > Hi Bruno: > > > > Ive reissued the release version 4.2.18.20101223.2214, available at > > > > http://www.unidata.ucar.edu/software/netcdf-java/ > > > > with this bug fixed. thanks for reporting the problem. > > > > John > > > > > Hello, > > > > > > I've problem when read vlen_t data stored in big endian format. In > > attached > > > file all variable are read correctly except the variable levels from > > type > > > vlen_t. For example, for value 549 the value read by as.getInt(i) is > > > 620888064, in Hexadecimal 549 is 00 00 02 25 and 620888064 is 25 02 00 > > 00... > > > I correct this manually, but can you update the java API? > > > Best Wishes, > > > > > > Bruno Santos > > > > > > > > > Here the code: > > > *Array data = dataLevels.read(initialIndex + ":" + finalIndex + > > > ",:");* > > > // loop over outer dimension > > > int x = 0; > > > long samplesTotal = 0; > > > long maxSamples = 200000L; > > > > > > *while (data.hasNext() && samplesTotal < maxSamples) {* > > > Array as = (Array) data.next(); // inner variable length array > > > of short > > > //ArrayInt.D1 as = (ArrayInt.D1) data.next(); // inner variable > > > length array of short > > > long nextTime = 0; > > > long timeSlice = 0; > > > > > > //System.out.println("Data: " + data.next().getClass()); > > > if (sPeriodArray.get(x) > 0) { > > > timeSlice = sPeriodArray.get(x); > > > } else { > > > //----------Change > > > long samplesPerSecond = sRateArray.get(x); > > > timeSlice = 1000000000 / samplesPerSecond; > > > } > > > > > > //System.out.println("as.getSize: " + as.getSizeBytes()); > > > //System.out.println("as.getSize: " + as.getSize()); > > > int i = 0; > > > while (i < as.getSize()){ > > > *//Incorrect value* > > > int aux = as.getInt(i); > > > > > > * if (bigEndian){* > > > * int aux1;* > > > * int aux2;* > > > * int aux3;* > > > * int aux4;* > > > * > > > * > > > * aux1 = (aux & 0xFF) << 24;* > > > * aux2 = (aux & 0xFF00) << 8;* > > > * aux3 = (aux & 0xFF0000) >> 8;* > > > * aux4 = (aux & 0xFF000000) >> 24;* > > > * > > > * > > > * //Corrected value* > > > * aux = (aux1 & 0xFF000000) | (aux2 & 0x00FF0000)| > > (aux3 > > > & 0x0000FF00) | (aux4 & 0x000000FF);* > > > } > > > } > > > > > > > > > > > > Ticket Details > > =================== > > Ticket ID: NMT-724530 > > Department: Support netCDF Java > > Priority: Normal > > Status: Closed > > > > > > Ticket Details =================== Ticket ID: NMT-724530 Department: Support netCDF Java Priority: High Status: Closed