ucar.nc2.NetcdfFiles Java Examples

The following examples show how to use ucar.nc2.NetcdfFiles. You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example #1
Source File: TestGrib1Unpack.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testThinGridAtEndofFile() throws IOException {
  final String testfile = "../grib/src/test/data/thinGrid.grib1";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {

    Variable var = nc.findVariable("Temperature_isobaric");
    Array data = var.read();
    Assert.assertEquals(73 * 73, data.getSize());

    float first = data.getFloat(0);
    float last = data.getFloat((73 * 73) - 1);

    Assert.assertEquals(291.0, first, 1e-6);
    Assert.assertEquals(278.0, last, 1e-6);
  }
}
 
Example #2
Source File: TestS3ExternalCompressionRead.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testMicrosoftBlobS3() throws IOException {
  // https://nexradsa.blob.core.windows.net/nexrad-l2/1997/07/07/KHPX/KHPX19970707_000827.gz
  String host = "nexradsa.blob.core.windows.net";
  String bucket = "nexrad-l2";
  String key = "1991/07/20/KTLX/KTLX19910720_160529.gz";
  String s3Uri = "cdms3://" + host + "/" + bucket + "?" + key;
  try (NetcdfFile ncfile = NetcdfFiles.open(s3Uri)) {

    assertThat(ncfile.findDimension("scanR")).isNotNull();
    assertThat(ncfile.findDimension("gateR")).isNotNull();
    assertThat(ncfile.findDimension("radialR")).isNotNull();

    Variable reflectivity = ncfile.findVariable("Reflectivity");
    Assert.assertNotNull(reflectivity);

    // read array
    Array array = reflectivity.read();

    assertThat(array.getRank()).isEqualTo(3);

    assertThat(array.getShape()).isEqualTo(new int[] {1, 366, 460});
  }
}
 
Example #3
Source File: CurvilinearGridPointMappingTest.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * Test GridCoordSystem.getLatLon()
 *
 * @throws IOException if ...
 * @throws InvalidRangeException if ...
 */
@Test
public void checkGridCoordSystem_getLatLon() throws IOException, InvalidRangeException {
  int[] origin = new int[] {j, i};
  int[] shape = new int[] {1, 1};

  NetcdfFile ncf = NetcdfFiles.open(datasetLocation);
  Variable latVar = ncf.findVariable("lat");
  Array latArray = latVar.read(origin, shape);
  Variable lonVar = ncf.findVariable("lon");
  Array lonArray = lonVar.read(origin, shape);

  double latVal = latArray.getDouble(latArray.getIndex());
  double lonVal = lonArray.getDouble(lonArray.getIndex());

  GridDataset gd = GridDataset.open(datasetLocation);
  GeoGrid gg = gd.findGridByName("hs");
  GridCoordSystem gridCoordSys = gg.getCoordinateSystem();
  // gridCoordSys.getXHorizAxis().;
  // gridCoordSys.getYHorizAxis();
  LatLonPoint llPnt = gridCoordSys.getLatLon(170, 62);

  Assert.assertEquals(lat, llPnt.getLatitude(), 0.001);
  Assert.assertEquals(lon, llPnt.getLongitude(), 0.001);
}
 
Example #4
Source File: BufrIospBuilder.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private String findUniqueName(Structure.Builder<?> struct, String want, String def) {
  if (want == null) {
    return def + tempNo++;
  }

  String vwant = NetcdfFiles.makeValidCdmObjectName(want);
  Optional<Variable.Builder<?>> oldV = struct.findMemberVariable(vwant);
  if (!oldV.isPresent()) {
    return vwant;
  }

  int seq = 2;
  while (true) {
    String wantSeq = vwant + "-" + seq;
    oldV = struct.findMemberVariable(wantSeq);
    if (!oldV.isPresent()) {
      return wantSeq;
    }
    seq++;
  }
}
 
Example #5
Source File: TestLongitudeWrap.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void testTimeAxisEval() throws IOException {
  /**
   * The following tests BugFixes.evalTimeAxes, called by ucar.nc2.dt.grid.GridCoordSys.isGridCoordSys
   */
  String testFileFullPath = TestDir.cdmUnitTestDir + "ft/grid/echoTops_runtime.nc";
  GridDataset runtimeDataset = new GridDataset(new NetcdfDataset(NetcdfFiles.open(testFileFullPath)));
  if (runtimeDataset.getGrids().isEmpty()) {
    throw new RuntimeException("Runtime data file did not generate a dataset with grids");
  }
  if (runtimeDataset.getGrids().get(0).getCoordinateSystem().getRunTimeAxis() == null) {
    throw new RuntimeException("Runtime data file did not generate a dataset with a RunTime axis");
  }

  System.out.println("BugFixesTest - completed.");
}
 
Example #6
Source File: TestNc4IospReading.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private boolean doCompare(String location, boolean showCompare, boolean showEach, boolean compareData)
    throws IOException {
  try (NetcdfFile ncfile = NetcdfFiles.open(location); NetcdfFile jni = openJni(location)) {
    jni.setLocation(location + " (jni)");
    // System.out.printf("Compare %s to %s%n", ncfile.getIosp().getClass().getName(),
    // jni.getIosp().getClass().getName());

    Formatter f = new Formatter();
    CompareNetcdf2 tc = new CompareNetcdf2(f, showCompare, showEach, compareData);
    boolean ok = tc.compare(ncfile, jni, new CompareNetcdf2.Netcdf4ObjectFilter());
    System.out.printf(" %s compare %s ok = %s%n", ok ? "" : "***", location, ok);
    if (!ok || (showCompare && showCompareResults))
      System.out.printf("%s%n=====================================%n", f);
    return ok;
  }
}
 
Example #7
Source File: TestOpenInMemory.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private boolean scanBufrFile(String filename)
    throws IOException, IllegalAccessException, InstantiationException, ClassNotFoundException {
  int count = 0;
  try (RandomAccessFile raf = new RandomAccessFile(filename, "r")) {

    MessageScanner scan = new MessageScanner(raf);
    while (scan.hasNext()) {
      Message m = scan.next();
      if (m == null)
        continue;
      byte[] mbytes = scan.getMessageBytes(m);
      try (NetcdfFile ncfile = NetcdfFiles.openInMemory("test", mbytes, "ucar.nc2.iosp.bufr.BufrIosp2")) {
        NetcdfDataset ncd = new NetcdfDataset(ncfile);
      }
    }
  }
  return true;
}
 
Example #8
Source File: TestN3iospCompare.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
@Test
public void compareWithBuilder()
    throws IOException, InstantiationException, IllegalAccessException, ClassNotFoundException {
  logger.info("TestBuilders on {}%n", filename);
  SPFactory.setServiceProvider("ucar.nc2.iosp.netcdf3.N3raf");
  try (NetcdfFile org = NetcdfFile.open(filename)) {
    SPFactory.setServiceProvider("ucar.nc2.internal.iosp.netcdf3.N3iospNew");
    try (NetcdfFile withBuilder = NetcdfFiles.open(filename)) {
      Formatter f = new Formatter();
      CompareNetcdf2 compare = new CompareNetcdf2(f, false, false, true);
      if (!compare.compare(org, withBuilder)) {
        System.out.printf("Compare %s%n%s%n", filename, f);
        fail();
      }
    }
  } finally {
    SPFactory.setServiceProvider("ucar.nc2.iosp.netcdf3.N3raf");
  }
}
 
Example #9
Source File: Grib1ReportPanel.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private Map<Integer, GridMatch> getGridsOld(MFile ff, Formatter f) throws IOException {
  Map<Integer, GridMatch> grids = new HashMap<>(100);
  try (NetcdfFile ncfile = NetcdfFiles.open(ff.getPath(), "ucar.nc2.iosp.grib.GribServiceProvider", -1, null, null)) {
    NetcdfDataset ncd = new NetcdfDataset(ncfile);
    GridDataset grid = new GridDataset(ncd);
    for (GridDatatype dt : grid.getGrids()) {
      GridMatch gm = new GridMatch(grid, dt, false);
      GridMatch dup = grids.get(gm.hashCode());
      if (dup != null)
        f.format(" DUP OLD (%d == %d) = %s (%s) and DUP %s (%s)%n", gm.hashCode(), dup.hashCode(),
            gm.grid.getFullName(), gm.show(), dup.grid.getFullName(), dup.show());
      else
        grids.put(gm.hashCode(), gm);
    }
  } catch (Throwable t) {
    t.printStackTrace();
  }
  return grids;
}
 
Example #10
Source File: DatasetViewer.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
private void compareBuilder() {
  if (ds == null)
    return;
  String fileLocation = ds.getLocation();
  try (NetcdfFile org = NetcdfFile.open(fileLocation)) {
    try (NetcdfFile withBuilder = NetcdfFiles.open(fileLocation)) {
      Formatter f = new Formatter();
      CompareNetcdf2 compare = new CompareNetcdf2(f, false, false, true);
      boolean ok = compare.compare(org, withBuilder, new CoordsObjFilter());
      infoTA.setText(f.toString());
      infoTA.gotoTop();
      infoWindow.setTitle("Compare Old (file1) with Builder (file 2)");
      infoWindow.show();
    }
  } catch (Throwable ioe) {
    StringWriter sw = new StringWriter(10000);
    ioe.printStackTrace(new PrintWriter(sw));
    infoTA.setText(sw.toString());
    infoTA.gotoTop();
    infoWindow.show();
  }
}
 
Example #11
Source File: TestDataTemplate.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testDrs40() throws IOException {
  final String testfile = "../grib/src/test/data/pdsScale.pds1.grib2";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("Temperature_isobaric_ens");
    float[] data = (float[]) var.read().get1DJavaArray(DataType.FLOAT);

    Assert.assertEquals(263.57705688, data[0], 1e-6);
    Assert.assertEquals(263.70205688, data[1234], 1e-6);
  }
}
 
Example #12
Source File: TestGridAsPointP.java    From tds with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void checkGridAsPointNetcdfNew(byte[] content, String varName) throws JDOMException, IOException {
  // Open the binary response in memory
  Formatter errlog = new Formatter();
  try (NetcdfFile nf = NetcdfFiles.openInMemory("checkGridAsPointNetcdf.nc", content)) {
    FeatureDataset fd = FeatureDatasetFactoryManager.wrap(FeatureType.STATION,
        NetcdfDatasets.enhance(nf, NetcdfDataset.getDefaultEnhanceMode(), null), null, errlog);
    assertNotNull(errlog.toString(), fd);
    VariableSimpleIF v = fd.getDataVariable(varName);
    assertNotNull(varName, v);
  }
}
 
Example #13
Source File: TestDataTemplate.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testDrs0() throws IOException {
  final String testfile = "../grib/src/test/data/Eumetsat.VerticalPerspective.grib2";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("Pixel_scene_type");
    float[] data = (float[]) var.read().get1DJavaArray(DataType.FLOAT);

    Assert.assertTrue(Float.isNaN(data[0]));
    Assert.assertEquals(101.0, data[584 * 1237 + 632], 1e-6);
  }
}
 
Example #14
Source File: TestDataTemplate.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testDrs2() throws IOException {
  final String testfile = "../grib/src/test/data/ds.snow.grib2";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("Total_snowfall_surface_6_Hour_Accumulation");
    float[] data = (float[]) var.read().get1DJavaArray(DataType.FLOAT);

    Assert.assertTrue(Float.isNaN(data[0]));
    Assert.assertTrue(Float.isNaN(data[1234]));
  }
}
 
Example #15
Source File: TestDataTemplate.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testDrs3() throws IOException {
  final String testfile = "../grib/src/test/data/ds.sky.grib2";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("Total_cloud_cover_surface");
    float[] data = (float[]) var.read().get1DJavaArray(DataType.FLOAT);

    Assert.assertTrue(Float.isNaN(data[0]));
    Assert.assertEquals(23.0, data[37 * 177 + 114], 1e-6);
  }
}
 
Example #16
Source File: TestBufrRead.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void openNetcdf(String filename) throws IOException {
  System.out.printf("%n***openNetcdf bufr %s%n", filename);
  try (NetcdfFile ncfile = NetcdfFiles.open(filename)) {
    if (show)
      System.out.printf("%s%n", ncfile);
  }
}
 
Example #17
Source File: TestGribCompareBuilders.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void compareWithBuilder() throws IOException {
  System.out.printf("TestBuilders on %s%n", filename);
  try (NetcdfFile org = NetcdfFile.open(filename)) {
    try (NetcdfFile withBuilder = NetcdfFiles.open(filename)) {
      Formatter f = new Formatter();
      CompareNetcdf2 compare = new CompareNetcdf2(f);
      if (!compare.compare(org, withBuilder, null)) {
        System.out.printf("Compare %s%n%s%n", filename, f);
        fail();
      }
    }
  }
}
 
Example #18
Source File: TestGrib1Unpack.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testEcmwfExtendedComplexData() throws IOException {
  final String testfile = "../grib/src/test/data/complex_packing.grib1";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("Minimum_temperature_at_2_metres_in_the_last_6_hours_surface_6_Hour");
    Array data = var.read();
    float first = data.getFloat(0);

    Assert.assertEquals(264.135559, first, 1e-6);
  }
}
 
Example #19
Source File: TestMRMS.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void checkVariable() throws IOException {
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("LowLevelCompositeReflectivity_altitude_above_msl");
    Assert.assertNotNull(var);

    Attribute att = var.findAttribute("missing_value");
    Assert.assertNotNull(att);
    Assert.assertEquals(-99., att.getNumericValue().doubleValue(), 1e-6);

    att = var.findAttribute("_FillValue");
    Assert.assertNotNull(att);
    Assert.assertEquals(-999., att.getNumericValue().doubleValue(), 1e-6);
  }
}
 
Example #20
Source File: TestDataTemplate.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testPngBitmap() throws IOException {
  final String testfile = "../grib/src/test/data/HLYA10.grib2";
  try (NetcdfFile nc = NetcdfFiles.open(testfile)) {
    Variable var = nc.findVariable("VAR0-19-223_FROM_7-212--1_isobaric");
    float[] data = (float[]) var.read().get1DJavaArray(DataType.FLOAT);

    Assert.assertEquals(0.36976, data[13], 1e-5);
    Assert.assertTrue(Double.isNaN(data[15]));
  }
}
 
Example #21
Source File: TestGribSpheroids.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void code1_spherical_specified() throws IOException {
  String filename = dir + "LDUE18.grib2";
  try (NetcdfFile ncfile = NetcdfFiles.open(filename, null)) {
    Variable v = ncfile.findVariable("LambertConformal_Projection");
    Attribute axis = v.findAttribute("earth_radius");
    Assert.assertEquals(6371200., axis.getNumericValue().doubleValue(), 0.1);
  }
}
 
Example #22
Source File: TestGribSpheroids.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void code0_assume_spherical() throws IOException {
  String filename = dir + "grid174_scanmode_64_example.grb2";
  try (NetcdfFile ncfile = NetcdfFiles.open(filename, null)) {
    Variable v = ncfile.findVariable("LatLon_Projection");
    Attribute axis = v.findAttribute("earth_radius");
    Assert.assertEquals(6367470., axis.getNumericValue().doubleValue(), 0.1);
  }
}
 
Example #23
Source File: TestBufrCompareBuilders.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void compareWithBuilder() throws IOException {
  System.out.printf("TestBuilders on %s%n", filename);
  try (NetcdfFile org = NetcdfFile.open(filename)) {
    try (NetcdfFile withBuilder = NetcdfFiles.open(filename)) {
      Formatter f = new Formatter();
      CompareNetcdf2 compare = new CompareNetcdf2(f, false, false, true);
      if (!compare.compare(org, withBuilder, null)) {
        System.out.printf("Compare %s%n%s%n", filename, f);
        fail();
      }
    }
  }
}
 
Example #24
Source File: TestBufr2Xml.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void testStuff() throws Exception {
  String unitDir = TestDir.cdmUnitTestDir + "datasets/bufr/exclude/";
  String filename = unitDir + "uniqueExamples.bufr";

  int size = 0;
  int count = 0;

  try (RandomAccessFile raf = new RandomAccessFile(filename, "r"); OutputStream out = new ByteArrayOutputStream()) {
    MessageScanner scan = new MessageScanner(raf);
    while (scan.hasNext()) {
      Message message = scan.next();
      if (message == null || !message.isTablesComplete() || !message.isBitCountOk())
        continue;
      byte[] mbytes = scan.getMessageBytesFromLast(message);
      NetcdfFile ncfile = NetcdfFiles.openInMemory("test", mbytes, "ucar.nc2.iosp.bufr.BufrIosp");
      NetcdfDataset ncd = new NetcdfDataset(ncfile);
      new Bufr2Xml(message, ncd, out, true);
      out.close();
      count++;
      size += message.getMessageSize();
    }

  } catch (Throwable e) {
    e.printStackTrace();
  }

  System.out.printf("total size= %f Kb %n", .001 * size);
}
 
Example #25
Source File: SpatialSubsettingTest.java    From tds with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void shouldGetVariablesSubset() throws Exception {

  // gridDataController.getGridSubset(params, validationResult, response);

  this.mockMvc.perform(requestBuilder).andExpect(MockMvcResultMatchers.status().isOk())
      .andExpect(new ResultMatcher() {
        public void match(MvcResult result) throws Exception {
          NetcdfFile nf = NetcdfFile.openInMemory("test_data.ncs", result.getResponse().getContentAsByteArray());
          ucar.nc2.dt.grid.GridDataset gdsDataset = new ucar.nc2.dt.grid.GridDataset(new NetcdfDataset(nf));
          // Open the binary response in memory
          if (TestDir.cdmUseBuilders) {
            nf = NetcdfFiles.openInMemory("test_data.ncs", result.getResponse().getContentAsByteArray());
            gdsDataset = new ucar.nc2.dt.grid.GridDataset(
                NetcdfDatasets.enhance(nf, NetcdfDataset.getDefaultEnhanceMode(), null));
          } else {
            nf = NetcdfFile.openInMemory("test_data.ncs", result.getResponse().getContentAsByteArray());
            gdsDataset = new ucar.nc2.dt.grid.GridDataset(new NetcdfDataset(nf));
          }
          LatLonRect responseBBox = gdsDataset.getBoundingBox();

          assertTrue(
              responseBBox.intersect((datasetBBOX)) != null && responseBBox.intersect((requestedBBOX)) != null);
          assertTrue(!responseBBox.equals(datasetBBOX));
        }
      });
}
 
Example #26
Source File: TestSubsettingUtils.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public static void subsetVariables(String filename, String varName, Section s)
    throws InvalidRangeException, IOException {
  System.out.println("testVariableSubset=" + filename + "," + varName);

  try (NetcdfFile ncfile = NetcdfFiles.open(filename)) {
    Variable v = ncfile.findVariable(varName);
    assert (null != v);
    subsetVariable(v, s, v.read());
  }
}
 
Example #27
Source File: TestCurvilinearGridPointMapping.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * Test CoverageCoordSys.HorizCoordSys.getLatLon()
 *
 * @throws IOException if ...
 * @throws InvalidRangeException if ...
 */
@Test
public void checkGridCoordSystem_getLatLon() throws IOException, InvalidRangeException {
  int[] origin = new int[] {j, i};
  int[] shape = new int[] {1, 1};

  NetcdfFile ncf = NetcdfFiles.open(datasetLocation);
  Variable latVar = ncf.findVariable("lat");
  Array latArray = latVar.read(origin, shape);
  Variable lonVar = ncf.findVariable("lon");
  Array lonArray = lonVar.read(origin, shape);

  double latVal = latArray.getDouble(0);
  double lonVal = lonArray.getDouble(0);
  logger.debug("{}, {}", latVal, lonVal);

  try (FeatureDatasetCoverage cc = CoverageDatasetFactory.open(datasetLocation)) {
    Assert.assertNotNull(datasetLocation, cc);
    CoverageCollection gcs = cc.findCoverageDataset(FeatureType.CURVILINEAR);
    Assert.assertNotNull("gcs", gcs);
    Coverage cover = gcs.findCoverage(covName);
    Assert.assertNotNull(covName, cover);

    CoverageCoordSys gridCoordSys = cover.getCoordSys();
    Assert.assertNotNull("CoverageCoordSys", gridCoordSys);
    HorizCoordSys hcs = gridCoordSys.getHorizCoordSys();
    Assert.assertNotNull("HorizCoordSys", hcs);

    LatLonPoint llPnt = hcs.getLatLon(j, i);
    Assert2.assertNearlyEquals(lat, llPnt.getLatitude());
    Assert2.assertNearlyEquals(lon, llPnt.getLongitude());
  }
}
 
Example #28
Source File: TestNc4IospReading.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Test
public void fractalHeapProblem() throws IOException {
  String filename = TestDir.cdmUnitTestDir + "formats/netcdf4/espresso_his_20130913_0000_0007.nc";
  System.out.printf("***READ %s%n", filename);
  doCompare(filename, false, false, false);

  try (NetcdfFile ncfile = NetcdfFiles.open(filename)) {
    Assert.assertNotNull(ncfile.findVariable("h"));
  }
}
 
Example #29
Source File: TestS3Read.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * AWS S3
 *
 * https://aws.amazon.com/s3/
 *
 * @throws IOException Error accessing object store
 */
@Test
public void awsFullReadFile() throws IOException {
  System.setProperty(AWS_REGION_PROP_NAME, AWS_G16_REGION);
  try (NetcdfFile ncfile = NetcdfFiles.open(AWS_G16_S3_URI_FULL)) {
    testFullReadGoes16S3(ncfile);
  } finally {
    System.clearProperty(AWS_REGION_PROP_NAME);
  }
}
 
Example #30
Source File: TestBufrBuilderProblem.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
private void showNew(String filename) throws IOException {

    try (NetcdfFile withBuilder = NetcdfFiles.open(filename)) {
      // Variable v = withBuilder.findVariable("catchments_x");
      // Array data = v.read();
      System.out.printf("withBuilder = %s%n", withBuilder);
    }
  }