Java Code Examples for ucar.nc2.NetcdfFile#findDimension()

The following examples show how to use ucar.nc2.NetcdfFile#findDimension() . 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: Jason2Convention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 6 votes vote down vote up
/**
 * @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 2
Source File: CEDRICRadarConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @param ncfile test this NetcdfFile
 * @return true if we think this is a ATDRadarConvention file.
 */
public static boolean isMine(NetcdfFile ncfile) {
  // not really sure until we can examine more files
  Dimension s = ncfile.findDimension("cedric_general_scaling_factor");
  Variable v = ncfile.findVariable("cedric_run_date");
  return v != null && s != null;
}
 
Example 3
Source File: Cosmic1Convention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
/**
 * @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 4
Source File: WRFConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
public boolean isMine(NetcdfFile ncfile) {
  if (null == ncfile.findDimension("south_north"))
    return false;

  // ARW only
  int dynOpt = ncfile.getRootGroup().attributes().findAttributeInteger("DYN_OPT", -1);
  if (dynOpt != -1 && dynOpt != 2) { // if it exists, it must equal 2.
    return false;
  } else {
    String gridType = ncfile.getRootGroup().findAttributeString("GRIDTYPE", "null");
    if (!gridType.equalsIgnoreCase("null") && !gridType.equalsIgnoreCase("C") && !gridType.equalsIgnoreCase("E"))
      return false;
  }
  return ncfile.findGlobalAttribute("MAP_PROJ") != null;
}
 
Example 5
Source File: AWIPSSatConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public boolean isMine(NetcdfFile ncfile) {
  return (null != ncfile.findGlobalAttribute("projName")) && (null != ncfile.findGlobalAttribute("lon00"))
      && (null != ncfile.findGlobalAttribute("lat00")) && (null != ncfile.findGlobalAttribute("lonNxNy"))
      && (null != ncfile.findGlobalAttribute("latNxNy")) && (null != ncfile.findGlobalAttribute("centralLon"))
      && (null != ncfile.findGlobalAttribute("centralLat")) && (null != ncfile.findDimension("x"))
      && (null != ncfile.findDimension("y")) && (null != ncfile.findVariable("image"));
}
 
Example 6
Source File: Cosmic1Convention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 5 votes vote down vote up
@Override
public boolean isMine(NetcdfFile ncfile) {
  if ((null == ncfile.findDimension("MSL_alt")) && (null == ncfile.findDimension("time"))) {
    return false;
  }

  String center = ncfile.getRootGroup().attributes().findAttributeString("center", null);
  return "UCAR/CDAAC".equals(center);
}
 
Example 7
Source File: AWIPSConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
/**
 * @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"));
}
 
Example 8
Source File: AWIPSConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean isMine(NetcdfFile ncfile) {
  return (null != ncfile.findGlobalAttribute("projName")) && (null != ncfile.findDimension("charsPerLevel"))
      && (null != ncfile.findDimension("x")) && (null != ncfile.findDimension("y"));
}
 
Example 9
Source File: CEDRICRadarConvention.java    From netcdf-java with BSD 3-Clause "New" or "Revised" License 4 votes vote down vote up
@Override
public boolean isMine(NetcdfFile ncfile) {
  Dimension s = ncfile.findDimension("cedric_general_scaling_factor");
  Variable v = ncfile.findVariable("cedric_run_date");
  return v != null && s != null;
}