Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Public API, part 1 #137

Merged
merged 13 commits into from
Oct 27, 2019
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public void testNexrad2Dataset() throws IOException {
testAllMethods(topDir + "nexrad/level2/Level2_KYUX_20060527_2335.ar2v");
}

@Test
// @Test
public void testReadDirectory() throws IOException {
long start = System.currentTimeMillis();
// doDirectory(TestAll.testdataDir + "radar/nexrad/level2/VCP11", false);
Expand All @@ -48,6 +48,12 @@ public void testReadDirectory() throws IOException {
System.out.println("that took = " + took + " msec");
}

@Test
public void problem() throws IOException {
String filename = topDir + "nexrad/level2/VCP11/20030912143758.raw";
testAllMethods(filename);
}

private int doDirectory(String dirName, boolean alwaysUncompress, int max, String suffix) throws IOException {

File dir = new File(dirName);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
package ucar.nc2.ncml;

import java.util.Set;
import org.junit.AfterClass;
import org.junit.BeforeClass;
import org.junit.Test;
Expand All @@ -9,14 +10,14 @@
import ucar.ma2.InvalidRangeException;
import ucar.nc2.dataset.DatasetUrl;
import ucar.nc2.dataset.NetcdfDataset;
import ucar.nc2.dataset.NetcdfDataset.Enhance;
import ucar.nc2.ft.FeatureDataset;
import ucar.nc2.util.CompareNetcdf2;
import ucar.nc2.util.cache.FileCacheIF;
import ucar.unidata.util.test.category.NeedsCdmUnitTest;
import ucar.unidata.util.test.TestDir;
import java.io.IOException;
import java.lang.invoke.MethodHandles;
import java.util.EnumSet;
import java.util.Formatter;
import java.util.List;

Expand Down Expand Up @@ -46,7 +47,7 @@ public static void cleanupClass() {
public void TestAggCached() throws IOException, InvalidRangeException {
String filename = TestDir.cdmUnitTestDir + "agg/caching/wqb.ncml";
DatasetUrl durl = DatasetUrl.findDatasetUrl(filename);
// String filename = "file:./"+TestNcML.topDir + "aggExisting.xml";
// String filename = "file:./"+TestNcMLRead.topDir + "aggExisting.xml";
boolean ok = true;

System.out.printf("==========%n");
Expand All @@ -57,7 +58,7 @@ public void TestAggCached() throws IOException, InvalidRangeException {
ok &= CompareNetcdf2.compareFiles(ncd, ncd2, out, false, false, false);
System.out.printf("----------------%nfile=%s%n%s%n", filename, out);

EnumSet<NetcdfDataset.Enhance> modes = ncd2.getEnhanceMode();
Set<Enhance> modes = ncd2.getEnhanceMode();
showModes(modes);
ncd2.close();
System.out.printf("==========%n");
Expand All @@ -79,7 +80,7 @@ public void TestAggCached() throws IOException, InvalidRangeException {
assert gotit;
}

private void showModes(EnumSet<NetcdfDataset.Enhance> modes) {
private void showModes(Set<NetcdfDataset.Enhance> modes) {
for (NetcdfDataset.Enhance mode : modes) {
System.out.printf("%s,", mode);
}
Expand Down
2 changes: 2 additions & 0 deletions cdm/core/src/main/java/thredds/filesystem/MFileOS.java
Original file line number Diff line number Diff line change
Expand Up @@ -32,6 +32,7 @@

package thredds.filesystem;

import javax.annotation.Nullable;
import thredds.inventory.MFile;
import ucar.unidata.util.StringUtil2;
import javax.annotation.concurrent.ThreadSafe;
Expand All @@ -52,6 +53,7 @@ public class MFileOS implements MFile {
* @param filename name of the existing file.
* @return MFileOS or null
*/
@Nullable
public static MFileOS getExistingFile(String filename) {
if (filename == null)
return null;
Expand Down
4 changes: 4 additions & 0 deletions cdm/core/src/main/java/ucar/ma2/Section.java
Original file line number Diff line number Diff line change
Expand Up @@ -842,6 +842,10 @@ public int getStride(int i) {
return list.get(i).stride();
}

public long getSize() {
return Index.computeSize(getShape());
}

/**
* Get rank - number of Ranges.
*
Expand Down
Loading