Package com.thoughtworks.xstream.io.binary

Examples of com.thoughtworks.xstream.io.binary.ReaderDepthState$Attribute


      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

     */
    @Override
    public Date dateValue(final String name) {
        if (name != null) {
            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()) {
                        final CalendarDate date;
                        try {
                            date = CalendarDateFormatter.isoStringToCalendarDate(Calendar.proleptic_gregorian, value);
                        } catch (IllegalArgumentException e) {
View Full Code Here

      group = toto.getParentGroup();

      // Scan node's attribute
      List<?> list_attr = group.getAttributes();
      for (Object name : list_attr) {
        Attribute attr = (Attribute) name;
        System.out.println(">> attribut : " + attr.toString());
      }
    }

    System.out.println("Total execution time: " + (System.currentTimeMillis() - time) / 1000. + "s");
  }
View Full Code Here

TOP

Related Classes of com.thoughtworks.xstream.io.binary.ReaderDepthState$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.