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.
Greetings Mario! There are a few ways you could go about doing this. The first way is to simply put your lookup table into the netCDF file. For clarity, I would add an ancillary_variables attribute to the integer climate class variable that points to the variable holding your lookup table information (http://cf-pcmdi.llnl.gov/documents/cf-conventions/1.6/ch03s04.html). However, there really isn't a standard way for applications to know how to use the lookup value, so it will be up to you to document your data format to make sure others understand what is going on with climate class variables. The second approach would extend the first by writing and I/O Service Provider (IOSP) for your data (see section 4 of the netCDF-Java tutorial http://www.unidata.ucar.edu/software/netcdf-java/tutorial/ for more info). In this situation, you would extend the reading capabilities of netCDF-Java to handle the lookup for your specific type of data file. This would allow you to create a method to do the lookup for the user. A third way (but non-Java) would be to use enumerated types in netcdf-4(http://www.unidata.ucar.edu/software/netcdf/workshops/2011/groups-types/EnumCDL.html). This method, however, is not usable from netCDF-Java, as the netCDF-4 enhanced data model is not supported at this time. Hopefully this will give you a few ideas. Cheers! Sean > Dear support team, > > I've already sent an email to the mailing list. Unfortunately I did > not get an answer which is why I am writing this mail to you. > > I am currently implementing a climate classification algorithm using > the NetCDF-Java 4.2 API. The climate class is stored as an integer > value. > I'ld now like to know if there is a way to associate the integer > values with the name of the corresponding climate class, using > something like a lookup-table? > > I would be glad if you could send me a code example. > > Thanks a lot, > Mario > > Ticket Details =================== Ticket ID: JSN-352871 Department: Support netCDF Java Priority: Urgent Status: Open