NSF Unidata

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[netCDFJava #HRY-102614]: problem in using NetCDF-Java Library to create netcdf file

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 Jeff,

The reason your ncml file won't work is because the variables you are creating
are each bigger than 2 gigabytes. If you switch to writing out a netcdf4 file, 
then
you will be able to use your ncml file without modification.

To enable netcdf4 writing, you will need the C library installed. See

http://www.unidata.ucar.edu/software/thredds/current/netcdf-java/reference/netcdf4Clibrary.html

for more information.

Cheers,

Sean

> Dear Sir/Madam:
> I am using the function NcMLReader.writeNcMLToFile(InputStream ncml, String 
> fileOutName) in NetCDF-Java Library (netcdfAll-4.6.jar)  to create a netcdf 
> file with ncml.However,it failed because of the error below:
> 
> java.lang.IllegalArgumentException: Variable starting pos=2217611712 may not 
> exceed 2147483647
> at ucar.nc2.iosp.netcdf3.N3header.writeHeader(N3header.java:686) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.iosp.netcdf3.N3header.create(N3header.java:602) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.iosp.netcdf3.N3iosp.create(N3iosp.java:668) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.NetcdfFileWriter.create(NetcdfFileWriter.java:797) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.FileWriter2.write(FileWriter2.java:196) ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.FileWriter2.write(FileWriter2.java:176) ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.ncml.NcMLReader.writeNcMLToFile(NcMLReader.java:1652) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at ucar.nc2.ncml.NcMLReader.writeNcMLToFile(NcMLReader.java:1634) 
> ~[netcdfAll-4.6.jar:4.6.0]
> at com.jeff.cdm.Netcdf3Util.createFileWithNCML(Netcdf3Util.java:100) 
> [JeffUtil.jar:?]
> at 
> com.xxzx.datadist.processor.impl.CreateNCProcessor.process(CreateNCProcessor.java:53)
>  [DataDistributor.jar:?]
> at com.xxzx.datadist.job.DataDistJob.start(DataDistJob.java:127) 
> [DataDistributor.jar:?]
> at com.xxzx.datadist.DataDistributor.runJob(DataDistributor.java:130) 
> [DataDistributor.jar:?]
> at com.xxzx.datadist.DataDistributor.main(DataDistributor.java:92) 
> [DataDistributor.jar:?]
> 
> The ncml file I used is in the attachment "qpf.ncml".
> Could you tell me how to solve the problem?
> Thank you for your attention.
> Best regards
> Jeff

Ticket Details
===================
Ticket ID: HRY-102614
Department: Support netCDF Java
Priority: Normal
Status: Open