Package com.subhajit.build

Examples of com.subhajit.build.Manifest$Attribute


  private void readValues(NetcdfDataset ds, Variable v, Element varElem, Element valuesElem) {

    // check if values are specified by attribute
    String fromAttribute = valuesElem.getAttributeValue("fromAttribute");
    if (fromAttribute != null) {
      Attribute att = null;
      int pos = fromAttribute.indexOf('@'); // varName@attName
      if (pos > 0) {
        String varName = fromAttribute.substring(0, pos);
        String attName = fromAttribute.substring(pos + 1);
        Variable vFrom = ds.getRootGroup().findVariable(varName); // LOOK groups
        if (vFrom == null) {
          errlog.format("Cant find variable %s %n", fromAttribute);
          return;
        }
        att = vFrom.findAttribute(attName);

      } else // attName or @attName
        String attName = (pos == 0) ? fromAttribute.substring(1) : fromAttribute;
        att = ds.getRootGroup().findAttribute(attName);
      }
      if (att == null) {
        errlog.format("Cant find attribute %s %n", fromAttribute);
        return;
      }
      Array data = att.getValues();
      v.setCachedData(data, true);
      return;
    }

    // check if values are specified by start / increment
View Full Code Here


        if (grid == null) {
            throw new IllegalArgumentException("No grid named " + gridName
                    + " in fileName");
        }
        if ( !gcs.isRegularSpatial()) {
            Attribute att = dataset.findGlobalAttributeIgnoreCase("datasetId");
            if(att != null && att.getStringValue().contains("DMSP")){
                writeSwathGrid(fileName, gridName,time,level, greyScale, pt);
                return;
            } else {
                throw new IllegalArgumentException(
                    "Must have 1D x and y axes for " + grid.getFullName());
View Full Code Here

      List<GridDatatype> grids = ncd.getGrids();
      Collections.sort(grids);

      for (GridDatatype g : grids) {
        f.format(" %s (", g.getFullName());
        Attribute att = g.findAttributeIgnoreCase("GRIB_param_id");
        if (att != null)
          f.format("%s/%s,param=%s", att.getNumericValue(1), att.getNumericValue(2), att.getNumericValue(3));
        f.format(")%n");
      }
    } catch (Throwable t) {
      System.out.printf("Failed on %s = %s%n", filename, t.getMessage());
      return;
View Full Code Here

    for (GridDatatype g : grids) {
      GridCoordSystem gsys = g.getCoordinateSystem();
      CoordinateAxis t = gsys.getTimeAxis();
      Variable v = g.getVariable();
      String level = v.findAttribute("GRIB_level_type_name").getStringValue();
      Attribute att = v.findAttribute("GRIB_interval_stat_type");
      String stat = (att == null) ? "" : att.getStringValue();
      att = v.findAttribute("GRIB_ensemble");
      String ens = "";
      if (att != null) ens = att.getStringValue();
      else {
        att = v.findAttribute("GRIB_ensemble_derived_type");
        if (att != null) ens = att.getStringValue();
      }
      att = v.findAttribute("GRIB_probability_type");
      String prob = (att == null) ? "" : att.getStringValue();
      System.out.printf(format, v.getFullName(), level, stat, ens, prob);
    }
    System.out.printf("%n");
    ncd.close();
  }
View Full Code Here

    for (GridDatatype g : ncd.getGrids()) {
      GridCoordSystem gsys = g.getCoordinateSystem();
      CoordinateAxis t = gsys.getTimeAxis();
      Variable v = g.getVariable();
      Attribute param = v.findAttribute("GRIB_product_definition_template");
      Integer template = param.getNumericValue().intValue();
      List<String> list = map.get(template);
      if (list == null) {
        list = new ArrayList<String>();
        map.put(template, list);
      }
View Full Code Here

    Variable timeVar = ncf.getRootGroup().findVariable( "time");
    Variable latVar = ncf.getRootGroup().findVariable( "latitude");
    Variable lonVar = ncf.getRootGroup().findVariable( "longitude");
    Variable altVar = ncf.getRootGroup().findVariable( "altitude");

    Attribute timeUnits = timeVar.findAttribute( "units");
    String newUnits = "test unit string";
    System.out.println( "Switching time units from \"" + timeUnits.toString() + " \" to \"" + newUnits + "\"" );
    timeVar.addAttribute( new Attribute( "units", newUnits) );

    Array latArray;
    try
    {
      latArray = latVar.read();
View Full Code Here

    assertTrue( "Global attributes list is null.",
                globalAtts != null );
    assertTrue( "Number of global attributes <" + globalAtts.size() + "> not as expected <" + trajDsInfo.getNumGlobalAtts() + ">.",
                globalAtts.size() == trajDsInfo.getNumGlobalAtts() );

    Attribute gatt = trajDs.findGlobalAttributeIgnoreCase( trajDsInfo.getExampGlobalAttName() );
    assertTrue( "Global attribute \"" + trajDsInfo.getExampGlobalAttName() + "\" <" + gatt.getStringValue() + "> does not contain expected substring <" + trajDsInfo.getExampGlobalAttValSubstring() + ">.",
                gatt.getStringValue().indexOf( trajDsInfo.getExampGlobalAttValSubstring() ) != -1 );

    // Check data variables from TypedDataset.
    List dataVars = trajDs.getDataVariables();
    assertTrue( "Data vars list is null.",
                dataVars != null );
View Full Code Here

  private void makeGrib1Vocabulary(List<GridDatatype> grids, PrintStream out) {
    String stdName;
    out.println("\n<variables vocabulary='GRIB-1'>");
    for (GridDatatype grid : grids) {
      Attribute att = grid.findAttributeIgnoreCase("GRIB_param_number");
      stdName = (att != null) ? att.getNumericValue().toString() : null;

      out.print("  <variable name='");
      out.print(grid.getFullName());
      out.print("' vocabulary_name='");
      out.print(stdName != null ? stdName : "dunno");
View Full Code Here

     */
    @Override
    public String stringValue(final String name) {
        if (name != null) { // For createResponsibleParty(...) convenience.
            for (final Group group : groups) {
                final Attribute attribute = findAttribute(group, name);
                if (attribute != null && attribute.isString()) {
                    String value = attribute.getStringValue();
                    if (value != null && !(value = value.trim()).isEmpty()) {
                        return value;
                    }
                }
            }
View Full Code Here

     */
    @Override
    public Number numericValue(final String name) {
        if (name != null) {
            for (final Group group : groups) {
                final Attribute attribute = findAttribute(group, name);
                if (attribute != null) {
                    final Number value = attribute.getNumericValue();
                    if (value != null) {
                        return value;
                    }
                    String asString = attribute.getStringValue();
                    if (asString != null && !(asString = asString.trim()).isEmpty()) {
                        return parseNumber(asString);
                    }
                }
            }
View Full Code Here

TOP

Related Classes of com.subhajit.build.Manifest$Attribute

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.