Package org.waveprotocol.wave.model.document.operation.util

Examples of org.waveprotocol.wave.model.document.operation.util.ImmutableStateMap$Attribute


    gridDataset.getTitle();
    gridDatatype.getFullName();

    StringBuilder buf = new StringBuilder();

    Attribute gridMappingAtt = gridDatatype.findAttributeIgnoreCase( "grid_mapping" );
    String gridMapping = gridMappingAtt.getStringValue();
    Variable gridMapVar = gridDataset.getNetcdfFile().getRootGroup().findVariable(gridMapping);

    Attribute gridMappingNameAtt = gridMapVar.findAttributeIgnoreCase( "grid_mapping_name" );
    String gridMappingName = gridMappingNameAtt.getStringValue();
    buf.append( "EPSG:" ).append( ProjectionStandardsInfo.getProjectionByCfName( gridMappingName));


    return buf.toString();
  }
View Full Code Here


  public ucar.unidata.geoloc.EarthLocation getCommonOrigin() {
    return origin;
  }

  public String getRadarID() {
    Attribute ga = ds.findGlobalAttribute("Station");
    if(ga != null)
        return ga.getStringValue();
    else
        return "XXXX";
  }
View Full Code Here

    else
        return "XXXX";
  }

  public String getRadarName() {
    Attribute ga = ds.findGlobalAttribute("StationName");
    if(ga != null)
        return ga.getStringValue();
    else
        return "Unknown Station";
  }
View Full Code Here

  private String lonVarName;
  private String elevVarName;

  static public boolean isValidFile( NetcdfDataset ds)
  {
    Attribute conventionsAtt = ds.findGlobalAttribute( "Conventions");
    if ( conventionsAtt == null)
      conventionsAtt = ds.findGlobalAttributeIgnoreCase( "Conventions");
    if ( conventionsAtt == null) return( false);
    if ( ! conventionsAtt.isString()) return( false);
    if ( ! conventionsAtt.getStringValue().equals( "NCAR-RAF/nimbus" ) ) return( false );

    Attribute versionAtt = ds.findGlobalAttributeIgnoreCase( "Version" );
    if ( versionAtt == null )
    {
      // A bit of a hack for some UWYO KingAir files.
      versionAtt = new Attribute( "Version", "1.3" );
      ds.addAttribute( null, versionAtt );
      ds.finish();

      return ( true );
    }
    if ( ! versionAtt.isString() ) return ( false );
    if ( versionAtt.getStringValue( ).equals( "1.2")) return( true );
    if ( versionAtt.getStringValue( ).equals( "1.3")) return( true );
   
    return( false );
  }
View Full Code Here

  }

  private static Config buildConfig( NetcdfDataset ncd )
  {
    // Check for "zebra_platform" attribute w/ value of "class".
    Attribute attrib = ncd.findGlobalAttributeIgnoreCase( "zebra_platform" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;
    if ( !attrib.getStringValue().equals( "class" ) ) return null;

    // Check for "history" attribute w/ value of "ClassNcFile".
    attrib = ncd.findGlobalAttributeIgnoreCase( "history" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;
    if ( !attrib.getStringValue().equals( "ClassNcFile" ) ) return null;

    // Check for existence of global attribute "AvapsEditorVersion".
    attrib = ncd.findGlobalAttributeIgnoreCase( "AvapsEditorVersion" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check for existence of global attribute "SoundingDescription".
    attrib = ncd.findGlobalAttributeIgnoreCase( "SoundingDescription" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check that only one dimension and that it is the time dimension.
    List list = ncd.getRootGroup().getDimensions();
    if ( list.size() != 1) return null;
    Dimension d = (Dimension) list.get(0);
View Full Code Here

  }

  private static Config buildConfig( NetcdfDataset ncd )
  {
    // Check for global attribute "ingest_software".
    Attribute attrib = ncd.findGlobalAttributeIgnoreCase( "ingest_software" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;
    if ( attrib.getStringValue().indexOf( "sonde_ingest.c" ) == -1 ) return null;

    // Check for existence of global attribute "sounding_number".
    attrib = ncd.findGlobalAttributeIgnoreCase( "sounding_number" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check for existence of global attribute "serial_number".
    attrib = ncd.findGlobalAttributeIgnoreCase( "serial_number" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check for existence of global attribute "launch_status".
    attrib = ncd.findGlobalAttributeIgnoreCase( "launch_status" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check for global attribute "zeb_platform".
    attrib = ncd.findGlobalAttributeIgnoreCase( "zeb_platform" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;

    // Check for global attribute "history".
    attrib = ncd.findGlobalAttributeIgnoreCase( "history" );
    if ( attrib == null ) return null;
    if ( !attrib.isString() ) return null;
    if ( attrib.getStringValue().indexOf( "Zebra DataStore library" ) == -1
         && attrib.getStringValue().indexOf( "zebra-zeblib" ) == -1 )
      return null;

    // Check that only one dimension and that it is the time dimension.
    List list = ncd.getRootGroup().getDimensions();
    if ( list.size() != 1 ) return null;
View Full Code Here

    Variable elev = new Variable(ncfile, null, null, "elevation");
    elev.setDataType(DataType.SHORT);
    elev.setDimensions("lat lon");

    elev.addAttribute(new Attribute("units", "m"));
    elev.addAttribute(new Attribute("units_desc", "meters above sea level"));
    elev.addAttribute(new Attribute("long_name", "digital elevation in meters above mean sea level"));
    elev.addAttribute(new Attribute("missing_value", (short) -9999));
    ncfile.addVariable(null, elev);

    Variable lat = new Variable(ncfile, null, null, "lat");
    lat.setDataType(DataType.FLOAT);
    lat.setDimensions("lat");
    lat.addAttribute(new Attribute("units", "degrees_north"));
    ncfile.addVariable(null, lat);
    Array data = Array.makeArray(DataType.FLOAT, nlats, starty, -incr);
    lat.setCachedData(data, false);

    Variable lon = new Variable(ncfile, null, null, "lon");
    lon.setDataType(DataType.FLOAT);
    lon.setDimensions("lon");
    lon.addAttribute(new Attribute("units", "degrees_east"));
    ncfile.addVariable(null, lon);
    Array lonData = Array.makeArray(DataType.FLOAT, nlons, startx, incr);
    lon.setCachedData(lonData, false);

    ncfile.addAttribute(null, new Attribute("Conventions", "CF-1.0"));
    ncfile.addAttribute(null, new Attribute("History", "Direct read by Netcdf-Java CDM library"));
    ncfile.addAttribute(null, new Attribute("Source", "http://eros.usgs.gov/products/elevation/gtopo30.html"));

    ncfile.finish();
  }
View Full Code Here

    public List<Attribute> getAttributes() {
      if (atts == null)
        atts = new ArrayList<Attribute>(2);
     
      if (pov.getDesc() != null) atts.add(new Attribute("long_name", pov.getDesc()));
      if (pov.getUnits() != null) atts.add(new Attribute("units", pov.getUnits()));
      return atts;
    }
View Full Code Here

  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

TOP

Related Classes of org.waveprotocol.wave.model.document.operation.util.ImmutableStateMap$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.