package ucar.nc2.iosp.bufr;

import org.junit.Ignore;
import org.junit.Test;
import org.junit.experimental.categories.Category;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import ucar.nc2.Variable;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dataset.NetcdfDatasets;
import ucar.unidata.util.test.category.NeedsCdmUnitTest;
import ucar.unidata.util.test.TestDir;
import java.io.File;
import java.io.IOException;
import java.lang.invoke.MethodHandles;

@Category(NeedsCdmUnitTest.class)
public class Tds355Test {
  private static final Logger logger = LoggerFactory.getLogger(MethodHandles.lookup().lookupClass());

  File supportDir = new File(TestDir.testdataDir, "support");
  File tds355Dir = new File(supportDir, "TDS-355");

  @Ignore("cant deal with BUFR at the moment")
  @Test
  public void testTds355() throws IOException {
    File example = new File(tds355Dir, "iasi_20110513_045057_metopa_23676_eps_o.l1_bufr");

    try (NetcdfDataset dataset = NetcdfDatasets.openDataset(example.getAbsolutePath())) {
      Variable obs = dataset.findVariable("obs");

      obs.read(); // Throws an NPE after about 50 seconds on my machine.
    }
  }
}
