private boolean checkHicoL1B() { Attribute hicol1bName = ncfile.findGlobalAttribute("metadata_FGDC_Instrument_Information_Instrument_Name"); return hicol1bName != null; }
public static SeaWiFSL1AGeonav.DataType determineSeawifsDataType(NetcdfFile ncFile) { SeaWiFSL1AGeonav.DataType dataType = SeaWiFSL1AGeonav.DataType.LAC; Attribute dataTypeAttr = ncFile.findGlobalAttribute("Data_Type"); Attribute numScanLinesAttr = ncFile.findGlobalAttribute("Number_of_Scan_Lines"); if (dataTypeAttr.getStringValue().equals("GAC")) { dataType = SeaWiFSL1AGeonav.DataType.GAC; } return dataType; }
static private int intAttribute_( NetcdfFile ncFile, String name ) { int result = 0; Attribute attribute = ncFile.findGlobalAttribute( name ); if ( attribute != null ) { result = attribute.getNumericValue().intValue(); } return result; }
static private double doubleAttribute_( NetcdfFile ncFile, String name ) { double result = 0.0; Attribute attribute = ncFile.findGlobalAttribute( name ); if ( attribute != null ) { result = attribute.getNumericValue().doubleValue(); } return result; }
public static ProductData.UTC getSceneRasterTime(NetcdfFile ncFile, String dateAttrName, String timeAttrName) { final Attribute dateAttr = ncFile.findGlobalAttribute(dateAttrName); final Attribute timeAttr = ncFile.findGlobalAttribute(timeAttrName); final String dateTimeStr = getDateTimeString(dateAttr, timeAttr); if (dateTimeStr != null) { return parseDateTime(dateTimeStr); } return null; }
public static int determineNumberScanLines(NetcdfFile ncFile) { Attribute numScanLinesAttr = ncFile.findGlobalAttribute("Number_of_Scan_Lines"); return numScanLinesAttr.getNumericValue().intValue(); }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a Zebra file. */ public static boolean isMine(NetcdfFile ncfile) { Variable v = ncfile.findVariable("time_offset"); if (v == null || !v.isCoordinateVariable()) return false; String desc = v.getDescription(); if (desc == null || (!desc.equals("Time delta from start_time") && !desc.equals("PWV window midpoint time delta from start_time"))) return false; if (null == ncfile.findGlobalAttribute( "start_date")) return false; if (null == ncfile.findGlobalAttribute( "start_time")) return false; return true; }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a Zebra file. */ public static boolean isMine(NetcdfFile ncfile) { Variable v = ncfile.findVariable("time_offset"); if (v == null || !v.isCoordinateVariable()) return false; String desc = v.getDescription(); if (desc == null || (!desc.equals("Time delta from start_time") && !desc.equals("PWV window midpoint time delta from start_time"))) return false; if (null == ncfile.findGlobalAttribute( "start_date")) return false; if (null == ncfile.findGlobalAttribute( "start_time")) return false; return true; }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a Zebra file. */ public static boolean isMine(NetcdfFile ncfile) { Variable v = ncfile.findVariable("time_offset"); if (v == null || !v.isCoordinateVariable()) return false; String desc = v.getDescription(); if (desc == null || (!desc.equals("Time delta from start_time") && !desc.equals("PWV window midpoint time delta from start_time"))) return false; if (null == ncfile.findGlobalAttribute( "start_date")) return false; if (null == ncfile.findGlobalAttribute( "start_time")) return false; return true; }
static private boolean hasIntAttribute_( NetcdfFile ncFile, String name, int min, int max ) { boolean result = false; Attribute a = ncFile.findGlobalAttribute( name ); if ( a != null ) { if ( a.getDataType() == DataType.INT ) { final int v = a.getNumericValue().intValue(); result = v >= min && v <= max; } } return result; }
static private boolean hasStringAttribute_( NetcdfFile ncFile, String name, int length ) { Attribute a = ncFile.findGlobalAttribute( name ); return a != null && a.isString() && a.getStringValue().length()==length; }
static private boolean hasIntAttributeIn_( NetcdfFile ncFile, String name, int[] match ) { boolean result = false; Attribute a = ncFile.findGlobalAttribute( name ); if ( a != null && (a.getDataType() == DataType.INT) ) { final int value = a.getNumericValue().intValue(); final int count = match.length; for ( int index = 0; ! result && index < count; ++index ) { result = value == match[ index ]; } } return result; }
public String readProductType(final ProfileReadContext ctx) { Attribute productType = ctx.getNetcdfFile().findGlobalAttribute("Conventions"); if (productType != null) { return productType.getStringValue(); } else { return Constants.FORMAT_NAME; } } }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a AWIPS file. */ public static boolean isMine(NetcdfFile ncfile) { return (null != ncfile.findGlobalAttribute("projName")) && (null != ncfile.findDimension("charsPerLevel")) && (null != ncfile.findDimension("x")) && (null != ncfile.findDimension("y")); }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a AWIPS file. */ public static boolean isMine(NetcdfFile ncfile) { return (null != ncfile.findGlobalAttribute("projName")) && (null != ncfile.findDimension("charsPerLevel")) && (null != ncfile.findDimension("x")) && (null != ncfile.findDimension("y")); }
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a AWIPS file. */ public static boolean isMine(NetcdfFile ncfile) { return (null != ncfile.findGlobalAttribute("projName")) && (null != ncfile.findDimension("charsPerLevel")) && (null != ncfile.findDimension("x")) && (null != ncfile.findDimension("y")); }
@Test public void testVlengthAttribute() throws IOException { try (NetcdfFile ncfile = TestH5.openH5("support/vlstra.h5")) { Attribute att = ncfile.findGlobalAttribute("test_scalar"); assert (null != att); assert (!att.isArray()); assert (att.isString()); assert (att.getStringValue().equals("This is the string for the attribute")); } }
public void testReplaceAtt() { // System.out.println("\nncfile = "+ncfile); Attribute att = ncfile.findGlobalAttribute("title"); assert null != att; assert !att.isArray(); assert att.isString(); assert att.getDataType() == DataType.STRING; assert att.getStringValue().equals("replaced"); assert att.getNumericValue() == null; assert att.getNumericValue(3) == null; }
public void testGlobalAtt() { Attribute att = ncfile.findGlobalAttribute("Conventions"); assert null != att; assert !att.isArray(); assert att.isString(); assert att.getDataType() == DataType.STRING; assert att.getStringValue().equals("Metapps"); assert att.getNumericValue() == null; assert att.getNumericValue(3) == null; }
@Test public void testAddMetadataToScan() throws IOException, InvalidRangeException { String endpoint = TestOnLocalServer.withHttpPath("cdmremote/testGridScan/GFS_CONUS_80km_20120229_1200.grib1"); logger.debug("{}", endpoint); try (NetcdfFile ncd = NetcdfDataset.openFile(endpoint, null)) { Assert.assertNotNull(ncd); Attribute att = ncd.findGlobalAttribute("ncmlAdded"); Assert.assertNotNull(att); Assert.assertEquals("stuff", att.getStringValue()); } } }