Package com.cloudera.lib.service

Examples of com.cloudera.lib.service.Instrumentation$Variable


     * _more_
     */
    protected void setEarthLocation() {

        try {
            Variable ga = ds.findVariable("latitude");
            if (ga != null) {
                latv = ga.readScalarDouble();
            } else {
                latv = 0.0;
            }

            ga = ds.findVariable("longitude");

            if (ga != null) {
                lonv = ga.readScalarDouble();
            } else {
                lonv = 0.0;
            }

            ga = ds.findVariable("altitude");
            if (ga != null) {
                elev = ga.readScalarDouble();
            } else {
                elev = 0.0;
            }
        } catch (IOException e) {}

View Full Code Here


     * _more_
     *
     * @throws Exception _more_
     */
    protected void setTimeUnits() throws Exception {
        Variable t  = ds.findVariable("time");
        String   ut = t.getUnitsString();
        dateUnits = new DateUnit(ut);
    }
View Full Code Here

         */
        public float[] readAllData() throws IOException {
            Array    allData;
            Array    hrData    = null;
            Sweep    spn       = (Sweep) sweeps.get(0);
            Variable v         = spn.getsweepVar();

            int minRadial = getMinRadialNumber();
            int minRadials = minRadial * nsweeps;
            int radials = getNumRadials();
            int gates = range.length;
            try {
                allData = v.read();
            } catch (IOException e) {
                throw new IOException(e.getMessage());
            }
            if(minRadials == radials) {
                return (float []) allData.get1DJavaArray(float.class);
View Full Code Here

      lonVarName = "LON";
      elevVarName = "ALT";

      // Determine and set the units (base time) for the time variable.
      String baseTimeVarName = "base_time";
      Variable baseTimeVar = ncfile.findVariable( baseTimeVarName );
      int baseTime = baseTimeVar.readScalarInt();
      Date baseTimeDate;
      if ( baseTime != 0 )
      {
        String baseTimeString = baseTime + " seconds since 1970-01-01T00:00:00";
        baseTimeDate = DateUnit.getStandardDate( baseTimeString );
View Full Code Here

  }

  private boolean timeVarAllZeros() throws IOException
  {
    Variable curTimeVar = this.ncfile.getRootGroup().findVariable( timeVarName);
    List section = new ArrayList(1);
    Array a = null;
    try
    {
      section.add ( new Range( 0, 2));
      a = curTimeVar.read( section);
    }
    catch ( InvalidRangeException e )
    {
      throw new IOException( "Invalid range (0,2): " + e.getMessage());
    }
View Full Code Here

    return key;
  }

  static public String getVariableName(NetcdfDataset ds, String key, Formatter errlog) {
    Variable v = null;
    String vs = getLiteral(ds, key, errlog);
    if (vs != null) {
      v = ds.findVariable(vs);
      if ((v == null) && (errlog != null))
        errlog.format(" Cant find Variable %s from %s\n", vs, key);
    }
    return v == null ? null : v.getShortName();
  }
View Full Code Here

      if ((haveValue != null) && haveValue.equals(attValue))
        return v;
    }
    for (Variable v : ds.getVariables()) {
      if (v instanceof Structure) {
        Variable vn = getVariableWithAttribute((Structure)v, attName, attValue);
        if (null != vn) return vn;
      }
    }
    return null;
  }
View Full Code Here

    }
    return null;
  }

  static public String getNameOfVariableWithAttribute(NetcdfDataset ds, String attName, String attValue) {
    Variable v = getVariableWithAttributeValue(ds, attName, attValue);
    return (v == null) ? null : v.getShortName();
  }
View Full Code Here

    return null;
  }


  static public boolean hasRecordStructure(NetcdfDataset ds) {
    Variable v = ds.findVariable("record");
    return (v != null) && (v.getDataType() == DataType.STRUCTURE);
  }
View Full Code Here

    Config trajConfig = new Config();
    trajConfig.setTimeDim( d);

    // Check that have variable time(time) with units that are udunits time
    Variable var = ncd.getRootGroup().findVariable( timeVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    String units = var.findAttribute( "units").getStringValue();
    Date date = DateUnit.getStandardDate( "0 " + units);
    if ( date == null) return null;

    trajConfig.setTimeVar( var);

    // Check for variable latitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( latVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "degrees_north")) return null;

    trajConfig.setLatVar( var);

    // Check for variable longitude(time) with units of "deg".
    var = ncd.getRootGroup().findVariable( lonVarName);
    if ( var == null ) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "degrees_east")) return null;

    trajConfig.setLonVar( var);

    // Check for variable altitude(time) with units of "m".
    var = ncd.getRootGroup().findVariable( elevVarName);
    if ( var == null) return null;
    list = var.getDimensions();
    if ( list.size() != 1) return null;
    d = (Dimension) list.get(0);
    if ( ! d.getName().equals( timeDimName)) return null;
    units = var.findAttribute( "units").getStringValue();
    if ( ! SimpleUnit.isCompatible( units, "meters")) return null;

    trajConfig.setElevVar( var);

    trajConfig.setTrajectoryId( trajId);
View Full Code Here

TOP

Related Classes of com.cloudera.lib.service.Instrumentation$Variable

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.