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.

Re: [netcdf-java] Deprecated class/method (FileWriter.writeToFile()), any guidance as to what else I should use?

Thanks, Brian.

Those classes all contain various methods for writing to NetCDF files, but
none appear to
​have a 1:1 correspondence
to the functionality you got from the now deprecated
FileWriter.writeToFile() method, at least from what I can tell (the JavaDoc
is sparse
​,​
at best).  From what I can tell one way to go about it
​ is​
to use the FileWriter2 constructor
​ and​
then
​its ​
write() method,
​like so:​


    ​FileWriter2 fileWriter = new FileWriter2(netcdfDataset, outFilePath,
NetcdfFileWriter.Version.netcdf3, null);
    NetcdfFile outNetcdfFile = fileWriter.write();​

The above seems to work just fine.  ​Is this the reasonable/recommended​
way to do things now?

--James


On Wed, Aug 20, 2014 at 3:38 PM, Smith, Brian <brian.smith@xxxxxxxxxxxxxx>
wrote:

>  Hi James,
>
>
>
> I believe the current functions for this purpose are
> http://www.unidata.ucar.edu/software/thredds/v4.3/netcdf-java/v4.3/javadoc/ucar/nc2/NetcdfFileWriter.html
> or
> http://www.unidata.ucar.edu/software/thredds/v4.3/netcdf-java/v4.3/javadoc/ucar/nc2/FileWriter2.html
> or
> http://www.unidata.ucar.edu/software/thredds/v4.3/netcdf-java/v4.3/javadoc/ucar/nc2/dt/grid/NetcdfCFWriter.html
> depending on your needs, assuming you are using 4.3.
>
>
>
> Cheers,
>
> Brian
>
>
>
> *From:* netcdf-java-bounces@xxxxxxxxxxxxxxxx [mailto:
> netcdf-java-bounces@xxxxxxxxxxxxxxxx] *On Behalf Of *James Adams - NOAA
> Affiliate
> *Sent:* Wednesday, August 20, 2014 10:58 AM
> *To:* Java NetCDF
> *Subject:* [netcdf-java] Deprecated class/method
> (FileWriter.writeToFile()), any guidance as to what else I should use?
>
>
>
> The method FileWriter.writeToFile(NetcdfFile,
>
> ​ ​
>
> String
>
> ​,​
>
> boolean)
>
> ​ is marked as deprecated in the JavaDoc,​ and shows as such in Eclipse.
>  I'd like to use an appropriate/non-deprecated method for this, but the
> JavaDoc gives no guidance as to what that might be.  My use case is that I
> have a NetcdfDataset that I want to write to file.
>
>
>
> Can anyone advise?  Thanks in advance for any suggestions.
>
>
>
> --James
>
> ------------------------------
>
> CONFIDENTIALITY NOTICE: This e-mail message is for the sole use of the
> intended recipient(s) and may contain confidential and privileged
> information. Any unauthorized review, use, disclosure or distribution of
> any kind is strictly prohibited. If you are not the intended recipient,
> please contact the sender via reply e-mail and destroy all copies of the
> original message. Thank you.
>
  • 2014 messages navigation, sorted by:
    1. Thread
    2. Subject
    3. Author
    4. Date
    5. ↑ Table Of Contents
  • Search the netcdf-java archives: