NOTICE: This version of the NSF Unidata web site (archive.unidata.ucar.edu) is no longer being updated.
Current content can be found at unidata.ucar.edu.

To learn about what's going on, see About the Archive Site.

[netcdf-java] NetcdfFileWriteable setName() is deprecated, but i don't know what else to use

Hi,

I have a problem to achieve my goal. My goal is: opening an existing netcd file, make some modification to it, then output to a different netcdf file. My java code is like the following:

final NetcdfFileWriteable writableFile = NetcdfFileWriteable.openExisting(inputNetcdfFileName); //open an existing input netcdf file. writableFile is not blank, it has everything defined in the input netcdf file.

       writableFile.setRedefineMode(true);

      //did some modification, like changing variable values, etc

writableFile.setName(outputFileName); //i want to write out to a different netcdf file, i don't want to overwrite the original input netcdf file

The code above works fine for me. However, setName() is *Deprecated.
*


     setName

public void *setName*(java.lang.String filename)

   *Deprecated.* /use NetcdfFileWriteable.createNew(String filename);/

   Set the filename of a new file to be created: call before calling
   create().

   *Parameters:*
       |filename| - name of new file to create.

/NetcdfFileWriteable.createNew(String filename) /is different thing. It returns a blank netcdf file object.

final NetcdfFileWriteable writableFile = NetcdfFileWriteable.createNew(fileName); //now, writableFile is blank

How can I avoid using deprecated setName() to achieve my goal? Thank you very much.



  • 2010 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: