2

可変長変数を使用して netCDF-4 ファイルを書き込もうとしています。

理想的には ncgen ユーティリティを使用したかったのですが、 ncml入力をサポートしていません。したがって、netCDF-java lib 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 schemaによると、ディメンションの定義は正しいです。エラー メッセージ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 エラーが発生します。

利用可能な最新バージョンを使用しています:

  • HDF 1.8.17
  • netcdf C 4.4.0
  • netCDF-Java ライブラリ 4.6.6

エラーは、変数が見つからないことに関するものです (FileWrite はすべての変数をコピーしようとしています)。ただし、エラーの原因を見つけようとして立ち往生しています。

4

2 に答える 2

0

これを netCDF-java lib branch 5.0.0で再現しました。0cc266dをコミットしますが、エラーはもう少し明確です:

あなたの2番目の例では:

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-06-29T20:18:29.927 に答える