public static boolean isMine(NetcdfFile ncfile) { String satName = ncfile.findAttValueIgnoreCase(null, "SATNAME", null); if ((satName == null) || !(satName.equalsIgnoreCase("Aqua"))) return false; String instName = ncfile.findAttValueIgnoreCase(null, "INTRUMENT_NAME", null); if ((instName == null) || !(instName.equalsIgnoreCase("modis"))) return false; return true; }
@Override public int doAct(String filename) throws IOException { try (NetcdfFile ncfile = NetcdfDataset.openFile(filename, null)) { System.out.printf(" Open McIdas File %s ", filename); String ft = ncfile.findAttValueIgnoreCase(null, "featureType", "none"); String iosp = ncfile.getIosp().getFileTypeId(); System.out.printf(" iosp=%s ft=%s%n", iosp, ft); assert iosp.equals("McIDASArea") || iosp.equals("McIDASGrid") : iosp; assert ft.equals(FeatureType.GRID.toString()) : ft; return 1; } catch (Throwable t) { System.out.printf(" FAILED =%s%n", t.getMessage()); t.printStackTrace(); countFail++; return 0; } }
/** * Create a new vertical transform for Ocean_S_coordinate_g2 * * @param ds dataset * @param timeDim time dimension * @param params list of transformation Parameters */ public OceanSG2(NetcdfFile ds, Dimension timeDim, List<Parameter> params) { super(timeDim); String etaName = getParameterStringValue(params, ETA); String sName = getParameterStringValue(params, S); String depthName = getParameterStringValue(params, DEPTH); String depthCName = getParameterStringValue(params, DEPTH_C); String cName = getParameterStringValue(params, C); etaVar = ds.findVariable(etaName); sVar = ds.findVariable(sName); depthVar = ds.findVariable(depthName); depthCVar = ds.findVariable(depthCName); cVar = ds.findVariable(cName); units = ds.findAttValueIgnoreCase(depthVar, CDM.UNITS, "none"); }
public void test1() throws IOException, InvalidRangeException { String filename = "file:./" + TestNcML.topDir + "aggSynthetic.xml"; NetcdfFile ncfile = NcMLReader.readNcML(filename, null); Variable v = ncfile.findVariable("time"); assert v != null; String testAtt = ncfile.findAttValueIgnoreCase(v, "units", null); assert testAtt != null; assert testAtt.equals("months since 2000-6-16 6:00"); testDimensions(ncfile); testCoordVar(ncfile); testAggCoordVar(ncfile); testReadData(ncfile, "T"); testReadSlice(ncfile, "T"); ncfile.close(); }