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 Stephan, > FYI: I have been able to build netCDF in the Windows by rebuild the c project > as a static library and then using the C++ interface inside my Project Good, congratulations! > I have another question / issue: > > Using the pres_temp_4D_wr.cpp example, I have been able to create a file and > then display it. > > I would like to be able to define a 3rd dimension ( i.e. in the example > "level") in terms of a variable for altitudes. When using the display tool > (LLnL VisIt), I can not display the pressure. I'm not usre I understand the question, but maybe you just want to define a third coordinate variable, level, to provide the altitudes corresponding to each level dimension index. In that case, just follow the pattern for latVar and lonVar: // Define the level coordinate variable for altitudes NcVar *levelVar; if (!(levelVar = dataFile.add_var("level", ncFloat, lvlDim))) // Define the units attribute for the level coordinate variable. if (!levelVar->add_att("units", "meters")) return NC_ERR; // Write the level coordinate variable data to the file. float levels[NLVL]; for (int lvl = 0; lvl < NLVL; lvl++) levels[lvl] = 100.0 * lvl; // for 0 meters, 100 meters, ... if (!levelVar->put(levels, NLVL)) return NC_ERR; --Russ Russ Rew UCAR Unidata Program address@hidden http://www.unidata.ucar.edu Ticket Details =================== Ticket ID: PRS-970596 Department: Support netCDF Priority: Normal Status: Closed