Due to the current gap in continued funding from the U.S. National Science Foundation (NSF), the NSF Unidata Program Center has temporarily paused most operations. See NSF Unidata Pause in Most Operations for details.
You might want to look at this list of tools. http://unidata.ucar.edu/software/netcdf/software.html =Dennis Heimbigner Unidate On 4/2/2017 1:38 PM, Antonio Rodriges wrote:
Ross, Bob is right. There is no an out-of-the-box routine/method in NetCDF-Java to do this for you. If you try to code this yourself in Java, you'll get to deal with a lot of tricky details related to diverse conventions (CF, ...). AFAIK, none of the NCO operators produces multiple output files, i.e. you cannot give an nco tool a single input file and get multiple output files (split a NetCDF file by time axis into multiple files). However, CDO is able to do this: https://code.zmaw.de/projects/cdo/embedded/index.html#x1-1070002.2.8 You may use "Process" as Bob suggests or a more powerful lib, e.g. wrapper around native Java "Process": https://github.com/zeroturnaround/zt-exec to invoke CDO from Java. The final notice: CDO is much limited compared to NCO regarding support of generic NetCDF files. This means that if your NetCDF files contain axes other than latitude, longitude, level, time (see the manual for the detailed list) - CDO will refuse to handle such files. 2017-04-02 21:05 GMT+03:00 Bob Simons - NOAA Federal <bob.simons@xxxxxxxx>:Two ways you can do this: 1) If you can do something in NCO, it is probably much simpler to keep doing it in NCO. From Java, you can call Process process = Runtime.getRuntime().exec(cmd); to call an operating system process (but see the detailed examples on the web for how to do this for your operating system), including calling NCO. 2) If I understand the problem, the only way I know of to do this with netcdf-java, is to read the time and other data values and write the .nc files with the individual time values and the data associated with each time (and all the associated dimensions and attributes). That's the nature of working with netcdf-java. (Perhaps someone else will chime in with a simpler method.) P.S. I don't know your reasons for using netcdf-java 4.2. I understand that sometimes projects are, for now, locked into a certain version. But if you can, I encourage you to switch to the latest version (4.6.8). Things are done differently in recent versions of netcdf-java and various bugs have been fixed. You'll probably have to switch to a modern version of Java someday, so, if you can, you might as well switch now so you don't have to rewrite this code later. On Sun, Apr 2, 2017 at 6:19 AM, Alter, Ross E ERDC-RDE-CRREL-NH CIV <Ross.E.Alter@xxxxxxxxxxxxx> wrote:Hi all, I'm using the Java Netcdf API (v4.2) to work with weather model output in Netcdf format. However, I am trying to convert a NetcdfFile with multiple time steps to a List of NetcdfFiles with single time steps, and I can't seem to find a direct way to accomplish this using the existing NetcdfFile methods without first reading a specific variable (which I would prefer not to do). I'm aware of how to solve this using NCO, but I would like to solve this using Java since that is the language in which the software is written. If you could please offer a suggestion on the most effective way to accomplish the above, I'd really appreciate it. Thanks a lot for your help! Ross _______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdf-java mailing list netcdf-java@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/-- Sincerely, Bob Simons IT Specialist Environmental Research Division NOAA Southwest Fisheries Science Center 99 Pacific St., Suite 255A (New!) Monterey, CA 93940 (New!) Phone: (831)333-9878 (New!) Fax: (831)648-8440 Email: bob.simons@xxxxxxxx The contents of this message are mine personally and do not necessarily reflect any position of the Government or the National Oceanic and Atmospheric Administration. <>< <>< <>< <>< <>< <>< <>< <>< <>< _______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdf-java mailing list netcdf-java@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/_______________________________________________ NOTE: All exchanges posted to Unidata maintained email lists are recorded in the Unidata inquiry tracking system and made publicly available through the web. Users who post to any of the lists we maintain are reminded to remove any personal information that they do not want to be made public. netcdf-java mailing list netcdf-java@xxxxxxxxxxxxxxxx For list information or to unsubscribe, visit: http://www.unidata.ucar.edu/mailing_lists/
netcdf-java
archives: