我正在尝试编写一个带有可变长度变量的netCDF-4文件。
理想情况下,我应该使用ncgen实用程序,但它不支持ncml输入。因此,我使用的是netCDF 4.6.6。以下不带可变长度变量的ncml生成一个可行的netCDF-4文件:
java -Xmx1g -classpath ~/dump/netcdfAll-4.6.6.jar ucar.nc2.dataset.NetcdfDataset -in test.ncml -out test.nc4 -netcdf4这是对应的ncml/xml:
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://what.no">
<group name="data">
<dimension name="number_packets" length="6"/>
<variable name="packet_time_utc" shape="number_packets" type="double">
</variable>
</group>
</netcdf>如果我在ncml中添加另一个无限维,则会发生失败。
<?xml version="1.0" encoding="UTF-8"?>
<netcdf xmlns="http://www.unidata.ucar.edu/namespaces/netcdf/ncml-2.2" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://what.no">
<group name="data">
<dimension name="number_packets" length="6" isVariableLength="true" isShared="false"/>
<variable name="packet_time_utc" shape="number_packets" type="double">
</variable>
</group>
</netcdf>根据ncml 模式,尺寸的定义是正确的。Error msg NetCDF:未找到变量
NetcdfDatataset read from test-vlen.ncml write to test-Vlen.nc4 java.io.IOException: -49: NetCDF: Variable not found
at ucar.nc2.jni.netcdf.Nc4Iosp.writeData(Nc4Iosp.java:2835)
at ucar.nc2.jni.netcdf.Nc4Iosp.writeData(Nc4Iosp.java:2789)
at ucar.nc2.NetcdfFileWriter.write(NetcdfFileWriter.java:954)
at ucar.nc2.NetcdfFileWriter.write(NetcdfFileWriter.java:938)
at ucar.nc2.FileWriter2.copyAll(FileWriter2.java:431)
at ucar.nc2.FileWriter2.copyVarData(FileWriter2.java:384)
at ucar.nc2.FileWriter2.write(FileWriter2.java:199)
at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1888)
Exception in thread "main" java.io.IOException: -101: NetCDF: HDF error
at ucar.nc2.jni.netcdf.Nc4Iosp.close(Nc4Iosp.java:289)
at ucar.nc2.NetcdfFileWriter.abort(NetcdfFileWriter.java:1032)
at ucar.nc2.FileWriter2.write(FileWriter2.java:207)
at ucar.nc2.dataset.NetcdfDataset.main(NetcdfDataset.java:1888)指定length="*" (如建议的这里 )将导致不同的NumberFormatException错误。
我正在使用现有的最新版本:
错误在于找不到变量(FileWrite想要复制所有变量)。然而,我被困在试图寻找错误的根源。
发布于 2016-06-29 20:18:29
我用netCDF分支5.0.0;commit 0cc266d再现了这一点,但是错误更清楚一些:
第二个例子是:
java.lang.IllegalArgumentException: Dimensions added to a group must be shared.移除isShared="false"
java.lang.IllegalArgumentException: variable length dimension cannot be shared or unlimited在我看来,目前还没有人支持。
发布于 2016-07-12 00:50:47
不幸的是,这不是我们在NetCDF中支持的东西。我在GitHub上对此发表了意见。
https://stackoverflow.com/questions/38103030
复制相似问题