Java Code Examples for ucar.nc2.NetcdfFile#findAttValueIgnoreCase()
The following examples show how to use
ucar.nc2.NetcdfFile#findAttValueIgnoreCase() .
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: UnidataPointObsDataset.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
public static boolean isValidFile(NetcdfFile ds) { if (!ds.findAttValueIgnoreCase(null, "cdm_data_type", "").equalsIgnoreCase(FeatureType.POINT.toString()) && !ds.findAttValueIgnoreCase(null, "cdm_datatype", "").equalsIgnoreCase(FeatureType.POINT.toString())) return false; String conv = ds.findAttValueIgnoreCase(null, "Conventions", null); if (conv == null) return false; StringTokenizer stoke = new StringTokenizer(conv, ","); while (stoke.hasMoreTokens()) { String toke = stoke.nextToken().trim(); if (toke.equalsIgnoreCase("Unidata Observation Dataset v1.0")) return true; } return false; }
Example 2
Source File: Jason2Convention.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 6 votes |
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a Zebra file. */ public static boolean isMine(NetcdfFile ncfile) { // :start_time = 9.17028312E8; // double // :stop_time = 9.170284104681826E8; // double if ((null == ncfile.findDimension("time"))) { return false; } // if (null == ncfile.findGlobalAttribute( "start_time")) return false; // if (null == ncfile.findGlobalAttribute( "stop_time")) return false; String center = ncfile.findAttValueIgnoreCase(null, "processing_center", null); if ("ESPC".equals(center)) { String mission = ncfile.findAttValueIgnoreCase(null, "mission_name", null); return "OSTM/Jason-2".equals(mission); } else return false; }
Example 3
Source File: UnidataStationObsMultidimDataset.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
public static boolean isValidFile(NetcdfFile ds) { if (!ds.findAttValueIgnoreCase(null, "cdm_data_type", "").equalsIgnoreCase(FeatureType.STATION.toString()) && !ds.findAttValueIgnoreCase(null, "cdm_datatype", "").equalsIgnoreCase(FeatureType.STATION.toString())) return false; String conv = ds.findAttValueIgnoreCase(null, "Conventions", null); if (conv == null) return false; boolean convOk = false; StringTokenizer stoke = new StringTokenizer(conv, ","); while (stoke.hasMoreTokens()) { String toke = stoke.nextToken().trim(); if (toke.equalsIgnoreCase("Unidata Observation Dataset v1.0")) convOk = true; } if (!convOk) return false; if (null == UnidataObsDatasetHelper.findDimension(ds, "station")) return false; // this field indicates a linked list Variable stationIndexVar = UnidataObsDatasetHelper.findVariable(ds, "parent_index"); if (stationIndexVar != null) return false; return true; }
Example 4
Source File: Cosmic1Convention.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a Zebra file. */ public static boolean isMine(NetcdfFile ncfile) { // :start_time = 9.17028312E8; // double // :stop_time = 9.170284104681826E8; // double if ((null == ncfile.findDimension("MSL_alt")) && (null == ncfile.findDimension("time"))) { return false; } // if (null == ncfile.findGlobalAttribute( "start_time")) return false; // if (null == ncfile.findGlobalAttribute( "stop_time")) return false; String center = ncfile.findAttValueIgnoreCase(null, "center", null); return "UCAR/CDAAC".equals(center); }
Example 5
Source File: IFPSConvention.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 5 votes |
/** * @param ncfile the NetcdfFile to test * @return true if we think this is a IFPSConvention file. */ public static boolean isMine(NetcdfFile ncfile) { // check that file has a latitude and longitude variable, and that latitude has an attribute called // projectionType boolean geoVarsCheck; Variable v = ncfile.findVariable("latitude"); if (null != ncfile.findVariable("longitude") && (null != v)) { geoVarsCheck = null != ncfile.findAttValueIgnoreCase(v, "projectionType", null); } else { // bail early return false; } // check that there is a global attribute called fileFormatVersion, and that it has one // of two known values boolean fileFormatCheck; Attribute ff = ncfile.findGlobalAttributeIgnoreCase("fileFormatVersion"); if (ff != null) { String ffValue = ff.getStringValue(); // two possible values (as of now) fileFormatCheck = (ffValue.equalsIgnoreCase("20030117") || ffValue.equalsIgnoreCase("20010816")); } else { // bail return false; } // both must be true return (geoVarsCheck && fileFormatCheck); }
Example 6
Source File: FslWindProfiler.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static boolean isMine(NetcdfFile ncfile) { String title = ncfile.findAttValueIgnoreCase(null, "title", null); return title != null && (title.startsWith("WPDN data")); }
Example 7
Source File: Nimbus.java From netcdf-java with BSD 3-Clause "New" or "Revised" License | 4 votes |
public static boolean isMine(NetcdfFile ncfile) { String s = ncfile.findAttValueIgnoreCase(null, "Convention", "none"); return s.equalsIgnoreCase("NCAR-RAF/nimbus"); }