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 Jeff: You cant do this: VariableSimpleAdapter var = new VariableSimpleAdapter(structureMembers.addMember("test", "test", "m", DataType.DOUBLE, new int[]{1})); because it creates a variable with non-shared dimensions, and you are writing to netcdf, which requires shared dimensions. You should have a real Variable; do you ? John > Hi Lansing, > > Attached is a simple test program. This gives the NPE when run. > I'm not adding any values just creating variables and writing the header. > > Am I creating the variables correctly? > > -Jeff > > > > address@hidden> wrote: > > > Jeff, > > > > What are you using for the method addMember in the StructureDataScalar > > class? I put together this: > > > > public void addMember(String name, String desc, String units, double val, > > int[] intArr) { > > StructureMembers.Member m = members.addMember(name, desc, units, > > DataType.DOUBLE, intArr); > > ArrayDouble.D0 data = new ArrayDouble.D0(); > > data.set(val); > > setMemberData(m, data); > > } > > > > but you're test code is sending in the type Double, not a value. Do you > > have something like this: > > > > public void addMember(String name, String desc, String units, DATATYPE, > > int[] intArr) { > > *some other code* > > > > Or did you mean to send in some double value? > > > > -Lansing > > > > Ticket Details > > =================== > > Ticket ID: JYB-204699 > > Department: Support netCDF Java > > Priority: Normal > > Status: Open > > > > > > Ticket Details =================== Ticket ID: JYB-204699 Department: Support netCDF Java Priority: Normal Status: Open