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 Tom: Typically you have to create an IOSP for this kind of thing. See Section 4 of: http://www.unidata.ucar.edu/software/netcdf-java/tutorial/index.html If you know what you are doing, you can create the Dimensions, Variables, Attributes, etc. Data values must be stored in memory with Variable.setCache(). We dont have any docs for this "on-the-fly" creation, so i would recommend implementing an IOSP, which will be easier in the long run. > Hi John, > > I am looping through data; I want to create an empty ncdf4-compliant > object and fill it with this data (defining Dimensions, Variables, > Attributes, values...). I am *not* asking about writing a file to disk; > I am asking about creating/populating an object in memory. For writing > to disk, other resources/APIs will be used (e.g. the Lincoln Labs JNI > for this purpose). > > The *NetcdfFileWriteable *object does this for ncdf3. I don't see any > way, in the Java API, to do so for ncdf4. Can you tell me how I can > loop through data in memory and populate a ncdf4-compliant object - > perhaps a GeoGrid, or a GridDataset, or something? > > Thanks, > Tom > > Ticket Details =================== Ticket ID: VSP-832015 Department: Support netCDF Java Priority: Critical Status: Closed